File tree Expand file tree Collapse file tree
MapboxAndroidSDK/src/main/java/com/spatialdev/osm
app/src/main/java/org/redcross/openmapkit Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -206,27 +206,30 @@ private void updateBoundingBox() {
206206 }
207207 }
208208
209- public void addNode () {
209+ public OSMNode addNode () {
210210 LatLng center = mapView .getCenter ();
211211 OSMNode node = new OSMNode (center );
212212 jtsModel .addOSMStandaloneNode (node );
213213 mapView .invalidate ();
214+ return node ;
214215 }
215216
216- public void addNode (OSMNode node ) {
217+ public OSMNode addNode (OSMNode node ) {
217218 Marker marker = node .getMarker ();
218219 if (marker != null ) {
219220 marker .setVisibility (true );
220221 }
221222 jtsModel .addOSMStandaloneNode (node );
222223 mapView .invalidate ();
224+ return node ;
223225 }
224226
225- public void moveNode () {
227+ public OSMNode moveNode () {
226228 LatLng center = mapView .getCenter ();
227229 OSMNode selectedNode = (OSMNode )OSMElement .getSelectedElements ().getFirst ();
228230 selectedNode .move (jtsModel , center );
229231 mapView .invalidate ();
232+ return selectedNode ;
230233 }
231234
232235 public OSMNode deleteNode () {
Original file line number Diff line number Diff line change 1515import java .io .IOException ;
1616import java .util .LinkedList ;
1717import java .util .List ;
18+ import java .util .Timer ;
19+ import java .util .TimerTask ;
1820
1921public class OSMNode extends OSMElement {
2022
@@ -152,6 +154,16 @@ public void select() {
152154 super .select ();
153155 if (marker != null ) {
154156 marker .setMarker (marker .getMapView ().getContext ().getResources ().getDrawable (R .mipmap .maki_star_orange ));
157+ } else {
158+ // Very wretched hack. Something is wrong with Mapbox Android SDK (Deprecated). Satisfies #98
159+ new Timer ().schedule (new TimerTask () {
160+ @ Override
161+ public void run () {
162+ if (marker != null ) {
163+ marker .setMarker (marker .getMapView ().getContext ().getResources ().getDrawable (R .mipmap .maki_star_orange ));
164+ }
165+ }
166+ }, 100 );
155167 }
156168 }
157169
Original file line number Diff line number Diff line change @@ -14,9 +14,6 @@ Android mobile application for browsing OpenStreetMap features to create and edi
1414 - Can be launched by your XForm survey to select OSM features and create/edit tags within your survey collection workflow.
1515 - Tags and OSM ID are sent back to ODK Collect to be stored in survey data
1616
17-
18- ![ OpenMapKit Flowchart] ( /docs/assets/OpenMapKit_flowchart.png )
19-
2017## Documentation
2118
2219See the [ wiki] ( https://github.com/AmericanRedCross/openmapkit/wiki ) for details on how to setup and load data into the app.
Original file line number Diff line number Diff line change @@ -376,8 +376,10 @@ protected void initializeAddNodeButtons() {
376376 View .OnClickListener listener = new View .OnClickListener () {
377377 @ Override
378378 public void onClick (View v ) {
379- osmMap .addNode ();
379+ OSMNode node = osmMap .addNode ();
380380 toggleNodeMode ();
381+ node .select ();
382+ identifyOSMFeature (node );
381383 }
382384 };
383385 addNodeMarkerBtn .setOnClickListener (listener );
You can’t perform that action at this time.
0 commit comments