예제 #1
0
        /// 조회
        private void InitModel()
        {
            ItemsSelect.Clear();
            ItemsFile.Clear();

            //저장된 shp파일 목록
            DirectoryInfo di = new DirectoryInfo(BizUtil.GetDataFolder("shape"));

            //foreach (FileInfo fi in di.GetFiles().Where(f=> f.Extension.Contains("shp") || f.Extension.Contains("dbf") || f.Extension.Contains("prj") || f.Extension.Contains("shx")))
            foreach (FileInfo fi in di.GetFiles().Where(f => f.Extension.Contains("shp")))
            {
                try
                {
                    FileDtl dtl = new FileDtl();
                    dtl.DWN_NAM = fi.Name;
                    dtl.FIL_TYP = fi.Extension.Replace(".", "");
                    dtl.FIL_SIZ = fi.Length.ToString();

                    //파일객체
                    ItemsSelect.Add(dtl);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }
예제 #2
0
        private async void InitMap()
        {
            //지도위치 및 스케일 초기화
            await mapView.SetViewpointCenterAsync(_ulsanCoords, _ulsanScale);

            //Base맵 초기화
            Console.WriteLine("this._map.SpatialReference - " + this._map.SpatialReference);
            //this._map.Basemap = Basemap.CreateOpenStreetMap();

            //타일맵
            TileCache        tileCache = new TileCache(BizUtil.GetDataFolder("tile", "korea.tpk"));
            ArcGISTiledLayer tileLayer = new ArcGISTiledLayer(tileCache);

            this._map.Basemap = new Basemap(tileLayer);


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


            //맵뷰 클릭이벤트 설정
            mapView.GeoViewTapped -= handlerGeoViewTappedMoveFeature;
            mapView.GeoViewTapped -= handlerGeoViewTappedAddFeature;
            mapView.GeoViewTapped -= handlerGeoViewTapped;
            mapView.GeoViewTapped += handlerGeoViewTapped;


            // Create graphics overlay to display sketch geometry
            _sketchOverlay = new GraphicsOverlay();
            mapView.GraphicsOverlays.Add(_sketchOverlay);
        }
예제 #3
0
        public async void Initialize_LocalServer()
        {
            try
            {
                // 1.LocalServer 모듈 시작...
                // LocalServer must not be running when setting the data path.
                if (LocalServer.Instance.Status == LocalServerStatus.Started)
                {
                    await LocalServer.Instance.StopAsync();
                }

                if (LocalServer.Instance.Status == LocalServerStatus.Stopped)
                {
                    // Set the local data path - must be done before starting. On most systems, this will be C:\EsriSamples\AppData.
                    // This path should be kept short to avoid Windows path length limitations.
                    string tempDataPathRoot = Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.Windows)).FullName;
                    string tempDataPath     = BizUtil.GetDataFolder("EsriLocalServer", "AppData");

                    Directory.CreateDirectory(tempDataPath); // CreateDirectory won't overwrite if it already exists.
                    LocalServer.Instance.AppDataPath = tempDataPath;

                    // Start the local server instance
                    await LocalServer.Instance.StartAsync();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("Please ensure that local server is installed prior to using the sample. See instructions in readme.md. Message: {0}", ex.Message), "Local Server failed to start");
                return;
            }


            // 2.서버상에 LocalFeatureService 서비스시작..
            // Load the sample data and get the path
            if (_localFeatureService == null)
            {
                string myfeatureServicePath = GetFeatureLayerPath();

                // Create the feature service to serve the local data
                _localFeatureService = new LocalFeatureService(myfeatureServicePath);
                //_localFeatureService.MaxRecords = 3000; //피처서비스 최대 표현레코드 수

                // Listen to feature service status changes
                _localFeatureService.StatusChanged += _localFeatureService_StatusChanged;

                // Start the feature service
                try
                {
                    await _localFeatureService.StartAsync();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "The feature service failed to load");
                }
            }
        }
예제 #4
0
        /// <summary>
        /// 물리적파일을 업로드한후, 파일테이블에 등록하고, _FIL_SEQ를 생성한다
        /// </summary>
        /// <returns></returns>
        private void UploadFileList()
        {
            // 1.shp 물리적파일 저장

            /// Items는 추가된 파일객체만이다
            foreach (FileInfo fi in ItemsFile)
            {
                string shp_file_path = Path.Combine(BizUtil.GetDataFolder("shape"), fi.Name);

                try
                {
                    // 1.shp파일 프로그램 위치에 저장
                    fi.CopyTo(shp_file_path, true);
                }
                catch (Exception ex)
                {
                    Messages.ShowErrMsgBox(ex.Message);
                }
            }
        }
예제 #5
0
        private async void InitMap()
        {
            //지도위치 및 스케일 초기화
            await mapView.SetViewpointCenterAsync(GisCmm.fmsCoords, GisCmm.fmsScale);

            //Base맵 초기화
            Console.WriteLine("this._map.SpatialReference - " + this._map.SpatialReference);
            //this._map.Basemap = Basemap.CreateOpenStreetMap();

            //타일맵
            TileCache        tileCache = new TileCache(BizUtil.GetDataFolder("tile", "korea.tpk"));
            ArcGISTiledLayer tileLayer = new ArcGISTiledLayer(tileCache);

            //this._map.Basemap = new Basemap(tileLayer);

            //WebTileLayer
            myBaseLayer = new WebTiledLayer(_templateUri3);
            Console.WriteLine(myBaseLayer.TemplateUri);

            //myBaseLayer = new WebTiledLayer(_templateUri2);
            //myBaseLayer = new WebTiledLayer(_templateUri2, myBaseLayer.TileInfo, myBaseLayer.FullExtent);

            Basemap layerBasemap = new Basemap(myBaseLayer);

            //myBaseLayer.Attribution = _attribution;
            this._map.Basemap = layerBasemap;



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


            //맵뷰 클릭이벤트 설정
            //mapView.GeoViewTapped -= handlerGeoViewTapped;
            mapView.GeoViewTapped += handlerGeoViewTapped;

            // Create graphics overlay to display sketch geometry
            _sketchOverlay = new GraphicsOverlay();
            mapView.GraphicsOverlays.Add(_sketchOverlay);
        }
예제 #6
0
        public async Task <ShapefileFeatureTable> InitLayerTable(string _layerNm)
        {
            string shapeNm = "";

            try
            {
                string[] ary = _layerNm.Split('^');
                shapeNm = ary[0]; //레이어테이블명


                string shapefilePath             = Path.Combine(BizUtil.GetDataFolder("shape", shapeNm + ".shp"));
                ShapefileFeatureTable layerTable = await ShapefileFeatureTable.OpenAsync(shapefilePath);

                return(layerTable);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(null);
            }
        }
