Exemplo n.º 1
0
 /// <summary>
 /// Draw around the outside of the page
 /// </summary>
 private void DrawBorder()
 {
     //Border = PPath.CreateRectangle(X, Y, PageSize.A4.Width, PageSize.A4.Height);
     Border     = PPath.CreateRectangle(X, Y, Width, Height);
     Border.Pen = Pens.Black;
     AddChild(Border);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Create and show a new error
        /// </summary>
        /// <param Name="error">The text to display to the user</param>
        /// <param Name="camera">The camera to display the error on</param>
        /// <param Name="duration">How long to display the error for</param>
        public Error(string error, PCamera camera, int duration = 3000)
        {
            //Slightly shade the background to bring attention to the error
            PPath background = PPath.CreateRectangle(0, 0, camera.ViewBounds.Width, camera.ViewBounds.Height);

            background.Brush = new SolidBrush(Color.FromArgb(30, 220, 220, 220));
            AddChild(background);

            //Add the error text to the center of the screen
            PText errorText = new PText(error);

            errorText.ConstrainWidthToTextWidth = false;
            errorText.Font          = new Font("Century Gothic", 18);
            errorText.TextAlignment = StringAlignment.Center;

            float height = errorText.Font.Height;
            float width  = camera.Canvas.FindForm().Width;
            float y      = (camera.Canvas.FindForm().Height - height) / 2;

            errorText.Bounds = new RectangleF(0, y, width, height);

            AddChild(errorText);

            //Display the error
            camera.AddChild(this);

            //Remove the error after the required time
            PActivity dissapear = new PActivity(duration);

            dissapear.ActivityFinished += activityFinished;
            camera.Canvas.Root.AddActivity(dissapear);
        }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
0
        public static IEnumerable <PPath> RecursiveDepthSearch(Graph <EdgeInfo, NodeInfo> Graph, PPath path, Rational length, double originalityBorder)
        {
            if (path.length == length)
            {
                yield return(path);

                yield break;
            }
            if (path.length > 1 || path.originalityByVertices < originalityBorder)
            {
                yield break;
            }


            var last  = path.edges[path.edges.Count - 1];
            var edges = last.To.IncidentEdges.OrderByDescending(z => z.Data.length).ToList();
            var bad   = edges.Where(z => z.To == last.From).First();

            edges.Remove(bad);
            edges.Add(bad);
            foreach (var e in edges)
            {
                var p = new PPath();
                p.edges = path.edges.ToList();
                p.edges.Add(e);
                p.length = path.length + e.Data.length;
                foreach (var c in RecursiveDepthSearch(Graph, p, length, originalityBorder))
                {
                    yield return(c);
                }
            }
        }
Exemplo n.º 5
0
        public void MakeIteration()
        {
            var newPathes = CreateMatrix();

            for (int begin = 0; begin < Graph.NodesCount; begin++)
            {
                for (int intermediate = 0; intermediate < Graph.NodesCount; intermediate++)
                {
                    foreach (var currentPath in currentPathes[begin, intermediate])
                    {
                        foreach (var edge in Graph[intermediate].IncidentEdges)
                        {
                            var end  = edge.To;
                            var path = new PPath {
                                edges = currentPath.edges.ToList(), length = currentPath.length
                            };
                            path.edges.Add(edge);
                            path.length += edge.Data.length;
                            if (path.length > maxLength)
                            {
                                continue;
                            }
                            newPathes[begin, end.NodeNumber].Add(path);
                            RegisterOutput(path);
                        }
                    }
                }
            }
            currentPathes = newPathes;

            Scoring();
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            bool isFound = false;

            foreach (Process PPath in Process.GetProcessesByName("node"))
            {
                int    processId   = PPath.Id;
                string processArgs = "";

                var q = string.Format("select CommandLine from Win32_Process where ProcessId='{0}'", processId);
                ManagementObjectSearcher   searcher = new ManagementObjectSearcher(q);
                ManagementObjectCollection result   = searcher.Get();

                foreach (ManagementObject obj in result)
                {
                    processArgs = obj["CommandLine"].ToString();
                    if (processArgs.ToLower().Contains("appium"))
                    {
                        isFound = true;
                        PPath.Kill();
                        Console.WriteLine("Killed process id {0} : {1}", processId, processArgs);
                    }
                }
            }

            if (!isFound)
            {
                Console.WriteLine("No process found for appium");
            }
        }
Exemplo n.º 7
0
        public InterpGroup(int idx, PCCObject pccobj)
            : base()
        {
            index = idx;
            pcc   = pccobj;

            title = new SText("");
            if (pcc.Exports[index].ClassName == "InterpGroupDirector")
            {
                GroupName = "DirGroup";
            }
            listEntry       = PPath.CreateRectangle(0, 0, Timeline.ListWidth, Timeline.TrackHeight);
            listEntry.Brush = GroupBrush;
            listEntry.Pen   = null;
            PPath p = PPath.CreatePolygon(7, 5, 12, 10, 7, 15);

            p.Brush = Brushes.Black;
            listEntry.AddChild(p);
            listEntry.AddChild(PPath.CreateLine(0, listEntry.Bounds.Bottom, Timeline.ListWidth, listEntry.Bounds.Bottom));
            colorAccent        = new PNode();
            colorAccent.Brush  = null;
            colorAccent.Bounds = new RectangleF(Timeline.ListWidth - 10, 0, 10, listEntry.Bounds.Bottom);
            listEntry.AddChild(colorAccent);
            title.TranslateBy(20, 3);
            listEntry.AddChild(title);
            listEntry.MouseDown += listEntry_MouseDown;
            collapsed            = true;
            InterpTracks         = new List <InterpTrack>();

            LoadData();
        }
Exemplo n.º 8
0
        public override void Initialize()
        {
            PCanvas canvas = Canvas;

            PPath circle = PPath.CreateEllipse(0, 0, 100, 100);

            circle.Pen   = new Pen(Color.Yellow, 10);
            circle.Brush = Brushes.Yellow;

            PPath rectangle = PPath.CreateRectangle(-100, -50, 100, 100);

            rectangle.Pen   = new Pen(Color.Orange, 15);
            rectangle.Brush = Brushes.Orange;

            PNodeCache cache = new PNodeCache();

            cache.AddChild(circle);
            cache.AddChild(rectangle);

            cache.InvalidateCache();

            canvas.Layer.AddChild(cache);
            canvas.RemoveInputEventListener(canvas.PanEventHandler);
            canvas.AddInputEventListener(new PDragEventHandler());
        }
 public override void OnMouseUp(object sender, PInputEventArgs e)
 {
     base.OnMouseUp(sender, e);
     // update the rectangle shape.
     UpdateRectangle();
     rectangle = null;
 }
Exemplo n.º 10
0
 public void CreateConnections(ref List <DlgObj> objects)
 {
     for (int i = 0; i < Outlinks.Count; i++)
     {
         for (int j = 0; j < objects.Count; j++)
         {
             if (objects[j].Id == Outlinks[i].Link)
             {
                 PPath  p1   = Outlinks[i].node;
                 DlgObj p2   = (DlgObj)dv.nodeLayer[j];
                 PPath  edge = new PPath();
                 if (p1.Tag == null)
                 {
                     p1.Tag = new ArrayList();
                 }
                 if (p2.Tag == null)
                 {
                     p2.Tag = new ArrayList();
                 }
                 ((ArrayList)p1.Tag).Add(edge);
                 ((ArrayList)p2.Tag).Add(edge);
                 edge.Tag = new ArrayList();
                 ((ArrayList)edge.Tag).Add(p1);
                 ((ArrayList)edge.Tag).Add(p2);
                 dv.addEdge(edge);
             }
         }
     }
 }
Exemplo n.º 11
0
 public void RecreateConnections(IList <DObj> objects)
 {
     foreach (OutputLink outLink in Outlinks)
     {
         foreach (int link in outLink.Links)
         {
             foreach (DiagNode destAction in objects.OfType <DiagNode>())
             {
                 if (destAction.NodeID == link)
                 {
                     PPath p1   = outLink.node;
                     var   edge = new DiagEdEdge();
                     if (p1.Tag == null)
                     {
                         p1.Tag = new List <DiagEdEdge>();
                     }
                     ((List <DiagEdEdge>)p1.Tag).Add(edge);
                     destAction.InputEdges.Add(edge);
                     edge.Pen        = new Pen(getColor(outLink.RCat));
                     edge.start      = p1;
                     edge.end        = destAction;
                     edge.originator = this;
                     edge.inputIndex = outLink.InputIndices;
                     g.addEdge(edge);
                     outLink.Edges.Add(edge);
                     destAction.RefreshInputLinks();
                 }
             }
         }
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// Creates the connection to the annex node.
        /// </summary>
        public override void CreateConnections(ref List <PathfindingNodeMaster> Objects)
        {
            var annexZoneLocProp = export.GetProperty <ObjectProperty>("AnnexZoneLocation");

            if (annexZoneLocProp != null)
            {
                //IExportEntry annexzonelocexp = pcc.Exports[annexZoneLocProp.Value - 1];

                PathfindingNodeMaster othernode = null;
                int othernodeidx = annexZoneLocProp.Value - 1;
                if (othernodeidx != 0)
                {
                    foreach (PathfindingNodeMaster node in Objects)
                    {
                        if (node.export.Index == othernodeidx)
                        {
                            othernode = node;
                            break;
                        }
                    }
                }

                if (othernode != null)
                {
                    PPath edge = new PPath();
                    ((ArrayList)Tag).Add(edge);
                    ((ArrayList)othernode.Tag).Add(edge);
                    edge.Tag = new ArrayList();
                    ((ArrayList)edge.Tag).Add(this);
                    ((ArrayList)edge.Tag).Add(othernode);
                    g.edgeLayer.AddChild(edge);
                }
            }
        }
Exemplo n.º 13
0
        public override void Initialize()
        {
            PRoot  root  = Canvas.Root;
            PLayer layer = Canvas.Layer;

            PNode n      = PPath.CreateRectangle(0, 0, 100, 80);
            PNode sticky = PPath.CreateRectangle(0, 0, 50, 50);

            PBoundsHandle.AddBoundsHandlesTo(n);
            sticky.Brush = Color.Yellow;
            PBoundsHandle.AddBoundsHandlesTo(sticky);

            layer.AddChild(n);
            Canvas.Camera.AddChild(sticky);

            PCamera otherCamera = new PCamera();

            otherCamera.AddLayer(layer);
            root.AddChild(otherCamera);

            PCanvas other = new PCanvas();

            other.Camera = otherCamera;
            PForm result = new PForm(false, other);

            result.StartPosition = FormStartPosition.Manual;
            result.Location      = new System.Drawing.Point(this.Location.X + this.Width, this.Location.Y);
            result.Size          = this.Size;
            result.Show();
        }
Exemplo n.º 14
0
        public SplinePoint0Node(int idx, float x, float y, IMEPackage p, PathingGraphEditor grapheditor)
            : base(idx, p, grapheditor)
        {
            string         s          = export.ObjectName;
            StructProperty splineInfo = export.GetProperty <StructProperty>("SplineInfo");

            if (splineInfo != null)
            {
                ArrayProperty <StructProperty> pointsProp = splineInfo.GetProp <ArrayProperty <StructProperty> >("Points");
                StructProperty point0 = pointsProp[0];
                StructProperty point1 = pointsProp[1];
                a    = PathfindingEditor.GetVector2(point0.GetProp <StructProperty>("OutVal"));
                tan1 = PathfindingEditor.GetVector2(point0.GetProp <StructProperty>("LeaveTangent"));
                tan2 = PathfindingEditor.GetVector2(point1.GetProp <StructProperty>("ArriveTangent"));
                d    = PathfindingEditor.GetVector2(point1.GetProp <StructProperty>("OutVal"));
                // = getType(s);
                float w = 25;
                float h = 25;
                shape          = PPath.CreateEllipse(0, 0, w, h);
                outlinePen     = new Pen(color);
                shape.Pen      = outlinePen;
                shape.Brush    = pathfindingNodeBrush;
                shape.Pickable = false;
                this.AddChild(shape);
                this.Bounds       = new RectangleF(0, 0, w, h);
                val               = new SText(export.Index + "\nSpline Start");
                val.Pickable      = false;
                val.TextAlignment = StringAlignment.Center;
                val.X             = w / 2 - val.Width / 2;
                val.Y             = h / 2 - val.Height / 2;
                this.AddChild(val);
                var props = export.GetProperties();
                this.TranslateBy(x, y);
            }
        }
Exemplo n.º 15
0
        public Sector(PLayer layer, String name)
        {
            Random rnd      = new Random((int)DateTime.Now.Ticks); // seeded with ticks
            Color  penColor = Color.FromArgb((rnd.Next(0, 255)), (rnd.Next(0, 255)), (rnd.Next(0, 255)));

            Pen sigPen = new Pen(penColor, 2.0F);

            sigPen.DashStyle = DashStyle.DashDotDot;

            PPath sigCircle = PPath.CreateEllipse(100, 500, 100, 100);

            sigCircle.Pen   = sigPen;
            sigCircle.Brush = Brushes.Transparent;

            PText pname = new PText(name);

            pname.TextBrush     = Brushes.White;
            pname.TextAlignment = StringAlignment.Center;
            pname.X             = sigCircle.X;
            pname.Y             = sigCircle.Y;

            //Display Object by adding them to its layer
            layer.AddChild(pname);
            layer.AddChild(sigCircle);
        }
Exemplo n.º 16
0
        public SFXNav_TurretPoint(int idx, float x, float y, IMEPackage p, PathingGraphEditor grapheditor)
            : base(idx, p, grapheditor)
        {
            string s = export.ObjectName;

            // = getType(s);
            float w         = 50;
            float h         = 50;
            PPath nodeShape = PPath.CreatePolygon(diamondshape);

            shape          = nodeShape;
            outlinePen     = new Pen(color);
            shape.Pen      = outlinePen;
            shape.Brush    = actorNodeBrush;
            shape.Pickable = false;
            this.AddChild(shape);
            this.Bounds       = new RectangleF(0, 0, w, h);
            val               = new SText(idx.ToString());
            val.Pickable      = false;
            val.TextAlignment = StringAlignment.Center;
            val.X             = w / 2 - val.Width / 2;
            val.Y             = h / 2 - val.Height / 2;
            this.AddChild(val);
            var props = export.GetProperties();

            this.TranslateBy(x, y);
        }
        public override void Initialize()
        {
            PLayer layer        = Canvas.Layer;
            PNode  animatedNode = PPath.CreateRectangle(0, 0, 100, 80);

            layer.AddChild(animatedNode);

            // create node to display animation path
            PPath ppath = new PPath();

            // create animation path
            ppath.AddLine(0, 0, 300, 300);
            ppath.AddLine(300, 300, 300, 0);
            ppath.AddArc(0, 0, 300, 300, -90, 90);
            ppath.CloseFigure();

            // add the path to the scene graph
            layer.AddChild(ppath);

            PPositionPathActivity positionPathActivity = new PPositionPathActivity(5000, 0, new PositionPathTarget(animatedNode));

            positionPathActivity.PositionPath = (XnaGraphicsPath)ppath.PathReference.Clone();
            positionPathActivity.LoopCount    = int.MaxValue;

            // add the activity
            animatedNode.AddActivity(positionPathActivity);
        }
Exemplo n.º 18
0
        public override void Initialize()
        {
            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    PNode rect = PPath.CreateRectangle(i * 60, j * 60, 50, 50);
                    rect.Brush = Brushes.Blue;
                    Canvas.Layer.AddChild(rect);
                }
            }

            // Turn off default navigation event handlers
            Canvas.RemoveInputEventListener(Canvas.PanEventHandler);
            Canvas.RemoveInputEventListener(Canvas.ZoomEventHandler);

            // Create a selection event handler
            PSelectionEventHandler selectionEventHandler = new PSelectionEventHandler(Canvas.Layer, Canvas.Layer);

            Canvas.AddInputEventListener(selectionEventHandler);
            Canvas.Root.DefaultInputManager.KeyboardFocus = Canvas.Camera.ToPickPath();

            PNotificationCenter.DefaultCenter.AddListener(this,
                                                          "selectionChanged",
                                                          PSelectionEventHandler.SELECTION_CHANGED_NOTIFICATION,
                                                          selectionEventHandler);
        }
Exemplo n.º 19
0
        //! Заполняет граф диалога нужными узлами
        void fillDialogGraphView(CDialog root)
        {
            // Initialize, and create a layer for the edges (always underneath the nodes)
            this.DialogShower.Layer.RemoveAllChildren();
            nodeLayer = new PNodeList();
            edgeLayer = new PLayer();

            this.DialogShower.Root.AddChild(edgeLayer);
            this.DialogShower.Camera.AddLayer(0, edgeLayer);

            // Show root node
            float rootx    = (float)(this.ClientSize.Width / 5);
            float rooty    = (float)(this.ClientSize.Height / 5);
            SizeF size     = CalcEllipsisSizeForNode(root.DialogID);
            PNode rootNode = PPath.CreateEllipse(rootx, rooty, size.Width, size.Height);

            rootNode.Brush = Brushes.Green;

            PText rootText = new PText(root.DialogID.ToString());

            rootText.Pickable = false;
            rootText.X        = rootNode.X + 15;
            rootText.Y        = rootNode.Y + 10;
            rootNode.Tag      = new ArrayList();

            //          ((ArrayList)rootNode.Tag).Add(root.DialogID);
            rootNode.AddChild(rootText);
            nodeLayer.Add(rootNode);
            if (!graphs.Keys.Contains(rootNode))
            {
                graphs.Add(rootNode, new GraphProperties(root.DialogID));
            }
            this.fillDialogSubgraphView(root, rootNode, 1, ref edgeLayer, ref nodeLayer, false);//, rootNode, edgeLayer);
            this.DialogShower.Layer.AddChildren(nodeLayer);
        }
Exemplo n.º 20
0
        public static void UpdateEdge(PPath edge)
        {
            // Note that the node's "FullBounds" must be used (instead of just the "Bound")
            // because the nodes have non-identity transforms which must be included when
            // determining their position.

            ArrayList nodes = (ArrayList)edge.Tag;
            PNode     node1 = (PNode)nodes[0];
            PNode     node2 = (PNode)nodes[1];
            PointF    start = node1.GlobalBounds.Location;
            PointF    end = node2.GlobalBounds.Location;
            float     h1x, h1y, h2x;

            if (nodes.Count > 2 && (int)nodes[2] == -1) //var link
            {
                start.X += node1.GlobalBounds.Width * 0.5f;
                start.Y += node1.GlobalBounds.Height;
                h1x      = h2x = 0;
                h1y      = end.Y > start.Y ? 200 * (float)Math.Log10((end.Y - start.Y) / 200 + 1) : 200 * (float)Math.Log10((start.Y - end.Y) / 100 + 1);
                end.X   += node2.GlobalBounds.Width / 2;
                end.Y   += node2.GlobalBounds.Height / 2;
            }
            else
            {
                start.X += node1.GlobalBounds.Width;
                start.Y += node1.GlobalBounds.Height * 0.5f;
                end.Y   += node2.GlobalBounds.Height * 0.5f;
                h1x      = h2x = end.X > start.X ? 200 * (float)Math.Log10((end.X - start.X) / 200 + 1) : 200 * (float)Math.Log10((start.X - end.X) / 100 + 1);
                h1y      = 0;
            }

            edge.Reset();
            //edge.AddLine(start.X, start.Y, end.X, end.Y);
            edge.AddBezier(start.X, start.Y, start.X + h1x, start.Y + h1y, end.X - h2x, end.Y, end.X, end.Y);
        }
Exemplo n.º 21
0
        public SFXNav_LadderNode(int idx, float x, float y, IMEPackage p, PathingGraphEditor grapheditor)
            : base(idx, p, grapheditor)
        {
            string s = export.ObjectName;

            // = getType(s);
            float        w        = 50;
            float        h        = 50;
            BoolProperty bTopNode = export.GetProperty <BoolProperty>("bTopNode");

            PointF[] shapetouse = laddertopshape;
            if (bTopNode == null || bTopNode.Value == false)
            {
                shapetouse = ladderbottomshape;
            }
            shape          = PPath.CreatePolygon(shapetouse);
            outlinePen     = new Pen(color);
            shape.Pen      = outlinePen;
            shape.Brush    = pathfindingNodeBrush;
            shape.Pickable = false;
            this.AddChild(shape);
            this.Bounds       = new RectangleF(0, 0, w, h);
            val               = new SText(idx.ToString());
            val.Pickable      = false;
            val.TextAlignment = StringAlignment.Center;
            val.X             = w / 2 - val.Width / 2;
            val.Y             = h / 2 - val.Height / 2;
            this.AddChild(val);
            var props = export.GetProperties();

            this.TranslateBy(x, y);
        }
Exemplo n.º 22
0
        public EverythingElseNode(int idx, float x, float y, IMEPackage p, PathingGraphEditor grapheditor)
            : base(idx, p, grapheditor)
        {
            string s = export.ObjectName;

            // = getType(s);
            float w = 50;
            float h = 50;

            shape          = PPath.CreateRectangle(0, 0, w, h);
            outlinePen     = new Pen(color);
            shape.Pen      = outlinePen;
            shape.Brush    = backgroundBrush;
            shape.Pickable = false;
            this.AddChild(shape);
            this.Bounds       = new RectangleF(0, 0, w, h);
            val               = new SText(idx.ToString());
            val.Pickable      = false;
            val.TextAlignment = StringAlignment.Center;
            val.X             = w / 2 - val.Width / 2;
            val.Y             = h / 2 - val.Height / 2;
            this.AddChild(val);
            this.TranslateBy(x, y);
            if (comment.Text != "")
            {
                s += "\n";
            }
            comment.Text = s + comment.Text;
        }
Exemplo n.º 23
0
        public BlockingVolumeNode(int idx, float x, float y, IMEPackage p, PathingGraphEditor grapheditor)
            : base(idx, p, grapheditor)
        {
            string s = export.ObjectName;

            if (grapheditor.showVolumeBrushes && grapheditor.showVolume_BlockingVolume)
            {
                var TShape = get3DBrushShape();
                if (TShape != null)
                {
                    shape = PPath.CreatePolygon(TShape);
                }
                else
                {
                    shape = PPath.CreateRectangle(0, 0, 50, 50);
                }
            }
            else
            {
                shape = PPath.CreateRectangle(0, 0, 50, 50);
            }
            outlinePen     = new Pen(color);
            shape.Pen      = outlinePen;
            shape.Brush    = actorNodeBrush;
            shape.Pickable = false;
            this.AddChild(shape);
            this.Bounds       = new RectangleF(0, 0, 50, 50);
            val               = new SText(idx.ToString());
            val.Pickable      = false;
            val.TextAlignment = StringAlignment.Center;
            val.X             = 50 / 2 - val.Width / 2;
            val.Y             = 50 / 2 - val.Height / 2;
            this.AddChild(val);
            this.TranslateBy(x, y);
        }
Exemplo n.º 24
0
        public SplinePoint1Node(int idx, float x, float y, IMEPackage p, PathingGraphEditor grapheditor)
            : base(idx, p, grapheditor)
        {
            string s = export.ObjectName;

            // = getType(s);
            float w = 20;
            float h = 20;

            shape          = PPath.CreateEllipse(0, 0, w, h);
            outlinePen     = new Pen(color);
            shape.Pen      = outlinePen;
            shape.Brush    = pathfindingNodeBrush;
            shape.Pickable = false;
            this.AddChild(shape);
            this.Bounds       = new RectangleF(0, 0, w, h);
            val               = new SText(export.Index + "\nSpline End");
            val.Pickable      = false;
            val.TextAlignment = StringAlignment.Center;
            val.X             = w / 2 - val.Width / 2;
            val.Y             = h / 2 - val.Height / 2;
            this.AddChild(val);
            var props = export.GetProperties();

            this.TranslateBy(x, y);
        }
Exemplo n.º 25
0
        public override void Initialize()
        {
            PPath n1 = PPath.CreateRectangle(0, 0, 100, 80);
            PPath n2 = PPath.CreateEllipse(100, 100, 200, 34);
            PPath n3 = new PPath();

            n3.AddLine(0, 0, 20, 40);
            n3.AddLine(20, 40, 10, 200);
            n3.AddLine(10, 200, 155.444f, 33.232f);
            n3.CloseFigure();
            n3.Brush = Color.Yellow;

            n1.Pen = new System.Drawing.Pen(System.Drawing.Brushes.Red, 5);
            n2.Pen = new System.Drawing.Pen(System.Drawing.Brushes.Black, 0); //Fixed width stroke
            n3.Pen = new System.Drawing.Pen(System.Drawing.Brushes.Black, 0); //Fixed width stroke

            Canvas.Layer.AddChild(n1);
            Canvas.Layer.AddChild(n2);
            Canvas.Layer.AddChild(n3);

            // create a set of bounds handles for reshaping n3, and make them
            // sticky relative to the getCanvas().getCamera().
            PStickyHandleManager sm = new PStickyHandleManager(Canvas.Camera, n3);

            Canvas.RemoveInputEventListener(Canvas.PanEventHandler);
            Canvas.AddInputEventListener(new PDragEventHandler());
        }
Exemplo n.º 26
0
 public Dot(IGraphElementHost host)
     : base(host)
 {
     DotSize     = 1;
     PNode.Brush = null;
     PPath.AddRectangle(Position.X, Position.Y, DotSize, DotSize);
 }
Exemplo n.º 27
0
        public Starbase(PLayer layer, String name, float x, float y, float sigRadius, float rrRadius)
        {
            float sigDia = (sigRadius * 2) / 100;
            float rrDia  = (rrRadius * 2) / 100;

            string dataDirectory = "Images";
            string filePath      = Path.Combine("..", "..");

            if (File.Exists(Path.Combine(dataDirectory, "stations.gif")))
            {
                filePath = "";
            }

            Image  image        = Image.FromFile(Path.Combine(filePath, Path.Combine(dataDirectory, "stations.gif")));
            PImage stationImage = new PImage(image);

            stationImage.X = (x - (image.Width / 2)) / 100;
            stationImage.Y = (y - (image.Height / 2)) / 100;

            float sigX = (x / 100) - ((sigDia / 2) - (image.Width / 2));
            float sigY = (y / 100) - ((sigDia / 2) - (image.Height / 2));
            float rrX  = (x / 100) - ((rrDia / 2) - (image.Width / 2));
            float rrY  = (y / 100) - ((rrDia / 2) - (image.Height / 2));

            Pen sigPen = new Pen(Color.Yellow, 2.0F);

            sigPen.DashStyle = DashStyle.DashDotDot;
            Pen rrPen = new Pen(Color.LightGoldenrodYellow, 1.0F);

            PPath sigCircle = PPath.CreateEllipse(sigX, sigY, sigDia, sigDia);

            sigCircle.Pen = sigPen;
            PPath rrCircle = PPath.CreateEllipse(rrX, rrY, rrDia, rrDia);

            rrCircle.Pen = rrPen;

            PNode sigNode = sigCircle;

            sigNode.Brush = Brushes.Transparent;

            PNode rrNode = rrCircle;

            rrNode.Brush = Brushes.Transparent;

            PText pname = new PText(name);

            pname.TextBrush     = Brushes.White;
            pname.TextAlignment = StringAlignment.Center;
            pname.X             = (x / 100) - (pname.Width / 2);
            pname.Y             = (y / 100) - 20;

            stationImage.AddChild(sigNode);
            stationImage.AddChild(rrNode);
            stationImage.AddChild(pname);

            //Display Object by adding them to its layer
            layer.AddChild(stationImage);
        }
Exemplo n.º 28
0
        public SplineActorNode(int idx, float x, float y, IMEPackage p, PathingGraphEditor grapheditor)
            : base(idx, p, grapheditor)
        {
            var splprop = export.GetProperty <ArrayProperty <StructProperty> >("Connections");

            if (splprop != null)
            {
                foreach (var prop in splprop)
                {
                    var spcomp  = prop.GetProp <ObjectProperty>("SplineComponent");
                    var cmpidx  = spcomp?.Value ?? 0;
                    var cntcomp = prop.GetProp <ObjectProperty>("ConnectTo");
                    pcc.TryGetUExport(cntcomp?.Value ?? 0, out ExportEntry cnctn);
                    if (spcomp != null && cmpidx > 0)
                    {
                        var component = pcc.GetUExport(cmpidx);
                        var spline    = new Spline(component, grapheditor, cnctn);
                        Splines.Add(spline);

                        spline.Pickable = false;
                        g.nodeLayer.AddChild(spline);
                    }
                    connections.Add(cnctn);
                }
            }

            Vector3 tangent = CommonStructs.GetVector3(export, "SplineActorTangent", new Vector3(300f, 0f, 0f));

            //(float controlPointX, float controlPointY, _) = tangent;

            (float controlPointX, float controlPointY, float controlPointZ) = ActorUtils.GetLocalToWorld(export).TransformNormal(tangent);

            LeaveTangentControlNode  = new SplinePointControlNode(this, controlPointX, controlPointY, controlPointZ, UpdateMode.LeaveTangent);
            ArriveTangentControlNode = new SplinePointControlNode(this, -controlPointX, -controlPointY, controlPointZ, UpdateMode.ArriveTangent);
            AddChild(LeaveTangentControlNode);
            AddChild(ArriveTangentControlNode);

            shape          = PPath.CreatePolygon(edgeShape);
            outlinePen     = new Pen(color);
            shape.Pen      = outlinePen;
            shape.Brush    = splineNodeBrush;
            shape.Pickable = false;
            AddChild(shape);
            float w = shape.Width;
            float h = shape.Height;

            Bounds = new RectangleF(0, 0, w, h);
            SText val = new SText(idx.ToString())
            {
                Pickable      = false,
                TextAlignment = StringAlignment.Center
            };

            val.X = w / 2 - val.Width / 2;
            val.Y = h / 2 - val.Height / 2;
            AddChild(val);
            SetOffset(x, y);
        }
Exemplo n.º 29
0
        public void SetShape(bool polygon)
        {
            if (shape != null)
            {
                RemoveChild(shape);
            }
            bool addVal = val == null;

            if (val == null)
            {
                val = new SText(index.ToString())
                {
                    Pickable      = false,
                    TextAlignment = StringAlignment.Center
                };
            }

            ShowAsPolygon = polygon;
            outlinePen    = new Pen(GetDefaultShapeColor()); //Can't put this in a class variable becuase it doesn't seem to work for some reason.
            if (polygon)
            {
                PointF[] polygonShape     = get3DBrushShape();
                int      calculatedHeight = get3DBrushHeight();
                if (polygonShape != null)
                {
                    shape = PPath.CreatePolygon(polygonShape);
                    var AveragePoint = GetAveragePoint(polygonShape);
                    val.X = AveragePoint.X - val.Width / 2;
                    val.Y = AveragePoint.Y - val.Height / 2;
                    if (calculatedHeight >= 0)
                    {
                        SText brushText = new SText($"Brush total height: {calculatedHeight}");
                        brushText.X             = AveragePoint.X - brushText.Width / 2;
                        brushText.Y             = AveragePoint.Y + 20 - brushText.Height / 2;
                        brushText.Pickable      = false;
                        brushText.TextAlignment = StringAlignment.Center;
                        shape.AddChild(brushText);
                    }
                    shape.Pen      = Selected ? selectedPen : outlinePen;
                    shape.Brush    = actorNodeBrush;
                    shape.Pickable = false;
                }
                else
                {
                    SetDefaultShape();
                }
            }
            else
            {
                SetDefaultShape();
            }
            AddChild(0, shape);
            if (addVal)
            {
                AddChild(val);
            }
        }
            protected override void OnStartDrag(object sender, PInputEventArgs e)
            {
                base.OnStartDrag(sender, e);

                squiggle  = new PPath();
                lastPoint = e.Position;
                //squiggle.Pen = new Pen(Brushes.Black, (float)(1/ e.Camera.ViewScale));
                layer.AddChild(squiggle);
            }