コード例 #1
0
 protected override void RefreshCore(GisEditorWpfMap currentMap, RefreshArgs refreshArgs)
 {
     base.RefreshCore(currentMap, refreshArgs);
     viewModel.SyncUIState();
     viewModel.SyncStylePreview();
     viewModel.Refresh();
 }
コード例 #2
0
        private void UpdateItems(GisEditorWpfMap map)
        {
            LegendImporterItems.Clear();
            var featureLayers = map.GetFeatureLayers(true);

            foreach (var featureLayer in featureLayers)
            {
                LegendImporterItems.Add(GenerateLayerItem(featureLayer));
                if (featureLayer.ZoomLevelSet.CustomZoomLevels.Count > 0)
                {
                    var featureLayerListItem = GisEditor.LayerManager.GetLayerListItem(featureLayer);
                    if (featureLayerListItem != null)
                    {
                        if (featureLayerListItem.Load != null)
                        {
                            featureLayerListItem.Load();
                            featureLayerListItem.Load = null;
                        }
                        foreach (var ComponentStyle in featureLayerListItem.Children)
                        {
                            if (ComponentStyle.Children.Count > 1)
                            {
                                LegendImporterItems.Add(GenerateComponentSytleItem(ComponentStyle));

                                GenerateImporterItems(ComponentStyle, LegendImporterItems, 2);
                            }
                            else
                            {
                                GenerateImporterItems(ComponentStyle, LegendImporterItems, 1);
                            }
                        }
                    }
                }
            }
        }
コード例 #3
0
        private static void AddOverlayInGoogleProjection(TileOverlay baseOverlay, GisEditorWpfMap map)
        {
            var    extendedMap            = map;
            string targetProj4            = Proj4Projection.GetGoogleMapParametersString();
            string sourceProj4            = extendedMap.DisplayProjectionParameters;
            var    showConfirmationResult = System.Windows.Forms.DialogResult.Yes;

            if (ManagedProj4ProjectionExtension.CanProject(targetProj4, sourceProj4) && map.Overlays.Count > 0)
            {
                showConfirmationResult = System.Windows.Forms.MessageBox.Show(GisEditor.LanguageManager.GetStringResource("DataRepositoryChangeProjectionWarningLabel"), GisEditor.LanguageManager.GetStringResource("DataRepositoryProjectionWarningCaption"), System.Windows.Forms.MessageBoxButtons.YesNo);
            }

            if (showConfirmationResult == System.Windows.Forms.DialogResult.Yes)
            {
                RemoveAllBaseOverlays(map);
                extendedMap.Overlays.Insert(0, baseOverlay);
                extendedMap.DisplayProjectionParameters = targetProj4;

                //extendedMap.ReprojectMap(targetProj4);
                SetExtent(map);
                if (map.MapUnit != GeographyUnit.Meter)
                {
                    map.MapUnit = GeographyUnit.Meter;
                }
                extendedMap.Refresh(new Overlay[] { baseOverlay, extendedMap.ExtentOverlay });
            }
        }
