Skip to content

Commit

Permalink
Better method names
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarah Lensing committed May 13, 2016
1 parent 063ca06 commit 7747dc7
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 31 deletions.
17 changes: 5 additions & 12 deletions library/src/main/java/com/mapzen/android/MapzenMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ public void drawDroppedPin(LngLat point) {
/**
* Clears the dropped pin from the map.
*/
public void clearDroppedPin() {
public void clearDroppedPins() {
overlayManager.clearDroppedPin();
}

Expand Down Expand Up @@ -477,13 +477,6 @@ public void drawSearchResults(List<LngLat> points, int... activeIndexes) {
}
}

/**
* Clears search result from the map.
*/
public void clearSearchResult() {
overlayManager.clearSearchResult();
}

/**
* Clears search results from the map.
*/
Expand All @@ -495,15 +488,15 @@ public void clearSearchResults() {
* Draws route pin at the point supplied.
* @param point
*/
public void drawRoutePin(LngLat point) {
overlayManager.drawRoutePin(point);
public void drawRouteLocationMarker(LngLat point) {
overlayManager.drawRouteLocationMarker(point);
}

/**
* Clears route pin from the map.
*/
public void clearRoutePin() {
overlayManager.clearRoutePin();
public void clearRouteLocationMarker() {
overlayManager.clearRouteLocationMarker();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions library/src/main/java/com/mapzen/android/OverlayManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public void clearSearchResult() {
* Draws route pin at the point supplied.
* @param point
*/
public void drawRoutePin(LngLat point) {
public void drawRouteLocationMarker(LngLat point) {
if (routePinData == null) {
routePinData = mapController.addDataLayer(NAME_ROUTE_PIN);
}
Expand All @@ -318,7 +318,7 @@ public void drawRoutePin(LngLat point) {
/**
* Clears route pin from the map.
*/
public void clearRoutePin() {
public void clearRouteLocationMarker() {
if (routePinData != null) {
routePinData.clear();
}
Expand Down
12 changes: 6 additions & 6 deletions library/src/test/java/com/mapzen/android/MapzenMapTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public class MapzenMapTest {
}

@Test public void clearDroppedPin_shouldInvokeOverlayManager() {
map.clearDroppedPin();
map.clearDroppedPins();
verify(overlayManager).clearDroppedPin();
}

Expand Down Expand Up @@ -320,7 +320,7 @@ public class MapzenMapTest {
}

@Test public void clearSearchResult_shouldInvokeOverlayManager() {
map.clearSearchResult();
map.clearSearchResults();
verify(overlayManager).clearSearchResult();
}

Expand All @@ -331,13 +331,13 @@ public class MapzenMapTest {

@Test public void drawRoutePin_shouldInvokeOverlayManager() {
LngLat point = new LngLat(-123, -70.0);
map.drawRoutePin(point);
verify(overlayManager).drawRoutePin(point);
map.drawRouteLocationMarker(point);
verify(overlayManager).drawRouteLocationMarker(point);
}

@Test public void clearRoutePin_shouldInvokeOverlayManager() {
map.clearRoutePin();
verify(overlayManager).clearRoutePin();
map.clearRouteLocationMarker();
verify(overlayManager).clearRouteLocationMarker();
}

@Test public void drawRouteLine_shouldInvokeOverlayManager() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public void drawRoutePin_shouldAddDataLayer() {
PowerMockito.doCallRealMethod().when(mapController).addDataLayer(anyString());

LngLat point = new LngLat(-123, -70);
overlayManager.drawRoutePin(point);
overlayManager.drawRouteLocationMarker(point);
verify(mapController).addDataLayer("mz_route_location");
}

Expand All @@ -295,8 +295,8 @@ public void drawRoutePin_shouldAddDataLayerOnce() {
PowerMockito.doCallRealMethod().when(mapController).addDataLayer(anyString());

LngLat point = new LngLat(-123, -70);
overlayManager.drawRoutePin(point);
overlayManager.drawRoutePin(point);
overlayManager.drawRouteLocationMarker(point);
overlayManager.drawRouteLocationMarker(point);
verify(mapController, times(1)).addDataLayer("mz_route_location");
}

Expand All @@ -306,7 +306,7 @@ public void drawRoutePin_shouldRequestRender() {
PowerMockito.doCallRealMethod().when(mapController).requestRender();

LngLat point = new LngLat(-123, -70);
overlayManager.drawRoutePin(point);
overlayManager.drawRouteLocationMarker(point);
verify(mapController).requestRender();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected void onCreate(Bundle savedInstanceState) {
Button clearPinBtn = (Button) findViewById(R.id.clear_btn);
clearPinBtn.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
map.clearDroppedPin();
map.clearDroppedPins();
}
});

Expand Down Expand Up @@ -56,6 +56,6 @@ private void drawDroppedPin(float x, float y) {

@Override protected void onDestroy() {
super.onDestroy();
map.clearDroppedPin();
map.clearDroppedPins();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected void onCreate(Bundle savedInstanceState) {
clearPinBtn.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
map.clearRouteLine();
map.clearRoutePin();
map.clearRouteLocationMarker();
points.clear();
}
});
Expand Down Expand Up @@ -66,12 +66,12 @@ private void addLineSegmentToRoute(float x, float y) {
points.add(point);
map.drawRouteLine(points);

map.drawRoutePin(points.get(0));
map.drawRouteLocationMarker(points.get(0));
}

@Override protected void onDestroy() {
super.onDestroy();
map.clearRouteLine();
map.clearRoutePin();
map.clearRouteLocationMarker();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected void onCreate(Bundle savedInstanceState) {
Button clearPinsBtn = (Button) findViewById(R.id.clear_pins_btn);
clearPinsBtn.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
map.clearSearchResult();
map.clearSearchResults();
}
});

Expand Down Expand Up @@ -69,6 +69,6 @@ private void showSearchResults() {

@Override protected void onDestroy() {
super.onDestroy();
map.clearSearchResult();
map.clearSearchResults();
}
}

0 comments on commit 7747dc7

Please sign in to comment.