Gustavo & Guillaume,
Thanks for your guys input and ideas, I appreciate it very much.
I think we can definitely solve this issue if we pay some attention to 2 issues.
1)Line Style Issue
Just plays around with the following test code with two kinds of LineStyles are used. In this small sample you can the great difference when using between LineStyle1 and LineStyle2. So when compound OutPen & InnerPen(Or and CenterPen) used LineStyle, it will make the point is drawn below.
winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
winformsMap1.CurrentExtent = new RectangleShape(0, 100, 100, 0);
winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.StandardColors.White);
LineShape lineShape = (LineShape)BaseShape.CreateShapeFromWellKnownData("LINESTRING(60 60, 70 70,75 60, 80 70, 85 60,95 80)");
InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer();
inMemoryLayer.InternalFeatures.Add("Line", new Feature(lineShape));
foreach (Vertex vertex in lineShape.Vertices)
{
Feature pointFeature = new Feature(vertex.X, vertex.Y);
inMemoryLayer.InternalFeatures.Add(pointFeature);
}
PointStyle pointStyle = new PointStyle( PointSymbolType.Circle,new GeoSolidBrush(GeoColor.FromArgb(255, GeoColor.StandardColors.Green)),20);
LineStyle lineStyle1 = new LineStyle(new GeoPen(GeoColor.FromArgb(200, GeoColor.StandardColors.Red), 20));
LineStyle lineStyle2 = new LineStyle(new GeoPen(GeoColor.FromArgb(200, GeoColor.StandardColors.Red), 20), new GeoPen(GeoColor.FromArgb(200, GeoColor.StandardColors.Blue), 12));
inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = lineStyle1;
//inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = lineStyle2;
inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = pointStyle;
inMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay staticOverlay = new LayerOverlay();
staticOverlay.Layers.Add("InMemoryFeatureLayer", inMemoryLayer);
winformsMap1.Overlays.Add("InMemoryOverlay", staticOverlay);
winformsMap1.Refresh();
To solve this issue, I suggest we use the custom styles instead, following style give the same result when using lineStyle2 while keep point was drawn above.
PointStyle pointStyle = new PointStyle( PointSymbolType.Circle,new GeoSolidBrush(GeoColor.FromArgb(255, GeoColor.StandardColors.Green)),20);
LineStyle subStyle1 = new LineStyle(new GeoPen(GeoColor.FromArgb(200, GeoColor.StandardColors.Red), 20));
LineStyle subStyle2 = new LineStyle(new GeoPen(GeoColor.FromArgb(200, GeoColor.StandardColors.Blue), 12));
inMemoryLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(subStyle1);
inMemoryLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(subStyle2); inMemoryLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(pointStyle);
2) Add feature sequence issue.
The adding features sequence will also make some different even though we only use the OutPen for the LineStyle. In this case, it will draw the features as its adding sequence.
winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
winformsMap1.CurrentExtent = new RectangleShape(0, 100, 100, 0);
winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.StandardColors.White);
LineShape lineShape = (LineShape)BaseShape.CreateShapeFromWellKnownData("LINESTRING(60 60, 70 70,75 60, 80 70, 85 60,95 80)");
InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer();
foreach (Vertex vertex in lineShape.Vertices)
{
Feature pointFeature = new Feature(vertex.X, vertex.Y);
inMemoryLayer.InternalFeatures.Add(pointFeature);
}
inMemoryLayer.InternalFeatures.Add("Line", new Feature(lineShape));
PointStyle pointStyle = new PointStyle( PointSymbolType.Circle,new GeoSolidBrush(GeoColor.FromArgb(255, GeoColor.StandardColors.Green)),20);
LineStyle lineStyle1 = new LineStyle(new GeoPen(GeoColor.FromArgb(200, GeoColor.StandardColors.Red), 20));
LineStyle lineStyle2 = new LineStyle(new GeoPen(GeoColor.FromArgb(200, GeoColor.StandardColors.Red), 20), new GeoPen(GeoColor.FromArgb(200, GeoColor.StandardColors.Blue), 12));
inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = lineStyle1;
//inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = lineStyle2;
inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = pointStyle;
inMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay staticOverlay = new LayerOverlay();
staticOverlay.Layers.Add("InMemoryFeatureLayer", inMemoryLayer);
winformsMap1.Overlays.Add("InMemoryOverlay", staticOverlay);
winformsMap1.Refresh();
In order to solve this problem, we may need to reorder the feature sequence at the beginning or before the DrawCore in your customized feature layer.
Any more questions just feel free to let me know.
Thanks.
Yale