Ejemplo n.º 1
0
 public void Scale(IPoint Origin, double sx, double sy)
 {
     if (null != this.m_triangle)
     {
         ((ITransform2D)this.m_triangle).Scale(Origin, sx, sy);
         if (this.m_autoTrans)
         {
             LabelLineElementClass mSize = this;
             mSize.m_size = mSize.m_size * Math.Max(sx, sy);
         }
         this.RefreshTracker();
     }
 }
Ejemplo n.º 2
0
        public IClone Clone()
        {
            LabelLineElementClass labelLineElementClass = new LabelLineElementClass();

            try
            {
                labelLineElementClass.Assign(this);
            }
            catch (Exception exception)
            {
            }
            return(labelLineElementClass);
        }
Ejemplo n.º 3
0
 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)
         {
             LabelLineElementClass mSize = this;
             mSize.m_size = mSize.m_size * Math.Max(affineTransformation2D.YScale, affineTransformation2D.XScale);
         }
         this.RefreshTracker();
     }
 }
Ejemplo n.º 4
0
 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(LabelLineElementClass.GetDeviceCaps(hDC, 88)) / 72;
     }
 }
Ejemplo n.º 5
0
        public bool IsEqual(IClone other)
        {
            if (null == other)
            {
                throw new COMException("Invalid objact.");
            }
            if (!(other is LabelLineElementClass))
            {
                throw new COMException("Bad object type.");
            }
            LabelLineElementClass labelLineElementClass = (LabelLineElementClass)other;

            return((!(labelLineElementClass.Name == this.m_elementName) ||
                    !(labelLineElementClass.Type == this.m_elementType) ||
                    labelLineElementClass.AutoTransform != this.m_autoTrans ||
                    labelLineElementClass.ReferenceScale != this.m_scaleRef ||
                    labelLineElementClass.AnchorPoint != this.m_anchorPointType ||
                    !((IClone)labelLineElementClass.Geometry).IsEqual((IClone)this.m_triangle) ||
                    !((IClone)labelLineElementClass.Symbol).IsEqual((IClone)this.m_fillSymbol)
                ? true
                : !((IClone)labelLineElementClass.SpatialReference).IsEqual((IClone)this.m_nativeSR))
                ? false
                : true);
        }
Ejemplo n.º 6
0
        public void Assign(IClone src)
        {
            if (null == src)
            {
                throw new COMException("Invalid objact.");
            }
            if (!(src is LabelLineElementClass))
            {
                throw new COMException("Bad object type.");
            }
            LabelLineElementClass labelLineElementClass = (LabelLineElementClass)src;

            this.m_elementName     = labelLineElementClass.Name;
            this.m_elementType     = labelLineElementClass.Type;
            this.m_autoTrans       = labelLineElementClass.AutoTransform;
            this.m_scaleRef        = labelLineElementClass.ReferenceScale;
            this.m_anchorPointType = labelLineElementClass.AnchorPoint;
            IObjectCopy objectCopyClass = new ObjectCopy();

            if (null != labelLineElementClass.CustomProperty)
            {
                if (labelLineElementClass.CustomProperty is IClone)
                {
                    this.m_customProperty = ((IClone)labelLineElementClass.CustomProperty).Clone();
                }
                else if (labelLineElementClass.CustomProperty is IPersistStream)
                {
                    this.m_customProperty = objectCopyClass.Copy(labelLineElementClass.CustomProperty);
                }
                else if (labelLineElementClass.CustomProperty.GetType().IsSerializable)
                {
                    MemoryStream    memoryStream    = new MemoryStream();
                    BinaryFormatter binaryFormatter = new BinaryFormatter();
                    binaryFormatter.Serialize(memoryStream, labelLineElementClass.CustomProperty);
                    memoryStream          = new MemoryStream(memoryStream.ToArray());
                    this.m_customProperty = binaryFormatter.Deserialize(memoryStream);
                }
            }
            if (null == labelLineElementClass.SpatialReference)
            {
                this.m_nativeSR = null;
            }
            else
            {
                this.m_nativeSR = objectCopyClass.Copy(labelLineElementClass.SpatialReference) as ISpatialReference;
            }
            if (null == labelLineElementClass.Symbol)
            {
                this.m_fillSymbol = null;
            }
            else
            {
                this.m_fillSymbol = (labelLineElementClass.Symbol as IClone).Clone() as ILineSymbol;
            }
            if (null == labelLineElementClass.Geometry)
            {
                this.m_triangle      = null;
                this.m_pointGeometry = null;
            }
            else
            {
                this.m_triangle = objectCopyClass.Copy(labelLineElementClass.Geometry) as IPolyline;
            }
        }