예제 #1
0
        /// <summary>
        /// Paints the shape of the person object in the plex. Here you can let your imagination go.
        /// </summary>
        /// <param name="g">The graphics canvas onto which to paint</param>
        public override void Paint(Graphics g)
        {
            if (RecalculateSize)
            {
                Rectangle = new RectangleF(new PointF(Rectangle.X, Rectangle.Y),
                                           g.MeasureString(Text, Font));
                RecalculateSize = false;                 //very important!
            }
            if (Site.Height == 0 || Site.Width == 0)
            {
                return;                                            //otherwise a division by zero
            }
            //the distance to the center
            distance = Math.Sqrt((Rectangle.Y - Site.Height / 2) * (Rectangle.Y - Site.Height / 2) + (Rectangle.X - Site.Width / 2) * (Rectangle.X - Site.Width / 2));
            //map the distance to an alpha value and let it be zero beyond the infinity-circle
            if (distance > Math.Min(Site.Height, Site.Width))
            {
                alpha = 0;
            }
            else
            {
                alpha = Math.Max(Math.Min(255 - Convert.ToInt32((255 * distance / Math.Min(Site.Height, Site.Width))), 254), 1);
            }

            g.FillEllipse(BackgroundBrush, Rectangle.X, Rectangle.Y, Rectangle.Width + 1, Rectangle.Height + 1);
            //g.DrawEllipse(pen, Rectangle.X, Rectangle.Y, Rectangle.Width + 1, Rectangle.Height + 1);
            if (ShowLabel)
            {
                StringFormat sf = new StringFormat();
                sf.Alignment = StringAlignment.Center;
                g.DrawString(ZOrder.ToString(), Font, TextBrush, Rectangle.X + (Rectangle.Width / 2), Rectangle.Y + 3, sf);
            }
            base.Paint(g);
        }
예제 #2
0
 /// <summary>
 /// Constructor that creates a <see cref="GraphItem"/> with the specified
 /// position, <see cref="CoordType"/>, <see cref="AlignH"/>, and <see cref="AlignV"/>.
 /// Other properties are set to default values as defined in the <see cref="Default"/> class.
 /// </summary>
 /// <remarks>
 /// The two coordinates define the location point for the object.
 /// The units of the coordinates are specified by the
 /// <see cref="ZedGraph.Location.CoordinateFrame"/> property.
 /// </remarks>
 /// <param name="x">The x position of the item.  The item will be
 /// aligned to this position based on the <see cref="AlignH"/>
 /// property.</param>
 /// <param name="y">The y position of the text.  The units
 /// of this position are specified by the
 /// <see cref="ZedGraph.Location.CoordinateFrame"/> property.  The text will be
 /// aligned to this position based on the
 /// <see cref="AlignV"/> property.</param>
 /// <param name="coordType">The <see cref="CoordType"/> enum value that
 /// indicates what type of coordinate system the x and y parameters are
 /// referenced to.</param>
 /// <param name="alignH">The <see cref="ZedGraph.AlignH"/> enum that specifies
 /// the horizontal alignment of the object with respect to the (x,y) location</param>
 /// <param name="alignV">The <see cref="ZedGraph.AlignV"/> enum that specifies
 /// the vertical alignment of the object with respect to the (x,y) location</param>
 public GraphItem(float x, float y, CoordType coordType, AlignH alignH, AlignV alignV)
 {
     this.isVisible = true;
     this.Tag       = null;
     this.zOrder    = ZOrder.A_InFront;
     this.location  = new Location(x, y, coordType, alignH, alignV);
 }
예제 #3
0
 /// <summary>
 /// Constructor that creates a <see cref="GraphItem"/> with the specified
 /// position, <see cref="CoordType"/>, <see cref="AlignH"/>, and <see cref="AlignV"/>.
 /// Other properties are set to default values as defined in the <see cref="Default"/> class.
 /// </summary>
 /// <remarks>
 /// The four coordinates define the starting point and ending point for
 /// <see cref="ArrowItem"/>'s, or the topleft and bottomright points for
 /// <see cref="ImageItem"/>'s.  For <see cref="GraphItem"/>'s that only require
 /// one point, the <see paramref="x2"/> and <see paramref="y2"/> values
 /// will be ignored.  The units of the coordinates are specified by the
 /// <see cref="ZedGraph.Location.CoordinateFrame"/> property.
 /// </remarks>
 /// <param name="x">The x position of the item.</param>
 /// <param name="y">The y position of the item.</param>
 /// <param name="x2">The x2 position of the item.</param>
 /// <param name="y2">The x2 position of the item.</param>
 /// <param name="coordType">The <see cref="CoordType"/> enum value that
 /// indicates what type of coordinate system the x and y parameters are
 /// referenced to.</param>
 /// <param name="alignH">The <see cref="ZedGraph.AlignH"/> enum that specifies
 /// the horizontal alignment of the object with respect to the (x,y) location</param>
 /// <param name="alignV">The <see cref="ZedGraph.AlignV"/> enum that specifies
 /// the vertical alignment of the object with respect to the (x,y) location</param>
 public GraphItem(float x, float y, float x2, float y2, CoordType coordType,
                  AlignH alignH, AlignV alignV)
 {
     this.Tag      = null;
     this.zOrder   = ZOrder.A_InFront;
     this.location = new Location(x, y, x2, y2, coordType, alignH, alignV);
 }
