Hi,
I am drawing a circle on top of a polygon on a map.How can I set the color of the circle to a different color than that of the polygon?
Thanks,
Phani.
Hi,
I am drawing a circle on top of a polygon on a map.How can I set the color of the circle to a different color than that of the polygon?
Thanks,
Phani.
Hi, Phani
Below is a code snippet that shows how to add a circle on top of a rectangle and set them different colors.void UserControl_Loaded(object sender, RoutedEventArgs e)
{
Map1.MapUnit = GeographyUnit.DecimalDegree;
InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer();
inMemoryLayer.Open();
inMemoryLayer.Columns.Add(new FeatureSourceColumn("Color"));
inMemoryLayer.Close();
inMemoryLayer.InternalFeatures.Add("Polygon", new Feature(new RectangleShape(60, 30, 90, 10)));
inMemoryLayer.InternalFeatures.Add("Circle", new Feature(new EllipseShape(new PointShape(75, 20), 8)));
Feature polygonFeature = inMemoryLayer.InternalFeatures["Polygon"];
polygonFeature.ColumnValues.Add("Color", "Red");
Feature circleFeature = inMemoryLayer.InternalFeatures["Circle"];
circleFeature.ColumnValues.Add("Color", "Green");
ValueStyle valueStyle = new ValueStyle();
valueStyle.ColumnName = "Color";
valueStyle.ValueItems.Add(new ValueItem("Red", AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Red)));
valueStyle.ValueItems.Add(new ValueItem("Green", AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Green)));
inMemoryLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(valueStyle);
inMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay featureOverlay = new LayerOverlay();
featureOverlay.Layers.Add(inMemoryLayer);
Map1.Overlays.Add("FeatureOverlay", featureOverlay);
Map1.CurrentExtent = new RectangleShape(50, 40, 100, 0);
}
It’s modified on the CreateAnInmomoryFeatureLayer example of HowDoI samples shipped out with our SilverlightEdition, you have try to apply it to the sample and run the application to see if it fits for your requirement.
Any further questions please feel free to let me know.
Thanks.
James
James,
Thank you for the Info.Thar really helped me.
-Phani
Phani,
Long time no see.
I am glad it’s working with you.
James