|
|
@@ -1,7 +1,9 @@
|
|
|
package com.izouma.walkchina.service;
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
+import com.izouma.walkchina.constant.AppConstants;
|
|
|
import com.izouma.walkchina.domain.City;
|
|
|
+import com.izouma.walkchina.domain.JourneyStage;
|
|
|
import com.izouma.walkchina.dto.Location;
|
|
|
import com.izouma.walkchina.dto.webservice.DirectionResponse;
|
|
|
import com.izouma.walkchina.repo.CityRepository;
|
|
|
@@ -44,7 +46,7 @@ public class MapServiceTest {
|
|
|
City from = cityRepository.findOne(Example.of(City.builder().name("南京").build())).orElse(null);
|
|
|
City to = cityRepository.findOne(Example.of(City.builder().name("扬州").build())).orElse(null);
|
|
|
DirectionResponse response = mapService.direction(new Location(from.getLatitude(), from.getLongitude()),
|
|
|
- new Location(to.getLatitude(), to.getLongitude()));
|
|
|
+ new Location(to.getLatitude(), to.getLongitude()));
|
|
|
System.out.println(new Gson().toJson(response));
|
|
|
}
|
|
|
|
|
|
@@ -52,4 +54,19 @@ public class MapServiceTest {
|
|
|
public void userMap() {
|
|
|
mapService.userMap(677L);
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void endPoint() {
|
|
|
+ JourneyStage stage = journeyStageRepository.findFirstByUserIdOrderByCreatedAtDesc(4263L).get();
|
|
|
+ Location location;
|
|
|
+
|
|
|
+ location = mapService.endPoint(stage.getRouteSteps(), 8000 * AppConstants.STEP_TO_DISTANCE_RATE, stage.getPolyline());
|
|
|
+ System.out.println(location.getLatitude() + "," + location.getLongitude());
|
|
|
+
|
|
|
+ location = mapService.endPoint(stage.getRouteSteps(), 9000 * AppConstants.STEP_TO_DISTANCE_RATE, stage.getPolyline());
|
|
|
+ System.out.println(location.getLatitude() + "," + location.getLongitude());
|
|
|
+
|
|
|
+ location = mapService.endPoint(stage.getRouteSteps(), 10000 * AppConstants.STEP_TO_DISTANCE_RATE, stage.getPolyline());
|
|
|
+ System.out.println(location.getLatitude() + "," + location.getLongitude());
|
|
|
+ }
|
|
|
}
|