예제 #4
0
        /// <summary>
        /// Constructor for deserializing objects
        /// </summary>
        /// <param name="info">A <see cref="SerializationInfo"/> instance that defines the serialized data
        /// </param>
        /// <param name="context">A <see cref="StreamingContext"/> instance that contains the serialized data
        /// </param>
        protected GraphObj(SerializationInfo info, StreamingContext context)
        {
            // The schema value is just a file version parameter.  You can use it to make future versions
            // backwards compatible as new member variables are added to classes
            int sch = info.GetInt32("schema");

            _location  = (Location)info.GetValue("location", typeof(Location));
            _isVisible = info.GetBoolean("isVisible");
            Tag        = info.GetValue("Tag", typeof(object));
            _zOrder    = (ZOrder)info.GetValue("zOrder", typeof(ZOrder));

            _isClippedToChartRect = info.GetBoolean("isClippedToChartRect");
            _link = (Link)info.GetValue("link", typeof(Link));

            IsSelected = info.GetBoolean("isSelected");
            IsMoving   = info.GetBoolean("isMoving");
            if (schema > 11)
            {
                IsX2Axis     = info.GetBoolean("isX2Axis");
                IsY2Axis     = info.GetBoolean("isY2Axis");
                _yAxisIndex  = Math.Max(0, info.GetInt32("yAxisIndex"));
                IsSelectable = info.GetBoolean("isSelectable");
                IsMovable    = info.GetBoolean("isMovable");
            }
        }
예제 #5
0
 public Diagram(Model model)
 {
     Tables.Clear();
     ZOrder.Clear();
     //Relationships.Clear();
     Model = model;
 }
예제 #6
0
        /// <summary>
        /// Render text to the specified <see cref="Graphics"/> device
        /// by calling the Draw method of each <see cref="GraphObj"/> object in
        /// the collection.
        /// </summary>
        /// <remarks>This method is normally only called by the Draw method
        /// of the parent <see cref="GraphPane"/> object.
        /// </remarks>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="pane">
        /// A reference to the <see cref="PaneBase"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        /// <param name="zOrder">A <see cref="ZOrder"/> enumeration that controls
        /// the placement of this <see cref="GraphObj"/> relative to other
        /// graphic objects.  The order of <see cref="GraphObj"/>'s with the
        /// same <see cref="ZOrder"/> value is control by their order in
        /// this <see cref="GraphObjList"/>.</param>
        public void Draw(Graphics g, PaneBase pane, float scaleFactor,
                         ZOrder zOrder)
        {
            // Draw the items in reverse order, so the last items in the
            // list appear behind the first items (consistent with
            // CurveList)
            for (int i = this.Count - 1; i >= 0; i--)
            {
                GraphObj item = this[i];
                if (item.ZOrder == zOrder && item.IsVisible)
                {
                    Region region = null;
                    if (item.IsClippedToChartRect && pane is GraphPane)
                    {
                        region = g.Clip.Clone();
                        g.SetClip(((GraphPane)pane).Chart._rect);
                    }

                    item.Draw(g, pane, scaleFactor);

                    if (item.IsClippedToChartRect && pane is GraphPane)
                    {
                        g.Clip = region;
                    }
                }
            }
        }
예제 #7
0
        public static void Raw()
        {
            const long RAW_VALUE = 0b_010_010_010_010_010_010_010_010_010_010_010_010_010_010_010_010_010_100_101_101_100;
            var        value     = new ZOrder(6, -16, 15);

            Assert.Equal(RAW_VALUE, value.Raw);
            Assert.Equal(value, ZOrder.FromRaw(RAW_VALUE));
        }
예제 #8
0
 public void Add(ZOrder zo)
 {
     if (!m_orders.ContainsKey(zo.ExchangeSymbol))
     {
         m_orders[zo.ExchangeSymbol] = new ConcurrentBag <ZOrder>();
     }
     m_orders[zo.ExchangeSymbol].Add(zo);
 }
예제 #9
0
 public void Hide(TableVisual obj)
 {
     ZOrder.Remove(obj);
     if (obj is TableVisual)
     {
         Tables.Remove((obj as TableVisual).Table);
     }
 }
예제 #10
0
        public static void AddAndSubtract()
        {
            var value = new ZOrder(1, 2, 3);
            var diff  = new ZOrder(10, -20, 0);

            Assert.Equal(new(11, -18, 3), value + diff);
            Assert.Equal(new(-9, 22, 3), value - diff);
        }
