当前位置: 首页>>代码示例>>C#>>正文


C# Models.NodeModel类代码示例

本文整理汇总了C#中Dynamo.Models.NodeModel的典型用法代码示例。如果您正苦于以下问题:C# NodeModel类的具体用法?C# NodeModel怎么用?C# NodeModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NodeModel类属于Dynamo.Models命名空间,在下文中一共展示了NodeModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsUpstreamOf

        internal static bool IsUpstreamOf(this NodeModel node, NodeModel otherNode)
        {
            var gathered = new List<NodeModel>();
            otherNode.AllUpstreamNodes(gathered);

            return gathered.Contains(node);
        }
开发者ID:rafatahmed,项目名称:Dynamo,代码行数:7,代码来源:NodeModelExtensions.cs

示例2: MarkNode

        // Reverse post-order to sort nodes
        private static void MarkNode(NodeModel node, Dictionary<NodeModel, MarkFlag> nodeFlags, Stack<NodeModel> sortedList)
        {
            MarkFlag flag;
            if (!nodeFlags.TryGetValue(node, out flag))
            {
                flag = MarkFlag.NoMark;
                nodeFlags[node] = flag;
            }

            if (MarkFlag.TempMark == flag)
                return;

            if (MarkFlag.NoMark == flag)
            {
                nodeFlags[node] = MarkFlag.TempMark;

                IEnumerable<NodeModel> outputs =
                    node.Outputs.Values.SelectMany(set => set.Select(t => t.Item2)).Distinct();
                foreach (NodeModel output in outputs)
                    MarkNode(output, nodeFlags, sortedList);

                nodeFlags[node] = MarkFlag.Marked;
                sortedList.Push(node);
            }
        }
开发者ID:heegwon,项目名称:Dynamo,代码行数:26,代码来源:AstBuilder.cs

示例3: AssertLocationValues

 private void AssertLocationValues(NodeModel locNode, Document doc)
 {
     var locValue = GetPreviewValue(locNode.GUID.ToString()) as Location;
     Assert.AreEqual(locValue.Name, doc.SiteLocation.PlaceName);
     Assert.AreEqual(locValue.Latitude, doc.SiteLocation.Latitude.ToDegrees(), 0.001);
     Assert.AreEqual(locValue.Longitude, doc.SiteLocation.Longitude.ToDegrees(), 0.001);
 }
开发者ID:whztt07,项目名称:Dynamo,代码行数:7,代码来源:SiteLocationTests.cs

示例4: Initialize

        /// <summary>
        /// Call this method to determine if the task should be scheduled for 
        /// execution.
        /// </summary>
        /// <param name="workspaceModel">Render packages for all the nodes in 
        /// this workspaceModel will be extracted, if 'nodeModel' parameter is 
        /// null.</param>
        /// <param name="nodeModel">An optional NodeModel from which all upstream 
        /// nodes are to be examined for render packages. If this parameter is 
        /// null, render packages are extracted from all nodes in workspaceModel.
        /// </param>
        /// <returns>Returns true if the task should be scheduled for execution,
        /// or false otherwise.</returns>
        /// 
        internal bool Initialize(WorkspaceModel workspaceModel, NodeModel nodeModel)
        {
            if (workspaceModel == null)
                throw new ArgumentNullException("workspaceModel");

            if (nodeModel == null) // No node is specified, gather all nodes.
            {
                targetedNodeId = Guid.Empty;

                // Duplicate a list of all nodes for consumption later.
                var nodes = workspaceModel.Nodes.Where(n => n.IsVisible);
                duplicatedNodeReferences = nodes.ToList();
            }
            else
            {
                targetedNodeId = nodeModel.GUID;

                // Recursively gather all upstream nodes. Stop 
                // gathering if this node does not display upstream.
                var gathered = new List<NodeModel>();
                WorkspaceUtilities.GatherAllUpstreamNodes(nodeModel,
                    gathered, model => model.IsUpstreamVisible);

                duplicatedNodeReferences = gathered;
            }

            return duplicatedNodeReferences.Any();
        }
开发者ID:JinWooShin,项目名称:Dynamo,代码行数:42,代码来源:AggregateRenderPackageAsyncTask.cs

