Hi ,
I have a custom point style that needs to change the style based on a feature column values.
The problem is the feature passed down in to custom style do not have any column values.
How to get the column values?
The code:
public class PolePointstyle : ThinkGeo.MapSuite.Styles.PointBaseStyle
{
protected override void DrawCore(IEnumerable<Feature> features, GeoCanvas canvas, Collection<SimpleCandidate> labelsInThisLayer, Collection<SimpleCandidate> labelsInAllLayers)
{
foreach (Feature feature in features)
{
PointStyle style = GetPointStyle(feature);
style.Draw(new Collection<Feature>() { feature }, canvas, labelsInThisLayer, labelsInAllLayers);
}
}
private PointStyle GetPointStyle(Feature feature)
{
bool hasPanel;
bool.TryParse(feature.ColumnValues["has_panel"].ToString(), out hasPanel);
var poleStyle = hasPanel? PointStyles.CreateSimpleTriangleStyle(GeoColor.StandardColors.Red, 10, GeoColor.StandardColors.Black, 1) : PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Blue, 10, GeoColor.StandardColors.Black, 1);
/*Other processing */
return poleStyle;
}
}