コード例 #4
0
        //private MenuItem GetRelateMenuItem(FeatureLayer featureLayer)
        //{
        //    MenuItem rootMenuItem = new MenuItem();
        //    rootMenuItem.Header = GisEditor.LanguageManager.GetStringResource("LayerListUIPluginRelateText");
        //    rootMenuItem.Icon = new Image() { Source = new BitmapImage(new Uri("/GisEditorPluginCore;component/Images/relation.png", UriKind.RelativeOrAbsolute)), Width = 16, Height = 16 };
        //    rootMenuItem.Click += new RoutedEventHandler(RelateMenuItem_Click);
        //    rootMenuItem.Tag = featureLayer;

        //    PluginHelper.ApplyReadonlyMode(rootMenuItem);
        //    return rootMenuItem;
        //}

        //private void RelateMenuItem_Click(object sender, RoutedEventArgs e)
        //{
        //    MenuItem menuItem = (MenuItem)sender;
        //    FeatureLayer sourceFeatureLayer = (FeatureLayer)menuItem.Tag;

        //    LinkSourceWindow window = new LinkSourceWindow(sourceFeatureLayer);
        //    window.Owner = Application.Current.MainWindow;
        //    window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
        //    if (window.ShowDialog().GetValueOrDefault())
        //    {
        //        LinkSourceItem resultItem = window.ResultLinkSource;
        //        sourceFeatureLayer.FeatureSource.LinkSources.Clear();
        //        sourceFeatureLayer.FeatureSource.LinkExpressions.Clear();
        //        ApplyLinkSourceItems(sourceFeatureLayer, resultItem.LinkSourceItems);
        //        sourceFeatureLayer.FeatureSource.RefreshColumns();
        //        GisEditor.ActiveMap.RefreshActiveOverlay();
        //        GisEditor.ActiveMap.Refresh();
        //    }
        //}

        //private void ApplyLinkSourceItems(FeatureLayer featureLayer, Collection<LinkSourceItem> linkSourceItems)
        //{
        //    LinkSource linkSource = new LinkSource();
        //    FillLinkSource(linkSource, linkSourceItems);

        //    foreach (var item in linkSource.LinkSources)
        //    {
        //        featureLayer.FeatureSource.LinkSources.Add(item);
        //    }

        //    foreach (var item in linkSource.LinkExpressions)
        //    {
        //        if (item.Split(new[] { featureLayer.Name }, StringSplitOptions.RemoveEmptyEntries).Length >= 2)
        //        {
        //            string[] results = item.Split('.');
        //            if (results.Length == 3)
        //            {
        //                string expressions = "feature";
        //                foreach (var result in results.Skip(1))
        //                {
        //                    expressions += "." + result;
        //                }
        //                featureLayer.FeatureSource.LinkExpressions.Add(expressions);
        //            }
        //            else
        //            {
        //                string expressions = item.Replace(featureLayer.Name, "feature");
        //                featureLayer.FeatureSource.LinkExpressions.Add(expressions);
        //            }
        //        }
        //        else
        //        {
        //            string expressions = item.Replace(featureLayer.Name, "feature");
        //            featureLayer.FeatureSource.LinkExpressions.Add(expressions);
        //        }
        //    }
        //}

        //private void FillLinkSource(LinkSource linkSource, Collection<LinkSourceItem> linkSourceItems)
        //{
        //    foreach (var item in linkSourceItems)
        //    {
        //        LinkSourcePlugin plugin = LinkSourcePluginManager.Instance.GetLinkSourcePlugin(item.Source.GetType());
        //        LinkSource newlinkSource = plugin.GetLinkSource(item);
        //        linkSource.LinkSources.Add(newlinkSource);
        //        linkSource.LinkExpressions.Add(item.LinkExpression);
        //        if (item.LinkSourceItems.Count > 0)
        //        {
        //            FillLinkSource(newlinkSource, item.LinkSourceItems);
        //        }
        //    }
        //}

        protected override void RefreshCore(GisEditorWpfMap currentMap, RefreshArgs refreshArgs)
        {
            // RefreshInternal(currentMap, refreshArgs);
            if (dispatcherTimer == null)
            {
                dispatcherTimer          = new DispatcherTimer();
                dispatcherTimer.Interval = TimeSpan.FromMilliseconds(200);
                dispatcherTimer.Tick    += (s, e) =>
                {
                    DispatcherTimer currentTimer = (DispatcherTimer)s;
                    currentTimer.Stop();

                    Tuple <GisEditorWpfMap, RefreshArgs> currentTimerTag = currentTimer.Tag as Tuple <GisEditorWpfMap, RefreshArgs>;
                    RefreshInternal(currentTimerTag.Item1, currentTimerTag.Item2);
                };
            }

            if (dispatcherTimer.IsEnabled)
            {
                dispatcherTimer.Stop();
            }

            Tuple <GisEditorWpfMap, RefreshArgs> timerTag = new Tuple <GisEditorWpfMap, RefreshArgs>(currentMap, refreshArgs);

            dispatcherTimer.Tag = timerTag;
            dispatcherTimer.Start();
        }
