示例#1
0
        /// <inheritdoc />
        public override void Add(ILayer layer)
        {
            IMapLayer ml = layer as IMapLayer;

            if (ml != null)
            {
                _layers.Add(ml);
            }
        }
        public static IFeatureLayer GetFeatureLayer(
            IMapLayerCollection pMapLayerCollection,
            FeatureSet pFeatureSet,
            string pName,
            Object pSymbolizer,
            ProjectionInfo pProjection)
        {
            IFeatureLayer mLayer;

            if (pFeatureSet.FeatureType == DotSpatial.Topology.FeatureType.Point)
            {
                mLayer = (PointLayer)pMapLayerCollection.Add(pFeatureSet);
                ((PointLayer)mLayer).Symbolizer = (PointSymbolizer)pSymbolizer;
                ((PointLayer)mLayer).LegendText = pName;
            }
            else if (pFeatureSet.FeatureType == DotSpatial.Topology.FeatureType.Line)
            {
                mLayer = (LineLayer)pMapLayerCollection.Add(pFeatureSet);
                ((LineLayer)mLayer).Symbolizer = (LineSymbolizer)pSymbolizer;
                ((LineLayer)mLayer).LegendText = pName;
            }
            else if (pFeatureSet.FeatureType == DotSpatial.Topology.FeatureType.Polygon)
            {
                mLayer = (PolygonLayer)pMapLayerCollection.Add(pFeatureSet);
                ((PolygonLayer)mLayer).Symbolizer = (PolygonSymbolizer)pSymbolizer;
                ((PolygonLayer)mLayer).LegendText = pName;
            }
            else
            {
                mLayer = null;
            }

            mLayer.Projection = pProjection;

            return(mLayer);
        }