예제 #7
0
        // 시설물정보팝업 보이기
        private void ShowFtrPop(string fTR_CDE, string fTR_IDN, GeoViewInputEventArgs e)
        {
            Hashtable param = new Hashtable();

            switch (fTR_CDE)
            {
            case "SA001":     //상수관로
                //팝업열기 & 위치
                popFct.IsOpen = false;

                popFct = new WTL_PIPE_LM();
                popFct.PlacementRectangle = new Rect(e.Position.X + 300, e.Position.Y - 200, 250, 300);
                popFct.IsOpen             = true;
                popFct.DataContext        = this;

                param = new Hashtable();
                param.Add("FTR_CDE", fTR_CDE);
                param.Add("FTR_IDN", fTR_IDN);
                param.Add("sqlId", "SelectWtlPipeDtl2");

                this.FctDtl = BizUtil.SelectObject(param) as CmmDtl;
                break;

            case "SA002":     //급수관로
                //팝업열기 & 위치
                popFct.IsOpen = false;

                popFct = new WTL_SPLY_LS();
                popFct.PlacementRectangle = new Rect(e.Position.X + 300, e.Position.Y - 200, 250, 300);
                popFct.IsOpen             = true;
                popFct.DataContext        = this;

                param = new Hashtable();
                param.Add("FTR_CDE", fTR_CDE);
                param.Add("FTR_IDN", fTR_IDN);
                param.Add("sqlId", "SelectSupDutDtl");

                this.FctDtl = BizUtil.SelectObject(param) as CmmDtl;
                break;

            case "SA003":     //스탠파이프
                //팝업열기 & 위치
                popFct.IsOpen = false;

                popFct = new WTL_STPI_PS();
                popFct.PlacementRectangle = new Rect(e.Position.X + 300, e.Position.Y - 200, 250, 300);
                popFct.IsOpen             = true;
                popFct.DataContext        = this;

                param = new Hashtable();
                param.Add("FTR_CDE", fTR_CDE);
                param.Add("FTR_IDN", fTR_IDN);
                param.Add("sqlId", "SelectStndPiDtl");

                this.FctDtl = BizUtil.SelectObject(param) as CmmDtl;
                break;

            case "SA100":     //상수맨홀
                //팝업열기 & 위치
                popFct.IsOpen = false;

                popFct = new WTL_MANH_PS();
                popFct.PlacementRectangle = new Rect(e.Position.X + 300, e.Position.Y - 200, 250, 300);
                popFct.IsOpen             = true;
                popFct.DataContext        = this;

                param = new Hashtable();
                param.Add("FTR_CDE", fTR_CDE);
                param.Add("FTR_IDN", fTR_IDN);
                param.Add("sqlId", "SelectWtsMnhoDtl");

                this.FctDtl = BizUtil.SelectObject(param) as CmmDtl;
                break;

            case "SA110":     //수원지
                //팝업열기 & 위치
                popFct.IsOpen = false;

                popFct = new WTL_HEAD_PS();
                popFct.PlacementRectangle = new Rect(e.Position.X + 300, e.Position.Y - 200, 250, 300);
                popFct.IsOpen             = true;
                popFct.DataContext        = this;

                param = new Hashtable();
                param.Add("FTR_CDE", fTR_CDE);
                param.Add("FTR_IDN", fTR_IDN);
                param.Add("sqlId", "SelectWtrSourDtl");

                this.FctDtl = BizUtil.SelectObject(param) as CmmDtl;
                break;

            case "SA112":     //취수장
                //팝업열기 & 위치
                popFct.IsOpen = false;

                popFct = new WTL_GAIN_PS();
                popFct.PlacementRectangle = new Rect(e.Position.X + 300, e.Position.Y - 200, 250, 300);
                popFct.IsOpen             = true;
                popFct.DataContext        = this;

                param = new Hashtable();
                param.Add("FTR_CDE", fTR_CDE);
                param.Add("FTR_IDN", fTR_IDN);
                param.Add("sqlId", "SelectIntkStDtl");

                this.FctDtl = BizUtil.SelectObject(param) as CmmDtl;
                break;

            case "SA113":     //정수장
                //팝업열기 & 위치
                popFct.IsOpen = false;

                popFct = new WTL_PURI_AS();
                popFct.PlacementRectangle = new Rect(e.Position.X + 300, e.Position.Y - 200, 250, 300);
                popFct.IsOpen             = true;
                popFct.DataContext        = this;

                param = new Hashtable();
                param.Add("FTR_CDE", fTR_CDE);
                param.Add("FTR_IDN", fTR_IDN);
                param.Add("sqlId", "SelectFiltPltDtl");

                this.FctDtl = BizUtil.SelectObject(param) as CmmDtl;
                break;

            case "SA114":     //배수지
                //팝업열기 & 위치
                popFct.IsOpen = false;

                popFct = new WTL_PIPE_LM();
                popFct.PlacementRectangle = new Rect(e.Position.X + 300, e.Position.Y - 200, 250, 300);
                popFct.IsOpen             = true;
                popFct.DataContext        = this;

                param = new Hashtable();
                param.Add("FTR_CDE", fTR_CDE);
                param.Add("FTR_IDN", fTR_IDN);
                param.Add("sqlId", "SelectWtrSupDtl");

                this.FctDtl = BizUtil.SelectObject(param) as CmmDtl;
                break;


            case "SA117":     //유량계
                //팝업열기 & 위치
                popFct.IsOpen = false;

                popFct = new WTL_FLOW_PS();
                popFct.PlacementRectangle = new Rect(e.Position.X + 300, e.Position.Y - 200, 250, 300);
                popFct.IsOpen             = true;
                popFct.DataContext        = this;

                param = new Hashtable();
                param.Add("FTR_CDE", fTR_CDE);
                param.Add("FTR_IDN", fTR_IDN);
                param.Add("sqlId", "SelectFlowMtDtl");

                this.FctDtl = BizUtil.SelectObject(param) as CmmDtl;

                break;

            case "SA118":
            case "SA119":                   //소화전,급수탑
                //팝업열기 & 위치
                popFct.IsOpen = false;

                popFct = new WTL_FIRE_PS();
                popFct.PlacementRectangle = new Rect(e.Position.X + 300, e.Position.Y - 200, 250, 300);
                popFct.IsOpen             = true;
                popFct.DataContext        = this;

                param = new Hashtable();
                param.Add("FTR_CDE", fTR_CDE);
                param.Add("FTR_IDN", fTR_IDN);
                param.Add("sqlId", "SelectFireFacDtl");

                this.FctDtl = BizUtil.SelectObject(param) as CmmDtl;

                break;


            case "SA120":     //저수조
                //팝업열기 & 위치
                popFct.IsOpen = false;

                popFct = new WTL_RSRV_PS();
                popFct.PlacementRectangle = new Rect(e.Position.X + 300, e.Position.Y - 200, 250, 300);
                popFct.IsOpen             = true;
                popFct.DataContext        = this;

                param = new Hashtable();
                param.Add("FTR_CDE", fTR_CDE);
                param.Add("FTR_IDN", fTR_IDN);
                param.Add("sqlId", "SelectWtrTrkDtl");

                this.FctDtl = BizUtil.SelectObject(param) as CmmDtl;
                break;


            case "SA121":     //수압계
                //팝업열기 & 위치
                popFct.IsOpen = false;

                popFct = new WTL_PRGA_PS();
                popFct.PlacementRectangle = new Rect(e.Position.X + 300, e.Position.Y - 200, 250, 300);
                popFct.IsOpen             = true;
                popFct.DataContext        = this;

                param = new Hashtable();
                param.Add("FTR_CDE", fTR_CDE);
                param.Add("FTR_IDN", fTR_IDN);
                param.Add("sqlId", "SelectWtprMtDtl");

                this.FctDtl = BizUtil.SelectObject(param) as CmmDtl;
                break;


            case "SA122":     //급수전계량기
                //팝업열기 & 위치
                popFct.IsOpen = false;

                popFct = new WTL_META_PS();
                popFct.PlacementRectangle = new Rect(e.Position.X + 300, e.Position.Y - 200, 250, 300);
                popFct.IsOpen             = true;
                popFct.DataContext        = this;

                param = new Hashtable();
                param.Add("FTR_CDE", fTR_CDE);
                param.Add("FTR_IDN", fTR_IDN);
                param.Add("sqlId", "SelectHydtMetrDtl");

                this.FctDtl = BizUtil.SelectObject(param) as CmmDtl;
                break;


            case "SA200":
            case "SA201":
            case "SA202":
            case "SA203":
            case "SA204":
            case "SA205":
            case "SA206":                                                                                         //변류시설
                //팝업열기 & 위치
                popFct.IsOpen = false;

                popFct = new WTL_VALV_PS();
                popFct.PlacementRectangle = new Rect(e.Position.X + 300, e.Position.Y - 200, 250, 300);
                popFct.IsOpen             = true;
                popFct.DataContext        = this;

                param = new Hashtable();
                param.Add("FTR_CDE", fTR_CDE);
                param.Add("FTR_IDN", fTR_IDN);
                param.Add("sqlId", "SelectValvFacDtl");

                this.FctDtl = BizUtil.SelectObject(param) as CmmDtl;
                break;

            default:
                break;
            }


            //아이콘이미지 설정
            //BitmapImage bi = new BitmapImage();
            //bi.BeginInit();
            //bi.UriSource = new Uri(Path.Combine(Path.Combine(BizUtil.GetDataFolder(), "style_img"), fTR_CDE), UriKind.Relative);
            //bi.EndInit();
            //BitImg = bi;
            BitImg = new BitmapImage(new Uri(Path.Combine(Path.Combine(BizUtil.GetDataFolder(), "style_img"), fTR_CDE))).Clone();
        }
예제 #8
0
        public MapLayerViewModel()
        {
            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;

                txtFTR_CDE = divGrid.FindName("txtFTR_CDE") as TextBox;
                txtFTR_IDN = divGrid.FindName("txtFTR_IDN") as TextBox;

                //지도초기화
                InitMap();


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

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


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


            //레이어 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;
                }
            });

            //팝업레이어 토글처리
            closeCmd = new RelayCommand <object>(delegate(object obj)
            {
                Popup divLayerInfo = obj as Popup;

                divLayerInfo.IsOpen = false;
            });


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

            //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;
                }
                //선택된레이어 해제
                _selectedLayerNms.Clear();
                _selectedLayerNm = "";
            });

            //시설물팝업에서 시설물메뉴화면 호출작업
            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)
                {
                    MapLayerView mapMainView = v as MapLayerView;
                    //MainWinViewModel vm = ((System.Windows.Controls.Grid)((ContentControl)mapMainView.Parent).Parent).DataContext as MainWinViewModel;
                    break;
                }
            });

            //파일찾기버튼 이벤트
            ChgImgCmd = new RelayCommand <object>(delegate(object obj)
            {
                // 전달된 파라미터
                if (obj == null)
                {
                    Messages.ShowErrMsgBox("시설물코드가 존재하지 않습니다.");
                    return;
                }
                string _FTR_CDE = obj as string;

                // UniqueValueRenderer 자원해제
                //uniqueValueRenderer = new UniqueValueRenderer();
                //layers[_selectedLayerNm].ResetRenderer();

                // 파일탐색기 열기
                OpenFileDialog openFileDialog   = new OpenFileDialog();
                openFileDialog.Multiselect      = false;
                openFileDialog.Filter           = "All files (*.*)|*.*";
                openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                if (openFileDialog.ShowDialog() == true)
                {
                    //아이콘 파일경로
                    string icon_foler = Path.Combine(BizUtil.GetDataFolder(), "style_img");


                    FileInfo[] files = openFileDialog.FileNames.Select(f => new FileInfo(f)).ToArray();  //파일인포
                    foreach (FileInfo fi in files)
                    {
                        try
                        {
                            //해당이미지파일을 FTR_CDE ex)SA117 이름의파일로 복사
                            fi.CopyTo(Path.Combine(icon_foler, _FTR_CDE), true);
                        }
                        catch (Exception ex)
                        {
                            Messages.ShowErrMsgBox(ex.Message);
                        }
                        finally
                        {
                            //1.렌더러 재구성
                            InitUniqueValueRenderer();

                            //2.레이어의 렌더러 재세팅
                            foreach (string sel in _selectedLayerNms)
                            {
                                layers[sel].Renderer = uniqueValueRenderer.Clone();
                                layers[sel].RetryLoadAsync();
                            }

                            //3.팝업이미지소스 업데이트
                            BitImg = new BitmapImage(new Uri(Path.Combine(Path.Combine(BizUtil.GetDataFolder(), "style_img"), _FTR_CDE))).Clone();
                        }
                    }
                }
            });



            btnCmd = new RelayCommand <object>(async delegate(object obj)
            {
                Button btn = obj as Button;
                switch (btn.Content.ToString())
                {
                case "시설물편집":
                    //시설물편집팝업호출



                    break;


                default:
                    break;
                }
            });


            //도형클리어처리
            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!");
            });

            //시설물찾기
            //findCmd = new RelayCommand<object>(FindAction);
        }
