Пример #1
0
        //circle
        public ICircle CreateCircle(IGraphElementHost host)
        {
            var e = new Circle(host);

            OnCreateGraphElement(e);
            return(e);
        }
Пример #2
0
        //text
        public IText CreateText(IGraphElementHost host, string caption)
        {
            var e = new Text(host, caption);

            OnCreateGraphElement(e);
            return(e);
        }
Пример #3
0
        //polygon
        public IPolygon CreatePoly(IGraphElementHost host)
        {
            var e = new Poly(host);

            OnCreateGraphElement(e);
            return(e);
        }
Пример #4
0
        //rectangle
        public IRectangle CreateRectangle(IGraphElementHost host)
        {
            var e = new Rectangle(host);

            OnCreateGraphElement(e);
            return(e);
        }
Пример #5
0
        //dot
        public IDot CreateDot(IGraphElementHost host)
        {
            var e = new Dot(host);

            OnCreateGraphElement(e);
            return(e);
        }
Пример #6
0
 public Rectangle(IGraphElementHost host)
     : base(host)
 {
     Position = new PointF(0, 0);
     Size     = new SizeF(40, 20);
     PPath.AddRectangle(Position.X, Position.Y, Size.Width, Size.Height);
 }
Пример #7
0
 public Dot(IGraphElementHost host)
     : base(host)
 {
     DotSize     = 1;
     PNode.Brush = null;
     PPath.AddRectangle(Position.X, Position.Y, DotSize, DotSize);
 }
Пример #8
0
 public Solid(IGraphElementHost host)
     : base(host)
 {
     if (PPath != null)
     {
         Pen = null;
     }
 }
Пример #9
0
 public Poly(IGraphElementHost host)
     : base(host)
 {
     Position         = new PointF(0, 0);
     FPoints          = new EditableList <PointF>();
     FPoints.Added   += new CollectionDelegate <PointF>(PointsChanged);
     FPoints.Removed += new CollectionDelegate <PointF>(PointsChanged);
     IsClosed         = false;
 }
Пример #10
0
        public Text(IGraphElementHost host, string caption)
            : base(host)
        {
            if (caption == null)
            {
                caption = "";
            }

            Caption = caption;
            Brush   = null;
        }
Пример #11
0
 public Circle(IGraphElementHost host)
     : base(host)
 {
     Radius = 5;
     if (Parent != null)
     {
         PPath.AddEllipse(Position.X, Position.Y, Radius, Radius);
     }
     else
     {
         PPath.AddEllipse(0, 0, Radius, Radius);
     }
 }
Пример #12
0
        public TempPath(IGraphElementHost host, ISolid start)
            : base(host)
        {
            Points = new List <PointF>();
            Start  = start;

            PNode.Brush = null;

            //start point
            Points.Add(Start.GlobalMiddle);

            //end point
            Points.Add(Start.GlobalMiddle);
        }
Пример #13
0
        public GraphElement(IGraphElementHost host)
        {
            PNode     = CreatePNode();
            PNode.Tag = this;
            FHost     = host;

            PNode.Brush = Brushes.Black;

            IsSelectable  = (host is ISelectable);
            IsMovable     = (host is IMovable);
            IsConnectable = (host is IConnectable);
            IsHoverable   = (host is IHoverable);
            IsClickable   = (host is IClickable);

            Selectable  = (host as ISelectable);
            Movable     = (host as IMovable);
            Connectable = (host as IConnectable);
            Hoverable   = (host as IHoverable);
            Clickable   = (host as IClickable);

            //enable piccolo input events?
            PNode.Pickable = IsSelectable || IsMovable || IsConnectable || IsHoverable || IsClickable;

            if (IsMovable)
            {
                PNode.TransformChanged += BoundsChanged;
            }

            if (IsHoverable)
            {
                PNode.MouseEnter += new PInputEventHandler(GraphElement_MouseEnter);
                PNode.MouseLeave += new PInputEventHandler(GraphElement_MouseLeave);
                PNode.MouseMove  += new PInputEventHandler(GraphElement_MouseMove);
            }

            if (IsClickable)
            {
                PNode.Click       += new PInputEventHandler(PNode_Click);
                PNode.DoubleClick += new PInputEventHandler(PNode_DoubleClick);
                PNode.MouseDown   += new PInputEventHandler(PNode_MouseDown);
                PNode.MouseUp     += new PInputEventHandler(PNode_MouseUp);
            }
        }
Пример #14
0
 public LinkPath(IGraphElementHost host, ITempPath temppath, ISolid end)
     : base(host, temppath.Start)
 {
     Points = temppath.Points;
     PathConstruction(end);
 }
Пример #15
0
 public LinkPath(IGraphElementHost host, ISolid start, ISolid end)
     : base(host, start)
 {
     PathConstruction(end);
 }