public bool IsEqual(IClone other) { if (null == other) { throw new COMException("Invalid objact."); } if (!(other is TriangleElementClass)) { throw new COMException("Bad object type."); } TriangleElementClass triangleElementClass = (TriangleElementClass)other; return((!(triangleElementClass.Name == this.m_elementName) || !(triangleElementClass.Type == this.m_elementType) || triangleElementClass.AutoTransform != this.m_autoTrans || triangleElementClass.ReferenceScale != this.m_scaleRef || triangleElementClass.Angle != this.m_rotation || triangleElementClass.Size != this.m_size || triangleElementClass.AnchorPoint != this.m_anchorPointType || !((IClone)triangleElementClass.Geometry).IsEqual((IClone)this.m_triangle) || !((IClone)triangleElementClass.FillSymbol).IsEqual((IClone)this.m_fillSymbol) ? true : !((IClone)triangleElementClass.SpatialReference).IsEqual((IClone)this.m_nativeSR)) ? false : true); }
public IClone Clone() { TriangleElementClass triangleElementClass = new TriangleElementClass(); triangleElementClass.Assign(this); return(triangleElementClass); }
public void Transform(esriTransformDirection direction, ITransformation transformation) { if (null != this.m_triangle) { ((ITransform2D)this.m_triangle).Transform(direction, transformation); IAffineTransformation2D affineTransformation2D = (IAffineTransformation2D)transformation; if (affineTransformation2D.YScale != 1) { TriangleElementClass mSize = this; mSize.m_size = mSize.m_size * Math.Max(affineTransformation2D.YScale, affineTransformation2D.XScale); } this.RefreshTracker(); } }
public void Scale(IPoint Origin, double sx, double sy) { if (null != this.m_triangle) { ((ITransform2D)this.m_triangle).Scale(Origin, sx, sy); ((ITransform2D)this.m_pointGeometry).Scale(Origin, sx, sy); if (this.m_autoTrans) { TriangleElementClass mSize = this; mSize.m_size = mSize.m_size * Math.Max(sx, sy); } this.RefreshTracker(); } }
private void SetupDeviceRatio(int hDC, IDisplay display) { if (display.DisplayTransformation != null) { if (display.DisplayTransformation.Resolution != 0) { this.m_dDeviceRatio = display.DisplayTransformation.Resolution / 72; if (display.DisplayTransformation.ReferenceScale != 0) { this.m_dDeviceRatio = this.m_dDeviceRatio * display.DisplayTransformation.ReferenceScale / display.DisplayTransformation.ScaleRatio; } } } else if (display.hDC == 0) { this.m_dDeviceRatio = (double)(1 / (this.TwipsPerPixelX() / 20)); } else { this.m_dDeviceRatio = Convert.ToDouble(TriangleElementClass.GetDeviceCaps(hDC, 88)) / 72; } }
public void Assign(IClone src) { if (null == src) { throw new COMException("Invalid objact."); } if (!(src is TriangleElementClass)) { throw new COMException("Bad object type."); } TriangleElementClass triangleElementClass = (TriangleElementClass)src; this.m_elementName = triangleElementClass.Name; this.m_elementType = triangleElementClass.Type; this.m_autoTrans = triangleElementClass.AutoTransform; this.m_scaleRef = triangleElementClass.ReferenceScale; this.m_rotation = triangleElementClass.Angle; this.m_size = triangleElementClass.Size; this.m_anchorPointType = triangleElementClass.AnchorPoint; IObjectCopy objectCopyClass = new ObjectCopy(); if (null != triangleElementClass.CustomProperty) { if (triangleElementClass.CustomProperty is IClone) { this.m_customProperty = ((IClone)triangleElementClass.CustomProperty).Clone(); } else if (triangleElementClass.CustomProperty is IPersistStream) { this.m_customProperty = objectCopyClass.Copy(triangleElementClass.CustomProperty); } else if (triangleElementClass.CustomProperty.GetType().IsSerializable) { MemoryStream memoryStream = new MemoryStream(); BinaryFormatter binaryFormatter = new BinaryFormatter(); binaryFormatter.Serialize(memoryStream, triangleElementClass.CustomProperty); memoryStream = new MemoryStream(memoryStream.ToArray()); this.m_customProperty = binaryFormatter.Deserialize(memoryStream); } } if (null == triangleElementClass.SpatialReference) { this.m_nativeSR = null; } else { this.m_nativeSR = objectCopyClass.Copy(triangleElementClass.SpatialReference) as ISpatialReference; } if (null == triangleElementClass.FillSymbol) { this.m_fillSymbol = null; } else { this.m_fillSymbol = objectCopyClass.Copy(triangleElementClass.FillSymbol) as ISimpleFillSymbol; } if (null == triangleElementClass.Geometry) { this.m_triangle = null; this.m_pointGeometry = null; } else { this.m_triangle = objectCopyClass.Copy(triangleElementClass.Geometry) as IPolygon; this.m_pointGeometry = objectCopyClass.Copy(((IArea)this.m_triangle).Centroid) as IPoint; } }