Пример #1
0
        /// <summary>
        /// Create a node and add it to the view-model.
        /// </summary>
        public NodeViewModel CreateNode(string name, Point nodeLocation)
        {
            //var node = new NodeViewModel(name);
            //var node = new RelationNode(RelationType.AND);
            //var node = new BlockDemo();
            //var node = new ProcessVM();
            var node = new SafetyPropertyVM("test");

            node.X = nodeLocation.X;
            node.Y = nodeLocation.Y;

            //
            // Create the default set of four connectors.
            // 创建默认的connector集合
            //

            // todo 类图还要对这里开多大的锚点数组做考虑
            //for (int i = 0; i < 6; i++)
            //{
            //    node.Connectors.Add(new ConnectorViewModel());
            //}

            //
            //Add the new node to the view-model.

            this.Network.Nodes.Add(node);

            return(node);
        }
Пример #2
0
        // 创建SafetyProperty
        public NodeViewModel CreateSafetyPropertyVM(Point nodeLocation)
        {
            SafetyPropertyVM node = new SafetyPropertyVM();

            // 放到全局资源里
            ResourceManager.currentProtocol.safetyProperties.Add(node.SafetyProperty);
            node.X = nodeLocation.X;
            node.Y = nodeLocation.Y;
            this.Network.Nodes.Add(node);
            return(node);
        }