예제 #11
0
 /// <summary>
 /// Constructor that creates a <see cref="GraphItem"/> with the specified
 /// position, <see cref="CoordType"/>, <see cref="AlignH"/>, and <see cref="AlignV"/>.
 /// Other properties are set to default values as defined in the <see cref="Default"/> class.
 /// </summary>
 /// <remarks>
 /// The four coordinates define the starting point and ending point for
 /// <see cref="ArrowItem"/>'s, or the topleft and bottomright points for
 /// <see cref="ImageItem"/>'s.  For <see cref="GraphItem"/>'s that only require
 /// one point, the <see paramref="x2"/> and <see paramref="y2"/> values
 /// will be ignored.  The units of the coordinates are specified by the
 /// <see cref="ZedGraph.Location.CoordinateFrame"/> property.
 /// </remarks>
 /// <param name="x">The x position of the item.</param>
 /// <param name="y">The y position of the item.</param>
 /// <param name="x2">The x2 position of the item.</param>
 /// <param name="y2">The x2 position of the item.</param>
 /// <param name="coordType">The <see cref="CoordType"/> enum value that
 /// indicates what type of coordinate system the x and y parameters are
 /// referenced to.</param>
 /// <param name="alignH">The <see cref="ZedGraph.AlignH"/> enum that specifies
 /// the horizontal alignment of the object with respect to the (x,y) location</param>
 /// <param name="alignV">The <see cref="ZedGraph.AlignV"/> enum that specifies
 /// the vertical alignment of the object with respect to the (x,y) location</param>
 public GraphItem(float x, float y, float x2, float y2, CoordType coordType,
                  AlignH alignH, AlignV alignV)
 {
     this.isVisible           = true;
     this.isClippedToAxisRect = Default.IsClippedToAxisRect;
     this.Tag      = null;
     this.zOrder   = ZOrder.A_InFront;
     this.location = new Location(x, y, x2, y2, coordType, alignH, alignV);
 }
예제 #12
0
파일: GraphObj.cs 프로젝트: hawking44/test
 /// <summary>
 /// Constructor that creates a <see cref="GraphObj"/> with the specified
 /// position, <see cref="CoordType"/>, <see cref="AlignH"/>, and <see cref="AlignV"/>.
 /// Other properties are set to default values as defined in the <see cref="Default"/> class.
 /// </summary>
 /// <remarks>
 /// The two coordinates define the location point for the object.
 /// The units of the coordinates are specified by the
 /// <see cref="ZedGraph.Location.CoordinateFrame"/> property.
 /// </remarks>
 /// <param name="x">The x position of the item.  The item will be
 /// aligned to this position based on the <see cref="AlignH"/>
 /// property.</param>
 /// <param name="y">The y position of the text.  The units
 /// of this position are specified by the
 /// <see cref="ZedGraph.Location.CoordinateFrame"/> property.  The text will be
 /// aligned to this position based on the
 /// <see cref="AlignV"/> property.</param>
 /// <param name="coordType">The <see cref="CoordType"/> enum value that
 /// indicates what type of coordinate system the x and y parameters are
 /// referenced to.</param>
 /// <param name="alignH">The <see cref="ZedGraph.AlignH"/> enum that specifies
 /// the horizontal alignment of the object with respect to the (x,y) location</param>
 /// <param name="alignV">The <see cref="ZedGraph.AlignV"/> enum that specifies
 /// the vertical alignment of the object with respect to the (x,y) location</param>
 public GraphObj(double x, double y, CoordType coordType, AlignH alignH, AlignV alignV)
 {
     _isVisible            = true;
     _isClippedToChartRect = Default.IsClippedToChartRect;
     this.Tag  = null;
     _zOrder   = ZOrder.A_InFront;
     _location = new Location(x, y, coordType, alignH, alignV);
     _link     = new Link();
 }
        public int CompareTo(object obj)
        {
            IDrawDesignControl dc = obj as IDrawDesignControl;

            if (dc != null)
            {
                return(ZOrder.CompareTo(dc.ZOrder));
            }
            throw new ArgumentException("object is not a IDrawDesignControl");
        }
예제 #14
0
파일: Depth.cs 프로젝트: OkashiKami/Odyssey
 public override int GetHashCode()
 {
     unchecked
     {
         int result = WindowLayer.GetHashCode();
         result = (result * 397) ^ ComponentLayer.GetHashCode();
         result = (result * 397) ^ ZOrder.GetHashCode();
         return(result);
     }
 }
예제 #15
0
        public void Remove(Table table)
        {
            TableVisual tv;

            if (Tables.TryGetValue(table, out tv))
            {
                Tables.Remove(table);
                ZOrder.Remove(tv);
            }
        }
예제 #16
0
        public void Add(Table table, int incr = 0)
        {
            var tv = new TableVisual(this, table);

            tv.X = OffsetX + incr;
            tv.Y = OffsetY + incr;

            Tables.Add(table, tv);
            ZOrder.Add(tv);
        }
예제 #17
0
        /// <summary>
        /// Constructor for deserializing objects
        /// </summary>
        /// <param name="info">A <see cref="SerializationInfo"/> instance that defines the serialized data
        /// </param>
        /// <param name="context">A <see cref="StreamingContext"/> instance that contains the serialized data
        /// </param>
        protected GraphItem(SerializationInfo info, StreamingContext context)
        {
            // The schema value is just a file version parameter.  You can use it to make future versions
            // backwards compatible as new member variables are added to classes
            int sch = info.GetInt32("schema");

            location  = (Location)info.GetValue("location", typeof(Location));
            isVisible = info.GetBoolean("isVisible");
            Tag       = info.GetValue("Tag", typeof(object));
            zOrder    = (ZOrder)info.GetValue("zOrder", typeof(ZOrder));
        }
예제 #18
0
        public static void Decoding()
        {
            var value = new ZOrder(6, -16, 15);

            Assert.Equal(6, value.X);
            Assert.Equal(-16, value.Y);
            Assert.Equal(15, value.Z);

            var(x, y, z) = value;
            Assert.Equal((6, -16, 15), (x, y, z));
        }
