コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        public static void AddBaseLayers(Map pMap)
        {
            var mBasemap = new MapGroup();

            mBasemap.LegendText = "Base Map";

            var          mLandFilename = Application.StartupPath + "\\GisData\\land.shp";
            PolygonLayer mLandLayer    = (PolygonLayer)mBasemap.Layers.Add(mLandFilename);

            mLandLayer.Symbolizer = new PolygonSymbolizer(GoogleMapsColors.Land);
            mLandLayer.LegendText = "Abu Dhabi Emirate";
            mLandLayer.Projection = KnownCoordinateSystems.Projected.UtmWgs1984.WGS1984UTMZone40N;
            mLandLayer.Reproject(pMap.Projection);

            var       mRoadsFilename = Application.StartupPath + "\\GisData\\roadssub.shp";
            LineLayer mRoadsLayer    = (LineLayer)mBasemap.Layers.Add(mRoadsFilename);

            mRoadsLayer.Symbolizer = new LineSymbolizer(GoogleMapsColors.MajorRoad, 2);
            mRoadsLayer.LegendText = "Approved Roads";
            mRoadsLayer.Projection = KnownCoordinateSystems.Projected.UtmWgs1984.WGS1984UTMZone40N;
            mRoadsLayer.Reproject(pMap.Projection);

            var ms  = new ShapefileDataProvider();
            var ms2 = ms.Open(Application.StartupPath + "\\GisData\\roadssub.shp");

            pMap.Layers.Add(mBasemap);
            pMap.Legend.RefreshNodes();

            mLandLayer.SelectionEnabled  = false;
            mRoadsLayer.SelectionEnabled = false;

            ExtFunctions.AddLabelsForFeatureLayer(mRoadsLayer, "Road IDs", "[ADRROADID]", Color.LightBlue, "Arial", 10, true);
            pMap.ViewExtents = mRoadsLayer.Extent;
            pMap.Refresh();
        }