Skip to content

Commit

Permalink
Closes #119
Browse files Browse the repository at this point in the history
  • Loading branch information
hallahan committed Apr 23, 2016
1 parent 4f8a8ef commit 9575f58
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
public class OSMMap implements MapViewListener, MapListener {

// DEBUG MODE - SHOW ENVELOPE AROUND TAP ON MAP
private static final boolean DEBUG = true;
private static final boolean DEBUG = false;

private MapView mapView;
private JTSModel jtsModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,11 @@ public OSMElement queryFromTap(ILatLng latLng, float zoom) {

}

// Log.i("queryFromTap closestElement", closestElement.toString());
return closestElement;
Geometry closestElementGeom = closestElement.getJTSGeom();
if (closestElementGeom != null && closestElementGeom.intersects(geometryFactory.createPoint(coord))) {
return closestElement;
}
return null;
}

private Envelope createTapEnvelope(Coordinate coord, double lat, double lng, float zoom) {
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/org/redcross/openmapkit/MapActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,12 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
*/
protected void identifyOSMFeature(OSMElement osmElement) {

// only open it if we render the OSM vectors,
// otherwise it is confusing for the user
if (mapView.getZoomLevel() < OSMMapBuilder.MIN_VECTOR_RENDER_ZOOM) {
return;
}

int numRequiredTags = 0;
if (ODKCollectHandler.isODKCollectMode()) {
Collection<ODKTag> requiredTags = ODKCollectHandler.getODKCollectData().getRequiredTags();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
public class OSMMapBuilder extends AsyncTask<File, Long, JTSModel> {

private static final float MIN_VECTOR_RENDER_ZOOM = 18;
public static final float MIN_VECTOR_RENDER_ZOOM = 18;
private static final String PERSISTED_OSM_FILES = "org.redcross.openmapkit.PERSISTED_OSM_FILES";

private static MapActivity mapActivity;
Expand Down

0 comments on commit 9575f58

Please sign in to comment.