示例5: Initialize

        /// <summary>
        /// Call this method to determine if the task should be scheduled for 
        /// execution.
        /// </summary>
        /// <param name="workspaceModel">Render packages for all the nodes in 
        /// this workspaceModel will be extracted, if 'nodeModel' parameter is 
        /// null.</param>
        /// <param name="nodeModel">An optional NodeModel from which all upstream 
        /// nodes are to be examined for render packages. If this parameter is 
        /// null, render packages are extracted from all nodes in workspaceModel.
        /// </param>
        /// <returns>Returns true if the task should be scheduled for execution,
        /// or false otherwise.</returns>
        /// 
        internal bool Initialize(WorkspaceModel workspaceModel, NodeModel nodeModel)
        {
            if (workspaceModel == null)
                throw new ArgumentNullException("workspaceModel");

            if (nodeModel == null) // No node is specified, gather all nodes.
            {
                NodeId = Guid.Empty;

                // Duplicate a list of all nodes for consumption later.
                duplicatedNodeReferences = workspaceModel.Nodes.ToList();
            }
            else
            {
                NodeId = nodeModel.GUID;

                // Recursively gather all upstream nodes.
                var gathered = new List<NodeModel>();
                GatherAllUpstreamNodes(nodeModel, gathered);
                duplicatedNodeReferences = gathered;
            }

            Debug.WriteLine(string.Format("Aggregation task initialized for {0}", nodeModel == null?"null":nodeModel.GUID.ToString()));
            return duplicatedNodeReferences.Any();
        }
开发者ID:whztt07,项目名称:Dynamo,代码行数:39,代码来源:AggregateRenderPackageAsyncTask.cs

示例6: ExportWithUnitsViewModel

 public ExportWithUnitsViewModel(ExportWithUnits model, NodeView nodeView)
 {
     exportWithUnitsModel = model;           
     nodeViewModel = nodeView.ViewModel;
     nodeModel = nodeView.ViewModel.NodeModel;
     model.PropertyChanged +=model_PropertyChanged;      
 }
开发者ID:rafatahmed,项目名称:Dynamo,代码行数:7,代码来源:ExportWithUnitsViewModel.cs

示例7: NodeViewModel

        public NodeViewModel(NodeModel logic)
        {
            nodeLogic = logic;

            //respond to collection changed events to sadd
            //and remove port model views
            logic.InPorts.CollectionChanged += inports_collectionChanged;
            logic.OutPorts.CollectionChanged += outports_collectionChanged;

            logic.PropertyChanged += logic_PropertyChanged;
            dynSettings.Controller.DynamoViewModel.Model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(Model_PropertyChanged);
            dynSettings.Controller.PropertyChanged += Controller_PropertyChanged;

            this.ErrorBubble = new InfoBubbleViewModel();
            this.PreviewBubble = new InfoBubbleViewModel();
            this.PreviewBubble.PropertyChanged += PreviewBubble_PropertyChanged;

            //Do a one time setup of the initial ports on the node
            //we can not do this automatically because this constructor
            //is called after the node's constructor where the ports
            //are initially registered
            SetupInitialPortViewModels();

            //dynSettings.Controller.RequestNodeSelect += new NodeEventHandler(Controller_RequestNodeSelect);
        }
开发者ID:kscalvin,项目名称:Dynamo,代码行数:25,代码来源:NodeViewModel.cs

示例8: NodeHelpPrompt

 public NodeHelpPrompt(NodeModel node)
 {
     this.DataContext = node;
     this.Owner = WPF.FindUpVisualTree<DynamoView>(this);
     //this.Owner = dynSettings.Bench;
     this.WindowStartupLocation = WindowStartupLocation.CenterOwner;
     InitializeComponent();
 }
开发者ID:kscalvin,项目名称:Dynamo,代码行数:8,代码来源:NodeHelpPrompt.xaml.cs