예제 #19
0
        public void AddRange(IEnumerable <Table> tables)
        {
            var i = 0;

            foreach (var t in tables)
            {
                var tv = new TableVisual(this, t, i);
                Tables.Add(t, tv);
                ZOrder.Add(tv);
                i++;
            }
        }
예제 #20
0
 /// <summary>
 /// Constructor that creates a <see cref="GraphObj"/> with the specified
 /// position, <see cref="CoordType"/>, <see cref="AlignH"/>, and <see cref="AlignV"/>.
 /// Other properties are set to default values as defined in the <see cref="Default"/> class.
 /// </summary>
 /// <remarks>
 /// The two coordinates define the location point for the object.
 /// The units of the coordinates are specified by the
 /// <see cref="ZedGraph.Location.CoordinateFrame"/> property.
 /// </remarks>
 /// <param name="x">The x position of the item.  The item will be
 /// aligned to this position based on the <see cref="AlignH"/>
 /// property.</param>
 /// <param name="y">The y position of the text.  The units
 /// of this position are specified by the
 /// <see cref="ZedGraph.Location.CoordinateFrame"/> property.  The text will be
 /// aligned to this position based on the
 /// <see cref="AlignV"/> property.</param>
 /// <param name="coordType">The <see cref="CoordType"/> enum value that
 /// indicates what type of coordinate system the x and y parameters are
 /// referenced to.</param>
 /// <param name="alignH">The <see cref="ZedGraph.AlignH"/> enum that specifies
 /// the horizontal alignment of the object with respect to the (x,y) location</param>
 /// <param name="alignV">The <see cref="ZedGraph.AlignV"/> enum that specifies
 /// the vertical alignment of the object with respect to the (x,y) location</param>
 /// <param name="xAxisIndex">Index of the XAxis</param>
 /// <param name="yAxisIndex">Index of the YAxis</param>
 protected GraphObj(double x, double y, CoordType coordType, AlignH alignH, AlignV alignV)
 {
     _isVisible            = true;
     _isClippedToChartRect = Default.IsClippedToChartRect;
     this.Tag   = null;
     _zOrder    = ZOrder.A_InFront;
     _location  = new Location(x, y, coordType, alignH, alignV);
     _link      = new Link();
     IsX2Axis   = false;
     IsY2Axis   = false;
     YAxisIndex = 0;
 }
예제 #21
0
        public static void IncAndDec()
        {
            var value = new ZOrder(5, 0, -200);

            Assert.Equal(new(6, 0, -200), value.IncX());
            Assert.Equal(new(5, 1, -200), value.IncY());
            Assert.Equal(new(5, 0, -199), value.IncZ());

            Assert.Equal(new(4, 0, -200), value.DecX());
            Assert.Equal(new(5, -1, -200), value.DecY());
            Assert.Equal(new(5, 0, -201), value.DecZ());
        }
예제 #22
0
        public Diagram Clone()
        {
            var res = new Diagram(Model)
            {
                OffsetX = this.OffsetX, OffsetY = this.OffsetY, Zoom = this.Zoom
            };

            res.Name   = Name + " copy";
            res.ZOrder = new List <TableVisual>(ZOrder.Select(obj => obj.CloneTo(res)));
            res.Tables = res.ZOrder.OfType <TableVisual>().ToDictionary(obj => obj.Table, obj => obj);

            return(res);
        }
예제 #23
0
        /// <summary>
        /// Constructor for deserializing objects
        /// </summary>
        /// <param name="info">A <see cref="SerializationInfo"/> instance that defines the serialized data
        /// </param>
        /// <param name="context">A <see cref="StreamingContext"/> instance that contains the serialized data
        /// </param>
        protected GraphObj(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            // The schema value is just a file version parameter.  You can use it to make future versions
            // backwards compatible as new member variables are added to classes
            int sch = info.GetInt32("schema");

            _location  = (Location)info.GetValue("location", typeof(Location));
            _isVisible = info.GetBoolean("isVisible");
            Tag        = info.GetValue("Tag", typeof(object));
            _zOrder    = (ZOrder)info.GetValue("zOrder", typeof(ZOrder));

            _isClippedToChartRect = info.GetBoolean("isClippedToChartRect");
            //_link = (Link)info.GetValue("link", typeof(Link));
        }
예제 #24
0
 /// <summary>
 /// Render text to the specified <see cref="Graphics"/> device
 /// by calling the Draw method of each <see cref="GraphItem"/> object in
 /// the collection.
 /// </summary>
 /// <remarks>This method is normally only called by the Draw method
 /// of the parent <see cref="GraphPane"/> object.
 /// </remarks>
 /// <param name="g">
 /// A graphic device object to be drawn into.  This is normally e.Graphics from the
 /// PaintEventArgs argument to the Paint() method.
 /// </param>
 /// <param name="pane">
 /// A reference to the <see cref="GraphPane"/> object that is the parent or
 /// owner of this object.
 /// </param>
 /// <param name="scaleFactor">
 /// The scaling factor to be used for rendering objects.  This is calculated and
 /// passed down by the parent <see cref="GraphPane"/> object using the
 /// <see cref="GraphPane.CalcScaleFactor"/> method, and is used to proportionally adjust
 /// font sizes, etc. according to the actual size of the graph.
 /// </param>
 /// <param name="zOrder">A <see cref="ZOrder"/> enumeration that controls
 /// the placement of this <see cref="GraphItem"/> relative to other
 /// graphic objects.  The order of <see cref="GraphItem"/>'s with the
 /// same <see cref="ZOrder"/> value is control by their order in
 /// this <see cref="GraphItemList"/>.</param>
 public void Draw(Graphics g, GraphPane pane, double scaleFactor,
                  ZOrder zOrder)
 {
     // Draw the items in reverse order, so the last items in the
     // list appear behind the first items (consistent with
     // CurveList)
     for (int i = this.Count - 1; i >= 0; i--)
     {
         GraphItem item = this[i];
         if (item.ZOrder == zOrder)
         {
             item.Draw(g, pane, scaleFactor);
         }
     }
 }
