Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TMS VCL WebGMaps
Working with Polygons

Adding a polygon:
var 
  PolygonItem: TPolygonItem;
begin
  PolygonItem := WebGMaps1.Polygons.Add;  
  PolygonItem.Polygon.BackgroundOpacity := 50;
  PolygonItem.Polygon.BorderWidth := 2;
  
  //Settings for a Polygon of type Circle
  PolygonItem.Polygon.PolygonType := ptCircle;
  PolygonItem.Polygon.Radius := 10000;
  PolygonItem.Polygon.Center.Latitude := 50;
  PolygonItem.Polygon.Center.Longitude := 2;
  
  //Settings for a Polygon of type Rectangle
  PolygonItem.Polygon.PolygonType := ptRectangle;
  PolygonItem.Polygon.Bounds.NorthEast.Latitude := 52;
  PolygonItem.Polygon.Bounds.NorthEast.Longitude := 4;
  PolygonItem.Polygon.Bounds.SouthWest.Latitude := 50;
  PolygonItem.Polygon.Bounds.SouthWest.Longitude := 3;
  
  //Settings for a Polygon of type Path
  PolygonItem.Polygon.PolygonType := ptPath;               
  PolygonItem.Polygon.Path.Add(50, 2);
  PolygonItem.Polygon.Path.Add(52, 4);
  PolygonItem.Polygon.Path.Add(50, 4);

  WebGMaps1.CreateMapPolygon(PolygonItem.Polygon);
end;
Editing a polygon:
PolygonItem.Polygon.Visible := not PolygonItem.Polygon.Visible;

WebGMaps1.UpdateMapPolygon(PolygonItem.Polygon);
Removing a polygon:
//Removes the Polygon from the map
WebGMaps1.DeleteMapPolygon(PolygonItem.Index);

//Removes the Polygon from the collection
WebGMaps1.Polygons.Delete(PolygonItem.Index);