示例9: AssertWatchContent

 /// <summary>
 /// Validates the watch content with the source nodes output.
 /// </summary>
 /// <param name="watch">WatchViewModel of the watch node</param>
 /// <param name="sourceNode">NodeModel for source to watch node</param>
 public void AssertWatchContent(WatchViewModel watch, NodeModel sourceNode)
 {
     string var = sourceNode.GetAstIdentifierForOutputIndex(0).Name;
     RuntimeMirror mirror = null;
     Assert.DoesNotThrow(() => mirror = ViewModel.Model.EngineController.GetMirror(var));
     Assert.IsNotNull(mirror);
     AssertWatchContent(watch, mirror.GetData());
 }
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:13,代码来源:WatchNodeTests.cs

示例10: PortViewModel

        public PortViewModel(PortModel port, NodeModel node)
        {
            _node = node;
            _port = port;

            _port.PropertyChanged += _port_PropertyChanged;
            _node.PropertyChanged += _node_PropertyChanged;
        }
开发者ID:riteshchandawar,项目名称:Dynamo,代码行数:8,代码来源:PortViewModel.cs

示例11: InitializeInputs

        protected override void InitializeInputs(NodeModel model)
        {
            model.InPortData.Clear();

            if (Definition.Parameters == null) return;

            foreach (string arg in Definition.Parameters)
                model.InPortData.Add(new PortData(arg, "parameter"));
        }
开发者ID:khoaho,项目名称:Dynamo,代码行数:9,代码来源:CustomNodeController.cs

示例12: Make

 /// <summary>
 /// Factory method to create a connector.  Checks to make sure that the start and end ports are valid, 
 /// otherwise returns null.
 /// </summary>
 /// <param name="start">The port where the connector starts</param>
 /// <param name="end">The port where the connector ends</param>
 /// <param name="startIndex"></param>
 /// <param name="endIndex"></param>
 /// <param name="portType"></param>
 /// <returns>The valid connector model or null if the connector is invalid</returns>
 public static ConnectorModel Make(NodeModel start, NodeModel end, int startIndex, int endIndex, PortType portType)
 {
     if (start != null && end != null && start != end && startIndex >= 0
         && endIndex >= 0 && start.OutPorts.Count > startIndex && end.InPorts.Count > endIndex )
     {
         return new ConnectorModel(start, end, startIndex, endIndex, portType);
     }
     
     return null;
 }
开发者ID:algobasket,项目名称:Dynamo,代码行数:20,代码来源:ConnectorModel.cs

示例13: Make

 /// <summary>
 /// Factory method to create a connector.  Checks to make sure that the start and end ports are valid, 
 /// otherwise returns null.
 /// </summary>
 /// <param name="start">The port where the connector starts</param>
 /// <param name="end">The port where the connector ends</param>
 /// <param name="startIndex"></param>
 /// <param name="endIndex"></param>
 /// <param name="portType"></param>
 /// <returns>The valid connector model or null if the connector is invalid</returns>
 internal static ConnectorModel Make(WorkspaceModel workspaceModel, NodeModel start, NodeModel end, int startIndex, int endIndex, PortType portType)
 {
     if (workspaceModel != null && start != null && end != null && start != end && startIndex >= 0
         && endIndex >= 0 && start.OutPorts.Count > startIndex && end.InPorts.Count > endIndex )
     {
         return new ConnectorModel(workspaceModel, start, end, startIndex, endIndex, portType);
     }
     
     return null;
 }
开发者ID:whztt07,项目名称:Dynamo,代码行数:20,代码来源:ConnectorModel.cs

示例14: InitializeOutputs

 protected override void InitializeOutputs(NodeModel model)
 {
     model.OutPortData.Clear();
     if (Definition.ReturnKeys != null && Definition.ReturnKeys.Any())
     {
         foreach (string key in Definition.ReturnKeys)
             model.OutPortData.Add(new PortData(key, "return value"));
     }
     else
         model.OutPortData.Add(new PortData("", "return value"));
 }
开发者ID:khoaho,项目名称:Dynamo,代码行数:11,代码来源:CustomNodeController.cs

示例15: ConnectorModel

        private ConnectorModel(
            NodeModel start, NodeModel end, int startIndex, int endIndex, Guid guid)
        {
            GUID = guid;
            Start = start.OutPorts[startIndex];

            PortModel endPort = end.InPorts[endIndex];

            Start.Connect(this);
            Connect(endPort);
        }
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:11,代码来源:ConnectorModel.cs


注:本文中的Dynamo.Models.NodeModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。