Suggestion: Custom Render Themeatic takes MaxVisible MinVisible into account

Topics: SharpMap Project, SharpMap v0.9 / v1.x
Jun 4, 2008 at 10:25 PM
Hi, not sure if this is the right place to put suggestions;

Basically I've added a bit of code into the VectorLayer and LabelLayer classes that takes into account the distance visibility of a particular attribute rather than the layer as a whole:

 

for(int i=0;i<features.Count;i++) {
  SharpMap.Data.
FeatureDataRow feature = features[i];
  SharpMap.Styles.
VectorStyle style = this.Theme.GetStyle(feature) as SharpMap.Styles.VectorStyle;

  //Added by me: skip the render of the VectorLayer if the custom style specifies it outside of the current zoom level
  if
(style.Enabled && style.MaxVisible < map.Zoom || style.MinVisible > map.Zoom) {
    continue;
  }
  RenderGeometry(g, map, feature.Geometry, style);
}

The main reason why I am doing this is because my datasets have attributes that sub-categorize them. For example, a shapefile and feature list of urban places - and in the .dbf file contains attributes on the population.

In the custom render thematic I may wish to make the font larger for larger populations, but I also may want to completely disable the rendering of certain small population points at a distance.

The same principle applies to the Label Layer. Please let me know what you think. Maybe this is already implemented?