コード例 #5
0
        private void FixBaseMapsCacheIssue(GisEditorWpfMap wpfMap)
        {
            Type[] baseOverlayTypes = new Type[]
            {
                typeof(WorldMapKitMapOverlay),
                typeof(BingMapsOverlay),
                typeof(OpenStreetMapOverlay)
            };

            wpfMap.Overlays.ForEach(o =>
            {
                if (o is WorldMapKitMapOverlay)
                {
                    ((WorldMapKitMapOverlay)o).RefreshCache();
                }
                else if (o is BingMapsOverlay)
                {
                    ((BingMapsOverlay)o).RefreshCache();
                }
                else if (o is OpenStreetMapOverlay)
                {
                    ((OpenStreetMapOverlay)o).RefreshCache();
                }
            });
        }
コード例 #6
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);
        }
コード例 #7
0
        protected override void ExportCore(GisEditorWpfMap map)
        {
            Bitmap bitmap = map.GetBitmap((int)map.ActualWidth, (int)map.ActualHeight, MapResizeMode.PreserveScaleAndCenter);

            SaveFileDialog saveFileDialog = new SaveFileDialog {
                Filter = "PNG files|*.png|PNG with PGW files|*.png"
            };

            if (saveFileDialog.ShowDialog(Application.Current.MainWindow).GetValueOrDefault())
            {
                bitmap.Save(saveFileDialog.FileName, System.Drawing.Imaging.ImageFormat.Png);
                if (saveFileDialog.FilterIndex == 2)
                {
                    string fileName = Path.ChangeExtension(saveFileDialog.FileName, ".pgw");
                    Collection <string> contents  = new Collection <string>();
                    WorldFile           worldFile = new WorldFile(map.CurrentExtent, (float)map.ActualWidth, (float)map.ActualHeight);
                    contents.Add(worldFile.HorizontalResolution.ToString(CultureInfo.InvariantCulture));
                    contents.Add(worldFile.RotationRow.ToString(CultureInfo.InvariantCulture));
                    contents.Add(worldFile.RotationColumn.ToString(CultureInfo.InvariantCulture));
                    contents.Add(worldFile.VerticalResolution.ToString(CultureInfo.InvariantCulture));
                    contents.Add(worldFile.UpperLeftX.ToString(CultureInfo.InvariantCulture));
                    contents.Add(worldFile.UpperLeftY.ToString(CultureInfo.InvariantCulture));
                    File.WriteAllLines(fileName, contents);
                }
            }
        }
 public void Synchronize(GisEditorWpfMap wpfMap, RefreshArgs synchronizeArgs)
 {
     RemoveConditionsLayerNotExist(wpfMap);
     SynchronizeTargetLayersComboBox(synchronizeArgs);
     SynchronizeSpatialQueryMode();
     SynchronizeButtonStatus();
 }
コード例 #9
0
        public static void SetZoomLevel(ZoomLevelSet zoomLevelSet, GisEditorWpfMap map)
        {
            zoomLevelSet.AddZoomLevels();
            map.ZoomLevelSet = zoomLevelSet;

            //the following line of code sets the zoom levels back to normal, if the Open Street Map was in the map previously.
            map.MinimumScale = map.ZoomLevelSet.GetZoomLevels().LastOrDefault().Scale;
        }
