public override void OnClick() { frmInputValue frmInputValue = new frmInputValue(); frmInputValue.Text = "输入方向"; if (SketchShareEx.IsFixDirection) { frmInputValue.InputValue = SketchShareEx.FixDirection; } else { ILine line = new Line(); line.PutCoords(SketchShareEx.LastPoint, SketchShareEx.m_pAnchorPoint); frmInputValue.InputValue = 180.0 * line.Angle / 3.1415926535897931; } if (frmInputValue.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.FixDirection(frmInputValue.InputValue); } }
public override void OnClick() { frmInputValue frmInputValue = new frmInputValue(); frmInputValue.Text = "输入长度"; if (SketchShareEx.IsFixLength) { frmInputValue.InputValue = SketchShareEx.FixLength; } else { ILine line = new Line(); line.PutCoords(SketchShareEx.LastPoint, SketchShareEx.m_pAnchorPoint); frmInputValue.InputValue = line.Length; } if (frmInputValue.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.FixLength(frmInputValue.InputValue); } }
public override void OnClick() { frmInputValue frmInputValue = new frmInputValue(); frmInputValue.Text = "距离"; frmInputValue.InputValue = 0.0; if (frmInputValue.ShowDialog() == System.Windows.Forms.DialogResult.OK) { double inputValue = frmInputValue.InputValue; IEnumFeature enumFeature = _context.FocusMap.FeatureSelection as IEnumFeature; enumFeature.Reset(); IFeature feature = enumFeature.Next(); new GeometryBag(); IFeatureClass featureClass = Yutai.ArcGIS.Common.Editor.Editor.CurrentEditTemplate.FeatureLayer.FeatureClass; Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.StartEditOperation(); int index = featureClass.FindField(featureClass.ShapeFieldName); IGeometryDef geometryDef = featureClass.Fields.get_Field(index).GeometryDef; while (feature != null) { try { ITopologicalOperator topologicalOperator = feature.ShapeCopy as ITopologicalOperator; IGeometry geometry = topologicalOperator.Buffer(inputValue); if (featureClass.ShapeType == esriGeometryType.esriGeometryPolyline) { IPolyline polyline = new Polyline() as IPolyline; (polyline as ISegmentCollection).AddSegmentCollection(geometry as ISegmentCollection); if (!polyline.IsEmpty) { IFeature feature2 = featureClass.CreateFeature(); if (geometryDef.HasZ) { (polyline as IZAware).ZAware = true; double num; double constantZ; geometryDef.SpatialReference.GetZDomain(out num, out constantZ); (polyline as IZ).SetConstantZ(constantZ); } feature2.Shape = polyline; feature2.Store(); } } else { IFeature feature2 = featureClass.CreateFeature(); if (geometryDef.HasZ) { (geometry as IZAware).ZAware = true; double num; double constantZ; geometryDef.SpatialReference.GetZDomain(out num, out constantZ); (geometry as IZ).SetConstantZ(constantZ); } feature2.Shape = geometry; feature2.Store(); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } feature = enumFeature.Next(); } Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.StopEditOperation(); _context.ActiveView.Refresh(); } }