예제 #1
0
        /// <summary>
        /// 지도맵,레이어 초기화
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        private async Task <string> resetAction(object obj)
        {
            //0.맵의레이어 클리어
            mapControl.ClearLayers();
            mapControl.Refresh();


            //1.맵초기화
            initMap();

            //2.레이어초기화
            CmmObj.initLayers();

            //3.레이어스택 초기화
            sts.Clear();

            //4.행정구역표시
            ShowShapeLayer("BML_GADM_AS", true);



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

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

            return("ok");
        }
예제 #2
0
        public MapArcObjViewModel()
        {
            loadedCmd = new RelayCommand <object>(delegate(object obj)
            {
                //뷰객체를 파라미터로 전달받기
                mapArcObjView = obj as UserControl;

                mapHost     = mapArcObjView.FindName("mapHost") as WindowsFormsHost;
                toolbarHost = mapArcObjView.FindName("toolbarHost") as WindowsFormsHost;
                treeLayer   = mapArcObjView.FindName("treeLayer") as TreeView;

                mapControl     = mapHost.Child as AxMapControl;
                toolbarControl = toolbarHost.Child as AxToolbarControl;


                //0.맵 초기화
                initMap();

                //1.레이어초기화
                CmmObj.initLayers();

                //2.UniqueRenderer 초기화
                CmmObj.InitUniqueValueRendererObj();

                //3.행정구역경계표시
                ShowShapeLayer("BML_GADM_AS", true);


                //맵마우스클릭 이벤트설정
                mapControl.OnMouseUp += OnMouseClick;
            });


            //레이어 ON/OFF
            chkCmd = new RelayCommand <object>(delegate(object obj)
            {
                Button doc = obj as Button;

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


                //ShowShapeLayer( doc.Tag.ToString(), chk);
                ShowShapeLayer(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) { }
            });


            //GIS초기화
            resetCmd = new RelayCommand <object>(async delegate(object obj) {
                string stat = await resetAction(obj);
            });

            //SHP파일관리창
            importCmd = new RelayCommand <object>(async delegate(object obj) {
                ShpMngView view = new ShpMngView();
                if (view.ShowDialog() is bool)
                {
                    //재조회
                    string stat = await resetAction(null);
                }
            });
        }