public IGeometryBag ConstructPolygonByLine(IGeometryBag igeometryBag_0) { int i; IPolygon polygon; IGeometryCollection geometryBagClass = new GeometryBag() as IGeometryCollection; object value = Missing.Value; IArray array = this.SplitLine(igeometryBag_0); int[] numArray = new int[array.Count]; IArray arrayClass = new Array(); for (i = 0; i < array.Count; i++) { numArray[i] = 0; } IGeometry element = null; IGeometry geometry = null; for (i = 0; i < array.Count; i++) { element = array.Element[i] as IGeometry; IPolyline polyline = (IPolyline)element; geometry = element; if (this.method_3(array, polyline.FromPoint) != 1 && this.method_3(array, polyline.ToPoint) != 1) { if (!polyline.IsClosed) { if ((numArray[i] & 2) == 0) { numArray[i] = numArray[i] | 2; polygon = this.BulidPoly(array, numArray, geometry, false); if (polygon != null) { geometryBagClass.AddGeometry(polygon, ref value, ref value); } } if ((numArray[i] & 1) == 0) { numArray[i] = numArray[i] | 1; polygon = this.BulidPoly(array, numArray, geometry, true); if (polygon != null) { geometryBagClass.AddGeometry(polygon, ref value, ref value); } } } else { ISegmentCollection polygonClass = new Polygon() as ISegmentCollection; polygonClass.AddSegmentCollection((ISegmentCollection)polyline); polygon = (IPolygon)polygonClass; ((ITopologicalOperator)polygon).Simplify(); geometryBagClass.AddGeometry(polygon, ref value, ref value); } } } return((IGeometryBag)geometryBagClass); }
private void method_5() { this.bool_6 = true; this.bool_1 = false; IEnumFeature enumFeature = _context.FocusMap.FeatureSelection as IEnumFeature; IGeometryCollection geometryCollection = new GeometryBag() as IGeometryCollection; enumFeature.Reset(); IFeature feature = enumFeature.Next(); object value = Missing.Value; while (feature != null) { esriGeometryType geometryType = feature.Shape.GeometryType; if (geometryType == esriGeometryType.esriGeometryPolygon || geometryType == esriGeometryType.esriGeometryPolyline) { IClone clone = feature.Shape as IClone; geometryCollection.AddGeometry(clone.Clone() as IGeometry, ref value, ref value); this.bool_4 = true; } feature = enumFeature.Next(); } if (this.bool_2) { this.isegmentGraph_0.SetEmpty(); this.isegmentGraphCursor_0 = null; } this.isegmentGraph_0.Load(geometryCollection as IEnumGeometry, false, true); this.bool_2 = false; }
private void method_2() { this.bool_0 = false; IEnumFeature featureSelection = this.imap_0.FeatureSelection as IEnumFeature; IGeometryCollection geometryBagClass = new GeometryBag() as IGeometryCollection; featureSelection.Reset(); for (IFeature i = featureSelection.Next(); i != null; i = featureSelection.Next()) { esriGeometryType geometryType = i.Shape.GeometryType; if ((geometryType == esriGeometryType.esriGeometryPolygon ? true : geometryType == esriGeometryType.esriGeometryPolyline)) { IClone shape = i.Shape as IClone; object value = Missing.Value; geometryBagClass.AddGeometry(shape.Clone() as IGeometry, ref value, ref value); this.bool_0 = true; } } this.isegmentGraph_0.SetEmpty(); this.isegmentGraph_0.Load(geometryBagClass as IEnumGeometry, false, true); }
private void CreateResultElements() { IGeometryCollection geometryCollection = new GeometryBag() as IGeometryCollection; for (int i = 0; i < this._networkInfo.arrayList_1.Count; i++) { object missing = Type.Missing; IFeature feature = (IFeature)this._networkInfo.arrayList_1[i]; geometryCollection.AddGeometry(feature.ShapeCopy, ref missing, ref missing); } if (this._networkInfo.arrayList_1.Count > 0) { IRgbColor rgbColor = new RgbColor(); rgbColor.Red = (255); rgbColor.Green = (0); rgbColor.Blue = (255); IGraphicsContainer graphicsContainer = (IGraphicsContainer)m_iApp.ActiveView; for (int j = 0; j < geometryCollection.GeometryCount; j++) { ILineElement lineElement = new LineElement() as ILineElement; IElement element = (IElement)lineElement; element.Geometry = (geometryCollection.get_Geometry(j)); ILineElement arg_F5_0 = lineElement; ISimpleLineSymbol simpleLineSymbolClass = new SimpleLineSymbol(); simpleLineSymbolClass.Color = (rgbColor); simpleLineSymbolClass.Width = (10.0); simpleLineSymbolClass.Style = (0); arg_F5_0.Symbol = (simpleLineSymbolClass); graphicsContainer.AddElement(element, 0); } IEnvelope envelope = ((IGeometry)geometryCollection).Envelope; envelope.Expand(1.2, 1.2, true); m_iApp.ActiveView.Extent = (envelope); m_iApp.ActiveView.Refresh(); } }
private IGeometryCollection method_5(IGeometryCollection igeometryCollection_0, bool bool_1, IPoint ipoint_0) { int i; object value = Missing.Value; int geometryCount = igeometryCollection_0.GeometryCount; double[] numArray = new double[geometryCount]; double[] numArray1 = new double[geometryCount - 1]; for (i = 0; i < geometryCount; i++) { ICurve geometry = (ICurve)igeometryCollection_0.Geometry[i]; ILine lineClass = new Line(); IPointCollection pointCollection = (IPointCollection)geometry; if (CommonHelper.distance(geometry.FromPoint, ipoint_0) >= CommonHelper.distance(geometry.ToPoint, ipoint_0)) { numArray[i] = CommonHelper.azimuth(pointCollection.Point[pointCollection.PointCount - 1], pointCollection.Point[pointCollection.PointCount - 2]); } else { numArray[i] = CommonHelper.azimuth(pointCollection.Point[0], pointCollection.Point[1]); } } for (i = 1; i < geometryCount; i++) { numArray1[i - 1] = numArray[i] - numArray[0]; if (numArray1[i - 1] < 0) { numArray1[i - 1] = numArray1[i - 1] + 360; } } IGeometryCollection geometryBagClass = new GeometryBag() as IGeometryCollection; while (geometryBagClass.GeometryCount != geometryCount) { double num = numArray[0]; int num1 = 0; for (i = 1; i < geometryCount; i++) { if (num > numArray[i]) { num = numArray[i]; num1 = i; } } numArray[num1] = numArray[num1] + 363; geometryBagClass.AddGeometry(igeometryCollection_0.Geometry[num1], ref value, ref value); } if (!bool_1) { IGeometryCollection geometryCollection = new GeometryBag() as IGeometryCollection; geometryCollection.AddGeometry(geometryBagClass.Geometry[0], ref value, ref value); for (i = geometryCount - 1; i > 0; i--) { geometryCollection.AddGeometry(geometryBagClass.Geometry[i], ref value, ref value); } geometryBagClass = geometryCollection; } return(geometryBagClass); }
private IGeometry method_4(IArray iarray_0, IGeometry igeometry_0, IPoint ipoint_0, bool bool_1, ref bool bool_2) { IGeometry geometry; IGeometry geometry1; IRelationalOperator ipoint0 = (IRelationalOperator)ipoint_0; IGeometryCollection geometryBagClass = new GeometryBag() as IGeometryCollection; object value = Missing.Value; for (int i = 0; i < iarray_0.Count; i++) { if (!((IPolyline)iarray_0.Element[i]).IsClosed && ipoint0.Touches((IGeometry)iarray_0.Element[i])) { geometryBagClass.AddGeometry((IGeometry)iarray_0.Element[i], ref value, ref value); } } int geometryCount = geometryBagClass.GeometryCount; if (geometryCount > 1) { geometryBagClass = this.method_5(geometryBagClass, !bool_1, ipoint_0); int num = 0; while (true) { geometry1 = geometryBagClass.Geometry[num]; if (igeometry_0 == geometry1) { break; } num++; if (num == geometryCount) { num = 0; } } do { num++; if (num == geometryCount) { num = 0; } geometry1 = geometryBagClass.Geometry[num]; if (CommonHelper.distance(((ICurve)geometry1).FromPoint, ipoint_0) >= CommonHelper.distance(((ICurve)geometry1).ToPoint, ipoint_0)) { if (this.method_3(iarray_0, ((ICurve)geometry1).FromPoint) <= 1) { continue; } bool_2 = false; geometry = geometry1; return(geometry); } else { if (this.method_3(iarray_0, ((ICurve)geometry1).ToPoint) <= 1) { continue; } bool_2 = true; geometry = geometry1; return(geometry); } } while (igeometry_0 != geometry1); geometry = null; } else { geometry = null; } return(geometry); }
public override void OnMouseUp(int int_0, int int_1, int int_2, int int_3) { if (int_0 != 2 && this.bool_0) { this.bool_0 = false; IActiveView activeView = (IActiveView)_context.FocusMap; IEnvelope envelope = null; IPoint point = null; if (this.inewEnvelopeFeedback_0 == null) { point = this.ipoint_0; } else { envelope = this.inewEnvelopeFeedback_0.Stop(); this.inewEnvelopeFeedback_0 = null; if (envelope.Width == 0.0 || envelope.Height == 0.0) { point = this.ipoint_0; envelope = null; } } IList list = new ArrayList(); IEnumFeature enumFeature = _context.FocusMap.FeatureSelection as IEnumFeature; enumFeature.Reset(); IFeature feature = enumFeature.Next(); IGeometryCollection geometryCollection = new GeometryBag() as IGeometryCollection; object value = Missing.Value; while (feature != null) { list.Add(feature); geometryCollection.AddGeometry(feature.ShapeCopy, ref value, ref value); feature = enumFeature.Next(); } IEnvelope envelope2 = (geometryCollection as IGeometryBag).Envelope; IPoint point2 = new Point { X = (envelope2.XMax + envelope2.XMin) / 2.0, Y = (envelope2.YMax + envelope2.YMin) / 2.0 }; double num; double num2; if (envelope != null) { IPoint point3 = new Point { X = (envelope.XMax + envelope.XMin) / 2.0, Y = (envelope.YMax + envelope.YMin) / 2.0 }; num = point2.X - point3.X; num2 = point2.Y - point3.Y; double num3 = envelope.Width / envelope2.Width; double num4 = envelope.Height / envelope2.Height; num3 = ((num3 > num4) ? num4 : num3); (geometryCollection as ITransform2D).Scale(point2, num3, num3); } else { num = point2.X - point.X; num2 = point2.Y - point.Y; } (geometryCollection as ITransform2D).Move(-num, -num2); Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.StartEditOperation(); for (int i = 0; i < list.Count; i++) { feature = (list[i] as IFeature); try { IFeature feature2 = RowOperator.CreatRowByRow(feature) as IFeature; feature2.Shape = geometryCollection.get_Geometry(i); feature2.Store(); } catch (Exception exception_) { CErrorLog.writeErrorLog(this, exception_, ""); } } Yutai.ArcGIS.Common.Editor.Editor.EditWorkspace.StopEditOperation(); activeView.Refresh(); } }