예제 #25
0
        /// <summary>
        /// The Copy Constructor
        /// </summary>
        /// <param name="rhs">The <see cref="GraphItem"/> object from which to copy</param>
        public GraphItem(GraphItem rhs)
        {
            this.isVisible = rhs.IsVisible;

            if (rhs.Tag is ICloneable)
            {
                this.Tag = ((ICloneable)rhs.Tag).Clone();
            }
            else
            {
                this.Tag = rhs.Tag;
            }

            this.zOrder   = rhs.ZOrder;
            this.location = (Location)rhs.Location.Clone();
        }
        private void UpdateZOrder(ActivityDesigner activityDesigner, ZOrder zorder)
        {
            IDesignerHost       service     = base.GetService(typeof(IDesignerHost)) as IDesignerHost;
            DesignerTransaction transaction = null;

            if (service != null)
            {
                transaction = service.CreateTransaction(DR.GetString("ZOrderUndoDescription", new object[] { activityDesigner.Text }));
            }
            try
            {
                bool flag = false;
                CompositeActivityDesigner parentDesigner = this;
                ActivityDesigner          designer2      = activityDesigner;
                while ((parentDesigner != null) && (designer2 != null))
                {
                    if (parentDesigner is FreeformActivityDesigner)
                    {
                        ReadOnlyCollection <ActivityDesigner> containedDesigners = parentDesigner.ContainedDesigners;
                        if ((containedDesigners.Count > 1) && (containedDesigners[(zorder == ZOrder.Background) ? 0 : (containedDesigners.Count - 1)] != designer2))
                        {
                            int connector = (zorder == ZOrder.Background) ? 0 : containedDesigners.Count;
                            parentDesigner.MoveActivities(new ConnectorHitTestInfo(this, HitTestLocations.Designer, connector), new List <Activity>(new Activity[] { designer2.Activity }).AsReadOnly());
                            flag = true;
                        }
                    }
                    designer2      = parentDesigner;
                    parentDesigner = parentDesigner.ParentDesigner;
                }
                if (flag)
                {
                    base.Invalidate();
                }
                if (transaction != null)
                {
                    transaction.Commit();
                }
            }
            catch (Exception exception)
            {
                if (transaction != null)
                {
                    transaction.Cancel();
                }
                throw exception;
            }
        }
예제 #27
0
        public static void BitShifting()
        {
            var zero = new ZOrder(0, 0, 0);

            Assert.Equal(zero, zero >> 2);
            Assert.Equal(zero, zero << 2);

            var pos123 = new ZOrder(1, 2, 3);

            Assert.Equal(new(4, 8, 12), pos123 << 2);
            Assert.Equal(pos123, new ZOrder(4, 8, 12) >> 2);

            var neg123 = new ZOrder(-1, -2, -3);

            Assert.Equal(new(-4, -8, -12), neg123 << 2);
            Assert.Equal(neg123, new ZOrder(-4, -8, -12) >> 2);
        }
예제 #28
0
 public virtual IEnumerable <IVisual> Query(Rectangle clipBounds, ZOrder zOrder)
 {
     if (zOrder == ZOrder.EdgesFirst)
     {
         foreach (var visual in Visuals)
         {
             if (visual is IVisualEdge)
             {
                 var bounds = visual.Shape.BoundsRect;
                 bounds = bounds.Inflate(1, 1);
                 if (clipBounds.IntersectsWith(bounds))
                 {
                     yield return(visual);
                 }
             }
         }
     }
     foreach (var visual in Visuals)
     {
         if (!(visual is IVisualEdge))
         {
             var bounds = visual.Shape.BoundsRect;
             bounds = bounds.Inflate(1, 1);
             if (clipBounds.IntersectsWith(bounds))
             {
                 yield return(visual);
             }
         }
     }
     if (zOrder == ZOrder.NodesFirst)
     {
         foreach (var visual in Visuals)
         {
             if (visual is IVisualEdge)
             {
                 var bounds = visual.Shape.BoundsRect;
                 bounds = bounds.Inflate(1, 1);
                 if (clipBounds.IntersectsWith(bounds))
                 {
                     yield return(visual);
                 }
             }
         }
     }
 }