예제 #9
0
        /// <summary>
        /// Shape 레이어 보이기/끄기 - Shape버전
        /// </summary>
        /// <param name="_mapView"></param>
        /// <param name="layer"></param>
        /// <param name="chk"></param>
        public async void ShowShapeLayer(MapView _mapView, string _layerNm, bool chk)
        {
            try
            {
                // 0.해당레이어 가져오기
                string filterExp = "";
                string layerNm   = "";

                try
                {
                    string[] ary = _layerNm.Split(',');
                    layerNm   = ary[0]; //레이어테이블명
                    filterExp = ary[1]; //필터표현식
                }
                catch (Exception) { }

                FeatureLayer layer = layers[_layerNm];
                //Type memberType = this.GetType();



                // 1.레이어 ON
                if (chk)
                {
                    if (_mapView.Map.OperationalLayers.Contains(layer))
                    {
                        //on상태 아무것도 안함
                    }
                    else
                    {
                        if (layer != null && layer.LoadStatus == LoadStatus.Loaded) //레이어객체 있으면 단순추가
                        {
                            _mapView.Map.OperationalLayers.Add(layer);
                        }
                        else //레이어객체 없으면 Shape 로딩
                        {
                            string shapefilePath = Path.Combine(BizUtil.GetDataFolder("shape", layerNm + ".shp"));
                            try
                            {
                                ShapefileFeatureTable layerTable = await ShapefileFeatureTable.OpenAsync(shapefilePath);

                                layer            = new FeatureLayer(layerTable); /////// 신규레이어 생성 ///////
                                layers[_layerNm] = layer;                        /////// 딕셔너리에 자동으로 저장되지는 않을것임 ///////

                                layer.Renderer = uniqueValueRenderer.Clone();    //렌더러는 레이어 각각 할당해야하므로 렌더러복사하여 할당
                                _mapView.Map.OperationalLayers.Add(layer);
                            }
                            catch (Exception)
                            {
                                //throw e;
                            }
                        }
                    }


                    // 필터링 인수있으면 하위시설물으로 필터
                    if (!FmsUtil.IsNull(filterExp))
                    {
                        layer.DefinitionExpression = filterExp;
                    }
                }
                // 2.레이어 OFF
                else
                {
                    if (_mapView.Map.OperationalLayers.Contains(layer))
                    {
                        _mapView.Map.OperationalLayers.Remove(layer);
                    }
                    else
                    {
                        //off상태 아무것도 안함
                    }

                    // 필터링 인수있으면 하위시설물으로 필터 리셋
                    if (!FmsUtil.IsNull(filterExp))
                    {
                        layer.DefinitionExpression = "";
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("레이어가 존재하지 않습니다.");
            }
        }
예제 #10
0
        //맵뷰 Feature선택 처리 - 상세정보팝업
        public async void ShowFctPage(Feature identifiedFeature)
        {
            try
            {
                // 0.기존선택해제
                if (_selectedFeature != null)
                {
                    try
                    {
                        // Reset the selection.
                        layers[_selectedLayerNm].ClearSelection();
                        _selectedFeature = null;
                    }
                    catch (Exception) { }
                }


                // 1.선택처리
                _selectedFeature = (Feature)identifiedFeature; //선택피처 ArcGISFeature 변환저장
                //_selectedFeature = (ArcGISFeature)identifiedFeature; //선택피처 ArcGISFeature 변환저장

                // 선택된 레이어에서 속성정보 가져오기
                string _FTR_CDE = identifiedFeature.GetAttributeValue("FTR_CDE").ToString();
                string _FTR_IDN = identifiedFeature.GetAttributeValue("FTR_IDN").ToString();

                // DB시설물조회 후 해당시설물정보 UserControl로 전환
                if (FmsUtil.IsNull(_FTR_CDE) || FmsUtil.IsNull(_FTR_IDN))
                {
                    Messages.ShowErrMsgBox("시설물 DB정보가 없습니다.");
                    return;
                }
                //else if (_FTR_IDN == this.FTR_IDN)
                //{
                //    //기존시설물이면 토글처리(선택처리하지 않음)
                //    //this.FTR_CDE= "";
                //    this.FTR_IDN = null;
                //}
                else
                {
                    //시설물선택활성화 처리
                    layers[_selectedLayerNm].SelectFeature(identifiedFeature);
                    //해당피처로 이동
                    await mapView.SetViewpointCenterAsync(identifiedFeature.Geometry.Extent.GetCenter(), 40000);

                    //this.FTR_CDE = _FTR_CDE;
                    this.FTR_IDN = _FTR_IDN;
                }



                // UserControl 시설물정보 재로딩
                InitPage(cbFTR_CDE.EditValue.ToString(), this.FTR_CDE, this.FTR_IDN);


                // 아이콘 이미지소스 업데이트
                try
                {
                    BitImg = new BitmapImage(new Uri(Path.Combine(Path.Combine(BizUtil.GetDataFolder(), "style_img"), _FTR_CDE))).Clone();
                }
                catch (Exception) {}
            }
            catch (Exception e)
            {
                Console.WriteLine("레이어 featrue click error..." + e.Message);
            }
        }
예제 #11
0
        public EditWinViewModel()
        {
            //string licenseKey = "runtimelite,1000,rud1244207246,none,9TJC7XLS1MJPF5KHT033"; //그린텍
            //string licenseKey = "runtimelite,1000,rud9177830334,none,A3E60RFLTFM5NERL1040"; //kyun0828 free

            //ArcGISRuntimeEnvironment.SetLicense(licenseKey);



            LoadedCommand = new RelayCommand <object>(delegate(object obj)
            {
                // 0.뷰객체를 파라미터로 전달받기
                editWinView  = obj as EditWinView;
                this.mapView = editWinView.FindName("mapView") as MapView;

                // 1.지도초기화
                InitMap();

                //레이어초기화
                initLayers();

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

                // 2.화면 및 콤보초기화
                cbFTR_CDE = editWinView.cbFTR_CDE;
                BizUtil.SetCombo(cbFTR_CDE, "Select_FTR_LIST", "FTR_CDE", "FTR_NAM", "선택");
                cbFTR_CDE.EditValueChanged += cbFTR_CDEHandler; //콤보변경핸들러

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

                mapView.SketchEditor.GeometryChanged       += OnGeometryChanged;
                mapView.SketchEditor.SelectedVertexChanged += OnSelectedVertexChanged;
            });



            //시설물조회 후 해당레이어 표시
            SearchCommand = new RelayCommand <object>(delegate(object obj) {
                if (FmsUtil.IsNull(FTR_CDE))
                {
                    Messages.ShowInfoMsgBox("시설물을 선택하세요.");
                    return;
                }

                //기존항목 초기화
                ResetLayer();

                //기존페이지 초기화
                InitPage(cbFTR_CDE.EditValue.ToString(), null, null);

                SearchLayer(obj);
            });



            //아이콘변경 (파일찾기)
            ChgImgCmd = new RelayCommand <object>(delegate(object obj)
            {
                // 전달된 파라미터
                if (obj == null)
                {
                    Messages.ShowErrMsgBox("시설물코드가 존재하지 않습니다.");
                    return;
                }
                string _FTR_CDE = obj as string;

                // UniqueValueRenderer 자원해제
                //uniqueValueRenderer = new UniqueValueRenderer();
                //layers[_selectedLayerNm].ResetRenderer();

                // 파일탐색기 열기
                OpenFileDialog openFileDialog   = new OpenFileDialog();
                openFileDialog.Multiselect      = false;
                openFileDialog.Filter           = "All files (*.*)|*.*";
                openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                if (openFileDialog.ShowDialog() == true)
                {
                    //아이콘 파일경로
                    string icon_foler = Path.Combine(BizUtil.GetDataFolder(), "style_img");


                    FileInfo[] files = openFileDialog.FileNames.Select(f => new FileInfo(f)).ToArray();  //파일인포
                    foreach (FileInfo fi in files)
                    {
                        try
                        {
                            //해당이미지파일을 FTR_CDE ex)SA117 이름의파일로 복사
                            fi.CopyTo(Path.Combine(icon_foler, _FTR_CDE), true);
                        }
                        catch (Exception ex)
                        {
                            Messages.ShowErrMsgBox(ex.Message);
                        }
                        finally
                        {
                            //1.렌더러 재구성
                            CmmRun.InitUniqueValueRenderer();

                            //2.레이어의 렌더러 재세팅
                            foreach (string sel in _selectedLayerNms)
                            {
                                layers[sel].Renderer = CmmRun.uniqueValueRenderer.Clone();
                                layers[sel].RetryLoadAsync();
                            }

                            //3.팝업이미지소스 업데이트
                            BitImg = new BitmapImage(new Uri(Path.Combine(Path.Combine(BizUtil.GetDataFolder(), "style_img"), _FTR_CDE))).Clone();
                        }
                    }
                }
            });



            AddCmd = new RelayCommand <object>(async delegate(object obj)
            {
                if (_selectedLayerNms.Count < 1)
                {
                    MessageBox.Show("시설물을 선택하세요.");
                    return;
                }
                else if (_selectedLayerNms.Count > 1)
                {
                    MessageBox.Show("시설물을 하나만 선택하세요.");
                    return;
                }



                //Polygon 피처인 경우 - SketchEditor 를 GraphicOverlay에 생성한다
                //라인피처인 경우 - SketchEditor 를 GraphicOverlay에 생성한다
                if (_selectedLayerNm.Equals("WTL_PIPE_LM") || _selectedLayerNm.Equals("WTL_SPLY_LS") || _selectedLayerNm.Equals("WTL_PURI_AS") ||
                    _selectedLayerNm.Equals("WTL_LBLK_AS") || _selectedLayerNm.Equals("WTL_MBLK_AS") || _selectedLayerNm.Equals("WTL_SBLK_AS"))
                {
                    try
                    {
                        SketchCreationMode creationMode = SketchCreationMode.Polyline;
                        Symbol symbol;
                        if (_selectedLayerNm.Equals("WTL_PURI_AS") || _selectedLayerNm.Equals("WTL_LBLK_AS") || _selectedLayerNm.Equals("WTL_MBLK_AS") || _selectedLayerNm.Equals("WTL_SBLK_AS"))
                        {
                            creationMode = SketchCreationMode.Polygon;
                            symbol       = new SimpleFillSymbol()
                            {
                                Color = System.Drawing.Color.SkyBlue, Style = SimpleFillSymbolStyle.Solid
                            };
                        }
                        else if (_selectedLayerNm.Equals("WTL_PIPE_LM"))
                        {
                            creationMode = SketchCreationMode.Polyline;
                            symbol       = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.SkyBlue, 2);
                        }
                        else
                        {
                            creationMode = SketchCreationMode.Polyline;
                            symbol       = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.SkyBlue, 2);
                        }

                        MessageBox.Show("시설물을 추가할 지점을 마우스로 클릭하세요.(편집완료는 더블클릭)");

                        // Let the user draw on the map view using the chosen sketch mode
                        Esri.ArcGISRuntime.Geometry.Geometry geometry = await mapView.SketchEditor.StartAsync(creationMode, false); //맵에 신규geometry 얻어오기


                        //화면에 그래픽표시(참고용)
                        Graphic graphic = new Graphic(geometry, symbol);
                        _sketchOverlay.Graphics.Add(graphic);



                        // 0.화면초기화
                        editWinView.txtFTR_IDN.EditValue = ""; //FTR_IDN = ""
                        NEW_FTR_IDN = "";

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

                        //신규시설물 페이지전환
                        InitPage(cbFTR_CDE.EditValue.ToString(), FTR_CDE, null);


                        // 1.레이어에 위치추가
                        AddFeatureToLayer(geometry);


                        // 2.시설물DB 저장
                        Messages.ShowInfoMsgBox("위치정보가 추가되었습니다. 해당시설물의 상세정보를 저장하세요");
                    }
                    catch (TaskCanceledException)
                    {
                        // Ignore ... let the user cancel drawing
                    }
                    catch (Exception ex)
                    {
                        // Report exceptions
                        MessageBox.Show("Error drawing graphic shape: " + ex.Message);
                    }
                }
                //포인트피처의 경우는 클릭핸들러만 추가함
                else
                {
                    ////화면초기화
                    editWinView.txtFTR_IDN.EditValue = ""; //FTR_IDN = ""
                    NEW_FTR_IDN = "";

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

                    ////신규시설물 페이지전환
                    InitPage(cbFTR_CDE.EditValue.ToString(), FTR_CDE, null);


                    //추가처리 탭핸들러 추가
                    mapView.GeoViewTapped -= handlerGeoViewTappedMoveFeature;
                    mapView.GeoViewTapped -= handlerGeoViewTapped;
                    mapView.GeoViewTapped += handlerGeoViewTappedAddFeature;
                    MessageBox.Show("시설물을 추가할 지점을 마우스로 클릭하세요.");
                }
            });


            EditCmd = new RelayCommand <object>(delegate(object obj)
            {
                if (_selectedFeature == null)
                {
                    MessageBox.Show("시설물을 선택하세요.");
                    return;
                }


                MessageBox.Show("이동할 지점을 마우스로 클릭하세요.");
                //이동처리 탭핸들러 추가
                mapView.GeoViewTapped -= handlerGeoViewTappedAddFeature;
                mapView.GeoViewTapped -= handlerGeoViewTapped;
                mapView.GeoViewTapped += handlerGeoViewTappedMoveFeature;
            });


            DelCmd = new RelayCommand <object>(OnDelCmd);


            //레이어 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;

                //레이어표시 - FTR_IDN 조건 필터링없음
                ShowShapeLayerFilter(mapView, doc.Tag.ToString(), chk, null);

                //조회된 피처 자동선택
                string ftr_cde = doc.Tag.ToString() == "WTL_PIPE_LM" ? "SA001" : "SA002";
                SelectFct(ftr_cde, "", layers[doc.Tag.ToString()]);
            });
        }