コード例 #10
0
        protected override void RefreshCore(GisEditorWpfMap currentMap, RefreshArgs refreshArgs)
        {
            measureGroup.SynchronizeState(currentMap);
            MeasureTrackInteractiveOverlay measurementOverlay = null;

            if (GisEditor.ActiveMap != null && GisEditor.ActiveMap.InteractiveOverlays.Contains("MeasurementOverlay"))
            {
                measurementOverlay = GisEditor.ActiveMap.InteractiveOverlays["MeasurementOverlay"] as MeasureTrackInteractiveOverlay;
                if (measurementOverlay != null)
                {
                    RenderMode renderMode = MeasureSetting.Instance.UseGdiPlusInsteadOfDrawingVisual ? RenderMode.GdiPlus : RenderMode.DrawingVisual;
                    if (measurementOverlay.RenderMode != renderMode)
                    {
                        measurementOverlay.RenderMode = renderMode;
                    }
                    switch (measurementOverlay.TrackMode)
                    {
                    case TrackMode.Point:
                        GisEditor.ActiveMap.Cursor = GisEditorCursors.DrawPoint;
                        break;

                    case TrackMode.Rectangle:
                        GisEditor.ActiveMap.Cursor = GisEditorCursors.DrawRectangle;
                        break;

                    case TrackMode.Square:
                        GisEditor.ActiveMap.Cursor = GisEditorCursors.DrawSqure;
                        break;

                    case TrackMode.Ellipse:
                        GisEditor.ActiveMap.Cursor = GisEditorCursors.DrawEllipse;
                        break;

                    case TrackMode.Circle:
                        GisEditor.ActiveMap.Cursor = GisEditorCursors.DrawCircle;
                        break;

                    case TrackMode.Polygon:
                        GisEditor.ActiveMap.Cursor = GisEditorCursors.DrawPolygon;
                        break;

                    case TrackMode.Line:
                        GisEditor.ActiveMap.Cursor = GisEditorCursors.DrawLine;
                        break;

                    case TrackMode.Custom:
                        GisEditor.ActiveMap.Cursor = GisEditorCursors.Normal;
                        break;
                    }

                    if (measurementOverlay.MeasureCustomeMode == MeasureCustomeMode.Move &&
                        measurementOverlay.TrackMode == TrackMode.Custom)
                    {
                        GisEditor.ActiveMap.Cursor = GisEditorCursors.Cross;
                    }
                }
            }
        }
コード例 #11
0
        protected override void AttachMapCore(GisEditorWpfMap wpfMap)
        {
            base.AttachMapCore(wpfMap);
            InitializeMap(wpfMap);
            FixBaseMapsCacheIssue(wpfMap);
            option.SetPanZoomBarVisiable(wpfMap);

            this.LayerPluginDropDownOpened += UIPlugin_LayerPluginDropDownOpened;
        }
コード例 #12
0
        public void SetPanZoomBarVisiable(GisEditorWpfMap map)
        {
            var panZoomBar = map.MapTools.OfType <SwitcherPanZoomBarMapTool>().FirstOrDefault();

            if (panZoomBar != null)
            {
                panZoomBar.IsEnabled = showPanZoomBar;
            }
        }
コード例 #13
0
        private Feature FindFeatureByPoint(double x, double y)
        {
            Feature result = null;

            IEnumerable <FeatureLayer> allFeatureLayers = null;
            string currentProj4 = String.Empty;

            if (ParentMap != null)
            {
                allFeatureLayers = ParentMap.GetFeatureLayers(true).Reverse();
                currentProj4     = ParentMap.DisplayProjectionParameters;
            }
            else
            {
                allFeatureLayers = new Collection <FeatureLayer>();
            }

            GeographyUnit currentUnit = GeographyUnit.DecimalDegree;

            if (!string.IsNullOrEmpty(currentProj4))
            {
                currentUnit = GisEditorWpfMap.GetGeographyUnit(currentProj4);
            }

            foreach (var featureLayer in allFeatureLayers)
            {
                Collection <Feature> featuresInDistance = null;
                featureLayer.SafeProcess(() =>
                {
                    featuresInDistance = AscendingSearch(x, y, currentUnit, featureLayer, 1, 20);
                });
                //featureLayer.Open();
                //var featuresInDistance = AscendingSearch(x, y, currentUnit, featureLayer, 1, 20);
                //featureLayer.Close();

                if (featuresInDistance != null && featuresInDistance.Count > 0)
                {
                    if (featuresInDistance.Count > 1)
                    {
                        result = featuresInDistance[0];
                        for (int i = 0; i < featuresInDistance.Count - 1; i++)
                        {
                            result = result.GetIntersection(featuresInDistance[i + 1]);
                        }
                    }
                    else
                    {
                        result = featuresInDistance[0];
                    }
                    result.Tag = Convert.ToBase64String(result.GetWellKnownBinary());
                    break;
                }
            }

            return(result);
        }