예제 #29
0
        /// <summary>
        /// Paints the shape of the person object in the plex. Here you can let your imagination go.
        /// </summary>
        /// <param name="g">The graphics canvas onto which to paint</param>
        public override void Paint(Graphics g)
        {
            if (RecalculateSize)
            {
                Rectangle = new RectangleF(new PointF(Rectangle.X, Rectangle.Y),
                                           g.MeasureString(Text, Font));
                RecalculateSize = false;                 //very important!
            }

            g.FillEllipse(BackgroundBrush, Rectangle.X, Rectangle.Y, Rectangle.Width + 1, Rectangle.Height + 1);
            //g.DrawEllipse(pen, Rectangle.X, Rectangle.Y, Rectangle.Width + 1, Rectangle.Height + 1);
            if (ShowLabel)
            {
                StringFormat sf = new StringFormat();
                sf.Alignment = StringAlignment.Center;
                g.DrawString(ZOrder.ToString(), Font, TextBrush, Rectangle.X + (Rectangle.Width / 2), Rectangle.Y + 3, sf);
            }
            base.Paint(g);
        }
예제 #30
0
        public virtual IEnumerable <IVisual> Query(Rectangle clipBounds, ZOrder zOrder)
        {
            IEnumerable <IVisual> search = GeoIndex.Query(clipBounds);

            if (zOrder == ZOrder.EdgesFirst)
            {
                foreach (var visual in search)
                {
                    if (visual is IVisualEdge)
                    {
                        if (DrawingExtensions.Intersects(clipBounds, visual.Shape.BoundsRect))
                        {
                            yield return(visual);
                        }
                    }
                }
            }

            foreach (var visual in search)
            {
                if (!(visual is IVisualEdge))
                {
                    if (DrawingExtensions.Intersects(clipBounds, visual.Shape.BoundsRect))
                    {
                        yield return(visual);
                    }
                }
            }

            if (zOrder == ZOrder.NodesFirst)
            {
                foreach (var visual in search)
                {
                    if (visual is IVisualEdge)
                    {
                        if (DrawingExtensions.Intersects(clipBounds, visual.Shape.BoundsRect))
                        {
                            yield return(visual);
                        }
                    }
                }
            }
        }
 private void UpdateZOrder(ActivityDesigner activityDesigner, ZOrder zorder)
 {
     IDesignerHost service = base.GetService(typeof(IDesignerHost)) as IDesignerHost;
     DesignerTransaction transaction = null;
     if (service != null)
     {
         transaction = service.CreateTransaction(DR.GetString("ZOrderUndoDescription", new object[] { activityDesigner.Text }));
     }
     try
     {
         bool flag = false;
         CompositeActivityDesigner parentDesigner = this;
         ActivityDesigner designer2 = activityDesigner;
         while ((parentDesigner != null) && (designer2 != null))
         {
             if (parentDesigner is FreeformActivityDesigner)
             {
                 ReadOnlyCollection<ActivityDesigner> containedDesigners = parentDesigner.ContainedDesigners;
                 if ((containedDesigners.Count > 1) && (containedDesigners[(zorder == ZOrder.Background) ? 0 : (containedDesigners.Count - 1)] != designer2))
                 {
                     int connector = (zorder == ZOrder.Background) ? 0 : containedDesigners.Count;
                     parentDesigner.MoveActivities(new ConnectorHitTestInfo(this, HitTestLocations.Designer, connector), new List<Activity>(new Activity[] { designer2.Activity }).AsReadOnly());
                     flag = true;
                 }
             }
             designer2 = parentDesigner;
             parentDesigner = parentDesigner.ParentDesigner;
         }
         if (flag)
         {
             base.Invalidate();
         }
         if (transaction != null)
         {
             transaction.Commit();
         }
     }
     catch (Exception exception)
     {
         if (transaction != null)
         {
             transaction.Cancel();
         }
         throw exception;
     }
 }
 internal bool CanUpdateZOrder(ActivityDesigner activityDesigner, ZOrder zorder)
 {
     CompositeActivityDesigner parentDesigner = this;
     ActivityDesigner designer2 = activityDesigner;
     while ((parentDesigner != null) && (designer2 != null))
     {
         if (parentDesigner is FreeformActivityDesigner)
         {
             ReadOnlyCollection<ActivityDesigner> containedDesigners = parentDesigner.ContainedDesigners;
             if ((containedDesigners.Count > 1) && (containedDesigners[(zorder == ZOrder.Background) ? 0 : (containedDesigners.Count - 1)] != designer2))
             {
                 return true;
             }
         }
         designer2 = parentDesigner;
         parentDesigner = parentDesigner.ParentDesigner;
     }
     return false;
 }
예제 #33
0
        /// <summary>
        /// Render text to the specified <see cref="Graphics"/> device
        /// by calling the Draw method of each <see cref="GraphItem"/> object in
        /// the collection.
        /// </summary>
        /// <remarks>This method is normally only called by the Draw method
        /// of the parent <see cref="GraphPane"/> object.
        /// </remarks>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="pane">
        /// A reference to the <see cref="GraphPane"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="GraphPane.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        /// <param name="zOrder">A <see cref="ZOrder"/> enumeration that controls
        /// the placement of this <see cref="GraphItem"/> relative to other
        /// graphic objects.  The order of <see cref="GraphItem"/>'s with the
        /// same <see cref="ZOrder"/> value is control by their order in
        /// this <see cref="GraphItemList"/>.</param>
        public void Draw( Graphics g, GraphPane pane, double scaleFactor,
							ZOrder zOrder )
        {
            // Draw the items in reverse order, so the last items in the
            // list appear behind the first items (consistent with
            // CurveList)
            for ( int i=this.Count-1; i>=0; i-- )
            {
                GraphItem item = this[i];
                if ( item.ZOrder == zOrder )
                    item.Draw( g, pane, scaleFactor );
            }
        }
