private void InitSelectableFeatureLayers()
        {
            featureLayers = new ObservableCollection <FeatureLayer>();

            if (GisEditor.ActiveMap != null)
            {
                var allFeatureLayers = GisEditor.ActiveMap.GetFeatureLayers(true).Where(layer =>
                {
                    if (layer is ShapeFileFeatureLayer)
                    {
                        ShapeFileFeatureLayerPlugin layerPlugin = new ShapeFileFeatureLayerPlugin();
                        var shapeType = layerPlugin.GetFeatureSimpleShapeType(layer);
                        if (shapeType == SimpleShapeType.Point)
                        {
                            return(false);
                        }
                    }

                    return(true);
                });

                foreach (var featureLayer in allFeatureLayers)
                {
                    FeatureLayers.Add(featureLayer);
                }
            }
        }
        /// <summary>
        /// レイヤーコンボボックスにレイヤーを格納します
        /// </summary>
        private void GetLayers()
        {
            // アクティブなマップビューを取得
            var mapView = MapView.Active;

            if (mapView == null)
            {
                return;
            }

            // コンボボックスに格納されているレイヤーをクリア
            FeatureLayers.Clear();
            RenderingLayers.Clear();

            // レイヤーコンボボックスにレイヤーを格納
            foreach (var featureLayer in mapView.Map.Layers.OfType <BasicFeatureLayer>())
            {
                FeatureLayers.Add(featureLayer);
            }

            // レンダリング タブのレイヤー コンボボックスにレイヤーを格納
            var renderingLayers = MapView.Active.Map.Layers.OfType <BasicFeatureLayer>().Where(f => f.GetType().Name != "AnnotationLayer");

            RenderingLayers.Clear();
            foreach (var renderingLayer in renderingLayers.Where(f => f.GetType().Name != "AnnotationLayer"))
            {
                RenderingLayers.Add(renderingLayer as FeatureLayer);
            }
        }
 /// <summary>
 /// レイヤーがマップに追加された場合に発生
 /// </summary>
 private void OnLayerAdded(LayerEventsArgs args)
 {
     // 追加したレイヤーをコンボボックスに追加
     foreach (var featureLayer in args.Layers.OfType <BasicFeatureLayer>().ToList())
     {
         FeatureLayers.Add(featureLayer);
     }
 }
