Val, sorry for the confusion. The whole issue here is about drawing multiple symbols for a single geographic location. My first issue was conflict resolution, which I have a ways to go on. The second being the use of ValueStyle. I went ahead a verbalized my problem with code, This should clear things up.
As you can see I simply add two point features to my map. I try to symbolize the first point with three separate valueitems. It only draws the first. On order to draw all three I need a separate point for each valueitem.
Another question is why doesn't the use of CustomPointStyle work. Am I doing something wrong. I thought I should just be able to add the pointsymbol for each symbol as a CustomPointStyle, but it would never draw.
Here is my code that you simple put into a form load event of a form with a mapcontrol. Hope this helps illustrate my issues with Valuestyle. Thanks.
Eric S.
private void Form1_Load(object sender, EventArgs e)
{
// somewhere in Virginia
winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
winformsMap1.CurrentExtent = ExtentHelper.GetDrawingExtent(new RectangleShape(-78, 39, -76, 38), winformsMap1.Width, winformsMap1.Height);
//winformsMap1.CurrentExtent = new RectangleShape(-78,39,-76,38);
InMemoryFeatureLayer eventLayer = new InMemoryFeatureLayer();
eventLayer.Open();
eventLayer.Columns.Add(new FeatureSourceColumn("EventId"));
eventLayer.Close();
ValueStyle EventValueStyle = new ValueStyle();
EventValueStyle.ColumnName = "EventId";
eventLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(EventValueStyle);
//eventLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Square,
// new GeoSolidBrush(
// GeoColor.StandardColors.Red),
// new GeoPen(
// GeoColor.StandardColors.Red), 20);
eventLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
eventLayer.Name = "Events";
// create a feature to add to the map
Feature feature1 = new Feature(-77,38.5,"1");
feature1.ColumnValues["EventId"] = "1001";
// need to symbolize the feature with three symbols
PointStyle symbol1 = new PointStyle();
symbol1.PointType = PointType.Symbol;
//symbol1.CustomPointStyles.Add(new PointStyle(PointSymbolType.Square, new GeoSolidBrush(GeoColor.StandardColors.Red), new GeoPen(GeoColor.StandardColors.Red), 20));
symbol1.SymbolType = PointSymbolType.Circle;
symbol1.SymbolSize = 20;
symbol1.SymbolSolidBrush = new GeoSolidBrush(GeoColor.StandardColors.Red);
symbol1.SymbolPen = new GeoPen(GeoColor.StandardColors.Red);
symbol1.XOffsetInPixel = 0;
PointStyle symbol2 = new PointStyle();
symbol2.PointType = PointType.Symbol;
//symbol2.CustomPointStyles.Add(new PointStyle(PointSymbolType.Cross, new GeoSolidBrush(GeoColor.StandardColors.Blue), new GeoPen(GeoColor.StandardColors.Blue), 20));
symbol2.SymbolType = PointSymbolType.Cross;
symbol2.SymbolSize = 20;
symbol2.SymbolSolidBrush = new GeoSolidBrush(GeoColor.StandardColors.Blue);
symbol2.SymbolPen = new GeoPen(GeoColor.StandardColors.Blue);
symbol2.XOffsetInPixel = 21;
PointStyle symbol3 = new PointStyle();
symbol3.PointType = PointType.Symbol;
//symbol3.CustomPointStyles.Add(new PointStyle(PointSymbolType.Diamond, new GeoSolidBrush(GeoColor.StandardColors.Green), new GeoPen(GeoColor.StandardColors.Green), 20));
symbol3.SymbolType = PointSymbolType.Diamond;
symbol3.SymbolSize = 20;
symbol3.SymbolSolidBrush = new GeoSolidBrush(GeoColor.StandardColors.Green);
symbol3.SymbolPen = new GeoPen(GeoColor.StandardColors.Green);
symbol3.XOffsetInPixel = 21;
// Problem Area!!
// Now try to add the three styles to one value. Shouldn't this draw all three symbols for the one value
// This does now work it only draws the first style
EventValueStyle.ValueItems.Add(new ValueItem("1001", symbol1));
EventValueStyle.ValueItems.Add(new ValueItem("1001", symbol2));
EventValueStyle.ValueItems.Add(new ValueItem("1001", symbol3));
// in order to get multiple symbols to display for a single point I have to duplicate the point for each symbol
Feature feature2 = new Feature(-76.5, 38.75, "2");
feature2.ColumnValues["EventId"] = "1002";
Feature feature3 = new Feature(-76.5, 38.75, "3");
feature3.ColumnValues["EventId"] = "1003";
Feature feature4 = new Feature(-76.5, 38.75, "4");
feature4.ColumnValues["EventId"] = "1004";
// and add a seperate valueitem for each duplicate feature
// this is not desirable but only way to get it to work
EventValueStyle.ValueItems.Add(new ValueItem("1002", symbol1));
EventValueStyle.ValueItems.Add(new ValueItem("1003", symbol2));
EventValueStyle.ValueItems.Add(new ValueItem("1004", symbol3));
eventLayer.Open();
eventLayer.EditTools.BeginTransaction();
eventLayer.EditTools.Add(feature1);
eventLayer.EditTools.Add(feature2);
eventLayer.EditTools.Add(feature3);
eventLayer.EditTools.Add(feature4);
eventLayer.EditTools.CommitTransaction();
eventLayer.Close();
LayerOverlay eventOverlay = new LayerOverlay();
eventOverlay.Name = "Events";
eventOverlay.Layers.Add("EventsLayer", eventLayer);
winformsMap1.Overlays.Add("EventsOverlay", eventOverlay);
winformsMap1.Refresh();
}