コード例 #14
0
 protected override void RefreshCore(GisEditorWpfMap currentMap, RefreshArgs refreshArgs)
 {
     if (!(refreshArgs != null && refreshArgs.Description.Equals(RefreshArgsDescription.EditLayerChangedDescription)))
     {
         base.RefreshCore(currentMap, refreshArgs);
         EditingToolsViewModel.Instance.Refresh(currentMap);
         snappingToolsRibbonGroup.ViewModel.EditOverlay = EditingToolsViewModel.Instance.EditOverlay;
         snappingToolsRibbonGroup.ViewModel.Refresh(currentMap);
     }
 }
コード例 #15
0
        protected override void RefreshCore(GisEditorWpfMap currentMap, RefreshArgs refreshArgs)
        {
            base.RefreshCore(currentMap, refreshArgs);
            if (lastMap != currentMap && bookmarkGroup != null)
            {
                ((BookmarkRibbonGroupViewModel)bookmarkGroup.DataContext).SyncBookmarkMenuItems();
            }

            lastMap = currentMap;
        }
コード例 #16
0
        private static void ChangeAllLayersZoomLevelSet(GisEditorWpfMap map, IEnumerable <ZoomLevel> zoomLevels)
        {
            var zoomLevelSet = new ZoomLevelSet();

            map.ZoomLevelSet.CustomZoomLevels.Clear();
            foreach (var item in zoomLevels)
            {
                zoomLevelSet.CustomZoomLevels.Add(item);
            }
            map.ZoomLevelSet = zoomLevelSet;
            map.MinimumScale = map.ZoomLevelSet.CustomZoomLevels.LastOrDefault().Scale;
            var allFeatureLayers = map.GetFeatureLayers();

            foreach (var featureLayer in allFeatureLayers)
            {
                var originalZoomLevels = featureLayer.ZoomLevelSet.CustomZoomLevels.ToList();
                featureLayer.ZoomLevelSet.CustomZoomLevels.Clear();
                foreach (var item in zoomLevels)
                {
                    var       max          = item.Scale * 2;
                    var       min          = item.Scale * 0.5;
                    ZoomLevel newZoomLevel = null;
                    if (item is PreciseZoomLevel)
                    {
                        newZoomLevel = new PreciseZoomLevel(item.Scale);
                    }
                    else
                    {
                        newZoomLevel = new ZoomLevel(item.Scale);
                    }
                    foreach (var style in item.CustomStyles)
                    {
                        newZoomLevel.CustomStyles.Add(style);
                    }

                    var styles = originalZoomLevels.Where(z => z.Scale <max && z.Scale> min).SelectMany(z => z.CustomStyles);
                    foreach (var style in styles)
                    {
                        if (!newZoomLevel.CustomStyles.Contains(style))
                        {
                            newZoomLevel.CustomStyles.Add(style);
                        }
                    }
                    featureLayer.ZoomLevelSet.CustomZoomLevels.Add(newZoomLevel);
                }
            }
            foreach (var layerOverlay in GisEditor.ActiveMap.Overlays.OfType <LayerOverlay>())
            {
                if (layerOverlay.MapArguments != null)
                {
                    // layerOverlay.Refresh();
                    layerOverlay.RefreshWithBufferSettings();
                }
            }
        }
コード例 #17
0
        private static void RemoveAllBaseOverlays(GisEditorWpfMap map)
        {
            var baseOverlays = map.Overlays.Where(o => o is WorldMapKitMapOverlay ||
                                                  o is OpenStreetMapOverlay ||
                                                  o is BingMapsOverlay).ToArray();

            foreach (var overlay in baseOverlays)
            {
                map.Overlays.Remove(overlay);
            }
        }
コード例 #18
0
        protected override void DetachMapCore(GisEditorWpfMap wpfMap)
        {
            base.DetachMapCore(wpfMap);
            if (initializedMaps.Contains(wpfMap))
            {
                wpfMap.Drop -= Map_Drop;
                initializedMaps.Remove(wpfMap);
            }

            this.LayerPluginDropDownOpened -= UIPlugin_LayerPluginDropDownOpened;
        }
