B4J Question jSD_OpenMaps - EditingPolygon/EditingPolyline

Davisbc

Member
Licensed User
Has anyone been able to get these 2 methods to work? I went back a loaded the demo and neither method seem to work. They return true when called but do not respond to any actions on the selected object. The object on the map does set itself to edit mode. Maybe i am missing a routine to handle the edits.

The following code is how i call the method. Its direct from the demo.

OpenMaps EditingPolygon code:
        Case "Polygon"
            Dim Success As Boolean =gmap.EditingPolygon(ObjSelected,Checked)
            logMessage ("EditPolygon status is " & Success)
            If Checked  Then
                LabelObj.Text="" ' reset add obj
                gmap.PanelOn
                gmap.MessageToPanel("Click the RIGHT mouse button to finish")
            Else
                gmap.PanelOff
            End If
            
        Case "Polyline"
            Dim Success As Boolean = gmap.EditingPolyline(ObjSelected,Checked)
            logMessage ("EditPolyline status is " & Success)
            If Checked  Then
                LabelObj.Text="" ' reset add obj
                gmap.PanelOn
                gmap.MessageToPanel("Click the RIGHT mouse button to finish")
            Else
                gmap.PanelOff
            End If

Thanks in advance,
barry
 

Star-Dust

Expert
Licensed User
Longtime User
Are you sure you selected the polygon (or polyline) before selecting edit?
Nuovovideo-ezgif.com-crop.gif
 
Upvote 0

Davisbc

Member
Licensed User
OK, i reloaded the demo source from https://www.b4x.com/android/forum/attachments/openmapsdemo-zip.163103/

I had to comment out the compiler path line in main. It is redundant to the "config Path" value

B4X:
#Region Project Attributes
    #MainFormWidth: 1000
    #MainFormHeight: 650
#End Region

'#JavaCompilerPath: 19, C:\Program Files\Java\jdk-19.0.2\bin\javac.exe
#PackagerProperty: IncludedModules = javafx.web

Sub Process_Globals

I got the same result i described earlier.

Are you using the same demo as the on on the download? I noticed the colors in your example are different than the ones in the demo.

Thanks in advance,
B
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Obviously it's the same example, but most importantly it's the same library. This seems like a superfluous question to me.
Describe the problem better, do other methods work? Can you add Polygons? After activating the modification, do white points appear in the corners of the polygon?
 
Upvote 0

Davisbc

Member
Licensed User
Obviously it's the same example, but most importantly it's the same library. This seems like a superfluous question to me.

Describe the problem better, do other methods work?

When you edit the polygon, the white points show up but do not respond to selecting and holding either the red + circle or the white ball at the vertex.

it works the same way for polyline or polygon. Edit works for circle.

POLYline
1767922852272.png



Polygon
1767922984045.png
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
If you can't aim for the white dots you simply need to increase the tolerance (standard value is 15). This will increase the diameter of the spot's sensitive field.
Obviously, if there are points that are too close to each other, increasing the tolerance would cause the sensitive area to overlap

B4X:
OpenaMap.EditConfigure(0,25)
 
Upvote 0

Davisbc

Member
Licensed User
Thanks, I modified the demo code to the following:

B4X:
Private Sub OMaps_Ready
    LabelZoom.Text=OMaps.Zoom
    OMaps.EditConfigure(0,45)   
    
    Log ("Map Ready")
    wait for (OMapsExt.AddressToLatLon("Torre Eiffel")) COMPLETE (ll As LatLng)
    
    Log ("Map Rady - After Wait")
    OMaps.Zoom=16
    OMaps.MoveCamera2(ll)
    

            
    Dim Cr As MapCircle = OMaps.AddCircle(ll,50,2,fx.Colors.Red,fx.Colors.Yellow,0.5)
    Dim Mk As Marker = OMaps.AddMarker2(ll.Latitude,ll.Longitude,"My Marker","https://cdn-icons-png.flaticon.com/512/684/684908.png")
    Dim Pl As MapPolyline = OMaps.AddPolyline(Array(pt(48.8586973, 2.296136), pt(48.8572973, 2.297036), pt(48.8572973, 2.295236)),4,fx.Colors.Red)
    Dim Pg As MapPolygon = OMaps.AddPolygon(Array(pt(48.8575703, 2.292737), pt(48.8561703, 2.293637), pt(48.8561703, 2.291837)),1,fx.Colors.Red,fx.Colors.Yellow,0.3)
    
    ObjectMap.Put(Cr.ID,Cr)
    ObjectMap.Put(Mk.ID,Mk)
    ObjectMap.Put(Pg.ID,Pg)
    ObjectMap.Put(Pl.ID,Pl)
End Sub

I could not edit the polygon.

I also noticed that the app never responded to the address to LatLon request. The map stays on Italy.

B
 
Upvote 0
Top