Diagram for .NET / User's Guide / Maps / Map Layers
In This Topic
    Map Layers
    In This Topic

    A map layer is a container that contains map features of a given type. The most commonly use map feature types are points, polylines and polygons. The type of the features a given map layer contains is indicated by the FeaturesType property. In the context of GIS data in the ESRI format, map layers are called shapefiles. The sections below explain how to control the appearance and the behavior of map layers and how to add a map layer to the map importer.

     Appearance

    The following map layer properties lets you control the appearance of the Nevron diagram elements created from the map features of this map layer:

    • NameColumn - the data column to use for naming of the diagram elements created from this map layer.
    • TextColumn - the data column to use for labeling of the diagram elements created from this map layer.
    • DefaultStyleSheetName - the default style sheet to apply to diagram elements created from the map features of this map layer. This style sheet is also inherited from all style sheets created from the fill rule.
    • FillRule - the fill rule to use for coloring the shapes of this shapefile. Check out the Fill Rules topic for more information.
    • PolygonLabelingMode - determines the mode for labeling of polygon features. Can be one of the following:
      Value Description
      BoundsCenter Labels are placed at the center of the polygon's bounding box if it is inside the polygon. If it is not, the Optimal rendering mode is used.
      Centroid Labels are placed at the centroid of the polygon if it is inside the polygon. If it is not, the Optimal rendering mode is used.
      Optimal Labels are placed at an optimal position in the polygon. This produces the best results, but is the most computationally expensive mode.
    • MinPointShapeSize - determines the minimum size of point shapes.
    • MaxPointShapeSize - determines the maximum size of point shapes.
    • PointSizeColumn - the name of the column that should be used to determine point shape sizes.
     Behavior

    The following map layer properties lets you configure its behavior:

    • MinShowZoomFactor, MaxShowZoomFactor - determine the zoom range in which the layer is shown.
    • MinTextShowZoomFactor, MaxTextShowZoomFactor - determine the zoom range in which the texts of the diagram elements created from this map layer are shown.
     ESRI Shapefiles

    Nevron Map for .NET currently supports only one type of map layers - ESRI shapefiles. The ESRI shapefile support is implemented by NEsriShapefile class that inherits NMapLayer. You can create an NEsriShapefile either from a file or from a pair of streams - a shapefile stream and a DBF stream, which contains attribute data for the map features of the shapefile. In case you use the constructor that accepts a file name, Nevron Map assumes that a DBF file with the same file name and an extension ".dbf" exists in the directory of the ESRI shapefile.

    The following piece of code demonstrates how to create, configure and add an ESRI shapefile to a map importer:

    Create, configure and add a shapefile
    Copy Code
    NEsriShapefile countries = new NEsriShapefile(Path.Combine(Application.StartupPath, CountriesFileName));
    countries.NameColumn = "CNTRY_NAME";
    countries.TextColumn = "CNTRY_NAME";
    countries.MinTextShowZoomFactor = 0.1f;   
    countries.FillRule = new NMapFillRuleValue("COLOR_MAP", Colors);
    mapImporter.AddLayer(countries);
    

    This creates a shapefile and instructs the map importer that is should use the "CNTRY_NAME" column both for naming and for the labeling of the diagram elements created from the shapefile. The texts of the diagram elements will become visible when the user zooms the map to at least 10%.

    See Also