Exemple #1
0
        public static WorldMapKitMapOverlay AddWorldMapKitOverlay(GisEditorWpfMap map)
        {
            var wmkOverlay = new WorldMapKitMapOverlay(WmkClientId, WmkPrivateKey);

            wmkOverlay.TileType             = TileType.HybridTile;
            wmkOverlay.Name                 = GisEditor.LanguageManager.GetStringResource("WorldMapKitName");
            wmkOverlay.DrawingExceptionMode = DrawingExceptionMode.DrawException;
            wmkOverlay.TileBuffer           = 2;
            wmkOverlay.DrawingException    += new EventHandler <DrawingExceptionTileOverlayEventArgs>(WmkOverlay_DrawingException);

            if (string.IsNullOrEmpty(map.DisplayProjectionParameters))
            {
                wmkOverlay.Projection           = Layers.WorldMapKitProjection.DecimalDegrees;
                map.DisplayProjectionParameters = Proj4Projection.GetEpsgParametersString(4326);
            }
            else
            {
                wmkOverlay.Projection = map.MapUnit == GeographyUnit.DecimalDegree ? Layers.WorldMapKitProjection.DecimalDegrees : Layers.WorldMapKitProjection.SphericalMercator;
            }
            wmkOverlay.RefreshCache();
            if (map.MapUnit == GeographyUnit.Meter || map.MapUnit == GeographyUnit.DecimalDegree)
            {
                BaseMapsHelper.RemoveAllBaseOverlays(map);
                map.Overlays.Insert(0, wmkOverlay);
                SetExtent(map);
                map.Refresh(wmkOverlay);
            }
            else
            {
                AddOverlayInGoogleProjection(wmkOverlay, map);
            }
            return(wmkOverlay);
        }
Exemple #2
0
        private static MenuItem GetChangeTransparencyItem(double transparencyPa)
        {
            var transparencyMenuItem = new MenuItem();

            transparencyMenuItem.Header      = transparencyPa + " %";
            transparencyMenuItem.IsCheckable = true;
            double value = transparencyPa / 100;

            transparencyMenuItem.Tag = value;

            transparencyMenuItem.Click += (s, e) =>
            {
                var selectedMenuItem = (MenuItem)s;
                var transparency     = Convert.ToDouble(selectedMenuItem.Tag);
                if (GisEditor.LayerListManager.SelectedLayerListItem == null)
                {
                    return;
                }


                BingMapsOverlay       bingMapsOverlay       = GisEditor.LayerListManager.SelectedLayerListItem.ConcreteObject as BingMapsOverlay;
                OpenStreetMapOverlay  openStreetMapOverlay  = GisEditor.LayerListManager.SelectedLayerListItem.ConcreteObject as OpenStreetMapOverlay;
                WorldMapKitMapOverlay worldMapKitMapOverlay = GisEditor.LayerListManager.SelectedLayerListItem.ConcreteObject as WorldMapKitMapOverlay;

                if (bingMapsOverlay != null && bingMapsOverlay.OverlayCanvas.Opacity != transparency)
                {
                    bingMapsOverlay.OverlayCanvas.Opacity = transparency;
                    bingMapsOverlay.Invalidate();
                }
                else if (openStreetMapOverlay != null && openStreetMapOverlay.OverlayCanvas.Opacity != transparency)
                {
                    openStreetMapOverlay.OverlayCanvas.Opacity = transparency;
                    openStreetMapOverlay.Invalidate();
                }
                else if (worldMapKitMapOverlay != null && worldMapKitMapOverlay.OverlayCanvas.Opacity != transparency)
                {
                    worldMapKitMapOverlay.OverlayCanvas.Opacity = transparency;
                    worldMapKitMapOverlay.Invalidate();
                }


                foreach (MenuItem item in ((MenuItem)selectedMenuItem.Parent).Items)
                {
                    if (!item.Equals(selectedMenuItem))
                    {
                        item.IsChecked = false;
                    }
                }
            };
            return(transparencyMenuItem);
        }