Esempio n. 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);
        }
Esempio n. 2
0
 private static BingMapsOverlay AddBingMapOverlayToMap(GisEditorWpfMap map, BingMapsConfigWindow configWindow, BingMapsOverlay bingOverlay)
 {
     bingOverlay                      = new BingMapsOverlay(configWindow.BingMapsKey, (Wpf.BingMapsMapType)configWindow.BingMapsStyle);//new BingMapsOverlay(configWindow.BingMapsKey);
     bingOverlay.Logo                 = null;
     bingOverlay.Name                 = GisEditor.LanguageManager.GetStringResource("BingMapsConfigWindowTitle");
     bingOverlay.TileType             = TileType.HybridTile;
     bingOverlay.DrawingExceptionMode = DrawingExceptionMode.DrawException;
     bingOverlay.DrawingException    += new EventHandler <DrawingExceptionTileOverlayEventArgs>(BingOverlay_DrawingException);
     bingOverlay.RefreshCache();
     BaseMapsHelper.AddOverlayInGoogleProjection(bingOverlay, map);
     return(bingOverlay);
 }
Esempio n. 3
0
        public static OpenStreetMapOverlay AddOpenStreetMapOverlay(GisEditorWpfMap map)
        {
            OpenStreetMapOverlay osmOverlay = new OpenStreetMapOverlay();

            osmOverlay.TileType             = TileType.HybridTile;
            osmOverlay.Name                 = "OpenStreetMap";
            osmOverlay.DrawingExceptionMode = DrawingExceptionMode.DrawException;
            osmOverlay.DrawingException    += new EventHandler <DrawingExceptionTileOverlayEventArgs>(OsmOverlay_DrawingException);
            osmOverlay.RefreshCache();
            BaseMapsHelper.AddOverlayInGoogleProjection(osmOverlay, map);
            return(osmOverlay);
        }
        private void GisEditorWpfMap_Loaded(object sender, RoutedEventArgs e)
        {
            GisEditorWpfMap currentMap = (GisEditorWpfMap)sender;

            if (CheckForInternetAvailability())
            {
                DispatcherTimer timer = new DispatcherTimer(DispatcherPriority.Background);
                timer.Interval = TimeSpan.FromMilliseconds(200);
                timer.Tick    += (s, e1) =>
                {
                    timer.Stop();
                    switch (Singleton <ContentSetting> .Instance.DefaultBaseMapOption)
                    {
                    case DefaultBaseMap.WorldMapKit:
                        BaseMapsHelper.AddWorldMapKitOverlay(currentMap);
                        GisEditor.UIManager.BeginRefreshPlugins();
                        break;

                    case DefaultBaseMap.OpenStreetMaps:
                        BaseMapsHelper.AddOpenStreetMapOverlay(currentMap);
                        GisEditor.UIManager.BeginRefreshPlugins();
                        break;

                    case DefaultBaseMap.BingMaps:
                        BaseMapsHelper.AddBingMapsOverlay(currentMap);
                        GisEditor.UIManager.BeginRefreshPlugins();
                        break;

                    case DefaultBaseMap.None:
                    default:
                        break;
                    }
                };
                timer.Start();
            }
            currentMap.Loaded -= GisEditorWpfMap_Loaded;
        }
 protected override void LoadCore()
 {
     BaseMapsHelper.AddOpenStreetMapOverlay(GisEditor.ActiveMap);
     GisEditor.UIManager.BeginRefreshPlugins(new RefreshArgs(this, RefreshArgsDescription.LoadCoreDescription));
 }
Esempio n. 6
0
 private static void osmLayer_DrawingException(object sender, DrawingExceptionLayerEventArgs e)
 {
     BaseMapsHelper.RaiseDrawingException <OpenStreetMapLayer>("OpenStreetMap", sender, e);
 }
Esempio n. 7
0
 private static void BingMapsLayer_DrawingException(object sender, DrawingExceptionLayerEventArgs e)
 {
     BaseMapsHelper.RaiseDrawingException <BingMapsLayer>("Bing Map", sender, e);
 }
Esempio n. 8
0
 private static void WorldMapKitLayer_DrawingException(object sender, DrawingExceptionLayerEventArgs e)
 {
     BaseMapsHelper.RaiseDrawingException <WorldMapKitLayer>("World Map Kit", sender, e);
 }