Hi,
I try to add polygon to the map , without success.
I use the following code: what wrong?
private void InitializeOverlays()
{
.......
if (Map.Overlays.GetKeys().Contains(lAYERS_OVERLAY) == false)
{
InMemoryFeatureLayer polygonrlayer = new InMemoryFeatureLayer();
polygonrlayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(150, GeoColor.StandardColors.Red));
polygonrlayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay layerOverlay = new LayerOverlay();
layerOverlay.Layers.Add(POLYGON_LAYER, polygonrlayer);
Map.Overlays.Add(lAYERS_OVERLAY, layerOverlay);
}
}
private void AddPolygons( )
{
InMemoryFeatureLayer polygonLayer = (InMemoryFeatureLayer)Map.FindFeatureLayer(POLYGON_LAYER);
polygonLayer.Open();
polygonLayer.EditTools.BeginTransaction();
Feature feature = new Feature("POLYGON((14.863037109375 47.722412109375,14.80810546875 47.634521484375,14.928955078125 47.27197265625,15.09375 47.22802734375,15.236572265625 47.348876953125,15.324462890625 47.524658203125,15.324462890625 47.8212890625,15.15966796875 47.9091796875,14.863037109375 47.722412109375))");
var valid = feature.IsValid();
polygonLayer.EditTools.Add(feature);
}
polygonLayer.EditTools.CommitTransaction();
Map.CurrentExtent = Map.Overlays[lAYERS_OVERLAY].GetBoundingBox();
Map.Refresh(Map.Overlays[lAYERS_OVERLAY]);
polygonLayer.Close();
}
Thanks alot!