Exemple #1
0
        /// <summary>
        /// Build a set of specific nodes by their IDs
        /// </summary>
        /// <param name="ids">Set of node IDs</param>
        /// <returns>Set of nodes</returns>
        public NodeSet BuildNodes(IntSet ids)
        {
            var nodes = new NodeSet();

            if (!IsValid())
            {
                return(nodes);
            }

            List <NodeCreator> creators = new List <NodeCreator>();
            NodeParams         parameters;

            foreach (int id in ids)
            {
                parameters.ID             = id;
                parameters.TypeName       = null; // TODO: Node type
                parameters.RefCSysID      = db.getNodeRcId(id);
                parameters.AnalysisCSysID = db.getNodeAcId(id);
                parameters.Coords         = db.getNodeCoords(id);

                var creator = NodeCreator.GetNodeCreatorByParams(parameters);
                creators.Add(creator);
            }

            foreach (var creator in creators)
            {
                var node = creator.BuildNode();
                nodes.Add(node);
            }

            return(nodes);
        }
Exemple #2
0
        /// <summary>
        /// The method attempts to populate a set of nodes for the current element
        /// </summary>
        /// <returns>Returns true if the result is successful, otherwise - false</returns>
        private bool TryLinkCornerNodesToElements()
        {
            if (_parentModel == null)
            {
                throw new ArgumentNullException("The parent model of element is null");
            }

            if (!(_parentModel is Model))
            {
                throw new InvalidCastException("The parent model object is not the model type");
            }

            if (NodeIDs == null || NodeIDs.Count <= 0)
            {
                throw new ArgumentNullException("Set of node IDs is null or empty");
            }

            foreach (var modelNode in ((Model)_parentModel).Nodes)
            {
                foreach (var cornerNodeID in CornerNodeIDs)
                {
                    if (cornerNodeID == modelNode.ID)
                    {
                        _cornerNodes.Add(modelNode.ID, modelNode);
                    }
                }
            }

            return(true);
        }