Esempio n. 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);
 }
Esempio n. 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);
     }
 }
Esempio n. 3
0
 public RotationGripHandle(GraphicBase parent, PointF relPos)
 {
     _parent        = parent;
     _drawrPosition = relPos;
     _fixrPosition  = new PointF(0.5f, 0.5f);
     _fixaPosition  = _parent.RelativeToAbsolutePosition(_fixrPosition, true);
 }
Esempio n. 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)));
     }
 }
Esempio n. 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);
 }
Esempio n. 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);
            }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
            }
Esempio n. 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);
        }
Esempio n. 12
0
        public int Add(GraphicBase go, bool fireChangedEvent)
        {
            go.ParentObject = this;
            int result = List.Add(go);

            if (fireChangedEvent)
            {
                OnChanged();
            }

            return(result);
        }
Esempio n. 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;
			}
Esempio n. 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();
            }
        }
Esempio n. 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);
            }
Esempio n. 16
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="from">The object to copy the data from.</param>
 protected GraphicBase(GraphicBase from)
 {
   CopyFrom(from);
 }
Esempio n. 17
0
			/// <summary>
			/// Creates a new HitTestObject.
			/// </summary>
			/// <param name="parent">The hitted object.</param>
			public GraphicBaseHitTestObject(GraphicBase parent)
				: base(parent)
			{
			}
Esempio n. 18
0
    public int Add(GraphicBase go, bool fireChangedEvent)
    {
      go.ParentObject = this;
      int result =  List.Add(go);

      if (fireChangedEvent)
        OnChanged();

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

      OnChanged();
    }
Esempio n. 20
0
 public bool Contains(GraphicBase go)
 {
     return(List.Contains(go));
 }
Esempio n. 21
0
 public int Add(GraphicBase go)
 {
   return Add(go, true);
 }
Esempio n. 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);
 }
Esempio n. 23
0
 public void CopyTo(GraphicBase[] array, int index)
 {
   List.CopyTo(array, index);
 }
Esempio n. 24
0
 public GraphicCollection(GraphicBase[] g)
   : base()
 {
   this.AddRange(g);
 }
Esempio n. 25
0
 /// <summary>
 /// Creates a new HitTestObject.
 /// </summary>
 /// <param name="parent">The hitted object.</param>
 public GraphicBaseHitTestObject(GraphicBase parent)
     : base(parent)
 {
 }
Esempio n. 26
0
 public void Remove(GraphicBase go)
 {
     List.Remove(go);
     OnChanged();
 }
Esempio n. 27
0
 public void Insert(int index, GraphicBase go)
 {
     List.Insert(index, go);
     OnChanged();
 }
Esempio n. 28
0
 public int IndexOf(GraphicBase go)
 {
     return(List.IndexOf(go));
 }
Esempio n. 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();
    }
Esempio n. 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;
 }
Esempio n. 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)));
   }
 }
Esempio n. 32
0
 public int IndexOf(GraphicBase go)
 {
   return List.IndexOf(go);
 }
Esempio n. 33
0
 public RotationGripHandle(GraphicBase parent, PointF relPos)
 {
   _parent = parent;
   _drawrPosition = relPos;
   _fixrPosition = new PointF(0.5f, 0.5f);
   _fixaPosition = _parent.RelativeToAbsolutePosition(_fixrPosition, true);
 }
Esempio n. 34
0
 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);
 }
Esempio n. 36
0
 public int Add(GraphicBase go)
 {
     return(Add(go, true));
 }
Esempio n. 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);
    }
Esempio n. 38
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="from">The object to copy the data from.</param>
 protected GraphicBase(GraphicBase from)
 {
     CopyFrom(from);
 }
Esempio n. 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);
		}
Esempio n. 40
0
 public bool Contains(GraphicBase go)
 {
   return List.Contains(go);
 }
Esempio n. 41
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);
 }
Esempio n. 42
0
 public void Insert(int index, GraphicBase go)
 {
   List.Insert(index, go);
   OnChanged();
 }