Ejemplo n.º 4
0
        protected override void RunCore()
        {
            FeaturesToBlend = FeatureLayers.Select(f => f.FeatureSource).ToList();

            IEnumerable <Feature> features = GetFeaturesFromTempFile();

            BlendFeatures(features);
        }
 /// <summary>
 /// Clear out the configuration
 /// </summary>
 /// <param name="args"></param>
 private void OnProjectOpened(ProjectEventArgs args)
 {
     Maps.Clear();
     FeatureLayers.Clear();
     Fields.Clear();
     Prefix        = string.Empty;
     Suffix        = string.Empty;
     FileExtension = string.Empty;
     FileWorkspace = string.Empty;
 }
 private void OnActiveViewChanged(ActiveMapViewChangedEventArgs args)
 {
     if (!_mapViewNotInitialized)
     {
         return;
     }
     _mapViewNotInitialized = false;
     ChartResult            = new KeyValuePair <string, int> [0];
     FeatureLayers.Clear();
     GetFeatureLayers();
 }
 /// <summary>
 /// Clear out the configuration
 /// </summary>
 /// <param name="args"></param>
 private void OnProjectOpened(ProjectEventArgs args)
 {
     Maps.Clear();
     FeatureLayers.Clear();
     Fields.Clear();
     _FileList.Clear();
     Prefix            = string.Empty;
     Suffix            = string.Empty;
     FileExtension     = string.Empty;
     FileWorkspace     = string.Empty;
     FileLoadingMethod = EnumFileLoadingMethod.None;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Clear out the configuration
 /// </summary>
 /// <param name="args"></param>
 private void OnProjectOpened(ProjectEventArgs args)
 {
     Maps.Clear();
     FeatureLayers.Clear();
     Fields.Clear();
     _fileList.Clear();
     Prefix               = string.Empty;
     Suffix               = string.Empty;
     FileWorkspace        = string.Empty;
     DestinationWorkspace = string.Empty;
     FileCloningMethod    = EnumFileCloningMethod.None;
 }
        /// <summary>
        /// レイヤーがマップから削除された場合に発生
        /// </summary>
        private void OnLayerRemoved(LayerEventsArgs args)
        {
            // 削除したレイヤーをコンボボックスから削除
            foreach (var featureLayer in args.Layers.OfType <BasicFeatureLayer>().ToList())
            {
                if (_featureLayers.Contains(featureLayer))
                {
                    FeatureLayers.Remove(featureLayer);
                }
            }

            // DataGridをクリアして選択しているフィーチャを解除
            Clear();
        }
        private void OnActivePaneChanged(PaneEventArgs args)
        {
            // get new feature layer list
            SelectedFeatureDataTable = null;
            ChartResult = new KeyValuePair <string, int> [0];
            FeatureLayers.Clear();
            var mapView = MapView.Active;

            if (mapView == null)
            {
                _mapViewNotInitialized = true;
                return;
            }
            GetFeatureLayers();
        }
Ejemplo n.º 11
0
        private void InitSelectableFeatureLayers()
        {
            featureLayers = new ObservableCollection <FeatureLayer>();

            if (GisEditor.ActiveMap != null)
            {
                var selectionOverlay = GisEditor.SelectionManager.GetSelectionOverlay();
                var allFeatureLayers = from l in GisEditor.ActiveMap.GetFeatureLayers(true)
                                       where selectionOverlay == null ? false : selectionOverlay.HighlightFeatureLayer.InternalFeatures.Any(f => f.Tag == l)
                                       select l;

                foreach (var featureLayer in allFeatureLayers)
                {
                    FeatureLayers.Add(featureLayer);
                }
                SelectedFeatureLayer = FeatureLayers.FirstOrDefault();
            }
        }
        /// <summary>
        /// レイヤーコンボボックスにレイヤーを格納します
        /// </summary>
        private void GetLayers()
        {
            // アクティブなマップビューを取得
            var mapView = MapView.Active;

            if (mapView == null)
            {
                return;
            }

            // コンボボックスに格納されているレイヤーをクリア
            FeatureLayers.Clear();
            RenderingLayers.Clear();

            // ジオメトリ操作add
            PolygonAndLineLayers.Clear();
            // ジオメトリ操作add



            // レイヤーコンボボックスにレイヤーを格納
            foreach (var featureLayer in mapView.Map.Layers.OfType <BasicFeatureLayer>())
            {
                FeatureLayers.Add(featureLayer);
            }

            // レンダリング タブのレイヤー コンボボックスにレイヤーを格納
            var renderingLayers = MapView.Active.Map.Layers.OfType <BasicFeatureLayer>().Where(f => f.GetType().Name != "AnnotationLayer");

            RenderingLayers.Clear();
            foreach (var renderingLayer in renderingLayers.Where(f => f.GetType().Name != "AnnotationLayer"))
            {
                RenderingLayers.Add(renderingLayer as FeatureLayer);
            }

            // ジオメトリ変換:ポリゴン・ラインレイヤーのみをコンボボックスに格納
            var polygonAndLineLayers = mapView.Map.Layers.OfType <FeatureLayer>().Where(f => f.ShapeType == esriGeometryType.esriGeometryPolygon || f.ShapeType == esriGeometryType.esriGeometryPolyline);

            PolygonAndLineLayers.Clear();
            foreach (var polygonAndLineLayer in polygonAndLineLayers)
            {
                PolygonAndLineLayers.Add(polygonAndLineLayer);
            }
        }
Ejemplo n.º 13
0
        private async void GetFeatureLayers(MapView theMapView)
        {
            System.Diagnostics.Debug.WriteLine("GetFeatureLayers");
            if (theMapView == null)
            {
                System.Diagnostics.Debug.WriteLine("theMapView is null -> can't load any feature layers");
                return;
            }

            // get new feature layer list
            SelectedFeatureDataTable = null;
            FeatureLayers.Clear();
            await QueuedTask.Run(() =>
            {
                var featureLayers = theMapView.Map.Layers.OfType <FeatureLayer>();
                lock (_lockFeaturelayers)
                {
                    _featureLayers.Clear();
                    foreach (var featureLayer in featureLayers)
                    {
                        _featureLayers.Add(featureLayer);
                    }
                }
            }).ContinueWith(t =>
            {
                if (t.Exception != null)
                {
                    var aggException = t.Exception.Flatten();
                    var sb           = new StringBuilder();
                    foreach (var exception in aggException.InnerExceptions)
                    {
                        sb.AppendLine(exception.Message);
                    }
                    MessageBox.Show(sb.ToString(), "Error in GetFeatureLayers", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            });

            NotifyPropertyChanged(() => FeatureLayers);
            //var firstFeatureLayer = FeatureLayers.FirstOrDefault();
            //if (firstFeatureLayer != null) SelectedFeatureLayer = firstFeatureLayer;
        }