예제 #34
0
파일: GraphObj.cs 프로젝트: viwhi1/TDMaker
        /// <summary>
        /// Constructor for deserializing objects
        /// </summary>
        /// <param name="info">A <see cref="SerializationInfo"/> instance that defines the serialized data
        /// </param>
        /// <param name="context">A <see cref="StreamingContext"/> instance that contains the serialized data
        /// </param>
        protected GraphObj( SerializationInfo info, StreamingContext context )
        {
            // The schema value is just a file version parameter.  You can use it to make future versions
            // backwards compatible as new member variables are added to classes
            int sch = info.GetInt32( "schema" );

            _location = (Location) info.GetValue( "location", typeof(Location) );
            _isVisible = info.GetBoolean( "isVisible" );
            Tag = info.GetValue( "Tag", typeof(object) );
            _zOrder = (ZOrder) info.GetValue( "zOrder", typeof(ZOrder) );

            _isClippedToChartRect = info.GetBoolean( "isClippedToChartRect" );
            _link = (Link) info.GetValue( "link", typeof( Link ) );
        }
        private void UpdateZOrder(ActivityDesigner activityDesigner, ZOrder zorder)
        {
            IDesignerHost designerHost = GetService(typeof(IDesignerHost)) as IDesignerHost;
            DesignerTransaction transaction = null;
            if (designerHost != null)
                transaction = designerHost.CreateTransaction(DR.GetString(DR.ZOrderUndoDescription, activityDesigner.Text));

            try
            {
                bool zOrderChanged = false;
                CompositeActivityDesigner parentDesigner = this;
                ActivityDesigner childDesigner = activityDesigner;
                while (parentDesigner != null && childDesigner != null)
                {
                    if (parentDesigner is FreeformActivityDesigner)
                    {
                        ReadOnlyCollection<ActivityDesigner> containedDesigners = parentDesigner.ContainedDesigners;
                        if (containedDesigners.Count > 1 && containedDesigners[(zorder == ZOrder.Background) ? 0 : containedDesigners.Count - 1] != childDesigner)
                        {
                            int moveIndex = (zorder == ZOrder.Background) ? 0 : containedDesigners.Count;
                            parentDesigner.MoveActivities(new ConnectorHitTestInfo(this, HitTestLocations.Designer, moveIndex), new List<Activity>(new Activity[] { childDesigner.Activity }).AsReadOnly());
                            zOrderChanged = true;
                        }
                    }

                    childDesigner = parentDesigner;
                    parentDesigner = parentDesigner.ParentDesigner;
                }

                if (zOrderChanged)
                    Invalidate();

                if (transaction != null)
                    transaction.Commit();
            }
            catch (Exception e)
            {
                if (transaction != null)
                    transaction.Cancel();

                throw e;
            }
        }
예제 #36
0
파일: GraphObj.cs 프로젝트: viwhi1/TDMaker
        /// <summary>
        /// Constructor that creates a <see cref="GraphObj"/> with the specified
        /// position, <see cref="CoordType"/>, <see cref="AlignH"/>, and <see cref="AlignV"/>.
        /// Other properties are set to default values as defined in the <see cref="Default"/> class.
        /// </summary>
        /// <remarks>
        /// The four coordinates define the starting point and ending point for
        /// <see cref="ArrowObj"/>'s, or the topleft and bottomright points for
        /// <see cref="ImageObj"/>'s.  For <see cref="GraphObj"/>'s that only require
        /// one point, the <see paramref="x2"/> and <see paramref="y2"/> values
        /// will be ignored.  The units of the coordinates are specified by the
        /// <see cref="ZedGraph.Location.CoordinateFrame"/> property.
        /// </remarks>
        /// <param name="x">The x position of the item.</param>
        /// <param name="y">The y position of the item.</param>
        /// <param name="x2">The x2 position of the item.</param>
        /// <param name="y2">The x2 position of the item.</param>
        /// <param name="coordType">The <see cref="CoordType"/> enum value that
        /// indicates what type of coordinate system the x and y parameters are
        /// referenced to.</param>
        /// <param name="alignH">The <see cref="ZedGraph.AlignH"/> enum that specifies
        /// the horizontal alignment of the object with respect to the (x,y) location</param>
        /// <param name="alignV">The <see cref="ZedGraph.AlignV"/> enum that specifies
        /// the vertical alignment of the object with respect to the (x,y) location</param>
        public GraphObj( double x, double y, double x2, double y2, CoordType coordType,
					AlignH alignH, AlignV alignV )
        {
            _isVisible = true;
            _isClippedToChartRect = Default.IsClippedToChartRect;
            this.Tag = null;
            _zOrder = ZOrder.A_InFront;
            _location = new Location( x, y, x2, y2, coordType, alignH, alignV );
            _link = new Link();
        }
예제 #37
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The <see cref="GraphItem"/> object from which to copy</param>
 public GraphItem( GraphItem rhs )
 {
     this.Tag = rhs.Tag;
     this.zOrder = rhs.ZOrder;
     this.location = rhs.Location;
 }
