Ejemplo n.º 1
0
        public static Node GetRandomNode()
        {
            var nodenumber = random.Next(0, 100);
            var nodename = "Node" + nodenumber;
            var node = new Node
                {
                    Size = {Value = new Point(150,120)},
                    Name = nodename,
                    ShortName = "N" + nodenumber,
                    Location = { Value = new Point(random.Next(0, 500), random.Next(0, 500)) },
                    Color = Colors[random.Next(0, Colors.Count - 1)],
                };

            node.Snaps.AddRange(new[]
                                    {
                                        new SnapSpot(node) {Offset = {X = 0, Y = .5}, Angle = -90, Name = "LeftSnap" + nodenumber, LockX = true},
                                        new SnapSpot(node) {Offset = {X = .5, Y = 0}, Angle = 0, Name = "TopSnap" + nodenumber, LockY = true},
                                        new SnapSpot(node) {Offset = {X = 1, Y = .5}, Angle = 90, Name = "RightSnap" + nodenumber, LockX = true},
                                        new SnapSpot(node) {Offset = {X = .5, Y = 1}, Angle = 180, Name = "BottomSnap" + nodenumber, LockY = true},
                                    });
            return node;
        }
Ejemplo n.º 2
0
 public SnapSpot(Node parent)
 {
     Parent = parent;
     Offset.ValueChanged = Recalculate;
 }
Ejemplo n.º 3
0
        public void CreateNewNode()
        {
            var newnode = new Node()
                              {
                                  Name = "Node" + (Nodes.Count + 1),
                                  IsNew = true
                              };

            Nodes.Add(newnode);
            SelectedObject = newnode;
        }