// 관리번호로 해당Feature 객체찾기 public async void SelectFct(string _FTR_CDE, string _FTR_IDN, FeatureLayer _featureLayer) { // 0.Feature 테이블 가져오기 //FeatureLayer __featureLayer = _featureLayer.Clone() as FeatureLayer; FeatureTable _featureTable = _featureLayer.FeatureTable; // Create a query parameters that will be used to Query the feature table. QueryParameters queryParams = new QueryParameters(); // Construct and assign the where clause that will be used to query the feature table. queryParams.WhereClause = " FTR_CDE = '" + _FTR_CDE + "' ORDER BY FTR_IDN DESC"; if (!FmsUtil.IsNull(_FTR_IDN)) { queryParams.WhereClause = " FTR_CDE = '" + _FTR_CDE + "' AND FTR_IDN like '%' || " + _FTR_IDN + " || '%'"; } List <Feature> features; try { // Query the feature table. FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams); // Cast the QueryResult to a List so the results can be interrogated. features = queryResult.ToList(); } catch (Exception e) { Messages.ShowErrMsgBox(e.Message); return; } if (features.Any()) { // Create an envelope. EnvelopeBuilder envBuilder = new EnvelopeBuilder(SpatialReferences.WebMercator); if (features.Count == 1) { //한건인 경우 선택처리 ShowFctPage(features[0]); } else { //피쳐영역 Extent 위치이동 foreach (Feature feature in features) { envBuilder.UnionOf(feature.Geometry.Extent); //복수의 피처영역 합치기 } // Zoom to the extent of the selected feature(s). await mapView.SetViewpointGeometryAsync(envBuilder.ToGeometry(), 50); } } }
//첨부파일 모듈호출 private void BtnAdd_Click(object sender, RoutedEventArgs e) { try { // 파일첨부윈도우 filePhotoView = new FilePhotoView(this.BIZ_ID, null); filePhotoView.Owner = Window.GetWindow(this); //FIL_SEQ 리턴 if (filePhotoView.ShowDialog() is bool) { string FIL_SEQ = filePhotoView.txtFIL_SEQ.Text; //저장버튼으로 닫힘 if (!FmsUtil.IsNull(FIL_SEQ)) { //AddFilSeqRow(FIL_SEQ); //첨부파일 한건추가 //조회그리드형으로 변경 InitModel(); } //닫기버튼으로 닫힘 } } catch (Exception ex) { Messages.ShowErrMsgBox(ex.ToString()); } //gv.AddNewRow(); //int newRowHandle = DataControlBase.NewItemRowHandle; //grid.SetCellValue(gv.FocusedRowHandle, "PAY_YMD", Convert.ToDateTime(DateTime.Today).ToString("yyyy-MM-dd")); }
//상수관로 시설물선택 private void BtnFtrSel_Click(object sender, RoutedEventArgs e) { try { // 지형지물팝업 윈도우 FtrSelView ftrSelView = new FtrSelView(null); ftrSelView.Owner = Window.GetWindow(this); //FTR_IDN 리턴 if (ftrSelView.ShowDialog() is bool) { string FTR_IDN = ftrSelView.txtFTR_IDN.Text; string FTR_CDE = ftrSelView.txtFTR_CDE.Text; string FTR_NAM = ftrSelView.txtFTR_NAM.Text; //저장버튼으로 닫힘 if (!FmsUtil.IsNull(FTR_IDN)) { txtPIP_IDN.EditValue = FTR_IDN; txtPIP_CDE.Text = FTR_CDE; txtPIP_NAM.EditValue = FTR_NAM; } //닫기버튼으로 닫힘 } } catch (Exception ex) { Messages.ShowErrMsgBox(ex.ToString()); } }
//첨부파일 모듈호출 private void BtnAdd_Click(object sender, RoutedEventArgs e) { try { // 파일첨부윈도우 FilePopView fileMngView = new FilePopView(this.FIL_SEQ); fileMngView.Owner = Window.GetWindow(this); //FIL_SEQ 리턴 if (fileMngView.ShowDialog() is bool) { string pFIL_SEQ = fileMngView.txtFIL_SEQ.Text; string sToDay = DateTime.Now.ToString("yyyyMMdd"); //저장버튼으로 닫힘 if (!FmsUtil.IsNull(pFIL_SEQ)) { if (FmsUtil.IsNull(this.FIL_SEQ)) { Hashtable param = new Hashtable(); param.Add("sqlId", "SaveFileMap"); param.Add("BIZ_ID", this.BIZ_ID); param.Add("FIL_SEQ", Convert.ToInt32(pFIL_SEQ)); param.Add("GRP_TYP", "111"); param.Add("TIT_NAM", "사진첨부"); param.Add("UPD_YMD", sToDay); param.Add("UPD_USR", Logs.strLogin_ID); param.Add("CTNT", ""); param.Add("CRE_YMD", sToDay); param.Add("CRE_USR", Logs.strLogin_ID); //저장처리 try { BizUtil.Update(param); } catch (Exception ex) { Messages.ShowErrMsgBox("저장 처리중 오류가 발생하였습니다." + ex.ToString()); return; } } InitModel(); } //닫기버튼으로 닫힘 } } catch (Exception ex) { Messages.ShowErrMsgBox(ex.ToString()); } //gv.AddNewRow(); //int newRowHandle = DataControlBase.NewItemRowHandle; //grid.SetCellValue(gv.FocusedRowHandle, "PAY_YMD", Convert.ToDateTime(DateTime.Today).ToString("yyyy-MM-dd")); }
//민원선택 팝업호출 private void BtnSel_Click(object sender, RoutedEventArgs e) { try { // 지형지물팝업 윈도우 CnstCmplSelView cnstCmplSelView = new CnstCmplSelView(); cnstCmplSelView.Owner = Window.GetWindow(this); //FTR_IDN 리턴 if (cnstCmplSelView.ShowDialog() is bool) { string RCV_NUM = cnstCmplSelView.txbRCV_NUM.Text; //저장버튼으로 닫힘 if (!FmsUtil.IsNull(RCV_NUM)) { txtRCV_NUM.EditValue = RCV_NUM; } //닫기버튼으로 닫힘 } } catch (Exception ex) { Messages.ShowErrMsgBox(ex.ToString()); } }
//초기모델조회 private void InitModel() { Hashtable param = new Hashtable(); // 0.파일첨부내역 param.Add("sqlId", "SelectFileMap"); param.Add("BIZ_ID", txtBIZ_ID.Text); param.Add("FIL_SEQ", txtFIL_SEQ.Text); FileMapDtl result = BizUtil.SelectObject(param) as FileMapDtl; // 내역없으면 신규첨부내용 if (!FmsUtil.IsNull(result)) { // 0.상세정보 Dtl = result; // 1.첨부파일 param.Clear(); param.Add("sqlId", "SelectFileDtl2"); param.Add("FIL_SEQ", txtFIL_SEQ.Text); ItemsSelect = new ObservableCollection <FileDtl>(BizUtil.SelectListObj <FileDtl>(param)); } }
// 시설물코드 변경 private void cbFTR_CDEHandler(object sender, EditValueChangedEventArgs e) { // 0.편집화면초기화 ResetLayer(); editWinView.txtFTR_IDN.EditValue = ""; //시설물레이어 초기화 _selectedLayerNm = ""; _selectedLayerNms.Clear(); // 0,상수관로,급수관로 체크되어있으면 다시시표시 foreach (Button btn in FmsUtil.FindVisualChildren <Button>(editWinView)) { try { CheckBox chkbox = btn.Template.FindName("chkLayer", btn) as CheckBox; if (chkbox.IsChecked is true) { ShowShapeLayerFilter(mapView, btn.Tag.ToString(), true, ""); } } catch (Exception) { } } // 1.새로운 레이어 시작 string ftr_cde = e.NewValue.ToString(); this.FTR_CDE = ftr_cde; if (!FmsUtil.IsNull(ftr_cde)) { //선택된 레이어 기록 _selectedLayerNm = GisCmm.GetLayerNm(ftr_cde); _selectedLayerNms.Add(GisCmm.GetLayerNm(ftr_cde)); } else { return; } // 2.선택된 레이어의 시설물 페이지로 초기화 InitPage(ftr_cde, null, null); // 시설물검색 if (_selectedLayerNm.Equals("WTL_PIPE_LM") || _selectedLayerNm.Equals("WTL_SPLY_LS")) { //대용량데이터는 자동검색 제외 SearchLayer(null); } else { SearchLayer(null); } }
/// <summary> /// 그리드저장 /// </summary> private void OnSave(object obj) { bool isChecked = false; foreach (PdjtInDtl row in GrdLst) { if ("Y".Equals(row.CHK)) { isChecked = true; break; } } if (!isChecked) { Messages.ShowInfoMsgBox("선택된 항목이 없습니다."); return; } if (Messages.ShowYesNoMsgBox("저장하시겠습니까?") != MessageBoxResult.Yes) { return; } Hashtable param = new Hashtable(); //그리드 저장 foreach (PdjtInDtl row in GrdLst) { if (row.CHK != "Y") { continue; } if (FmsUtil.IsNull(row.IN_YMD)) { MessageBox.Show("입고일자는 필수입니다."); return; } row.PDH_NUM = Convert.ToInt32(PDH_NUM); try { BizUtil.Update2(row, "SavePdjtInHtPop"); } catch (Exception) { Messages.ShowErrMsgBox("저장 처리중 오류가 발생하였습니다."); return; } } //저장처리성공 Messages.ShowOkMsgBox(); //재조회 initModel(); }
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) { base.OnMouseLeftButtonUp(e); //if (Controller.IsMouseLeftButtonDown) //{ // var layoutControl = Parent as FlowLayoutControl; // if (layoutControl != null) // { // Controller.IsMouseEntered = false; // layoutControl.MaximizedElement = layoutControl.MaximizedElement == this ? null : this; // } //} string file_name = ""; try { file_name = ((Image)e.OriginalSource).DataContext.ToString(); } catch (Exception) {} ////이미지 미리보기 if (FmsUtil.IsNull(file_name)) { MessageBox.Show("이미지파일이 없습니다."); return; } string file_path = System.IO.Path.Combine(@"" + FmsUtil.fileDir, file_name); try { BitmapImage bi = new BitmapImage(); bi.BeginInit(); //bi.UriSource = new Uri(file_path); bi.UriSource = new Uri(file_name); bi.EndInit(); imgView.Source = bi; grdImg.Visibility = Visibility.Visible; bdImg.Visibility = Visibility.Visible; } catch (Exception) { MessageBox.Show("이미지 정보가 없습니다."); } }
//시설물 한건 row 추가 private void AddFtrRow(string fTR_IDN, string fTR_CDE, string fTR_NAM, string hJD_NAM) { if (FmsUtil.IsNull(fTR_IDN)) { Messages.ShowInfoMsgBox("관리번호가 없습니다."); return; } ChscResultDtl drNew = new ChscResultDtl(); drNew.FTR_IDN = Convert.ToInt32(fTR_IDN); drNew.FTR_CDE = fTR_CDE; drNew.HJD_NAM = hJD_NAM; drNew.FTR_NAM = fTR_NAM; drNew.RPR_YMD = Convert.ToDateTime(DateTime.Today).ToString("yyyyMMdd"); drNew.CHK = "Y"; GrdLst.Add(drNew); }
//첨부파일 한건 row 추가 private void AddFilSeqRow(string fIL_SEQ) { if (FmsUtil.IsNull(fIL_SEQ)) { Messages.ShowInfoMsgBox("파일ID가 없습니다."); return; } DataRow drNew = ((DataTable)grid.ItemsSource).NewRow(); drNew["FIL_SEQ"] = fIL_SEQ; drNew["TIT_NAM"] = ""; drNew["CRE_YMD"] = Convert.ToDateTime(DateTime.Today).ToString("yyyy-MM-dd"); drNew["CRE_USR"] = ""; drNew["CTNT"] = ""; ((DataTable)grid.ItemsSource).Rows.Add(drNew); grid.View.FocusedRowHandle = ((DataTable)grid.ItemsSource).Rows.Count - 1; //그리드ROW position }
/// <summary> /// 첨부DB 저장처리 /// </summary> /// <param name="obj"></param> private void OnSave(object obj) { // 파일첨부확인 - 필수첨부이다 if (FmsUtil.IsNull(Dtl.FIL_SEQ) || Dtl.FIL_SEQ == 0) { Messages.ShowInfoMsgBox("첨부파일을 먼저 등록(저장)하세요."); return; } // 필수체크 (Tag에 필수체크 표시한 EditBox, ComboBox 대상으로 수행) if (!BizUtil.ValidReq(fileMngView)) { return; } if (Messages.ShowYesNoMsgBox("저장하시겠습니까?") != MessageBoxResult.Yes) { return; } try { Dtl.GRP_TYP = "112"; //일반파일 BizUtil.Update2(Dtl, "SaveFileMap2"); } catch (Exception ex) { Messages.ShowErrMsgBox("저장 처리중 오류가 발생하였습니다." + ex.Message); return; } //저장처리 성공 Messages.ShowOkMsgBox(); //InitModel(); btnClose.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); }
/// <summary> /// 저장작업 /// </summary> /// <param name="obj"></param> private void OnSave(object obj) { // 필수체크 (Tag에 필수체크 표시한 EditBox, ComboBox 대상으로 수행) if (!BizUtil.ValidReq(uC_FLOW_PS)) { return; } if (Messages.ShowYesNoMsgBox("저장하시겠습니까?") != MessageBoxResult.Yes) { return; } try { //1.시설물정보 FctDtl.FTR_CDE = this.FTR_CDE; FctDtl.FTR_IDN = Convert.ToInt32(this.FTR_IDN); //신규위치 및 기존위치 정보만 있을수 있으므로 shape의 관리번호를 기준으로한다. BizUtil.Update2(FctDtl, "saveFlowMtDtl"); //2.위치정보 - 위치편집한 경우만 if (!FmsUtil.IsNull(GisCmm.WKT_POINT)) { GisCmm.SavePoint(FctDtl.FTR_CDE, FctDtl.FTR_IDN.ToString(), "WTL_FLOW_PS"); GisCmm.WKT_POINT = ""; } } catch (Exception e) { Messages.ShowErrMsgBox("저장 처리중 오류가 발생하였습니다." + e.Message); return; } Messages.ShowOkMsgBox(); InitModel(); }
// 레이에서 해당 Feature 찾기 private async Task QueryStateFeature(string _FTR_CDE, string _FTR_IDN, FeatureLayer _featureLayer) { try { // 0.Feature 테이블 가져오기 //FeatureLayer __featureLayer = _featureLayer.Clone() as FeatureLayer; FeatureTable _featureTable = _featureLayer.FeatureTable; // Create a query parameters that will be used to Query the feature table. QueryParameters queryParams = new QueryParameters(); // Construct and assign the where clause that will be used to query the feature table. queryParams.WhereClause = " FTR_CDE = '" + _FTR_CDE + "' "; if (!FmsUtil.IsNull(_FTR_IDN)) { queryParams.WhereClause += " AND FTR_IDN = " + _FTR_IDN; } List <Feature> features; try { // Query the feature table. FeatureQueryResult queryResult = await _featureTable.QueryFeaturesAsync(queryParams); // Cast the QueryResult to a List so the results can be interrogated. features = queryResult.ToList(); } catch (Exception) { Messages.ShowErrMsgBox("보호된 메모리 접근 에러.."); return; } if (features.Any()) { // Create an envelope. EnvelopeBuilder envBuilder = new EnvelopeBuilder(SpatialReferences.WebMercator); // Loop over each feature from the query result. foreach (Feature feature in features) { // Add the extent of each matching feature to the envelope. //envBuilder.UnionOf(feature.Geometry.Extent); //복수의 피처영역 합치기 // Select each feature. _featureLayer.SelectFeature(feature); //해당피처로 이동 await mapView.SetViewpointCenterAsync(feature.Geometry.Extent.GetCenter(), 40000); } // Zoom to the extent of the selected feature(s). //await mapView.SetViewpointGeometryAsync(envBuilder.ToGeometry(), 50); } else { MessageBox.Show("해당 시설물 위치를 찾을 수 없습니다."); } } catch (Exception ex) { MessageBox.Show("An error occurred.\n" + ex, "Sample error"); } }
/// <summary> /// 메뉴선택 이벤트 /// </summary> /// <param name="obj"></param> private void MenuControlAction(object obj) { AccordionControl accrMenu = mainwin.FindName("accrMenu") as AccordionControl; try { AccordionItem accitemSelect = accrMenu.SelectedItem as AccordionItem; if (accitemSelect != null) { strSelectMenu = accitemSelect.Name.Replace("MN_", ""); DataRow[] dr = dtMenuList.Select("MNU_CD = '" + strSelectMenu + "' AND MNU_STEP = '3'"); if (dr.Length == 1) { if (!Logs.htPermission[strSelectMenu].ToString().Equals("N")) { if (!dr[0]["MNU_PATH"].ToString().Equals("")) { /* */ //Grid gridtitle = mainwin.FindName("gridtitle") as Grid; //gridtitle.RowDefinitions[0].Height = new GridLength(40, GridUnitType.Pixel); //regionManager.Regions["ContentRegion"].RemoveAll(); //regionManager.RequestNavigate("ContentRegion", new Uri(dr[0]["MNU_PATH"].ToString(), UriKind.Relative)); // 선택된 메뉴를 세션에 저장 Logs.strFocusMNU_CD = accitemSelect.Name.Split('_')[1].ToString(); /* * ContentsRegion표시하지않고 팝업윈도우를 호출 */ // 0.현재열려있는 팝업을 닫는다 /* Popup클래그 방식 * pmain.IsOpen = false; */ try { FmsUtil.popWinView.Close(); } catch (Exception) { } if (FmsUtil.IsNull(dr[0]["MNU_PATH"].ToString())) { Messages.ShowErrMsgBox("잘못된 메뉴경로입니다."); return; } // 2.점검관리화면은 단독윈도우형태 if (dr[0]["MNU_PATH"].ToString().Contains("Mntc/View/ChkSchListView.xaml")) { //클래스풀패키지명 만들기 string className = "GTI.WFMS.Modules"; var paths = dr[0]["MNU_PATH"].ToString().Split('/'); foreach (string p in paths) { className += "." + p.Replace(".xaml", ""); } //Type t = ModulesAssembly.GetType("GTI.WFMS.Modules.Mntc.View.ChkSchListView"); Type t = ModulesAssembly.GetType(className); FmsUtil.popWinView = Activator.CreateInstance(t) as Window; //popWinView = new ChkSchListView(); //공통팝업창 사이즈 초기화 FmsUtil.popWinView.Height = 631; //팝업결과리턴 if (FmsUtil.popWinView.ShowDialog() is bool) { //재조회 } } // 3.일반 업무화면은 Page 형태의 팝업 else { /* Window 공통화면 형태 */ FmsUtil.popWinView = new PopWinView(dr[0]["MNU_PATH"].ToString()); Label lbTitle = FmsUtil.popWinView.FindName("lbTitle") as Label;//화면타이틀 lbTitle.Content = dr[0]["MNU_NM"].ToString(); FmsUtil.popWinView.Title = dr[0]["MNU_NM"].ToString(); //팝업결과리턴 if (FmsUtil.popWinView.ShowDialog() is bool) { //재조회 } /* Popup 공통화면 형태 * try * { * pmain = new PopMain(dr[0]["MNU_PATH"].ToString()); * pmain.DataContext = this;//팝업에 현재데이터컨텍스트를 전달한다... * } * catch (Exception) * { * return; * } * * Label lbTitle = pmain.FindName("lbTitle") as Label;//화면타이틀 * lbTitle.Content = dr[0]["MNU_NM"].ToString(); * * pmain.PlacementTarget = borderTop; * pmain.Placement = PlacementMode.Bottom; * pmain.VerticalOffset = 100; * pmain.Placement = PlacementMode.Left; * pmain.HorizontalOffset = 100; * pmain.IsOpen = true; * pmain.StaysOpen = false; * //pmain.Focusable = true; * //FmsUtil.__popMain = pmain; //열린팝업을 전역변수로 저장해놓음 */ } } else { Messages.ShowInfoMsgBox("메뉴 경로가 부적합 합니다."); return; } } //else //{ // Messages.ShowInfoMsgBox("해당메뉴에 권한이 없습니다."); //} } } } catch (Exception ex) { Messages.ShowErrMsgBoxLog(ex); } }
/// <summary> /// 생성자 /// </summary> public FileMngViewModel() { // 초기로딩처리 LoadedCommand = new DelegateCommand <object>(OnLoaded); // 파일인포리스트 ItemsFile = new ObservableCollection <FileInfo>(); ItemsSelect = new ObservableCollection <FileDtl>(); ItemsAdd = new ObservableCollection <FileDtl>(); //파일저장버튼 이벤트 SaveFileCmd = new RelayCommand <object>(delegate(object obj) { if (ItemsFile.Count < 1) { MessageBox.Show("저장할 파일이 없습니다."); return; } upload_thread = new Thread(new ThreadStart(UploadFileListFX)); upload_thread.Start(); }); //첨부내용 저장버튼 이벤트 SaveCmd = new RelayCommand <object>(OnSave); //파일삭제버튼 이벤트 DelCmd = new DelegateCommand <object>(delegate(object obj) { string seq = ""; try { seq = obj.ToString(); } catch (Exception) { } if (FmsUtil.IsNull(seq) || "0".Equals(seq)) { Messages.ShowErrMsgBox("삭제할 대상이 없습니다."); return; } string file_name = ""; string del_file_path = ""; //0.첨부파일정보가져오기 Hashtable param = new Hashtable(); try { param.Add("FIL_SEQ", Dtl.FIL_SEQ); param.Add("SEQ", seq); param.Add("sqlId", "SelectFileDtl"); DataTable dt = BizUtil.SelectList(param); //물리파일명 가져오기 file_name = dt.Rows[0]["UPF_NAM"].ToString(); } catch (Exception ex) { Messages.ShowInfoMsgBox(ex.ToString()); InitModel(); return; } //1.첨부파일상세테이블 삭제 param["sqlId"] = "DeleteFileSeq"; BizUtil.Update(param); //2.물리적파일 삭제 del_file_path = System.IO.Path.Combine(dir_name, file_name); try { FileInfo fi = new FileInfo(del_file_path); fi.Delete(); } catch (Exception) { } //삭제성공 Messages.ShowOkMsgBox(); InitModel(); }); //기존파일 다운로드버튼 이벤트 DownloadCmd = new RelayCommand <object>(delegate(object obj) { FileDtl dtl = obj as FileDtl; string file_name = dtl.DWN_NAM; string file_name2 = dtl.UPF_NAM; try { source_file_path = System.IO.Path.Combine(dir_name, file_name2); } catch (Exception) { Messages.ShowErrMsgBox("다운로드할 수 없습니다."); return; } //파일다운로드 saveFileDialog = new System.Windows.Forms.SaveFileDialog(); saveFileDialog.Title = "저장경로를 지정하세요."; //초기 파일명 지정 saveFileDialog.FileName = file_name; saveFileDialog.OverwritePrompt = true; //saveFileDialog.Filter = "Excel|*.xlsx"; //saveFileDialog.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*"; 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(); } }); //파일찾기버튼 이벤트 FindFileCmd = new RelayCommand <object>(delegate(object obj) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Multiselect = true; openFileDialog.Filter = "All files (*.*)|*.*"; openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); if (openFileDialog.ShowDialog() == true) { FileInfo[] files = openFileDialog.FileNames.Select(f => new FileInfo(f)).ToArray(); //파일인포 foreach (FileInfo fi in files) { try { //파일객체 ItemsFile.Add(fi); //파일db객체 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) {} } } }); //윈도우 마우스드래그 WindowMoveCommand = new DelegateCommand <object>(delegate(object obj) { try { if (Mouse.LeftButton == MouseButtonState.Pressed) { if (fileMngView.WindowState == WindowState.Maximized) { fileMngView.Top = Mouse.GetPosition(fileMngView).Y - System.Windows.Forms.Cursor.Position.Y - 6; fileMngView.Left = System.Windows.Forms.Cursor.Position.X - Mouse.GetPosition(fileMngView).X + 20; fileMngView.WindowState = WindowState.Normal; } fileMngView.DragMove(); } } catch (Exception ex) { Messages.ShowErrMsgBoxLog(ex); } }); }
/// <summary> /// 생성자 /// </summary> public ChkSchDtlViewModel() { this.LoadedCommand = new DelegateCommand <object>(delegate(object obj) { // 0.화면객체인스턴스화 if (obj == null) { return; } chkSchDtlView = obj as ChkSchDtlView; cbMNG_CDE = chkSchDtlView.cbMNG_CDE; cbSCL_CDE = chkSchDtlView.cbSCL_CDE; btnDelete = chkSchDtlView.btnDelete; btnSave = chkSchDtlView.btnSave; btnClose = chkSchDtlView.btnClose; GrdLst = new ObservableCollection <ChscResultDtl>(); //2.화면데이터객체 초기화 InitDataBinding(); //3.권한처리 permissionApply(); //4.초기조히 initModel(); }); //점검저장 this.SaveCommand = new DelegateCommand <object>(delegate(object obj) { // 필수체크 (Tag에 필수체크 표시한 EditBox, ComboBox 대상으로 수행) if (!BizUtil.ValidReq(chkSchDtlView)) { return; } if (Messages.ShowYesNoMsgBox("저장하시겠습니까?") != MessageBoxResult.Yes) { return; } try { //다큐먼트 별로로 세팅 Dtl.CHK_CTNT = new TextRange(chkSchDtlView.richBox.Document.ContentStart, chkSchDtlView.richBox.Document.ContentEnd).Text.Trim(); BizUtil.Update2(Dtl, "SaveChscMaDtl"); } catch (Exception) { Messages.ShowErrMsgBox("저장 처리중 오류가 발생하였습니다."); return; } Messages.ShowOkMsgBox(); //화면닫기 btnClose.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); }); //점검삭제 this.DeleteCommand = new DelegateCommand <object>(delegate(object obj) { //0.삭제전 체크 Hashtable param = new Hashtable(); param.Add("sqlId", "SelectChscResultList"); param.Add("SCL_NUM", Dtl.SCL_NUM); Hashtable result = BizUtil.SelectLists(param); DataTable dt = new DataTable(); try { dt = result["dt"] as DataTable; if (dt.Rows.Count > 0) { //Messages.ShowErrMsgBox("점검시설물이 존재합니다."); //return; foreach (DataRow row in dt.Rows) { //0.점검사진삭제 //a.FIL_SEQ 첨부파일삭제 BizUtil.DelFileSeq(row["FIL_SEQ"]); //b.FILE_MAP 업무파일매핑삭제 param = new Hashtable(); param.Add("sqlId", "DeleteFileMap"); param.Add("BIZ_ID", row["FTR_CDE"].ToString() + row["FTR_IDN"].ToString()); param.Add("FIL_SEQ", row["FIL_SEQ"]); BizUtil.Update(param); //0.소모품삭제 PdjtHtDtl dtl = new PdjtHtDtl(); dtl.SCL_NUM = Convert.ToInt32(row["SCL_NUM"]); dtl.FTR_CDE = row["FTR_CDE"].ToString(); dtl.FTR_IDN = Convert.ToInt32(row["FTR_IDN"]); dtl.SEQ = Convert.ToInt32(row["SEQ"]); BizUtil.Update2(dtl, "DeletePdjtHt"); //1.데이터삭제 param.Clear(); param.Add("SCL_NUM", row["SCL_NUM"]); param.Add("FTR_CDE", row["FTR_CDE"]); param.Add("FTR_IDN", Convert.ToInt32(row["FTR_IDN"])); param.Add("sqlId", "DeleteChscResult"); param.Add("SEQ", Convert.ToInt32(row["SEQ"])); BizUtil.Update(param); } } } catch (Exception) { } // 1.삭제처리 if (Messages.ShowYesNoMsgBox("점검일정을 삭제하시겠습니까?") != MessageBoxResult.Yes) { return; } try { BizUtil.Update2(Dtl, "DeleteChscMaDtl"); } catch (Exception ex) { Messages.ShowErrMsgBox("삭제 처리중 오류가 발생하였습니다." + ex.ToString()); return; } Messages.ShowOkMsgBox(); //화면닫기 btnClose.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); }); //점검승인 this.ApprCmd = new DelegateCommand <object>(delegate(object obj) { // 필수체크 (Tag에 필수체크 표시한 EditBox, ComboBox 대상으로 수행) if (!BizUtil.ValidReq(chkSchDtlView)) { return; } if (Messages.ShowYesNoMsgBox("점검승인 하시겠습니까?") != MessageBoxResult.Yes) { return; } try { BizUtil.Update2(Dtl, "UpdateChscMaAppr"); } catch (Exception) { Messages.ShowErrMsgBox("저장 처리중 오류가 발생하였습니다."); return; } Messages.ShowOkMsgBox(); //화면닫기 btnClose.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); }); //행추가(시설물선택팝업) this.AddFtrSelCmd = new RelayCommand <object>(delegate(object obj) { try { // 지형지물팝업 윈도우 FtrSelView ftrSelView = new FtrSelView(null); ftrSelView.Owner = Window.GetWindow(chkSchDtlView); //FTR_IDN 리턴 if (ftrSelView.ShowDialog() is bool) { string FTR_IDN = ftrSelView.txtFTR_IDN.Text; string FTR_CDE = ftrSelView.txtFTR_CDE.Text; string FTR_NAM = ftrSelView.txtFTR_NAM.Text; string HJD_NAM = ftrSelView.txtHJD_NAM.Text; //저장버튼으로 닫힘 if (!FmsUtil.IsNull(FTR_IDN)) { AddFtrRow(FTR_IDN, FTR_CDE, FTR_NAM, HJD_NAM); //시설물 한건추가 } //닫기버튼으로 닫힘 } } catch (Exception ex) { Messages.ShowErrMsgBox(ex.ToString()); } }); // 그리드저장 this.GrdSaveCmd = new RelayCommand <object>(delegate(object obj) { bool isChecked = false; foreach (ChscResultDtl row in GrdLst) { if ("Y".Equals(row.CHK)) { isChecked = true; break; } } if (!isChecked) { Messages.ShowInfoMsgBox("선택된 항목이 없습니다."); return; } if (Messages.ShowYesNoMsgBox("저장하시겠습니까?") != MessageBoxResult.Yes) { return; } Hashtable param = new Hashtable(); //1.그리드 저장 foreach (ChscResultDtl row in GrdLst) { if (row.CHK != "Y") { continue; } try { row.SCL_NUM = Dtl.SCL_NUM; BizUtil.Update2(row, "SaveChscResult"); } catch (Exception) { Messages.ShowErrMsgBox("저장 처리중 오류가 발생하였습니다."); return; } } //2.점검마스터상태 변경 Hashtable pa = new Hashtable(); pa.Add("sqlId", "UpdateChscMaRes"); pa.Add("SCL_NUM", Dtl.SCL_NUM); BizUtil.Update(pa); //저장처리성공 Messages.ShowOkMsgBox(); //재조회 initModel(); }); // 행삭제 GrdDelCmd this.GrdDelCmd = new RelayCommand <object>(delegate(object obj) { //데이터 직접삭제처리 try { bool isChecked = false; foreach (ChscResultDtl row in GrdLst) { if ("Y".Equals(row.CHK)) { isChecked = true; break; } } if (!isChecked) { Messages.ShowInfoMsgBox("선택된 항목이 없습니다."); return; } if (Messages.ShowYesNoMsgBox("선택 항목을 삭제 하시겠습니까?") == MessageBoxResult.Yes) { foreach (ChscResultDtl row in GrdLst) { Hashtable param = new Hashtable(); try { if ("Y".Equals(row.CHK)) { if (row.SEQ == 0) { //그리드행만 삭제 GrdLst.RemoveAt(GrdLst.IndexOf(row)); return; } else { //0.점검사진삭제 //a.FIL_SEQ 첨부파일삭제 BizUtil.DelFileSeq(row.FIL_SEQ); //b.FILE_MAP 업무파일매핑삭제 param = new Hashtable(); param.Add("sqlId", "DeleteFileMap"); param.Add("BIZ_ID", row.FTR_CDE + row.FTR_IDN); param.Add("FIL_SEQ", row.FIL_SEQ); BizUtil.Update(param); //0.소모품삭제 PdjtHtDtl dtl = new PdjtHtDtl(); dtl.SCL_NUM = row.SCL_NUM; dtl.FTR_CDE = row.FTR_CDE; dtl.FTR_IDN = row.FTR_IDN; dtl.SEQ = row.SEQ; BizUtil.Update2(dtl, "DeletePdjtHt"); //1.데이터삭제 param.Clear(); param.Add("SCL_NUM", row.SCL_NUM); param.Add("FTR_CDE", row.FTR_CDE); param.Add("FTR_IDN", row.FTR_IDN); param.Add("SEQ", row.SEQ); param.Add("sqlId", "DeleteChscResult"); param.Add("SEQ", Convert.ToInt32(row.SEQ)); BizUtil.Update(param); } } } catch (Exception) { Messages.ShowErrMsgBox("삭제 처리중 오류가 발생하였습니다."); return; } } Messages.ShowOkMsgBox(); //재조회 initModel(); } } catch (Exception ex) { Messages.ShowErrMsgBoxLog(ex); } }); }
//맵뷰 클릭이벤트 핸들러 - 상세정보팝업 public async void handlerGeoViewTapped(object sender, GeoViewInputEventArgs e) { try { // PopFct 객체 생성여부 체크관련 - 검증안됨 /* * if (App.Current.Windows.Count > 1) * { * // do your code here, when you have more than one window open state this code will execute * } * * if (FmsUtil.IsWindowOpen<Popup>()) * { * PopFct pop = new PopFct(); * (Activator.GetObject((new PopFct()).GetType(), null) as PopFct).IsOpen = false; * } */ /* * divLayerInfo.PlacementRectangle = new Rect(e.Position.X, e.Position.Y, 250, 300); * divLayerInfo.IsOpen = true; */ // 위치에해당하는 피처찾은 결과 // 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; } // 기존선택해제 if (_selectedFeature != null) { try { // Reset the selection. layers[_selectedLayerNm].ClearSelection(); _selectedFeature = null; } catch (Exception) { } } // 선택처리 layers[_selectedLayerNm].SelectFeature(identifiedFeature); //시설물선택활성화 처리 //_selectedFeature = (ArcGISFeature)identifiedFeature; //선택피처 ArcGISFeature 변환저장 _selectedFeature = (Feature)identifiedFeature; //선택피처 ArcGISFeature 변환저장 //0.선택된 레이어에서 속성정보 가져오기 string _FTR_CDE = identifiedFeature.GetAttributeValue("FTR_CDE").ToString(); string _FTR_IDN = identifiedFeature.GetAttributeValue("FTR_IDN").ToString(); //1.DB시설물조회 후 레이어정보 세팅 if (FmsUtil.IsNull(_FTR_CDE) || FmsUtil.IsNull(_FTR_IDN)) { Messages.ShowErrMsgBox("시설물 DB정보가 없습니다."); return; } // 시설물정보팝업 보이기 ShowFtrPop(_FTR_CDE, _FTR_IDN, e); } catch (Exception) { Console.WriteLine("레이어 featrue click error..."); } }
/// <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("레이어가 존재하지 않습니다."); } }
/// <summary> /// UserControl 시설물페이지 로딩 /// </summary> /// <param name="CBO_FTR_CDE"></param> /// <param name="_FTR_CDE"></param> /// <param name="_FTR_IDN"></param> private void InitPage(string _FTR_CDE, string _FTR_IDN) { switch (_FTR_CDE) { case "SA001": //상수관로 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_PIPE_LM uc = new UC_PIPE_LM(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; uc.btnSel.Visibility = Visibility.Hidden; } break; case "SA002": //급수관로 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_SPLY_LS uc = new UC_SPLY_LS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; uc.btnSel.Visibility = Visibility.Hidden; } break; case "SA003": //스탠파이프 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_STPI_PS uc = new UC_STPI_PS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; uc.btnSel.Visibility = Visibility.Hidden; } break; case "SA100": //상수맨홀 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_MANH_PS uc = new UC_MANH_PS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; uc.btnSel.Visibility = Visibility.Hidden; } break; case "SA110": //수원지 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_HEAD_PS uc = new UC_HEAD_PS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; uc.btnSel.Visibility = Visibility.Hidden; } break; case "SA112": //취수장 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_GAIN_PS uc = new UC_GAIN_PS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; uc.btnSel.Visibility = Visibility.Hidden; } break; case "SA113": //정수장 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_PURI_AS uc = new UC_PURI_AS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; uc.btnSel.Visibility = Visibility.Hidden; } break; case "SA114": //배수지 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_SERV_PS uc = new UC_SERV_PS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; uc.btnSel.Visibility = Visibility.Hidden; } break; case "SA117": //유량계 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_FLOW_PS uc = new UC_FLOW_PS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; uc.btnSel.Visibility = Visibility.Hidden; } break; case "SA118": case "SA119": //급수탑,소화전 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_FIRE_PS uc = new UC_FIRE_PS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; uc.btnSel.Visibility = Visibility.Hidden; } break; case "SA120": //저수조 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_RSRV_PS uc = new UC_RSRV_PS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; uc.btnSel.Visibility = Visibility.Hidden; } break; case "SA121": //수압계 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_PRGA_PS uc = new UC_PRGA_PS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; uc.btnSel.Visibility = Visibility.Hidden; } break; case "SA122": //급수전계량기 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_META_PS uc = new UC_META_PS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; } break; case "SA200": case "SA201": case "SA202": case "SA203": case "SA204": case "SA205": if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_VALV_PS uc = new UC_VALV_PS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; uc.btnSel.Visibility = Visibility.Hidden; } break; case "SA206": //가압펌프장 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_PRES_PS uc = new UC_PRES_PS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; uc.btnSel.Visibility = Visibility.Hidden; } break; case "BZ001": //대블록 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_BLKL_AS uc = new UC_BLKL_AS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; } break; case "BZ002": //중블록 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_BLKM_AS uc = new UC_BLKM_AS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; } break; case "BZ003": //소블록 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { this.cctl.Content = null; } else { UC_BLKS_AS uc = new UC_BLKS_AS(_FTR_CDE, _FTR_IDN); this.cctl.Content = uc; uc.btnDel.Visibility = Visibility.Hidden; uc.btnSave.Visibility = Visibility.Hidden; } break; default: this.cctl.Content = new UC_FLOW_PS(_FTR_CDE, _FTR_IDN); break; } }
/// <summary> /// 레이어 보이기/끄기 - LocalServer버전 /// </summary> /// <param name="_map"></param> /// <param name="layer"></param> /// <param name="chk"></param> public async void ShowLocalServerLayer(MapView _mapView, 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) { } FeatureLayer layer = CmmRun.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) //레이어객체 있으면 단순추가 { // 필터링 인수있으면 하위시설물으로 필터 if (!FmsUtil.IsNull(filterExp)) { layer.DefinitionExpression = filterExp; } _mapView.Map.OperationalLayers.Add(layer); } else //레이어객체 없으면 Shape 로딩 { if (LocalServer.Instance.Status == LocalServerStatus.Started) { // Get the path to the first layer - the local feature service url + layer ID string layerUrl = _localFeatureService.Url + "/" + GetLayerId(_layerNm); // Create the ServiceFeatureTable ServiceFeatureTable myFeatureTable = new ServiceFeatureTable(new Uri(layerUrl)); // Create the Feature Layer from the table FeatureLayer myFeatureLayer = new FeatureLayer(myFeatureTable); CmmRun.layers[_layerNm] = myFeatureLayer; //생성한레이어를 딕셔너리에 저장 // 필터링 인수있으면 하위시설물으로 필터 if (!FmsUtil.IsNull(filterExp)) { myFeatureLayer.DefinitionExpression = filterExp; } //렌더러는 레이어 각각 할당해야하므로 렌더러복사하여 할당 myFeatureLayer.Renderer = CmmRun.uniqueValueRenderer.Clone(); // Add the layer to the map _mapView.Map.OperationalLayers.Add(myFeatureLayer); try { // Wait for the layer to load await myFeatureLayer.LoadAsync(); //한반도이내인 경우만 if (myFeatureLayer.FullExtent.XMax < 14566451.0 && myFeatureLayer.FullExtent.YMax < 5362210.0 && myFeatureLayer.FullExtent.XMin > 13691400.0 && myFeatureLayer.FullExtent.YMin < 3797264.0) { // Set the viewpoint on the MapView to show the layer data await _mapView.SetViewpointGeometryAsync(myFeatureLayer.FullExtent, 50); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error"); } } } } } // 2.레이어 OFF else { // 필터링 인수있으면 하위시설물으로 필터 if (!FmsUtil.IsNull(filterExp)) { layer.DefinitionExpression = filterExp; } if (_mapView.Map.OperationalLayers.Contains(layer)) { _mapView.Map.OperationalLayers.Remove(layer); } else { //off상태 아무것도 안함 } } } catch (Exception) { MessageBox.Show("레이어가 존재하지 않습니다."); } }
/// <summary> /// 그리드저장 /// </summary> private void OnSave(object obj) { bool isChecked = false; foreach (PdjtHtDtl row in GrdLst) { if ("Y".Equals(row.CHK)) { isChecked = true; break; } } if (!isChecked) { Messages.ShowInfoMsgBox("선택된 항목이 없습니다."); return; } //필수체크 foreach (PdjtHtDtl row in GrdLst) { if (row.CHK != "Y") { continue; } if (FmsUtil.IsNull(row.PDH_NUM)) { Messages.ShowErrMsgBox("소모품은 필수입력입니다."); return; } } if (Messages.ShowYesNoMsgBox("저장하시겠습니까?") != MessageBoxResult.Yes) { return; } //그리드 저장 foreach (PdjtHtDtl row in GrdLst) { if (row.CHK != "Y") { continue; } try { BizUtil.Update2(row, "SavePdjtHt"); } catch (Exception) { Messages.ShowErrMsgBox("저장 처리중 오류가 발생하였습니다."); return; } } //저장처리성공 Messages.ShowOkMsgBox(); //재조회 initModel(); }
//맵뷰 클릭이벤트 핸들러 - 상세정보팝업 public async void handlerGeoViewTapped(object sender, GeoViewInputEventArgs e) { try { // 위치에해당하는 피처찾은 결과 // Perform the identify operation. IdentifyLayerResult IR_SEL = await mapView.IdentifyLayerAsync(CmmRun.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; } // 기존선택해제 if (_selectedFeature != null) { try { // Reset the selection. CmmRun.layers[_selectedLayerNm].ClearSelection(); _selectedFeature = null; } catch (Exception) { } } // 선택처리 CmmRun.layers[_selectedLayerNm].SelectFeature(identifiedFeature); //시설물선택활성화 처리 //_selectedFeature = (ArcGISFeature)identifiedFeature; //선택피처 ArcGISFeature 변환저장 _selectedFeature = (Feature)identifiedFeature; //선택피처 ArcGISFeature 변환저장 //0.선택된 레이어에서 속성정보 가져오기 string _FTR_CDE = identifiedFeature.GetAttributeValue("FTR_CDE").ToString(); string _FTR_IDN = identifiedFeature.GetAttributeValue("FTR_IDN").ToString(); //1.DB시설물조회 후 레이어정보 세팅 if (FmsUtil.IsNull(_FTR_CDE) || FmsUtil.IsNull(_FTR_IDN)) { Messages.ShowErrMsgBox("시설물 DB정보가 없습니다."); return; } // 시설물정보팝업 보이기 ShowFtrPop(_FTR_CDE, _FTR_IDN, e); } catch (Exception) { Console.WriteLine("레이어 featrue click error..."); } }
/// <summary> /// UserControl 시설물페이지 로딩 /// </summary> /// <param name="CBO_FTR_CDE"></param> /// <param name="_FTR_CDE"></param> /// <param name="_FTR_IDN"></param> private void InitPage(string CBO_FTR_CDE, string _FTR_CDE, string _FTR_IDN) { editWinView.divBtn.Visibility = Visibility.Collapsed; //이동버튼 숨김 switch (CBO_FTR_CDE) { case "SA001": //상수관로 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_PIPE_LM(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_PIPE_LM)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_PIPE_LM(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "SA002": //급수관로 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_SPLY_LS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_SPLY_LS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_SPLY_LS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "SA003": //스탠파이프 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_STPI_PS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_STPI_PS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_STPI_PS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "SA100": //상수맨홀 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_MANH_PS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_MANH_PS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_MANH_PS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "SA110": //수원지 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_HEAD_PS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_HEAD_PS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_HEAD_PS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "SA112": //취수장 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_GAIN_PS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_GAIN_PS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_GAIN_PS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "SA113": //정수장 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_PURI_AS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_PURI_AS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_PURI_AS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "SA114": //배수지 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_SERV_PS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_SERV_PS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_SERV_PS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "SA117": //유량계 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_FLOW_PS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_FLOW_PS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_FLOW_PS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "SA118": case "SA119": //급수탑,소화전 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_FIRE_PS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_FIRE_PS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_FIRE_PS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "SA120": //저수조 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_RSRV_PS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_RSRV_PS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_RSRV_PS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "SA121": //수압계 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_PRGA_PS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_PRGA_PS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_PRGA_PS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "SA122": //급수전계량기 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_META_PS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_META_PS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_META_PS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "SA200": case "SA201": case "SA202": case "SA203": case "SA204": case "SA205": if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_VALV_PS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_VALV_PS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_VALV_PS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "SA206": //가압펌프장 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_PRES_PS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_PRES_PS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_PRES_PS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "BZ001": //대블록 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_BLKL_AS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_BLKL_AS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_BLKL_AS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "BZ002": //중블록 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_BLKM_AS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_BLKM_AS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_BLKM_AS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; case "BZ003": //소블록 if (FmsUtil.IsNull(_FTR_CDE) && FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = null; } else if (FmsUtil.IsNull(_FTR_IDN)) { editWinView.cctl.Content = new UC_BLKS_AS(_FTR_CDE); //신규페이지 NEW_FTR_IDN = ((UC_BLKS_AS)editWinView.cctl.Content).txtFTR_IDN.EditValue.ToString(); } else { editWinView.cctl.Content = new UC_BLKS_AS(_FTR_CDE, _FTR_IDN); //상세페이지 } break; default: editWinView.cctl.Content = new UC_FLOW_PS(_FTR_CDE, _FTR_IDN); break; } editWinView.divBtn.Visibility = Visibility.Visible; //이동버튼 보임 }
//맵뷰 클릭이벤트 핸들러 - 상세정보팝업 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..."); } }
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()]); }); }
/// <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); } }
/// <summary> /// 그리드저장 /// </summary> private void OnSave(object obj) { bool isChecked = false; foreach (PdjtMaDtl row in GrdLst) { if ("Y".Equals(row.CHK)) { isChecked = true; break; } } if (!isChecked) { Messages.ShowInfoMsgBox("선택된 항목이 없습니다."); return; } //필수체크 foreach (PdjtMaDtl row in GrdLst) { if (row.CHK != "Y") { continue; } if (FmsUtil.IsNull(row.PDT_CAT_CDE)) { Messages.ShowErrMsgBox("구분은 필수입력입니다."); return; } if (FmsUtil.IsNull(row.PDT_NAM)) { Messages.ShowErrMsgBox("품명은 필수입력입니다."); return; } } if (Messages.ShowYesNoMsgBox("저장하시겠습니까?") != MessageBoxResult.Yes) { return; } //그리드 저장 foreach (PdjtMaDtl row in GrdLst) { if (row.CHK != "Y") { continue; } try { BizUtil.Update2(row, "SavePdjtMa"); } catch (Exception ex) { Messages.ShowErrMsgBox("저장 처리중 오류가 발생하였습니다." + ex.Message); return; } } //저장처리성공 Messages.ShowOkMsgBox(); //재조회 SearchAction(null); }
//맵뷰 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); } }
//해당 영역에 존재하는 레이어 피처찾아서 활성화, 팝업창 private void findFtrByRegion(IFeatureLayer layer, IGeometry region) { ISpatialFilter pSF = new SpatialFilter(); pSF.Geometry = region; pSF.GeometryField = "Shape"; pSF.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; //pSF.SpatialRel = esriSpatialRelEnum.esriSpatialRelOverlaps; //pSF.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains; //pSF.SpatialRel = esriSpatialRelEnum.esriSpatialRelEnvelopeIntersects; IFeatureCursor pDestCur = layer.Search(pSF, false); IFeature pFeat = pDestCur.NextFeature(); while (pFeat != null) { // do something with pFeat //var ftr_cde = pFeat.Value[2]; //var ftr_idn = pFeat.Value[0]; string ftr_cde = ""; string ftr_idn = ""; //피처의 시설물코드,관리번호 알아내기 for (int i = 0; i < pFeat.Fields.FieldCount; i++) { if ("ftr_cde".Equals(pFeat.Fields.Field[i].Name.ToLower())) { ftr_cde = pFeat.Value[i]; break; } } for (int i = 0; i < pFeat.Fields.FieldCount; i++) { if ("ftr_idn".Equals(pFeat.Fields.Field[i].Name.ToLower())) { ftr_idn = Convert.ToString(pFeat.Value[i]); break; } } if (FmsUtil.IsNull(ftr_cde) || FmsUtil.IsNull(ftr_idn)) { MessageBox.Show("시설물정보가 없습니다."); return; } //1.셀렉트처리 필터링 IQueryFilter qfltr = new QueryFilter(); qfltr.WhereClause = " FTR_CDE = '" + ftr_cde + "' AND FTR_IDN = " + ftr_idn; IFeatureSelection fsel = layer as IFeatureSelection; fsel.Clear(); fsel.SelectFeatures(qfltr, esriSelectionResultEnum.esriSelectionResultAdd, true); mapControl.Refresh(); //0.시설물팝업호출 int ftr_cde_len = 0; try { ftr_cde_len = (Convert.ToString(ftr_cde) as string).Length; } catch (Exception) {} if (ftr_cde_len == 5 && !FmsUtil.IsNull(ftr_idn)) //시설물코드,번호가 유효한경우만 { FtrPopView ftrPopView = new FtrPopView(ftr_cde, ftr_idn); try { //타이틀 ftrPopView.lbTitle.Content = BizUtil.GetCodeNm("Select_FTR_LIST2", ftr_cde); } catch (Exception) { ftrPopView.lbTitle.Content = "시설물정보"; } if (ftrPopView.ShowDialog() is bool) { //재조회 fsel.Clear(); mapControl.Refresh(); } } break; //pFeat = pDestCur.NextFeature(); //첫번째 걸린 시설물만 팝업띄우자 } }