예제 #38
0
파일: GraphObj.cs 프로젝트: viwhi1/TDMaker
        /// <summary>
        /// The Copy Constructor
        /// </summary>
        /// <param name="rhs">The <see cref="GraphObj"/> object from which to copy</param>
        public GraphObj( GraphObj rhs )
        {
            // Copy value types
            _isVisible = rhs.IsVisible;
            _isClippedToChartRect = rhs._isClippedToChartRect;
            _zOrder = rhs.ZOrder;

            // copy reference types by cloning
            if ( rhs.Tag is ICloneable )
                this.Tag = ((ICloneable) rhs.Tag).Clone();
            else
                this.Tag = rhs.Tag;

            _location = rhs.Location.Clone();
            _link = rhs._link.Clone();
        }
예제 #39
0
        /// <summary>
        /// Constructor that creates a <see cref="GraphItem"/> with the specified
        /// position, <see cref="CoordType"/>, <see cref="AlignH"/>, and <see cref="AlignV"/>.
        /// Other properties are set to default values as defined in the <see cref="Default"/> class.
        /// </summary>
        /// <remarks>
        /// The four coordinates define the starting point and ending point for
        /// <see cref="ArrowItem"/>'s, or the topleft and bottomright points for
        /// <see cref="ImageItem"/>'s.  For <see cref="GraphItem"/>'s that only require
        /// one point, the <see paramref="x2"/> and <see paramref="y2"/> values
        /// will be ignored.  The units of the coordinates are specified by the
        /// <see cref="ZedGraph.Location.CoordinateFrame"/> property.
        /// </remarks>
        /// <param name="x">The x position of the item.</param>
        /// <param name="y">The y position of the item.</param>
        /// <param name="x2">The x2 position of the item.</param>
        /// <param name="y2">The x2 position of the item.</param>
        /// <param name="coordType">The <see cref="CoordType"/> enum value that
        /// indicates what type of coordinate system the x and y parameters are
        /// referenced to.</param>
        /// <param name="alignH">The <see cref="ZedGraph.AlignH"/> enum that specifies
        /// the horizontal alignment of the object with respect to the (x,y) location</param>
        /// <param name="alignV">The <see cref="ZedGraph.AlignV"/> enum that specifies
        /// the vertical alignment of the object with respect to the (x,y) location</param>
        public GraphItem( float x, float y, float x2, float y2, CoordType coordType,
					AlignH alignH, AlignV alignV )
        {
            this.Tag = null;
            this.zOrder = ZOrder.A_InFront;
            this.location = new Location( x, y, x2, y2, coordType, alignH, alignV );
        }
        internal bool CanUpdateZOrder(ActivityDesigner activityDesigner, ZOrder zorder)
        {
            bool canUpdateZOrder = false;
            CompositeActivityDesigner parentDesigner = this;
            ActivityDesigner childDesigner = activityDesigner;
            while (parentDesigner != null && childDesigner != null)
            {
                if (parentDesigner is FreeformActivityDesigner)
                {
                    ReadOnlyCollection<ActivityDesigner> containedDesigners = parentDesigner.ContainedDesigners;
                    if (containedDesigners.Count > 1 && containedDesigners[(zorder == ZOrder.Background) ? 0 : containedDesigners.Count - 1] != childDesigner)
                    {
                        canUpdateZOrder = true;
                        break;
                    }
                }

                childDesigner = parentDesigner;
                parentDesigner = parentDesigner.ParentDesigner;
            }

            return canUpdateZOrder;
        }
예제 #41
0
        /// <summary>
        /// Render text to the specified <see cref="Graphics"/> device
        /// by calling the Draw method of each <see cref="GraphObj"/> object in
        /// the collection.
        /// </summary>
        /// <remarks>This method is normally only called by the Draw method
        /// of the parent <see cref="GraphPane"/> object.
        /// </remarks>
        /// <param name="g">
        /// A graphic device object to be drawn into.  This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="pane">
        /// A reference to the <see cref="PaneBase"/> object that is the parent or
        /// owner of this object.
        /// </param>
        /// <param name="scaleFactor">
        /// The scaling factor to be used for rendering objects.  This is calculated and
        /// passed down by the parent <see cref="GraphPane"/> object using the
        /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        /// <param name="zOrder">A <see cref="ZOrder"/> enumeration that controls
        /// the placement of this <see cref="GraphObj"/> relative to other
        /// graphic objects.  The order of <see cref="GraphObj"/>'s with the
        /// same <see cref="ZOrder"/> value is control by their order in
        /// this <see cref="GraphObjList"/>.</param>
        public void Draw( Graphics g, PaneBase pane, float scaleFactor,
							ZOrder zOrder )
        {
            // Draw the items in reverse order, so the last items in the
            // list appear behind the first items (consistent with
            // CurveList)
            for ( int i=this.Count-1; i>=0; i-- )
            {
                GraphObj item = this[i];
                if ( item.ZOrder == zOrder && item.IsVisible )
                {
                    Region region = null;
                    if ( item.IsClippedToChartRect && pane is GraphPane )
                    {
                        region = g.Clip.Clone();
                        g.SetClip( ((GraphPane)pane).Chart._rect );
                    }

                    item.Draw( g, pane, scaleFactor );

                    if ( item.IsClippedToChartRect && pane is GraphPane )
                        g.Clip = region;
                }
            }
        }