コード例 #19
0
        public DataViewerViewModel(GisEditorWpfMap map, IEnumerable <FeatureLayer> availableLayers, FeatureLayer selectedLayer, bool showSelectedFeatures, bool allowEdit, IDictionary <FeatureLayer, Collection <string> > linkColumnNames)
        {
            enableColumnVirtualization = true;
            this.map                  = map;
            CurrentDataTable          = new DataTable();
            queryConditions           = new Collection <QueryConditionViewModel>();
            editDataChanges           = new ObservableCollection <EditDataChange>();
            HightLightRowColor        = DataViewerHelper.GetHightlightLayerColor();
            this.showSelectedFeatures = showSelectedFeatures;
            changedLayers             = new Collection <FeatureLayer>();
            AllowEdit                 = allowEdit;
            if (availableLayers != null && availableLayers.Count() > 0)
            {
                allLayerAdapters = new ObservableCollection <FeatureLayerAdapter>();

                foreach (var item in availableLayers)
                {
                    Collection <string> tempUriColumnNames = new Collection <string>();
                    if (linkColumnNames.ContainsKey(item))
                    {
                        tempUriColumnNames = linkColumnNames[item];
                    }
                    FeatureLayerPlugin featureLayerPlugin = GisEditor.LayerManager.GetLayerPlugins(item.GetType()).OfType <FeatureLayerPlugin>().FirstOrDefault();
                    if (featureLayerPlugin != null)
                    {
                        bool isEfficient = featureLayerPlugin.CanPageFeaturesEfficiently;
                        if (isEfficient)
                        {
                            PagedFeatureLayerAdapter shapeFileFeatureLayerDataAdapter = new PagedFeatureLayerAdapter(item, tempUriColumnNames);
                            shapeFileFeatureLayerDataAdapter.IsLinkDataSourceEnabled = !allowEdit;
                            shapeFileFeatureLayerDataAdapter.LoadingData            += new EventHandler <ProgressChangedEventArgs>(shapeFileFeatureLayerDataAdapter_LoadingData);
                            allLayerAdapters.Add(shapeFileFeatureLayerDataAdapter);
                        }
                        else
                        {
                            FeatureLayerAdapter featureLayerAdapter = new FeatureLayerAdapter(item, tempUriColumnNames);
                            allLayerAdapters.Add(featureLayerAdapter);
                        }
                    }
                }
                if (selectedLayer != null && availableLayers.Contains(selectedLayer))
                {
                    SelectedLayerAdapter = allLayerAdapters.Where(adapter => adapter.FeatureLayer == selectedLayer).FirstOrDefault();
                }
                else if (availableLayers.Contains(map.ActiveLayer))
                {
                    SelectedLayerAdapter = allLayerAdapters.Where(adapter => adapter.FeatureLayer == map.ActiveLayer).FirstOrDefault();
                }
                else
                {
                    SelectedLayerAdapter = allLayerAdapters.FirstOrDefault();
                }
            }
        }
コード例 #20
0
 /// <summary>
 /// Detaches the map.
 /// </summary>
 /// <param name="wpfMap">The WPF map.</param>
 public void DetachMap(GisEditorWpfMap wpfMap)
 {
     try
     {
         DetachMapCore(wpfMap);
     }
     catch (TypeLoadException ex)
     {
         HandleTypeLoadException(ex);
     }
 }
コード例 #21
0
 /// <summary>
 /// Gets the root layer list item core.
 /// </summary>
 /// <param name="wpfMap">The WPF map.</param>
 /// <returns></returns>
 protected virtual LayerListItem GetRootLayerListItemCore(GisEditorWpfMap wpfMap)
 {
     if (wpfMap != null)
     {
         return(GetLayerListItemForMap(wpfMap));
     }
     else
     {
         return(null);
     }
 }
コード例 #22
0
 private void DocumentWindows_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add && Singleton <ContentSetting> .Instance.DefaultBaseMapOption != DefaultBaseMap.None)
     {
         GisEditorWpfMap gisEditorWpfMap = e.NewItems.OfType <DocumentWindow>().Select(d => d.Content).FirstOrDefault() as GisEditorWpfMap;
         if (gisEditorWpfMap != null)
         {
             gisEditorWpfMap.Loaded -= GisEditorWpfMap_Loaded;
             gisEditorWpfMap.Loaded += GisEditorWpfMap_Loaded;
         }
     }
 }
