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(); } }
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(); } }