private async void DrawBarrier_Click(UIAlertAction action) { // Disable the button so the user recognizes that they are drawing a barrier. try { // Let the user draw on the map view using the polyline sketch mode. SketchCreationMode creationMode = SketchCreationMode.Polyline; Geometry geometry = await _myMapView.SketchEditor.StartAsync(creationMode, false); // Symbol for the barriers. SimpleLineSymbol barrierSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.Black, 5.0f); // Create the graphic to be used for barriers. Graphic barrierGraphic = new Graphic(geometry, new Dictionary <string, object>() { { "Type", "Barrier" } }, barrierSymbol) { ZIndex = 1 }; // Add a graphic from the polyline the user drew. _myMapView.GraphicsOverlays[0].Graphics.Add(barrierGraphic); } catch (TaskCanceledException) { // Ignore this exception. } catch (Exception ex) { // Report exceptions. CreateErrorDialog("Error drawing barrier:\n" + ex.Message); } }
private async void DrawButtonClick(object sender, RoutedEventArgs e) { try { // Set the focus to the map view(close the flyout panel) DrawToolsFlyout.Hide(); // Let the user draw on the map view using the chosen sketch mode SketchCreationMode creationMode = (SketchCreationMode)SketchModeComboBox.SelectedItem; Esri.ArcGISRuntime.Geometry.Geometry geometry = await MyMapView.SketchEditor.StartAsync(creationMode, true); // Create and add a graphic from the geometry the user drew Graphic graphic = CreateGraphic(geometry); _sketchOverlay.Graphics.Add(graphic); // Enable/disable the clear and edit buttons according to whether or not graphics exist in the overlay ClearButton.IsEnabled = _sketchOverlay.Graphics.Count > 0; EditButton.IsEnabled = _sketchOverlay.Graphics.Count > 0; } catch (TaskCanceledException) { // Ignore ... let the user cancel drawing } catch (Exception ex) { // Report exceptions var dialog = new MessageDialog("Error drawing graphic shape: " + ex.Message); dialog.ShowAsync(); } }
private async void DrawButtonClick(object sender, RoutedEventArgs e) { //////////////////////////////////////////////////////////////////////////////////////////////////// //MainWindow t = new MainWindow(); //GraphicsOverlay _sketchOverlay = MainWindow.graphicsOverlay; try { // Let the user draw on the map view using the chosen sketch mode SketchCreationMode creationMode = (SketchCreationMode)SketchModeComboBox.SelectedItem; Esri.ArcGISRuntime.Geometry.Geometry geometry = await myMapView.SketchEditor.StartAsync(creationMode, true); // Create and add a graphic from the geometry the user drew Graphic graphic = CreateGraphic(geometry); _sketchOverlay.Graphics.Add(graphic); // Enable/disable the clear and edit buttons according to whether or not graphics exist in the overlay ClearButton.IsEnabled = _sketchOverlay.Graphics.Count > 0; EditButton.IsEnabled = _sketchOverlay.Graphics.Count > 0; } catch (TaskCanceledException) { // Ignore ... let the user cancel drawing } catch (Exception ex) { // Report exceptions MessageBox.Show("绘制控件发生错误 : " + ex.Message); } }
private async void OnSketchModeItemClicked(object sender, PopupMenu.MenuItemClickEventArgs e) { try { // Get the title of the selected menu item (sketch mode) string sketchModeName = e.Item.TitleCondensedFormatted.ToString(); // Let the user draw on the map view using the chosen sketch mode SketchCreationMode creationMode = (SketchCreationMode)_sketchModeDictionary[sketchModeName]; Geometry geometry = await _myMapView.SketchEditor.StartAsync(creationMode, true); // Create and add a graphic from the geometry the user drew Graphic graphic = CreateGraphic(geometry); _sketchOverlay.Graphics.Add(graphic); } catch (TaskCanceledException) { // Ignore ... let the user cancel drawing } catch (Exception ex) { // Report exceptions AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); alertBuilder.SetTitle("Error drawing graphic shape"); alertBuilder.SetMessage(ex.Message); alertBuilder.Show(); } }
private async void _startSketchButton_Click(object sender, RoutedEventArgs e) { // フリーハンドでの作図(スケッチ モード)を開始する if (_startSketchButton.Content.ToString() == "作図開始") { _startSketchButton.Content = "作図停止"; SketchCreationMode creationMode = SketchCreationMode.FreehandLine; try { await _mainMapView.SketchEditor.StartAsync(creationMode, true); } catch (TaskCanceledException) { } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { } } else { // スケッチ モードを停止する _startSketchButton.Content = "作図開始"; if (_mainMapView.SketchEditor.CancelCommand.CanExecute(null)) { _mainMapView.SketchEditor.CancelCommand.Execute(null); } } }
private async void DrawButtonClick(object sender, RoutedEventArgs e) { MyMapView.GeoViewTapped -= MapViewTapped_Mouse_Point; _sketchOverlay.Graphics.Clear(); routeline = null; polygondrawgrp = null; try { // Let the user draw on the map view using the chosen sketch mode SketchCreationMode creationMode = (SketchCreationMode)SketchModeComboBox.SelectedItem; Esri.ArcGISRuntime.Geometry.Geometry geometry = await MyMapView.SketchEditor.StartAsync(creationMode, true); Graphic graphic = CreateGraphic(geometry); _sketchOverlay.Graphics.Add(graphic); if (geometry.GeometryType.ToString() == "Polyline") { routeline = coordinatesystem_polyline(geometry); } else if (geometry.GeometryType.ToString() == "Polygon") { polygondrawgrp = coordinatesystem_polygon(graphic); } } catch (TaskCanceledException) { // Ignore ... let the user cancel drawing } catch (Exception ex) { // Report exceptions MessageBox.Show("Error drawing graphic shape: " + ex.Message); } MyMapView.GeoViewTapped += MapViewTapped_Mouse_Point; }
private async void SketchGeometry(string sketchModeName) { try { // Let the user draw on the map view using the chosen sketch mode SketchCreationMode creationMode = (SketchCreationMode)_sketchModeDictionary[sketchModeName]; Geometry geometry = await _myMapView.SketchEditor.StartAsync(creationMode, true); // Create and add a graphic from the geometry the user drew Graphic graphic = CreateGraphic(geometry); _sketchOverlay.Graphics.Add(graphic); } catch (TaskCanceledException) { // Ignore ... let the user cancel drawing } catch (Exception ex) { // Report exceptions AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); alertBuilder.SetTitle("Error drawing graphic shape"); alertBuilder.SetMessage(ex.Message); alertBuilder.Show(); } }
private async void myMeasureLine_Click(object sender, RoutedEventArgs e) { // 找到鼠标点击位置的坐标 myMapView.GeoViewTapped += MyMapViewOnGeoViewTapped_Line; myMapView.GeoViewTapped -= MyMapViewOnGeoViewTapped_Area; myMeasureLine.IsEnabled = false; try { // 0表示point SketchCreationMode creationMode = SketchCreationMode.Polyline; Esri.ArcGISRuntime.Geometry.Geometry geometry = await myMapView.SketchEditor.StartAsync(creationMode, true); // Create and add a graphic from the geometry the user drew Graphic graphic = CreateGraphic(geometry); measureOverlay.Graphics.Add(graphic); } catch (TaskCanceledException) { // Ignore ... let the user cancel drawing } catch (Exception ex) { // Report exceptions MessageBox.Show("Error drawing graphic shape: " + ex.Message); } }
private async void DrawBarrierButton_Click(object sender, RoutedEventArgs e) { try { // Let the user draw on the map view using the polyline sketch mode. SketchCreationMode creationMode = SketchCreationMode.Polyline; Geometry geometry = await MyMapView.SketchEditor.StartAsync(creationMode, false); // Symbol for the barriers. SimpleLineSymbol barrierSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.Black, 5.0f); // Create the graphic to be used for barriers. Graphic barrierGraphic = new Graphic(geometry, new Dictionary <string, object>() { { "Type", "Barrier" } }, barrierSymbol) { ZIndex = 1 }; // Add a graphic from the polyline the user drew. MyMapView.GraphicsOverlays[0].Graphics.Add(barrierGraphic); } catch (TaskCanceledException) { // Ignore this exception. } catch (Exception ex) { // Report exceptions. await new MessageDialog("Error drawing barrier:\n" + ex.Message, "Sample error").ShowAsync(); } }
private async void DrawButtonClick(object sender, EventArgs e) { try { // Hide the draw/edit tools DrawToolsGrid.IsVisible = false; // Let the user draw on the map view using the chosen sketch mode SketchCreationMode creationMode = (SketchCreationMode)SketchModePicker.SelectedIndex; Esri.ArcGISRuntime.Geometry.Geometry geometry = await MyMapView.SketchEditor.StartAsync(creationMode, true); // Create and add a graphic from the geometry the user drew Graphic graphic = CreateGraphic(geometry); _sketchOverlay.Graphics.Add(graphic); // Enable/disable the clear and edit buttons according to whether or not graphics exist in the overlay ClearButton.IsEnabled = _sketchOverlay.Graphics.Count > 0; EditButton.IsEnabled = _sketchOverlay.Graphics.Count > 0; } catch (TaskCanceledException) { // Ignore ... let the user cancel drawing } catch (Exception ex) { // Report exceptions await DisplayAlert("Error", "Error drawing graphic shape: " + ex.Message, "OK"); } }
} // end CreateGraphic /// <summary> /// Draw Button Callback /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void DrawButtonClick(object sender, RoutedEventArgs e) { if (selectedLayers == null) { MessageBox.Show("Please select at least one layer", "LAYER SELECTION ERROR"); haveLayer = false; } else if (selectedLayers.Count < 1) { haveLayer = false; MessageBox.Show("Please select at least one layer", "LAYER SELECTION ERROR"); } else try { // Clear out previous graphics if they exist sketchOverlay.Graphics.Clear(); // Set Buttons AOIDraw.IsEnabled = true; AOIClear.IsEnabled = true; AOICancel.IsEnabled = true; AOISelect.IsEnabled = true; // Create graphics area for a redrawable rectangle w/labels SketchCreationMode creationMode = (SketchCreationMode)6; SketchEditConfiguration sketchEdit = new SketchEditConfiguration { AllowMove = true, AllowRotate = false, ResizeMode = (SketchResizeMode)1 }; // Let the user draw on the map view using the chosen sketch mode Esri.ArcGISRuntime.Geometry.Geometry geometry = await BasemapView.SketchEditor.StartAsync(creationMode, true); // Create and add a graphic from the geometry the user drew Graphic graphic = CreateGraphic(geometry); sketchOverlay.Graphics.Add(graphic); haveSketch = true; } catch (TaskCanceledException) { sketchOverlay.Graphics.Clear(); haveSketch = false; AOIDraw.IsEnabled = true; AOIClear.IsEnabled = true; AOICancel.IsEnabled = true; AOISelect.IsEnabled = true; } catch (Exception ex) { // Report exceptions MessageBox.Show("Error drawing graphic shape: " + ex.Message); } } // end DrawButtonClick
private async void DrawBarrierButtonClick(object sender, EventArgs e) { // Finish any drawings in progress. if (_barrierButton.Text != "Draw barrier") { // Finish the sketch. if (_myMapView.SketchEditor.CompleteCommand.CanExecute(null)) { _myMapView.SketchEditor.CompleteCommand.Execute(null); } // Update the UI. _barrierButton.Text = "Draw barrier"; return; } try { // Update the UI. _barrierButton.Text = "Finish drawing"; // Let the user draw on the map view using the polyline sketch mode. SketchCreationMode creationMode = SketchCreationMode.Polyline; Geometry geometry = await _myMapView.SketchEditor.StartAsync(creationMode, false); // Symbol for the barriers. SimpleLineSymbol barrierSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.Black, 5.0f); // Create the graphic to be used for barriers. Graphic barrierGraphic = new Graphic(geometry, new Dictionary <string, object>() { { "Type", "Barrier" } }, barrierSymbol) { ZIndex = 1 }; // Add a graphic from the polyline the user drew. _myMapView.GraphicsOverlays[0].Graphics.Add(barrierGraphic); } catch (TaskCanceledException) { // Ignore this exception. } catch (Exception ex) { // Report exceptions. CreateErrorDialog("Error drawing barrier:\n" + ex.Message); } // Enable the button when the user is done. _barrierButton.Enabled = true; }
private async void DrawButtonClick(object sender, EventArgs e) { try { DrawToolsGrid.IsVisible = false; SketchCreationMode creationMode = (SketchCreationMode)SketchModePicker.SelectedIndex; var userSelectedDrawing = SketchModePicker.SelectedItem.ToString().ToUpper(); switch (userSelectedDrawing) { case "MULTIPOINT": { creationMode = SketchCreationMode.Multipoint; break; } case "RECTANGLE": { creationMode = SketchCreationMode.Rectangle; break; } case "CIRCLE": { creationMode = SketchCreationMode.Circle; break; } default: { break; } } Esri.ArcGISRuntime.Geometry.Geometry geometry = await WorldMapView.SketchEditor.StartAsync(creationMode, true); Graphic graphic = CreateGraphic(geometry); _sketchOverlay.Graphics.Add(graphic); ClearButton.IsEnabled = _sketchOverlay.Graphics.Count > 0; EditButton.IsEnabled = _sketchOverlay.Graphics.Count > 0; } catch (TaskCanceledException) { } catch (Exception ex) { await Application.Current.MainPage.DisplayAlert("Error", "Error drawing graphic shape: " + ex.Message, "OK"); } }
private void completecommand(SketchCreationMode sketch) { try { if (MyMapView.SketchEditor.CompleteCommand.CanExecute(null)) { MyMapView.SketchEditor.CompleteCommand.Execute(null); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public async Task CreateNewGeometry(SketchCreationMode creationMode, bool measure = false) { if (IsActive) { return; } try { IsActive = true; SketchEditor.GeometryChanged += SketchEditor_GeometryChanged; var geometry = await SketchEditor.StartAsync(creationMode, new SketchEditConfiguration()); if (geometry == null || measure) { return; } // Creates a sqlite object to save data var item = new GeometryItem { Color = Color.Red.Name, GeometryType = geometry.GeometryType.ToString(), GeometryJson = geometry.ToJson() }; // Saves data await DatabaseRepository.Current.InsertAsync(item); // Creates graphic var graphic = GraphicFactory.Current.CreateGraphic(geometry, Color.Red, item.Id); // Add graphic to overlay OverlayProvider.Current.GeometryOverlay.Graphics.Add(graphic); } catch (Exception ex) { Debug.WriteLine("CreateNewGeometry Exception: " + ex.Message); } finally { IsActive = false; IsGeometryInfoVisible = false; SketchEditor.GeometryChanged -= SketchEditor_GeometryChanged; } }
private async void DrawBarrierButton_Click(object sender, EventArgs e) { // Finish drawing barriers if started. if (DrawBarrierButton.Text != "Draw barrier") { if (MyMapView.SketchEditor.CompleteCommand.CanExecute(null)) { MyMapView.SketchEditor.CompleteCommand.Execute(null); } DrawBarrierButton.Text = "Draw barrier"; return; } try { // Update the UI. DrawBarrierButton.Text = "Finish drawing"; // Let the user draw on the map view using the polyline sketch mode. SketchCreationMode creationMode = SketchCreationMode.Polyline; Geometry geometry = await MyMapView.SketchEditor.StartAsync(creationMode, false); // Symbol for the barriers. SimpleLineSymbol barrierSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.Black, 5.0f); // Create the graphic to be used for barriers. Graphic barrierGraphic = new Graphic(geometry, new Dictionary <string, object>() { { "Type", "Barrier" } }, barrierSymbol) { ZIndex = 1 }; // Add a graphic from the polyline the user drew. MyMapView.GraphicsOverlays[0].Graphics.Add(barrierGraphic); } catch (TaskCanceledException) { // Ignore this exception. } catch (Exception ex) { // Report exceptions. await Application.Current.MainPage.DisplayAlert("Error", "Error drawing barrier:\n" + ex.Message, "OK"); } }
private async void PlaceFacilites_Click(object sender, EventArgs e) { // Disable the button so the user recognizes that they are placing a facility. _addFacilitiesButton.Enabled = false; _addFacilitiesButton.SetTitleColor(UIColor.Gray, UIControlState.Disabled); try { // Let the user tap on the map view using the point sketch mode. SketchCreationMode creationMode = SketchCreationMode.Point; Geometry geometry = await _myMapView.SketchEditor.StartAsync(creationMode, false); // Symbology for a facility. PictureMarkerSymbol facilitySymbol = new PictureMarkerSymbol(new Uri("http://static.arcgis.com/images/Symbols/SafetyHealth/Hospital.png")) { Height = 30, Width = 30 }; // Create a graphic for the facility. Graphic facilityGraphic = new Graphic(geometry, new Dictionary <string, object>() { { "Type", "Facility" } }, facilitySymbol) { ZIndex = 2 }; // Add the graphic to the graphics overlay. _myMapView.GraphicsOverlays[0].Graphics.Add(facilityGraphic); } catch (TaskCanceledException) { // Ignore this exception. } catch (Exception ex) { // Report exceptions. CreateErrorDialog("Error drawing facility:\n" + ex.Message); } // Enable the button when the user is done. _addFacilitiesButton.Enabled = true; _addFacilitiesButton.SetTitleColor(UIColor.Blue, UIControlState.Normal); }
private void SketchModeTab_OnItemTapped(object sender, int e) { switch (e) { case 0: _creationMode = SketchCreationMode.Circle; break; case 1: _creationMode = SketchCreationMode.Rectangle; break; case 2: _creationMode = SketchCreationMode.FreehandLine; break; case 3: _creationMode = SketchCreationMode.FreehandPolygon; break; } }
private async void SketchGeometry(string sketchModeName) { try { // Let the user draw on the map view using the chosen sketch mode SketchCreationMode creationMode = (SketchCreationMode)_sketchModeDictionary[sketchModeName]; Esri.ArcGISRuntime.Geometry.Geometry geometry = await _myMapView.SketchEditor.StartAsync(creationMode, true); // Create and add a graphic from the geometry the user drew Graphic graphic = CreateGraphic(geometry); _sketchOverlay.Graphics.Add(graphic); } catch (TaskCanceledException) { // Ignore ... let the user cancel drawing } catch (Exception ex) { // Report exceptions UIAlertView alert = new UIAlertView("Error", "Error drawing graphic shape: " + ex.Message, null, "OK", null); } }
private async void DrawFacilities(UIAlertAction action) { try { // Let the user tap on the map view using the point sketch mode. SketchCreationMode creationMode = SketchCreationMode.Point; Geometry geometry = await _myMapView.SketchEditor.StartAsync(creationMode, true); // Symbology for a facility. PictureMarkerSymbol facilitySymbol = new PictureMarkerSymbol(new Uri("https://static.arcgis.com/images/Symbols/SafetyHealth/Hospital.png")) { Height = 30, Width = 30 }; // Create a graphic for the facility. Graphic facilityGraphic = new Graphic(geometry, new Dictionary <string, object>() { { "Type", "Facility" } }, facilitySymbol) { ZIndex = 2 }; // Add the graphic to the graphics overlay. _myMapView.GraphicsOverlays[0].Graphics.Add(facilityGraphic); } catch (TaskCanceledException) { // Ignore this exception. } catch (Exception ex) { // Report exceptions. CreateErrorDialog("Error drawing facility:\n" + ex.Message); } }
private async void PlaceFacilityButton_Click(object sender, RoutedEventArgs e) { try { // Let the user tap on the map view using the point sketch mode. SketchCreationMode creationMode = SketchCreationMode.Point; Geometry geometry = await MyMapView.SketchEditor.StartAsync(creationMode, false); // Symbology for a facility. PictureMarkerSymbol facilitySymbol = new PictureMarkerSymbol(new Uri("http://static.arcgis.com/images/Symbols/SafetyHealth/Hospital.png")) { Height = 30, Width = 30 }; // Create a graphic for the facility. Graphic facilityGraphic = new Graphic(geometry, new Dictionary <string, object>() { { "Type", "Facility" } }, facilitySymbol) { ZIndex = 2 }; // Add the graphic to the graphics overlay. MyMapView.GraphicsOverlays[0].Graphics.Add(facilityGraphic); } catch (TaskCanceledException) { // Ignore this exception. } catch (Exception ex) { // Report exceptions. await new MessageDialog("Error drawing facility:\n" + ex.Message, "Sample error").ShowAsync(); } }
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()]); }); }