예제 #12
0
        //맵뷰 클릭이벤트 핸들러 - 상세정보팝업
        public async void handlerGeoViewTapped(object sender, GeoViewInputEventArgs e)
        {
            try
            {
                // 위치에해당하는 피처찾은 결과
                // Perform the identify operation.
                IdentifyLayerResult IR_SEL = await mapView.IdentifyLayerAsync(layers[_selectedLayerNm], e.Position, 5, false);

                // 이벤트 타겟피처
                Feature identifiedFeature;
                if (IR_SEL.GeoElements.Any())
                {
                    identifiedFeature = (Feature)IR_SEL.GeoElements[0];
                }
                else
                {
                    // Return if there's nothing to show.
                    return;
                }



                // 0.기존선택해제
                if (_selectedFeature != null)
                {
                    try
                    {
                        // Reset the selection.
                        layers[_selectedLayerNm].ClearSelection();
                        _selectedFeature = null;
                    }
                    catch (Exception) { }
                }


                // 1.선택처리
                _selectedFeature = (Feature)identifiedFeature; //선택피처 ArcGISFeature 변환저장
                //_selectedFeature = (ArcGISFeature)identifiedFeature; //선택피처 ArcGISFeature 변환저장

                // 선택된 레이어에서 속성정보 가져오기
                string _FTR_CDE = identifiedFeature.GetAttributeValue("FTR_CDE").ToString();
                string _FTR_IDN = identifiedFeature.GetAttributeValue("FTR_IDN").ToString();

                // DB시설물조회 후 해당시설물정보 UserControl로 전환
                if (FmsUtil.IsNull(_FTR_CDE) || FmsUtil.IsNull(_FTR_IDN))
                {
                    Messages.ShowErrMsgBox("시설물 DB정보가 없습니다.");
                    return;
                }
                //else if (_FTR_IDN == this.FTR_IDN)
                //{
                //    //기존시설물이면 토글처리(선택처리하지 않음)
                //    //this.FTR_CDE= "";
                //    this.FTR_IDN = null;
                //}
                else
                {
                    //시설물선택활성화 처리
                    layers[_selectedLayerNm].SelectFeature(identifiedFeature);
                    //this.FTR_CDE = _FTR_CDE;
                    this.FTR_IDN = _FTR_IDN;
                }



                // UserControl 시설물정보 재로딩
                InitPage(cbFTR_CDE.EditValue.ToString(), this.FTR_CDE, this.FTR_IDN);


                // 아이콘 이미지소스 업데이트
                BitImg = new BitmapImage(new Uri(Path.Combine(Path.Combine(BizUtil.GetDataFolder(), "style_img"), _FTR_CDE))).Clone();
            }
            catch (Exception)
            {
                Console.WriteLine("레이어 featrue click error...");
            }
        }
