示例#1
0
 public SizeMoveGripHandle(GraphicBase parent, PointF relPos)
 {
     _parent        = parent;
     _drawrPosition = relPos;
     _fixrPosition  = new PointF(relPos.X == 0 ? 1 : 0, relPos.Y == 0 ? 1 : 0);
     _fixaPosition  = _parent.RelativeToAbsolutePosition(_fixrPosition, true);
 }
示例#2
0
 /// <summary>
 /// Scales the position of all items according to xscale and yscale.
 /// </summary>
 /// <param name="xscale"></param>
 /// <param name="yscale"></param>
 public void ScalePosition(double xscale, double yscale)
 {
     foreach (GraphicBase o in this.InnerList)
     {
         GraphicBase.ScalePosition(o, xscale, yscale);
     }
 }
示例#3
0
 public RotationGripHandle(GraphicBase parent, PointF relPos)
 {
     _parent        = parent;
     _drawrPosition = relPos;
     _fixrPosition  = new PointF(0.5f, 0.5f);
     _fixaPosition  = _parent.RelativeToAbsolutePosition(_fixrPosition, true);
 }
示例#4
0
 /// <summary>
 /// Scales the position of an item according to the provided xscale and yscale. Can be called with null for the item (in this case nothing happens).
 /// </summary>
 /// <param name="o">The graphics object whose position is scaled.</param>
 /// <param name="xscale">The xscale ratio.</param>
 /// <param name="yscale">The yscale ratio.</param>
 public static void ScalePosition(GraphicBase o, double xscale, double yscale)
 {
     if (o != null)
     {
         PointF oldP = o.Position;
         o.SetPosition(new PointF((float)(oldP.X * xscale), (float)(oldP.Y * yscale)));
     }
 }
示例#5
0
 /// <summary>
 /// Adds an item to this shape group.
 /// </summary>
 /// <param name="obj">Item to add.</param>
 public void Add(GraphicBase obj)
 {
     obj.SetCoordinatesByAppendInverseTransformation(_transformation, Main.EventFiring.Suppressed);
     _groupedObjects.Add(obj);
     obj.ParentObject = this;
     AdjustPosition();
     EhSelfChanged(EventArgs.Empty);
 }
示例#6
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                GraphicBase s = (GraphicBase)obj;

                info.AddValue("Position", s._position);
                info.AddValue("Bounds", s._bounds);
                info.AddValue("Rotation", s._rotation);
                info.AddValue("AutoSize", s._autoSize);
            }
示例#7
0
        protected override void CopyFrom(GraphicBase bfrom)
        {
            EmbeddedImageGraphic from = bfrom as EmbeddedImageGraphic;

            if (from != null)
            {
                this._imageProxy = null == from._imageProxy ? null : (ImageProxy)from._imageProxy.Clone();
            }
            base.CopyFrom(bfrom);
        }
示例#8
0
        protected override void CopyFrom(GraphicBase bfrom)
        {
            LinkedImageGraphic from = bfrom as LinkedImageGraphic;

            if (from != null)
            {
                this._imagePath   = from._imagePath;
                this._cachedImage = null == from._cachedImage ? null : (Image)from._cachedImage.Clone();
            }
            base.CopyFrom(bfrom);
        }
示例#9
0
        protected override void CopyFrom(GraphicBase bfrom)
        {
            ShapeGraphic from = bfrom as ShapeGraphic;

            if (from != null)
            {
                this._fillBrush = (BrushX)from._fillBrush.Clone();
                this._linePen   = (PenX)from._linePen.Clone();
            }
            base.CopyFrom(bfrom);
        }
示例#10
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                GraphicBase s = (GraphicBase)o;

                s._position = (PointF)info.GetValue("Position", s);
                s._bounds   = (RectangleF)info.GetValue("Bounds", s);
                s._rotation = info.GetSingle("Rotation");
                s._autoSize = info.GetBoolean("AutoSize");

                return(s);
            }
