OsmUtils { public static OverlayItem.HotspotPlace anchorToHotspot(float u, float v) { if (v > ANCHOR_HIGH_THRESHOLD) { if (u < ANCHOR_LOW_THRESHOLD) { return OverlayItem.HotspotPlace.LOWER_LEFT_CORNER; } else if (u > ANCHOR_HIGH_THRESHOLD) { return OverlayItem.HotspotPlace.LOWER_RIGHT_CORNER; } else { return OverlayItem.HotspotPlace.BOTTOM_CENTER; } } else if (v < ANCHOR_LOW_THRESHOLD) { if (u < ANCHOR_LOW_THRESHOLD) { return OverlayItem.HotspotPlace.UPPER_LEFT_CORNER; } else if (u > ANCHOR_HIGH_THRESHOLD) { return OverlayItem.HotspotPlace.UPPER_RIGHT_CORNER; } else { return OverlayItem.HotspotPlace.TOP_CENTER; } } else { if (u < ANCHOR_LOW_THRESHOLD) { return OverlayItem.HotspotPlace.LEFT_CENTER; } else if (u > ANCHOR_HIGH_THRESHOLD) { return OverlayItem.HotspotPlace.RIGHT_CENTER; } else { return OverlayItem.HotspotPlace.CENTER; } } }  static IGeoPoint toGeoPoint(LatLng latLng); static List<IGeoPoint> toGeoPoints(List<LatLng> points); static LatLng toLatLng(IGeoPoint geoPoint); static OverlayItem.HotspotPlace anchorToHotspot(float u, float v);  }
@Test public void testAnchorToHotspot() throws Exception { assertEquals( OverlayItem.HotspotPlace.UPPER_LEFT_CORNER, OsmUtils.anchorToHotspot(0f, 0f) ); assertEquals( OverlayItem.HotspotPlace.TOP_CENTER, OsmUtils.anchorToHotspot(0.5f, 0f) ); assertEquals( OverlayItem.HotspotPlace.UPPER_RIGHT_CORNER, OsmUtils.anchorToHotspot(1f, 0f) ); assertEquals( OverlayItem.HotspotPlace.LEFT_CENTER, OsmUtils.anchorToHotspot(0f, 0.5f) ); assertEquals( OverlayItem.HotspotPlace.CENTER, OsmUtils.anchorToHotspot(0.5f, 0.5f) ); assertEquals( OverlayItem.HotspotPlace.RIGHT_CENTER, OsmUtils.anchorToHotspot(1f, 0.5f) ); assertEquals( OverlayItem.HotspotPlace.LOWER_LEFT_CORNER, OsmUtils.anchorToHotspot(0f, 1f) ); assertEquals( OverlayItem.HotspotPlace.BOTTOM_CENTER, OsmUtils.anchorToHotspot(0.5f, 1f) ); assertEquals( OverlayItem.HotspotPlace.LOWER_RIGHT_CORNER, OsmUtils.anchorToHotspot(1f, 1f) ); }