예제 #13
0
        // 레이어 심볼 Renderer 구성 초기화 - ArcObject
        public static void InitUniqueValueRendererObj()
        {
            uniqueValueRendererObj            = new UniqueValueRenderer();
            uniqueValueRendererObj.FieldCount = 1;
            uniqueValueRendererObj.set_Field(0, "FTR_CDE");


            /* PictureMarkerSymbol 정의 */
            IRgbColor rgbColorCls = new RgbColor(); //배경칼라

            rgbColorCls.Red   = 255;
            rgbColorCls.Green = 255;
            rgbColorCls.Blue  = 255;


            // Create the gif marker and assign properties.
            //스탠파이프
            IPictureMarkerSymbol pictureSymbolSA003 = new PictureMarkerSymbol();

            pictureSymbolSA003.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA003"));
            pictureSymbolSA003.Angle = 0;
            pictureSymbolSA003.BitmapTransparencyColor = rgbColorCls;
            //pictureMarkerSymbol.Size = 16;
            pictureSymbolSA003.XOffset = 0;
            pictureSymbolSA003.YOffset = 0;
            //상수맨홀
            IPictureMarkerSymbol pictureSymbolSA100 = new PictureMarkerSymbol();

            pictureSymbolSA100.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA100"));
            pictureSymbolSA100.Angle = 0;
            pictureSymbolSA100.BitmapTransparencyColor = rgbColorCls;
            pictureSymbolSA100.XOffset = 0;
            pictureSymbolSA100.YOffset = 0;
            //수원지
            IPictureMarkerSymbol pictureSymbolSA110 = new PictureMarkerSymbol();

            pictureSymbolSA110.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA110"));
            pictureSymbolSA110.Angle = 0;
            pictureSymbolSA110.BitmapTransparencyColor = rgbColorCls;
            pictureSymbolSA110.XOffset = 0;
            pictureSymbolSA110.YOffset = 0;
            //취수장
            IPictureMarkerSymbol pictureSymbolSA112 = new PictureMarkerSymbol();

            pictureSymbolSA112.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA112"));
            pictureSymbolSA112.Angle = 0;
            pictureSymbolSA112.BitmapTransparencyColor = rgbColorCls;
            pictureSymbolSA112.XOffset = 0;
            pictureSymbolSA112.YOffset = 0;
            //배수지
            IPictureMarkerSymbol pictureSymbolSA114 = new PictureMarkerSymbol();

            pictureSymbolSA114.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA114"));
            pictureSymbolSA114.Angle = 0;
            pictureSymbolSA114.BitmapTransparencyColor = rgbColorCls;
            pictureSymbolSA114.XOffset = 0;
            pictureSymbolSA114.YOffset = 0;
            //유량계
            IPictureMarkerSymbol pictureSymbolSA117 = new PictureMarkerSymbol();

            pictureSymbolSA117.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA117"));
            pictureSymbolSA117.Angle = 0;
            pictureSymbolSA117.BitmapTransparencyColor = rgbColorCls;
            pictureSymbolSA117.XOffset = 0;
            pictureSymbolSA117.YOffset = 0;
            //급수탑
            IPictureMarkerSymbol pictureSymbolSA118 = new PictureMarkerSymbol();

            pictureSymbolSA118.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA118"));
            pictureSymbolSA118.Angle = 0;
            pictureSymbolSA118.BitmapTransparencyColor = rgbColorCls;
            //pictureMarkerSymbol.Size = 16;
            pictureSymbolSA118.XOffset = 0;
            pictureSymbolSA118.YOffset = 0;
            //소화전
            IPictureMarkerSymbol pictureSymbolSA119 = new PictureMarkerSymbol();

            pictureSymbolSA119.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA119"));
            pictureSymbolSA119.Angle = 0;
            pictureSymbolSA119.BitmapTransparencyColor = rgbColorCls;
            pictureSymbolSA119.XOffset = 0;
            pictureSymbolSA119.YOffset = 0;
            //저수조
            IPictureMarkerSymbol pictureSymbolSA120 = new PictureMarkerSymbol();

            pictureSymbolSA120.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA120"));
            pictureSymbolSA120.Angle = 0;
            pictureSymbolSA120.BitmapTransparencyColor = rgbColorCls;
            pictureSymbolSA120.XOffset = 0;
            pictureSymbolSA120.YOffset = 0;
            //수압계
            IPictureMarkerSymbol pictureSymbolSA121 = new PictureMarkerSymbol();

            pictureSymbolSA121.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA121"));
            pictureSymbolSA121.Angle = 0;
            pictureSymbolSA121.BitmapTransparencyColor = rgbColorCls;
            pictureSymbolSA121.XOffset = 0;
            pictureSymbolSA121.YOffset = 0;
            //급수전계량기
            IPictureMarkerSymbol pictureSymbolSA122 = new PictureMarkerSymbol();

            pictureSymbolSA122.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA122"));
            pictureSymbolSA122.Angle = 0;
            pictureSymbolSA122.BitmapTransparencyColor = rgbColorCls;
            pictureSymbolSA122.XOffset = 0;
            pictureSymbolSA122.YOffset = 0;
            //제수변
            IPictureMarkerSymbol pictureSymbolSA200 = new PictureMarkerSymbol();

            pictureSymbolSA200.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA200"));
            pictureSymbolSA200.Angle = 0;
            pictureSymbolSA200.BitmapTransparencyColor = rgbColorCls;
            pictureSymbolSA200.XOffset = 0;
            pictureSymbolSA200.YOffset = 0;
            //역지변
            IPictureMarkerSymbol pictureSymbolSA201 = new PictureMarkerSymbol();

            pictureSymbolSA201.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA201"));
            pictureSymbolSA201.Angle = 0;
            pictureSymbolSA201.BitmapTransparencyColor = rgbColorCls;
            pictureSymbolSA201.XOffset = 0;
            pictureSymbolSA201.YOffset = 0;
            //이토변
            IPictureMarkerSymbol pictureSymbolSA202 = new PictureMarkerSymbol();

            pictureSymbolSA202.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA202"));
            pictureSymbolSA202.Angle = 0;
            pictureSymbolSA202.BitmapTransparencyColor = rgbColorCls;
            pictureSymbolSA202.XOffset = 0;
            pictureSymbolSA202.YOffset = 0;
            //배기변
            IPictureMarkerSymbol pictureSymbolSA203 = new PictureMarkerSymbol();

            pictureSymbolSA203.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA203"));
            pictureSymbolSA203.Angle = 0;
            pictureSymbolSA203.BitmapTransparencyColor = rgbColorCls;
            pictureSymbolSA203.XOffset = 0;
            pictureSymbolSA203.YOffset = 0;
            //감압변
            IPictureMarkerSymbol pictureSymbolSA204 = new PictureMarkerSymbol();

            pictureSymbolSA204.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA204"));
            pictureSymbolSA204.Angle = 0;
            pictureSymbolSA204.BitmapTransparencyColor = rgbColorCls;
            pictureSymbolSA204.XOffset = 0;
            pictureSymbolSA204.YOffset = 0;
            //안전변
            IPictureMarkerSymbol pictureSymbolSA205 = new PictureMarkerSymbol();

            pictureSymbolSA205.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA205"));
            pictureSymbolSA205.Angle = 0;
            pictureSymbolSA205.BitmapTransparencyColor = rgbColorCls;
            pictureSymbolSA205.XOffset = 0;
            pictureSymbolSA205.YOffset = 0;

            //가압장
            IPictureMarkerSymbol pictureSymbolSA206 = new PictureMarkerSymbol();

            pictureSymbolSA206.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureGIF, BizUtil.GetDataFolder("style_img", "SA206"));
            pictureSymbolSA206.Angle = 0;
            pictureSymbolSA206.BitmapTransparencyColor = rgbColorCls;
            pictureSymbolSA206.XOffset = 0;
            pictureSymbolSA206.YOffset = 0;



            /* 라인심볼정의 */
            //상수관로
            ISimpleLineSymbol lineSymbolSA001 = new SimpleLineSymbol();

            lineSymbolSA001.Color = new RgbColor()
            {
                Red = 0, Green = 102, Blue = 255
            };
            lineSymbolSA001.Width = 1.5;
            //급수관로
            ISimpleLineSymbol lineSymbolSA002 = new SimpleLineSymbol();

            lineSymbolSA002.Color = new RgbColor()
            {
                Red = 0, Green = 204, Blue = 153
            };
            lineSymbolSA002.Width = 1.3;
            //행정구역
            //ISimpleLineSymbol lineSymbolEA305 = new SimpleLineSymbol();
            //lineSymbolEA305.Color = new RgbColor() { Red = 255, Green = 0, Blue = 0 };


            /* Fill심볼정의 */
            //라인심볼
            ISimpleLineSymbol pSLS = new SimpleLineSymbol();

            pSLS.Color = new RgbColor()
            {
                Red = 0, Green = 51, Blue = 204
            };
            //정수장
            ISimpleFillSymbol fillSymbolSA113 = new SimpleFillSymbol();

            fillSymbolSA113.Color = new RgbColor()
            {
                Red = 51, Green = 153, Blue = 255
            };
            fillSymbolSA113.Outline = pSLS;  //외각선은 라인심볼로 지정

            //라인심볼
            pSLS       = new SimpleLineSymbol();
            pSLS.Color = new RgbColor()
            {
                Red = 51, Green = 0, Blue = 204
            };
            //대블록
            ISimpleFillSymbol fillSymbolBZ001 = new SimpleFillSymbol();

            fillSymbolBZ001.Color = new RgbColor()
            {
                Red = 153, Green = 51, Blue = 255, Transparency = 50
            };
            fillSymbolBZ001.Outline = pSLS;  //외각선은 라인심볼로 지정

            //라인심볼
            pSLS       = new SimpleLineSymbol();
            pSLS.Color = new RgbColor()
            {
                Red = 0, Green = 204, Blue = 51
            };
            //중블록
            ISimpleFillSymbol fillSymbolBZ002 = new SimpleFillSymbol();

            fillSymbolBZ002.Color = new RgbColor()
            {
                Red = 51, Green = 255, Blue = 153, Transparency = 50
            };
            fillSymbolBZ002.Outline = pSLS;  //외각선은 라인심볼로 지정

            //라인심볼
            pSLS       = new SimpleLineSymbol();
            pSLS.Color = new RgbColor()
            {
                Red = 0, Green = 51, Blue = 204
            };
            //소블록
            ISimpleFillSymbol fillSymbolBZ003 = new SimpleFillSymbol();

            fillSymbolBZ003.Color = new RgbColor()
            {
                Red = 51, Green = 153, Blue = 255, Transparency = 50
            };
            fillSymbolBZ003.Outline = pSLS;  //외각선은 라인심볼로 지정

            //라인심볼
            pSLS       = new SimpleLineSymbol();
            pSLS.Color = new RgbColor()
            {
                Red = 255, Green = 0, Blue = 0
            };
            //행정구역
            ISimpleFillSymbol fillSymbolEA305 = new SimpleFillSymbol();

            fillSymbolEA305.Color = new RgbColor()
            {
                Red = 51, Green = 153, Blue = 255
            };
            fillSymbolEA305.Outline = pSLS;  //외각선은 라인심볼로 지정



            /* uniqueValue 에따른 심볼적용 */
            uniqueValueRendererObj.AddValue("SA003", "Name", pictureSymbolSA003 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA003", pictureSymbolSA003 as ISymbol);
            uniqueValueRendererObj.AddValue("SA100", "Name", pictureSymbolSA100 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA100", pictureSymbolSA100 as ISymbol);
            uniqueValueRendererObj.AddValue("SA110", "Name", pictureSymbolSA110 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA110", pictureSymbolSA110 as ISymbol);
            uniqueValueRendererObj.AddValue("SA112", "Name", pictureSymbolSA112 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA112", pictureSymbolSA112 as ISymbol);
            uniqueValueRendererObj.AddValue("SA114", "Name", pictureSymbolSA114 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA114", pictureSymbolSA114 as ISymbol);
            uniqueValueRendererObj.AddValue("SA117", "Name", pictureSymbolSA117 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA117", pictureSymbolSA117 as ISymbol);
            uniqueValueRendererObj.AddValue("SA118", "Name", pictureSymbolSA118 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA118", pictureSymbolSA118 as ISymbol);
            uniqueValueRendererObj.AddValue("SA119", "Name", pictureSymbolSA119 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA119", pictureSymbolSA119 as ISymbol);
            uniqueValueRendererObj.AddValue("SA120", "Name", pictureSymbolSA120 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA120", pictureSymbolSA120 as ISymbol);
            uniqueValueRendererObj.AddValue("SA121", "Name", pictureSymbolSA121 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA121", pictureSymbolSA121 as ISymbol);
            uniqueValueRendererObj.AddValue("SA122", "Name", pictureSymbolSA122 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA122", pictureSymbolSA122 as ISymbol);
            uniqueValueRendererObj.AddValue("SA200", "Name", pictureSymbolSA200 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA200", pictureSymbolSA200 as ISymbol);
            uniqueValueRendererObj.AddValue("SA201", "Name", pictureSymbolSA201 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA201", pictureSymbolSA201 as ISymbol);
            uniqueValueRendererObj.AddValue("SA202", "Name", pictureSymbolSA202 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA202", pictureSymbolSA202 as ISymbol);
            uniqueValueRendererObj.AddValue("SA203", "Name", pictureSymbolSA203 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA203", pictureSymbolSA203 as ISymbol);
            uniqueValueRendererObj.AddValue("SA204", "Name", pictureSymbolSA204 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA204", pictureSymbolSA204 as ISymbol);
            uniqueValueRendererObj.AddValue("SA205", "Name", pictureSymbolSA205 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA205", pictureSymbolSA205 as ISymbol);

            uniqueValueRendererObj.AddValue("SA206", "Name", pictureSymbolSA206 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA206", pictureSymbolSA206 as ISymbol);

            uniqueValueRendererObj.AddValue("SA001", "Name", lineSymbolSA001 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA001", lineSymbolSA001 as ISymbol);
            uniqueValueRendererObj.AddValue("SA002", "Name", lineSymbolSA002 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA002", lineSymbolSA002 as ISymbol);

            uniqueValueRendererObj.AddValue("EA305", "Name", fillSymbolEA305 as ISymbol);
            uniqueValueRendererObj.set_Symbol("EA305", fillSymbolEA305 as ISymbol);

            uniqueValueRendererObj.AddValue("SA113", "Name", fillSymbolSA113 as ISymbol);
            uniqueValueRendererObj.set_Symbol("SA113", fillSymbolSA113 as ISymbol);
            uniqueValueRendererObj.AddValue("BZ001", "Name", fillSymbolBZ001 as ISymbol);
            uniqueValueRendererObj.set_Symbol("BZ001", fillSymbolBZ001 as ISymbol);
            uniqueValueRendererObj.AddValue("BZ002", "Name", fillSymbolBZ002 as ISymbol);
            uniqueValueRendererObj.set_Symbol("BZ002", fillSymbolBZ002 as ISymbol);
            uniqueValueRendererObj.AddValue("BZ003", "Name", fillSymbolBZ003 as ISymbol);
            uniqueValueRendererObj.set_Symbol("BZ003", fillSymbolBZ003 as ISymbol);
        }
예제 #14
0
        /// <summary>
        /// Shape 레이어 보이기/끄기 - Shape버전
        /// </summary>
        /// <param name="_mapView"></param>
        /// <param name="layer"></param>
        /// <param name="chk"></param>
        public FeatureLayer ShowShapeLayer(string _layerNm, bool chk)
        {
            try
            {
                // 0.해당레이어 가져오기
                string filterExp = "";
                string shapeNm   = "";

                try
                {
                    string[] ary = _layerNm.Split('^');
                    shapeNm   = ary[0];                     //레이어테이블명
                    filterExp = "FTR_CDE='" + ary[1] + "'"; //필터표현식
                }
                catch (Exception) { }



                //0.layers 체크동기화
                CmmObj.layers[_layerNm].chk = chk;


                // 1.레이어 ON
                if (chk)
                {
                    if (CmmObj.layers[_layerNm].FL.Name != "")
                    {
                        //레이어로딩 상태이면 맵에 추가만 해줌
                        mapControl.AddLayer(CmmObj.layers[_layerNm].FL);
                        sts.Push(_layerNm);//레이어인덱스 가져오기위해 똑같이 스택에 저장해놓음
                    }
                    else
                    {
                        mapControl.AddShapeFile(BizUtil.GetDataFolder("shape"), shapeNm + ".shp");

                        //레이어객체 저장
                        CmmObj.layers[_layerNm].FL      = mapControl.get_Layer(0) as FeatureLayer; //스택형이므로 인덱스는 0
                        CmmObj.layers[_layerNm].FL.Name = CmmObj.getLayerKorNm(_layerNm);
                        sts.Push(_layerNm);                                                        //레이어인덱스 가져오기위해 똑같이 스택에 저장해놓음


                        /* Renderer 적용 */
                        IGeoFeatureLayer pGFL = CmmObj.layers[_layerNm].FL as IGeoFeatureLayer;

                        if ("BML_GADM_AS".Equals(_layerNm)) //행정구역
                        {
                            //라인심볼
                            ISimpleLineSymbol lineSymbol = new SimpleLineSymbol();
                            lineSymbol.Color = new RgbColor()
                            {
                                Red = 255, Green = 0, Blue = 0
                            };
                            lineSymbol.Style = esriSimpleLineStyle.esriSLSDashDotDot;
                            lineSymbol.Width = 1.5;

                            //Fill심볼
                            ISimpleFillSymbol fillSymbol = new SimpleFillSymbol();
                            fillSymbol.Color = new RgbColor()
                            {
                                Red = 255, Green = 255, Blue = 255
                            };
                            fillSymbol.Style = esriSimpleFillStyle.esriSFSHollow;

                            fillSymbol.Outline = lineSymbol;  //외각선은 라인심볼로 지정

                            ISimpleRenderer pSR = pGFL.Renderer as SimpleRenderer;
                            pSR.Symbol = fillSymbol as ISymbol;

                            //한반도영역내에 있는경우만 스케일링
                            IEnvelope area = CmmObj.layers[_layerNm].FL.AreaOfInterest;
                            if (area.XMin > GisCmm.XMin && area.XMax < GisCmm.XMax &&
                                area.YMin > GisCmm.YMin && area.YMax < GisCmm.YMax)
                            {
                                mapControl.Extent = area;
                            }
                            //초기행정구역이면 스케일조정
                            mapControl.MapScale = 288895;
                        }
                        else
                        {
                            //레이어의 UniqueValueRenderer 적용
                            pGFL.Renderer = CmmObj.uniqueValueRendererObj as IFeatureRenderer;
                        }
                    }


                    // 필터링 인수있으면 하위시설물으로 필터
                    if (!FmsUtil.IsNull(filterExp))
                    {
                        //레이어필터링
                        IFeatureLayerDefinition flayer = CmmObj.layers[_layerNm].FL as IFeatureLayerDefinition;
                        flayer.DefinitionExpression = filterExp;
                    }



                    return(CmmObj.layers[_layerNm].FL);
                }
                // 2.레이어 OFF
                else
                {
                    if (CmmObj.layers[_layerNm].FL.Name != "")
                    {
                        mapControl.DeleteLayer(sts.GetStackIdx(_layerNm));
                        sts.Remove(sts.GetIdx(_layerNm));
                    }
                    else
                    {
                        //로딩되지 않은상태 아무것도 안함
                    }
                    return(null);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("레이어가 존재하지 않습니다." + ex.Message);
                return(null);
            }
        }
예제 #15
0
        /// 생성자
        public ShpMngViewModel()
        {
            ItemsSelect = new ObservableCollection <FileDtl>();
            ItemsFile   = new ObservableCollection <FileInfo>();



            // 초기로딩처리
            LoadedCommand = new RelayCommand <object>(delegate(object obj) {
                if (obj == null)
                {
                    return;
                }
                //그리드뷰인스턴스
                shpMngView = obj as ShpMngView;


                // 초기조회
                InitModel();
            });


            //shp파일 임포트
            ImportCmd = new RelayCommand <object>(delegate(object obj) {
                //필수체크
                if (!BizUtil.ValidReq(shpMngView))
                {
                    return;
                }

                OpenFileDialog openFileDialog   = new OpenFileDialog();
                openFileDialog.Multiselect      = true;
                openFileDialog.Filter           = "Shape files |*.shp;*.shx;*.dbf;*.prj";
                openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                if (openFileDialog.ShowDialog() == true)
                {
                    FileInfo[] files = openFileDialog.FileNames.Select(f => new FileInfo(f)).ToArray(); //파일인포

                    int cnt = 0;                                                                        //전체파일수
                    int chk = 0;                                                                        //shp,dat파일수
                    foreach (FileInfo fi in files)
                    {
                        try
                        {
                            //파일객체
                            ItemsFile.Add(fi);
                            if (fi.Extension.Contains("shp") || fi.Extension.Contains("shx") || fi.Extension.Contains("dbf") || fi.Extension.Contains("prj"))
                            {
                                chk++;
                            }
                            cnt++;
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.Message);
                        }
                    }

                    if (chk < 4)
                    {
                        MessageBox.Show("shp, shx, dbf, prj 파일 4개를 선택해야합니다.");
                        return;
                    }
                    if (cnt > 4)
                    {
                        MessageBox.Show("한번에 한종류의 shp파일만 업로드할수 있습니다.");
                        return;
                    }



                    //파일업로드시작
                    upload_thread = new Thread(new ThreadStart(UploadFileListFX));
                    upload_thread.Start();
                }
            });



            //기존파일 다운로드버튼 이벤트
            DownloadCmd = new RelayCommand <object>(delegate(object obj)
            {
                FileDtl dtl      = obj as FileDtl;
                string file_name = dtl.DWN_NAM;

                try
                {
                    source_file_path = BizUtil.GetDataFolder("shape", file_name);
                }
                catch (Exception)
                {
                    Messages.ShowErrMsgBox("다운로드할 수 없습니다.");
                    return;
                }


                //파일다운로드
                saveFileDialog       = new System.Windows.Forms.SaveFileDialog();
                saveFileDialog.Title = "저장경로를 지정하세요.";
                //초기 파일명 지정
                saveFileDialog.FileName        = file_name;
                saveFileDialog.OverwritePrompt = true;
                saveFileDialog.Filter          = "All files (*.*)|*.*";

                if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    target_file_path = saveFileDialog.FileName;
                    download_thread  = new Thread(new ThreadStart(DownloadFX));
                    download_thread.Start();
                }
            });
        }
예제 #16
0
 // mpk 패키지파일의 위치 가져오기
 private static string GetFeatureLayerPath()
 {
     //return DataManager.GetDataFolder("4e94fec734434d1288e6ebe36c3c461f", "PointsOfInterest.mpk");
     //return GetDataFolder("4e94fec734434d1288e6ebe36c3c461f", "PointsOfInterest.mpk");
     return(BizUtil.GetDataFolder("tile", "wfms.mpk"));
 }
예제 #17
0
        // 레이어 심볼 Renderer 구성 초기화 - shape버전 레이어구성시에만 사용함
        public void InitUniqueValueRenderer()
        {
            uniqueValueRenderer = new UniqueValueRenderer();

            // 1.Point 마커 스타일링 - 속성값에따른 이미지 선별매핑
            //스탠드파이프
            SimpleLineSymbol SA003Symbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.SkyBlue, 1);
            UniqueValue      SA003Value  = new UniqueValue("SA003", "SA003", SA003Symbol, "SA003");
            //상수맨홀
            var SA100Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA100"), UriKind.Relative);
            PictureMarkerSymbol SA100Symbol = new PictureMarkerSymbol(SA100Uri);
            UniqueValue         SA100Value  = new UniqueValue("SA100", "SA100", SA100Symbol, "SA100"); //string description, string label, Symbol symbol, object value
            //취수장
            var SA112Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA112"), UriKind.Relative);
            PictureMarkerSymbol SA112Symbol = new PictureMarkerSymbol(SA112Uri);
            UniqueValue         SA112Value  = new UniqueValue("SA112", "SA112", SA112Symbol, "SA112"); //string description, string label, Symbol symbol, object value
            //배수지
            var SA114Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA114"), UriKind.Relative);
            PictureMarkerSymbol SA114Symbol = new PictureMarkerSymbol(SA114Uri);
            UniqueValue         SA114Value  = new UniqueValue("SA114", "SA114", SA114Symbol, "SA114"); //string description, string label, Symbol symbol, object value
            //수원지
            var SA110Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA110"), UriKind.Relative);
            PictureMarkerSymbol SA110Symbol = new PictureMarkerSymbol(SA110Uri);
            UniqueValue         SA110Value  = new UniqueValue("SA110", "SA110", SA110Symbol, "SA110"); //string description, string label, Symbol symbol, object value

            //유량계
            //BitmapImage bi = new BitmapImage();
            //bi.BeginInit();
            //bi.UriSource = new Uri(BizUtil.GetDataFolder("style_img", "SA117"), UriKind.Relative);
            //bi.EndInit();
            //byte[] data;
            //JpegBitmapEncoder encoder = new JpegBitmapEncoder();
            //encoder.Frames.Add(BitmapFrame.Create(bi));
            //using (MemoryStream ms = new MemoryStream())
            //{
            //    encoder.Save(ms);
            //    data = ms.ToArray();
            //}
            //FileStream fs = new FileStream(BizUtil.GetDataFolder("style_img", "SA117"), FileMode.Open);
            //var SA117Uri = await RuntimeImage.FromStreamAsync(fs);


            //RuntimeImage SA117Uri;
            //using (FileStream fs = new FileStream(BizUtil.GetDataFolder("style_img", "SA117"), FileMode.Open, FileAccess.Read))
            //{
            //    SA117Uri = await RuntimeImage.FromStreamAsync(fs);
            //    //fs.Flush();
            //    //fs.Dispose();
            //    //fs.Close();
            //}
            var SA117Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA117"), UriKind.Relative);
            PictureMarkerSymbol SA117Symbol = new PictureMarkerSymbol(SA117Uri);;
            UniqueValue         SA117Value  = new UniqueValue("SA117", "SA117", SA117Symbol, "SA117"); //string description, string label, Symbol symbol, object value



            //급수탑
            var SA118Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA118"), UriKind.Relative);
            PictureMarkerSymbol SA118Symbol = new PictureMarkerSymbol(SA118Uri);
            UniqueValue         SA118Value  = new UniqueValue("SA118", "SA118", SA118Symbol, "SA118"); //string description, string label, Symbol symbol, object value
            //소화전
            var SA119Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA119"), UriKind.Relative);
            PictureMarkerSymbol SA119Symbol = new PictureMarkerSymbol(SA119Uri);
            UniqueValue         SA119Value  = new UniqueValue("SA119", "SA119", SA119Symbol, "SA119");
            //저수조
            var SA120Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA120"), UriKind.Relative);
            PictureMarkerSymbol SA120Symbol = new PictureMarkerSymbol(SA120Uri);
            UniqueValue         SA120Value  = new UniqueValue("SA120", "SA120", SA120Symbol, "SA120");
            //수압계
            var SA121Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA121"), UriKind.Relative);
            PictureMarkerSymbol SA121Symbol = new PictureMarkerSymbol(SA121Uri);
            UniqueValue         SA121Value  = new UniqueValue("SA121", "SA121", SA121Symbol, "SA121"); //string description, string label, Symbol symbol, object value
            //급수전계량기
            var SA122Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA122"), UriKind.Relative);
            PictureMarkerSymbol SA122Symbol = new PictureMarkerSymbol(SA122Uri);
            UniqueValue         SA122Value  = new UniqueValue("SA122", "SA122", SA122Symbol, "SA122"); //string description, string label, Symbol symbol, object value

            /* 변류시설 그룹 */
            //제수변
            var SA200Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA200"), UriKind.Relative);
            PictureMarkerSymbol SA200Symbol = new PictureMarkerSymbol(SA200Uri);
            UniqueValue         SA200Value  = new UniqueValue("SA200", "SA200", SA200Symbol, "SA200"); //string description, string label, Symbol symbol, object value
            //역지변
            var SA201Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA201"), UriKind.Relative);
            PictureMarkerSymbol SA201Symbol = new PictureMarkerSymbol(SA201Uri);
            UniqueValue         SA201Value  = new UniqueValue("SA201", "SA201", SA201Symbol, "SA201"); //string description, string label, Symbol symbol, object value
            //이토변
            var SA202Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA202"), UriKind.Relative);
            PictureMarkerSymbol SA202Symbol = new PictureMarkerSymbol(SA202Uri);
            UniqueValue         SA202Value  = new UniqueValue("SA202", "SA202", SA202Symbol, "SA202"); //string description, string label, Symbol symbol, object value
            //배기변
            var SA203Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA203"), UriKind.Relative);
            PictureMarkerSymbol SA203Symbol = new PictureMarkerSymbol(SA203Uri);
            UniqueValue         SA203Value  = new UniqueValue("SA203", "SA203", SA203Symbol, "SA203"); //string description, string label, Symbol symbol, object value
            //감압변
            var SA204Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA204"), UriKind.Relative);
            PictureMarkerSymbol SA204Symbol = new PictureMarkerSymbol(SA204Uri);
            UniqueValue         SA204Value  = new UniqueValue("SA204", "SA204", SA204Symbol, "SA204"); //string description, string label, Symbol symbol, object value
            //안전변
            var SA205Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA205"), UriKind.Relative);
            PictureMarkerSymbol SA205Symbol = new PictureMarkerSymbol(SA205Uri);
            UniqueValue         SA205Value  = new UniqueValue("SA205", "SA205", SA205Symbol, "SA205"); //string description, string label, Symbol symbol, object value
            //소화전제수변
            var SA206Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA206"), UriKind.Relative);
            PictureMarkerSymbol SA206Symbol = new PictureMarkerSymbol(SA206Uri);
            UniqueValue         SA206Value  = new UniqueValue("SA206", "SA206", SA206Symbol, "SA206"); //string description, string label, Symbol symbol, object value

            //누수지점
            var SA300Uri = new Uri(BizUtil.GetDataFolder("style_img", "SA300"), UriKind.Relative);
            PictureMarkerSymbol SA300Symbol = new PictureMarkerSymbol(SA300Uri);
            UniqueValue         SA300Value  = new UniqueValue("SA300", "SA300", SA300Symbol, "SA300"); //string description, string label, Symbol symbol, object value

            uniqueValueRenderer.FieldNames.Add("FTR_CDE");

            uniqueValueRenderer.UniqueValues.Add(SA003Value);
            uniqueValueRenderer.UniqueValues.Add(SA100Value);
            uniqueValueRenderer.UniqueValues.Add(SA110Value);
            uniqueValueRenderer.UniqueValues.Add(SA112Value);
            uniqueValueRenderer.UniqueValues.Add(SA114Value);
            uniqueValueRenderer.UniqueValues.Add(SA117Value);
            uniqueValueRenderer.UniqueValues.Add(SA118Value);
            uniqueValueRenderer.UniqueValues.Add(SA119Value);
            uniqueValueRenderer.UniqueValues.Add(SA120Value);
            uniqueValueRenderer.UniqueValues.Add(SA121Value);
            uniqueValueRenderer.UniqueValues.Add(SA122Value);

            uniqueValueRenderer.UniqueValues.Add(SA200Value);
            uniqueValueRenderer.UniqueValues.Add(SA201Value);
            uniqueValueRenderer.UniqueValues.Add(SA202Value);
            uniqueValueRenderer.UniqueValues.Add(SA203Value);
            uniqueValueRenderer.UniqueValues.Add(SA204Value);
            uniqueValueRenderer.UniqueValues.Add(SA205Value);
            uniqueValueRenderer.UniqueValues.Add(SA206Value);

            uniqueValueRenderer.UniqueValues.Add(SA300Value);


            /*
             */
            // 2.Line 스타일링 - 속성값에따른 라인컬러 선별매핑
            //상수관로
            SimpleLineSymbol SA001Symbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.Blue, 2);
            UniqueValue      SA001Value  = new UniqueValue("SA001", "SA001", SA001Symbol, "SA001");
            //급수관로
            SimpleLineSymbol SA002Symbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.SkyBlue, 2);
            UniqueValue      SA002Value  = new UniqueValue("SA002", "SA002", SA002Symbol, "SA002");

            uniqueValueRenderer.UniqueValues.Add(SA001Value);
            uniqueValueRenderer.UniqueValues.Add(SA002Value);



            // 3.Polygon 스타일링 - 속성값에따른 라인&내부컬러 선별매핑
            //정수장
            SimpleFillSymbol SA113Symbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, System.Drawing.Color.Blue, new SimpleLineSymbol(SimpleLineSymbolStyle.Dash, System.Drawing.Color.SkyBlue, 1));
            UniqueValue      SA113Value  = new UniqueValue("SA113", "SA113", SA113Symbol, "SA113");


            //울산행정구역
            SimpleLineSymbol EA035Symbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Dash, System.Drawing.Color.Red, 2);
            UniqueValue      EA035Value  = new UniqueValue("EA035", "EA035", EA035Symbol, "EA035");


            uniqueValueRenderer.UniqueValues.Add(SA113Value);
            uniqueValueRenderer.UniqueValues.Add(EA035Value);
        }
예제 #18
0
        /// <summary>
        /// cmd.exe 실행 및 command 수행
        /// </summary>
        private void ExCmd_GisTbloader()
        {
            //0. Cmd.exe 호출
            ProcessStartInfo psi = new ProcessStartInfo();

            psi.FileName       = @"cmd";
            psi.WindowStyle    = ProcessWindowStyle.Hidden;          // cmd창이 숨겨지도록 하기
            psi.CreateNoWindow = true;                               // cmd창을 띄우지 안도록 하기

            psi.UseShellExecute        = false;
            psi.RedirectStandardOutput = true;        // cmd창에서 데이터를 가져오기
            psi.RedirectStandardInput  = true;        // cmd창으로 데이터 보내기
            psi.RedirectStandardError  = true;        // cmd창에서 오류 내용 가져오기


            Process process = new Process();

            process.EnableRaisingEvents = false;
            process.StartInfo           = psi;
            process.Start();

            //shp 저장소 경로이동
            string cdcmd = "c: ";

            process.StandardInput.Write(cdcmd + Environment.NewLine);
            cdcmd = "cd " + Path.Combine(BizUtil.GetDataFolder("shape"));
            process.StandardInput.Write(cdcmd + Environment.NewLine);

            foreach (FileInfo fi in ItemsFile)
            {
                if (!fi.Extension.Contains("shp"))
                {
                    continue;                                //shp파일에 대해서만 수행
                }
                //1.gisLoader 수행해서 clt 파일생성
                string gisLoadercmd = "gisLoader " + fi.Name + " infofms." + fi.Name.Replace(".shp", "");

                process.StandardInput.Write(gisLoadercmd + Environment.NewLine); // 명령어를 보낼때는 꼭 마무리를 해줘야 한다
                process.StandardInput.Close();                                   //StandardOutput 읽기위해서는 input을 닫아줘야함

                string        result = process.StandardOutput.ReadToEnd();
                StringBuilder sb     = new StringBuilder();
                sb.Append("[Control파일 생성] \r\n");
                sb.Append(result);
                sb.Append("\r\n");

                if (!result.Contains("complete"))
                {
                    MessageBox.Show("gisLoader Control파일 생성에 실패하였습니다.");
                    return;
                }

                process.StandardInput.Close();

                process.WaitForExit();
                process.Close();
                break; //한파일에대해서만 수행함
            }



            //2.tbloader 수행
            process.Start();

            //shp 저장소 경로이동
            cdcmd = "c: ";
            process.StandardInput.Write(cdcmd + Environment.NewLine);
            cdcmd = "cd " + Path.Combine(BizUtil.GetDataFolder("shape"));
            process.StandardInput.Write(cdcmd + Environment.NewLine);


            foreach (FileInfo fi in ItemsFile)
            {
                if (!fi.Extension.Contains("shp"))
                {
                    continue;                                //shp파일에 대해서만 수행
                }
                string   ctl    = fi.Name.Replace(".shp", "") + ".ctl";
                FileInfo ctl_fi = new FileInfo(Path.Combine(BizUtil.GetDataFolder("shape"), ctl));
                if (!ctl_fi.Exists)
                {
                    MessageBox.Show("Control파일이 없습니다.");
                    return;
                }

                // ctl파일에 인코딩 utf8 추가
                string new_file = ""; //추가수정파일내용
                try
                {
                    using (StreamReader r = File.OpenText(Path.Combine(BizUtil.GetDataFolder("shape"), ctl)))
                    {
                        string line = "";
                        while ((line = r.ReadLine()) != null)
                        {
                            new_file += line + "\n";
                            if (line.Contains("LOAD DATA"))
                            {
                                new_file += "CHARACTERSET UTF8" + "\n";
                            }
                        }
                    }

                    //using (StreamWriter w = File.AppendText(Path.Combine(BizUtil.GetDataFolder("shape"), ctl)))
                    //{
                    //    w.WriteLine("CHARACTERSET UTF8");
                    //}

                    //ctl파일 재생성
                    File.WriteAllText(Path.Combine(BizUtil.GetDataFolder("shape"), ctl), new_file);
                }
                catch (Exception) {}


                string tbloadercmd = "tbloader userid=infofms/infofms@tibero control=" + ctl;
                process.StandardInput.Write(tbloadercmd + Environment.NewLine); // 명령어를 보낼때는 꼭 마무리를 해줘야 한다
                process.StandardInput.Close();                                  //StandardOutput 읽기위해서는 input을 닫아줘야함

                string        result2 = process.StandardOutput.ReadToEnd();
                StringBuilder sb2     = new StringBuilder();
                sb2.Append("[Import 수행] \r\n");
                sb2.Append(result2);
                sb2.Append("\r\n");

                if (!result2.Contains("success"))
                {
                    MessageBox.Show("tbloader 임포트에 실패하였습니다.");
                    return;
                }

                MessageBox.Show("정상적으로 처리되었습니다.");

                process.WaitForExit();
                process.Close();
                break; //한파일에대해서만 수행함
            }
        }
예제 #19
0
        /// <summary>
        /// Shape 레이어 보이기/끄기 - Shape버전
        /// </summary>
        /// <param name="_mapView"></param>
        /// <param name="layer"></param>
        /// <param name="chk"></param>
        public async void ShowShapeLayerFilter(MapView _mapView, string _layerNm, bool chk, string _FTR_IDN)
        {
            try
            {
                // 0.해당레이어 가져오기
                string filterExp = "";
                string shapeNm   = "";

                try
                {
                    string[] ary = _layerNm.Split('^');
                    shapeNm   = ary[0];                     //레이어테이블명
                    filterExp = "FTR_CDE='" + ary[1] + "'"; //필터표현식
                }
                catch (Exception) { }

                //FTR_IDN 필터추가
                if (!FmsUtil.IsNull(_FTR_IDN))
                {
                    if (FmsUtil.IsNull(filterExp))
                    {
                        filterExp += "FTR_IDN LIKE '%' || " + _FTR_IDN + " ||  '%'";
                    }
                    else
                    {
                        filterExp += " AND FTR_IDN LIKE '%' ||  " + _FTR_IDN + " ||  '%'";
                    }
                }


                FeatureLayer layer = layers[_layerNm];
                //Type memberType = this.GetType();



                // 1.레이어 ON
                if (chk)
                {
                    // 필터링 인수있으면 하위시설물(관리번호, 전체)으로 필터
                    layer.DefinitionExpression = filterExp;


                    if (_mapView.Map.OperationalLayers.Contains(layer))
                    {
                        //on상태 아무것도 안함
                    }
                    else
                    {
                        if (layer != null && layer.LoadStatus == LoadStatus.Loaded) //레이어객체 있으면 단순추가
                        {
                            _mapView.Map.OperationalLayers.Add(layer);
                        }
                        else //레이어객체 없으면 Shape 로딩
                        {
                            string shapefilePath = Path.Combine(BizUtil.GetDataFolder("shape", shapeNm + ".shp"));
                            try
                            {
                                ShapefileFeatureTable layerTable = await ShapefileFeatureTable.OpenAsync(shapefilePath);


                                layer = new FeatureLayer(layerTable);   /////// 신규레이어 생성 ///////
                                layer.DefinitionExpression = filterExp; // 필터링 인수있으면 하위시설물(관리번호, 전체)으로 필터

                                layers[_layerNm] = layer;               /////// 딕셔너리에 자동으로 저장되지는 않을것임 ///////


                                layer.Renderer = CmmRun.uniqueValueRenderer.Clone(); //렌더러는 레이어 각각 할당해야하므로 렌더러복사하여 할당
                                _mapView.Map.OperationalLayers.Add(layer);
                            }
                            catch (Exception e)
                            {
                                Messages.ShowErrMsgBox(e.Message);
                            }
                        }
                    }

                    // Zoom the map to the extent of the shapefile.
                    //await _mapView.SetViewpointGeometryAsync(layer.FullExtent, 50);
                }
                // 2.레이어 OFF
                else
                {
                    if (_mapView.Map.OperationalLayers.Contains(layer))
                    {
                        _mapView.Map.OperationalLayers.Remove(layer);
                    }
                    else
                    {
                        //off상태 아무것도 안함
                    }

                    // 필터링 인수있으면 하위시설물으로 필터 리셋
                    layer.DefinitionExpression = "";
                }
            }
            catch (Exception)
            {
                MessageBox.Show("레이어가 존재하지 않습니다.");
            }
        }