示例#11
0
        protected override void CopyFrom(GraphicBase bfrom)
        {
            SimpleTextGraphic from = bfrom as SimpleTextGraphic;

            if (from != null)
            {
                this._font  = null == from._font ? null : (Font)from._font.Clone();
                this._text  = from._text;
                this._color = from._color;
            }
            base.CopyFrom(bfrom);
        }
示例#12
0
        public int Add(GraphicBase go, bool fireChangedEvent)
        {
            go.ParentObject = this;
            int result = List.Add(go);

            if (fireChangedEvent)
            {
                OnChanged();
            }

            return(result);
        }
示例#13
0
			public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
			{
				var s = null != o ? (ShapeGroup)o : new ShapeGroup();
				info.GetBaseValueEmbedded(s, typeof(ShapeGroup).BaseType, parent);

				int count = info.OpenArray("Elements");
				var list = new GraphicBase[count];
				for (int i = 0; i < count; i++)
					list[i] = (GraphicBase)info.GetValue("e", s);
				info.CloseArray(count);
				s.AddRange(list);

				return s;
			}
示例#14
0
        protected virtual void CopyFrom(GraphicBase from)
        {
            this._autoSize = from._autoSize;
            this._bounds   = from._bounds;
            this._position = from._position;
            this._rotation = from._rotation;
            bool wasUsed = (null != this._parent);

            this._parent = from._parent;

            if (wasUsed)
            {
                OnChanged();
            }
        }
示例#15
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                GraphicCollection s = null != o ? (GraphicCollection)o : new GraphicCollection();

                int count = info.OpenArray();

                for (int i = 0; i < count; i++)
                {
                    GraphicBase go = (GraphicBase)info.GetValue(s);
                    s.Add(go);
                }
                info.CloseArray(count);

                return(s);
            }
示例#16
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="from">The object to copy the data from.</param>
 protected GraphicBase(GraphicBase from)
 {
   CopyFrom(from);
 }
示例#17
0
			/// <summary>
			/// Creates a new HitTestObject.
			/// </summary>
			/// <param name="parent">The hitted object.</param>
			public GraphicBaseHitTestObject(GraphicBase parent)
				: base(parent)
			{
			}
    public int Add(GraphicBase go, bool fireChangedEvent)
    {
      go.ParentObject = this;
      int result =  List.Add(go);

      if (fireChangedEvent)
        OnChanged();

      return result;
    }
    public void AddRange(GraphicBase[] gos)
    {
      int len = gos.Length;
      for(int i=0;i<len;i++)
        this.Add(gos[i],false);

      OnChanged();
    }
示例#20
0
 public bool Contains(GraphicBase go)
 {
     return(List.Contains(go));
 }
 public int Add(GraphicBase go)
 {
   return Add(go, true);
 }
示例#22
0
 public SizeMoveGripHandle(GraphicBase parent, PointF relPos)
 {
   _parent = parent;
   _drawrPosition = relPos;
   _fixrPosition = new PointF(relPos.X == 0 ? 1 : 0, relPos.Y == 0 ? 1 : 0);
   _fixaPosition = _parent.RelativeToAbsolutePosition(_fixrPosition, true);
 }
 public void CopyTo(GraphicBase[] array, int index)
 {
   List.CopyTo(array, index);
 }
 public GraphicCollection(GraphicBase[] g)
   : base()
 {
   this.AddRange(g);
 }
示例#25
0
 /// <summary>
 /// Creates a new HitTestObject.
 /// </summary>
 /// <param name="parent">The hitted object.</param>
 public GraphicBaseHitTestObject(GraphicBase parent)
     : base(parent)
 {
 }
示例#26
0
 public void Remove(GraphicBase go)
 {
     List.Remove(go);
     OnChanged();
 }
示例#27
0
 public void Insert(int index, GraphicBase go)
 {
     List.Insert(index, go);
     OnChanged();
 }
示例#28
0
 public int IndexOf(GraphicBase go)
 {
     return(List.IndexOf(go));
 }
示例#29
0
    protected virtual void CopyFrom(GraphicBase from)
    {
      this._autoSize = from._autoSize;
      this._bounds = from._bounds;
      this._position = from._position;
      this._rotation = from._rotation;
      bool wasUsed = (null != this._parent);
      this._parent = from._parent;

      if(wasUsed)
        OnChanged();
    }
