Android Question GoogleMapExtra - A complex polygon.

javiers

Active Member
Licensed User
Longtime User
Good afternoon. You can make this polygon? I appreciate the help.

Regards.
polígono.png
 

javiers

Active Member
Licensed User
Longtime User
Thanks for your answer. I've solved this way. The idea was to draw up a map of Google at some point.
Here's the code:

B4X:
Sub creaproteger (radio As Int ,orden As Int, orientacion As Int)
''''''''Dibujar el segmento de proteger en la dirección del viento. radio m de radio
      Dim PolygonOptions1 As PolygonOptions
      Dim Point0, Point1, Point2, Point3, Point4, Point5, Point6, Point7,Point8, Point9, Point10 As LatLng
      Dim Puntos As List
        Dim Polygon1 As Polygon
      Puntos.Initialize
      Dim GPS0, GPS1 As GeoPoint
      GPS0.Initialize(CoorXY.Latitude,CoorXY.Longitude)
      '  points must be ordered in a  counterclockwise order
      '  (i found FillColor will fail if not correctly ordered). Los grados comienzan en las 12 (0ª) en sentido de las agujas
      ' del reloj. (90º corresponden a las 3, 180º a las 6, 270º a las 9).
      GPS1 = GPS0.GetDestinationPoint(500,0-orientacion)
      Point0.Initialize(GPS1.Latitude, GPS1.Longitude)
      Puntos.Add(Point0)
      GPS1 = GPS0.GetDestinationPoint(radio,60-orientacion)     
      Point1.Initialize(GPS1.Latitude, GPS1.Longitude)
      Puntos.Add(Point1)
      GPS1 = GPS0.GetDestinationPoint(radio,70-orientacion)     
      Point2.Initialize(GPS1.Latitude, GPS1.Longitude)
      Puntos.Add(Point2)
      GPS1 = GPS0.GetDestinationPoint(radio,80-orientacion)     
      Point3.Initialize(GPS1.Latitude, GPS1.Longitude)
      Puntos.Add(Point3)
      GPS1 = GPS0.GetDestinationPoint(radio,90-orientacion)     
      Point4.Initialize(GPS1.Latitude, GPS1.Longitude)
      Puntos.Add(Point4)
      GPS1 = GPS0.GetDestinationPoint(radio,100-orientacion)     
      Point5.Initialize(GPS1.Latitude, GPS1.Longitude)
      Puntos.Add(Point5)     
      GPS1 = GPS0.GetDestinationPoint(radio,110-orientacion)     
      Point6.Initialize(GPS1.Latitude, GPS1.Longitude)
      Puntos.Add(Point6)         
      GPS1 = GPS0.GetDestinationPoint(radio,120-orientacion)     
      Point7.Initialize(GPS1.Latitude, GPS1.Longitude)
      Puntos.Add(Point7)         
      GPS1 = GPS0.GetDestinationPoint(radio,130-orientacion)     
      Point8.Initialize(GPS1.Latitude, GPS1.Longitude)
      Puntos.Add(Point8)         
      GPS1 = GPS0.GetDestinationPoint(500,180-orientacion)
      Point9.Initialize(GPS1.Latitude, GPS1.Longitude)
      Puntos.Add(Point9) 
      Point10.Initialize(Point0.Latitude, Point0.Longitude)
      Puntos.Add(Point10)  '  closes the path

      PolygonOptions1.Initialize
      PolygonOptions1.FillColor=Colors.ARGB(128, 255, 0, 0)
      PolygonOptions1.AddPoints(Puntos)
      PolygonOptions1.StrokeColor=Colors.Red
      PolygonOptions1.StrokeWidth=2
     
      Polygon1=GoogleMapsExtras1.AddPolygon(GoogleMap1, PolygonOptions1)


End Sub

Sub creacirculo  (radio As Int)
                          Dim CircleOptions1 As CircleOptions
                          CircleOptions1.Initialize
                         
                          CircleOptions1.Center2(CoorXY.Latitude, CoorXY.Longitude).FillColor(Colors.ARGB(128, 192, 0, 25)).Radius(radio).StrokeColor(Colors.Black).StrokeWidth(2)
                         
                          Circle1  = GoogleMapsExtras1.AddCircle(GoogleMap1, CircleOptions1)
End Sub
 
Upvote 0
Top