private void MapFrame_LayerSelected(object sender, LayerSelectedEventArgs e) { if (!e.IsSelected && e.Layer == _activeLayer) { _activeLayer = null; if (_moveVertexFunction != null) { _moveVertexFunction.ClearSelection(); // changed by jany_ (2016-02-24) make sure highlighted features are reset too to prevent exception } return; } _activeLayer = e.Layer as IFeatureLayer; if (_activeLayer == null) { return; } if (_moveVertexFunction != null) { UpdateMoveVertexFunctionLayer(); } if (_addShapeFunction != null) // changed by jany_ (2016-02-24) update both because moveFeature might not be the active function just because it is not null { UpdateAddShapeFunctionLayer(); } }
private void SetActiveLayer(ILayer layer) { IFeatureLayer fl = layer as IFeatureLayer; if (fl == null) { _activeLayer = null; _addShape.Enabled = false; if (_moveVertexFunction != null) { _moveVertexFunction.ClearSelection(); // To prevent nullReference Exception when occrus MouseMove. UpdateMoveVertexFunctionLayer(); } if (_addShapeFunction != null) { _addShapeFunction.DeleteShape(null, null); // To clean the map while there is pending shape editing. UpdateAddShapeFunctionLayer(); } } else { _activeLayer = fl; _addShape.Enabled = true; } }
/// <summary> /// 맵프레임에서 레이어를 선택하면, 편집 레이어로 설정한다. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MapFrameLayerSelected(object sender, LayerSelectedEventArgs e) { if (!e.IsSelected && e.Layer == _activeLayer) { _activeLayer = null; // 예외를 방지하기 위해 강조 표시된 상태를 재설정합니다. _moveVertexFunction?.ClearSelection(); return; } _activeLayer = e.Layer as IFeatureLayer; if (_activeLayer == null) { _addShapeBtn.Enabled = false; _moveVertexBtn.Enabled = false; return; } // [20200409] fdragons _geoMap.FunctionMode = FunctionMode.Pan; _geoMap.Cursor = Cursors.Hand; // 편집중인 도형이 널이 아니기 때문에 둘 다 업데이트한다. if (_moveVertexFunction != null) { UpdateMoveVertexFunctionLayer(); } if (_addShapeFunction != null) { UpdateAddShapeFunctionLayer(); } }
private void UpdateMoveVertexFunctionLayer() { _moveVertexFunction.ClearSelection(); // changed by jany_ (2016-02-24) make sure highlighted features are reset too to prevent exception _moveVertexFunction.Layer = _activeLayer; SetSnapLayers(_moveVertexFunction); }