コード例 #23
0
 protected override void RefreshCore(GisEditorWpfMap currentMap, RefreshArgs refreshArgs)
 {
     base.RefreshCore(currentMap, refreshArgs);
     if (currentMap != null)
     {
         if (previousMap != currentMap)
         {
             viewGroup.viewModel.SelectedBackground = currentMap.BackgroundOverlay.BackgroundBrush;
             previousMap = currentMap;
         }
     }
 }
コード例 #24
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);
 }
コード例 #25
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);
        }
コード例 #26
0
        protected override void RefreshCore(GisEditorWpfMap currentMap, RefreshArgs refreshArgs)
        {
            var allFeatureLayers      = GisEditor.ActiveMap.GetFeatureLayers(true);
            var featureLayersToRemove = GisEditor.ActiveMap.SelectionOverlay.FilteredLayers.Where(l => !allFeatureLayers.Contains(l)).ToList();

            foreach (var item in featureLayersToRemove)
            {
                GisEditor.ActiveMap.SelectionOverlay.FilteredLayers.Remove(item);
            }

            selectionAndQueryingGroup.Synchronize(currentMap, refreshArgs);
            CommandHelper.CloseFindFeaturesWindow();
        }
コード例 #27
0
        protected override void RefreshCore(GisEditorWpfMap currentMap, RefreshArgs refreshArgs)
        {
            foreach (var map in GisEditor.GetMaps())
            {
                foreach (var overlay in map.Overlays.OfType <TileOverlay>())
                {
                    overlay.DrawingException -= Overlay_DrawingException;
                    overlay.DrawingException += Overlay_DrawingException;
                }
            }

            base.RefreshCore(currentMap, refreshArgs);
        }
コード例 #28
0
        protected override void RefreshCore(GisEditorWpfMap currentMap, RefreshArgs refreshArgs)
        {
            if (lastMap != null && lastMap != currentMap)
            {
                var boundingBoxSelectTool = lastMap.MapTools.OfType <BoundingBoxSelectorMapTool>().FirstOrDefault();
                if (boundingBoxSelectTool != null)
                {
                    lastMap.MapTools.Remove(boundingBoxSelectTool);
                    currentMap.MapTools.Add(boundingBoxSelectTool);
                }
            }

            lastMap = currentMap;
        }
コード例 #29
0
 protected override void DetachMapCore(GisEditorWpfMap wpfMap)
 {
     base.DetachMapCore(wpfMap);
     if (wpfMap.SelectionOverlay.TrackMode != TrackMode.None)
     {
         wpfMap.SelectionOverlay.TrackMode = TrackMode.None;
         wpfMap.Cursor = System.Windows.Input.Cursors.Arrow;
     }
     wpfMap.SelectionOverlay.HighlightFeatureLayer.InternalFeatures.Clear();
     wpfMap.SelectionOverlay.HighlightFeatureLayer.BuildIndex();
     wpfMap.SelectionOverlay.Refresh();
     wpfMap.SelectionOverlay.FeatureSelected -= new EventHandler <EventArgs>(SelectionOverlay_FeatureSelected);
     wpfMap.SelectionOverlay.HighlightFeatureLayer.InternalFeatures.CollectionChanged -= new NotifyCollectionChangedEventHandler(InternalFeatures_CollectionChanged);
 }
コード例 #30
0
        protected override void DetachMapCore(GisEditorWpfMap wpfMap)
        {
            base.DetachMapCore(wpfMap);

            //viewModel.IsAddingText = false;
            wpfMap.ExtentOverlay.MapMouseClick -= MarkerHelper.ActiveMap_MapClick;
            wpfMap.ExtentOverlay.MapMouseClick -= AnnotationHelper.ActiveMap_MapClick;
            var switcher = wpfMap.MapTools.OfType <SwitcherPanZoomBarMapTool>().FirstOrDefault();

            if (switcher != null)
            {
                switcher.SwitcherModeChanged -= SwitcherModeChanged;
            }
        }