Beispiel #1
0
        //시설물편집창
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            EditWinView view = new EditWinView();

            if (view.ShowDialog() is bool)
            {
                //재조회
                mapControl.Refresh();

                //심볼초기화
                CmmObj.InitUniqueValueRendererObj();
            }
        }
Beispiel #2
0
        public MapMainViewModel()
        {
            //string licenseKey = "runtimelite,1000,rud1244207246,none,9TJC7XLS1MJPF5KHT033"; //그린텍
            //string licenseKey = "runtimelite,1000,rud9177830334,none,A3E60RFLTFM5NERL1040"; //kyun0828 free

            //ArcGISRuntimeEnvironment.SetLicense(licenseKey);


            loadedCmd = new RelayCommand <object>(delegate(object obj)
            {
                //뷰객체를 파라미터로 전달받기
                System.Windows.Controls.Grid divGrid = obj as System.Windows.Controls.Grid;

                this.mapView     = divGrid.FindName("mapView") as MapView;
                this.divLayer    = divGrid.FindName("divLayer") as Popup;
                this.ClearButton = divGrid.FindName("ClearButton") as Button;


                //지도초기화
                InitMap();


                //시설물레이어DIV 초기화작업
                InitDivLayer();

                CmmRun.InitUniqueValueRenderer();//렌더러초기생성작업


                //비트맵초기화(시설물상세DIV 아이콘)
                BitImg = new BitmapImage();

                //ShowShapeLayer(mapView, "BML_GADM_AS", true);
            });


            //레이어 ON/OFF
            chkCmd = new RelayCommand <object>(delegate(object obj)
            {
                Button doc = obj as Button;
                //IEnumerable<CheckBox> collection = doc.Children.OfType<CheckBox>();
                //CheckBox chkbox = collection.First();

                CheckBox chkbox = doc.Template.FindName("chkLayer", doc) as CheckBox;
                bool chk        = (bool)chkbox.IsChecked;

                ShowLocalServerLayer(mapView, doc.Tag.ToString(), chk);
                //ShowShapeLayer(mapView, doc.Tag.ToString(), chk);


                //선택된 레이어저장
                try
                {
                    if (chk)
                    {
                        _selectedLayerNms.Add(doc.Tag.ToString());
                        _selectedLayerNm = doc.Tag.ToString();
                    }
                    else
                    {
                        _selectedLayerNms.Remove(doc.Tag.ToString());
                        _selectedLayerNm = _selectedLayerNms.LastOrDefault();
                    }
                }
                catch (Exception) { }
            });

            //팝업레이어 토글처리
            toggleCmd = new RelayCommand <object>(delegate(object obj)
            {
                StackPanel spLayer = divLayer.FindName("spLayer") as StackPanel;
                System.Windows.Controls.Grid gridTitle = divLayer.FindName("gridTitle") as System.Windows.Controls.Grid;

                spLayer.Visibility = spLayer.Visibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;

                if (spLayer.Visibility == Visibility.Collapsed)
                {
                    divLayer.Height = gridTitle.Height;
                }
                else
                {
                    divLayer.Height = gridTitle.Height + spLayer.Height;
                }
            });



            // 레이어스타일 Renderer 초기화 - shape방식에서만 사용함
            //InitUniqueValueRenderer();

            levelCmd = new RelayCommand <object>(delegate(object obj)
            {
                MessageBox.Show("MapScale - " + mapView.MapScale);
            });

            //GIS초기화
            resetCmd = new RelayCommand <object>(delegate(object obj)
            {
                //0.맵초기화
                InitMap();

                //1.로컬서버 재기동
                //Initialize_LocalServer();

                //2.레이어 클리어
                mapView.Map.OperationalLayers.Clear();


                //3.열여있는 시설물정보창 닫기
                popFct.IsOpen = false;

                TreeView treeLayer = obj as TreeView;

                //레이어div 체크해제
                foreach (CheckBox cb in FmsUtil.FindVisualChildren <CheckBox>(treeLayer))
                {
                    cb.IsChecked = false;
                }

                //선택된레이어 해제
                _selectedFeature = null;
                try
                {
                    CmmRun.layers[_selectedLayerNm].ClearSelection();
                }
                catch (Exception) { }
                _selectedLayerNms.Clear();
                _selectedLayerNm = "";


                // 행정구역 표시
                ShowLocalServerLayer(mapView, "BML_GADM_AS", true);
                //ShowShapeLayer(mapView, "BML_GADM_AS", true);
            });

            //시설물팝업에서 시설물메뉴화면 호출작업
            CallPageCmd = new RelayCommand <object>(delegate(object obj) {
                FctDtl fctDtl = obj as FctDtl;

                IRegionManager regionManager = FmsUtil.__regionManager;
                ViewsCollection views        = regionManager.Regions["ContentRegion"].ActiveViews as ViewsCollection;

                foreach (var v in views)
                {
                    MapArcObjView mapMainView = v as MapArcObjView;
                    //MainWinViewModel vm = ((System.Windows.Controls.Grid)((ContentControl)mapMainView.Parent).Parent).DataContext as MainWinViewModel;
                    break;
                }
            });

            //시설물편집창
            EditCmd = new RelayCommand <object>(delegate(object obj)
            {
                EditWinView view = new EditWinView();
                if (view.ShowDialog() is bool)
                {
                    //재조회
                }
            });



            //도형클리어처리
            clearCmd = new RelayCommand <object>(delegate(object obj)
            {
                // Remove all graphics from the graphics overlay
                _sketchOverlay.Graphics.Clear();

                // Disable buttons that require graphics
                ClearButton.IsEnabled = false;
            });
            completeCmd = new RelayCommand <object>(async delegate(object obj)
            {
                mapView.SketchEditor.Stop();
                //추가된 도형 저장처리

                //_selectedFeature.Geometry = _geometry;
                // Apply the edit to the feature table.
                await _selectedFeature.FeatureTable.UpdateFeatureAsync(_selectedFeature);
                _selectedFeature.Refresh();
                MessageBox.Show("Added feature ", "Success!");
            });
        }