From 02222199477454ac49ff36a7bd5565419f001ea8 Mon Sep 17 00:00:00 2001 From: yaelAmitay Date: Thu, 29 Dec 2016 19:56:25 -0800 Subject: [PATCH] navigation test avoid one segment #19 --- .../accessibility/navigation/Navigation.java | 2 +- .../accessibility/navigation/NavigationTest.java | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/smartcity/accessibility/navigation/Navigation.java b/src/main/java/smartcity/accessibility/navigation/Navigation.java index cdff34ea..2c2f3b26 100644 --- a/src/main/java/smartcity/accessibility/navigation/Navigation.java +++ b/src/main/java/smartcity/accessibility/navigation/Navigation.java @@ -37,7 +37,7 @@ public static LatLng[] showRoute(Location source, Location destination, Integer return arrayToLatLng(s.getShapePoints()); } - private static LatLng[] arrayToLatLng(Double[] shapePointsArr) { + public static LatLng[] arrayToLatLng(Double[] shapePointsArr) { LatLng[] $ = new LatLng[shapePointsArr.length / 2]; int k = 0; for (int i = 0; i < shapePointsArr.length - 1; i += 2) { diff --git a/src/test/java/smartcity/accessibility/navigation/NavigationTest.java b/src/test/java/smartcity/accessibility/navigation/NavigationTest.java index 441ff70c..34f6e810 100644 --- a/src/test/java/smartcity/accessibility/navigation/NavigationTest.java +++ b/src/test/java/smartcity/accessibility/navigation/NavigationTest.java @@ -50,7 +50,7 @@ public void getRouteFromServersWithLinksToAvoid() throws CommunicationFailed { Latlng to = new Latlng(31.770981, 34.620567);// HaYam HaTichon Blvd 1 List segmentsToAvoid = new ArrayList(); segmentsToAvoid.add(Navigation.getMapSegmentOfLatLng(31.769955, 34.623123));// bareket - // st + // st Route r = Navigation.getRouteFromMapQuest(from, to, segmentsToAvoid); Shape shape = r.getShape(); Double[] shapePoints = shape.getShapePoints(); @@ -70,15 +70,21 @@ public void getRouteFromServersWithLinksToAvoid() throws CommunicationFailed { } @Test - @Ignore - public void avoidSegement() throws CommunicationFailed { + public void avoidOneSegement() throws CommunicationFailed { // TODO this test is temporal for it relay on things that will change! Latlng from = new Latlng(31.768762, 34.632052);// abba ahimeir Latlng to = new Latlng(31.770981, 34.620567);// HaYam HaTichon Blvd 1 List segmentsToAvoid = new ArrayList(); segmentsToAvoid.add(Navigation.getMapSegmentOfLatLng(31.76935, 34.626793));// sd Double[] shapePoints = Navigation.getRouteFromMapQuest(from, to, segmentsToAvoid).getShape().getShapePoints(); - + MapView mapview = JxMapsFunctionality.getMapView(); + JxMapsConvertor.displayRoute(mapview, Navigation.arrayToLatLng(shapePoints)); + try { + Thread.sleep(10000000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Test @@ -96,4 +102,5 @@ public void displayMap() throws CommunicationFailed { e.printStackTrace(); } } + }