示例#30
0
 /// <summary>
 /// Tries to remove a child object of this collection.
 /// </summary>
 /// <param name="go">The object to remove.</param>
 /// <returns> If the provided object is a child object and
 /// the child object could be removed, the return value is true.</returns>
 public bool Remove(GraphicBase go)
 {
   // test our own objects for removal (only that that _are_ removable)
   if (object.ReferenceEquals(go, this._axisTitle))
   {
     _axisTitle = null;
     return true;
   }
   return false;
 }
示例#31
0
 /// <summary>
 /// Scales the position of an item according to the provided xscale and yscale. Can be called with null for the item (in this case nothing happens).
 /// </summary>
 /// <param name="o">The graphics object whose position is scaled.</param>
 /// <param name="xscale">The xscale ratio.</param>
 /// <param name="yscale">The yscale ratio.</param>
 public static void ScalePosition(GraphicBase o, double xscale, double yscale)
 {
   if(o!=null)
   {
     PointF oldP = o.Position;
     o.SetPosition(new PointF((float)(oldP.X*xscale),(float)(oldP.Y*yscale)));
   }
 }
 public int IndexOf(GraphicBase go)
 {
   return List.IndexOf(go);
 }
示例#33
0
 public RotationGripHandle(GraphicBase parent, PointF relPos)
 {
   _parent = parent;
   _drawrPosition = relPos;
   _fixrPosition = new PointF(0.5f, 0.5f);
   _fixaPosition = _parent.RelativeToAbsolutePosition(_fixrPosition, true);
 }
 public void Remove(GraphicBase go)
 {
   List.Remove(go);
   OnChanged();
 }
 protected override void CopyFrom(GraphicBase bfrom)
 {
   LinkedImageGraphic from = bfrom as LinkedImageGraphic;
   if (from != null)
   {
     this._imagePath = from._imagePath;
     this._cachedImage = null == from._cachedImage ? null : (Image)from._cachedImage.Clone();
   }
   base.CopyFrom(bfrom);
 }
示例#36
0
 public int Add(GraphicBase go)
 {
     return(Add(go, true));
 }
示例#37
0
    protected override void CopyFrom(GraphicBase bfrom)
    {
      TextGraphic from = bfrom as TextGraphic;
      if (from != null)
      {
        this._text = from._text;
        this._font = from._font == null ? null : (Font)from._font.Clone();
        this._textBrush = from._textBrush == null ? null : (BrushX)from._textBrush.Clone();
        this._background = from._background == null ? null : (IBackgroundStyle)from._background.Clone();
        this._lineSpacingFactor = from._lineSpacingFactor;
        _xAnchorType = from._xAnchorType;
        _yAnchorType = from._yAnchorType;

        // don't clone the cached items
        this._cachedTextLines = null;
        this._isStructureInSync = false;
        this._isMeasureInSync = false;
      }
      base.CopyFrom(bfrom);
    }
示例#38
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="from">The object to copy the data from.</param>
 protected GraphicBase(GraphicBase from)
 {
     CopyFrom(from);
 }
示例#39
0
		/// <summary>
		/// Adds an item to this shape group.
		/// </summary>
		/// <param name="obj">Item to add.</param>
		public void Add(GraphicBase obj)
		{
			obj.SetCoordinatesByAppendInverseTransformation(this._transformation, Main.EventFiring.Suppressed);
			_groupedObjects.Add(obj);
			obj.ParentObject = this;
			AdjustPosition();
			EhSelfChanged(EventArgs.Empty);
		}
 public bool Contains(GraphicBase go)
 {
   return List.Contains(go);
 }
 protected override void CopyFrom(GraphicBase bfrom)
 {
   SimpleTextGraphic from = bfrom as SimpleTextGraphic;
   if (from != null)
   {
     this._font = null == from._font ? null : (Font)from._font.Clone();
     this._text = from._text;
     this._color = from._color;
   }
   base.CopyFrom(bfrom);
 }
 public void Insert(int index, GraphicBase go)
 {
   List.Insert(index, go);
   OnChanged();
 }