NodePath* Dijkstra::calculate_path(Node* start, Node* dest) { /** * This is the dijkstra algorithm that searches through the node graph for * the most efficiant way from start node to destination node. */ //Initialize; set cost to startnode to zero and rest to inf. Node* current_node = start; NodeVector graph = grid->get_nodes(); for (NodeVector::iterator it = graph.begin(); it != graph.end(); it++) { (*it)->set_cost_from_start(max_cost); } start->set_cost_from_start(0); prio_queue.push(current_node); //Core loop while (!prio_queue.empty()) { current_node = prio_queue.top(); prio_queue.pop(); if (current_node == dest) { save_path(start, dest); while (!prio_queue.empty()) { prio_queue.pop(); } return create_path_copy(saved_paths[NodePair(start, dest)]); } NodeVector neighbors = current_node->get_neighbors(); for (NodeVector::iterator neighbor = neighbors.begin(); neighbor != neighbors.end(); neighbor++) { if (*neighbor == current_node) continue; if (!(*neighbor)->is_allowed()) continue; int new_cost = current_node->get_cost_from_start(); new_cost++; int neighbor_cost = (*neighbor)->get_cost_from_start(); if (new_cost < neighbor_cost) { (*neighbor)->set_cost_from_start(new_cost); (*neighbor)->set_parent(current_node); prio_queue.push((*neighbor)); } } } save_path(start, dest); return create_path_copy(saved_paths[NodePair(start, dest)]); }
/** * Copies the entries of the input vector of types to the output vector, * omitting duplicate types. Useful for TypeSet and UnionType simplification. */ void copyUnique(const NodeVector& input, NodeVector& output) { for (NodeVector::const_iterator it = input.begin(); it != input.end(); it++) { bool exists = false; for (NodeVector::iterator is = output.begin(); is != output.end(); is++) { if (equal(*it, *is)) { exists = true; break; } } if (!exists) output.push_back(*it); } assert(output.size() <= input.size()); assert(output.empty() == input.empty()); }
static void willRemoveChildren(ContainerNode* container) { NodeVector children; getChildNodes(container, children); container->document()->nodeChildrenWillBeRemoved(container); #if ENABLE(MUTATION_OBSERVERS) ChildListMutationScope mutation(container); #endif for (NodeVector::const_iterator it = children.begin(); it != children.end(); it++) { Node* child = it->get(); #if ENABLE(MUTATION_OBSERVERS) mutation.willRemoveChild(child); child->notifyMutationObserversNodeWillDetach(); #endif #if ENABLE(UNDO_MANAGER) if (UndoManager::isRecordingAutomaticTransaction(container)) UndoManager::addTransactionStep(NodeRemovingDOMTransactionStep::create(container, child)); #endif // fire removed from document mutation events. dispatchChildRemovalEvents(child); } ChildFrameDisconnector(container, ChildFrameDisconnector::DoNotIncludeRoot).disconnect(); }
void ContainerNode::parserInsertBefore(PassRefPtr<Node> newChild, Node* nextChild) { ASSERT(newChild); ASSERT(nextChild); ASSERT(nextChild->parentNode() == this); NodeVector targets; collectTargetNodes(newChild.get(), targets); if (targets.isEmpty()) return; if (nextChild->previousSibling() == newChild || nextChild == newChild) // nothing to do return; RefPtr<Node> next = nextChild; RefPtr<Node> nextChildPreviousSibling = nextChild->previousSibling(); for (NodeVector::const_iterator it = targets.begin(); it != targets.end(); ++it) { Node* child = it->get(); insertBeforeCommon(next.get(), child); childrenChanged(true, nextChildPreviousSibling.get(), nextChild, 1); ChildNodeInsertionNotifier(this).notify(child); } }
void sortNodes(NodeVector& all){ // int count=0; int max=0; deque<Node*> sorted; for (int i=0; i<all.size(); i++) { Node* n=all[i]; if(n->statementCount>max){ sorted.push_front(n); max=n->statementCount; } else sorted.push_back(n); } for (int i=0; i<all.size(); i++) { all[i]=sorted[i]; } std::sort(all.begin(), all.end(),sortNodePredicate); // auto x=all.begin(); // auto y=all.end(); // std::sort(x, y, sortNodePredicate);// [] (Node* a, Node* b){ return a->statementCount > b->statementCount; }); // std::sort(all.begin(), all.end(), [] (Node* a, Node* b)->bool { return a->statementCount < b->statementCount; }); // showNodes(all,false,false,false); // std::sort(all.begin(), all.end(), [] (Node* a, Node* b) { return a->statementCount < b->statementCount; }); // showNodes(all,false,false,false); // std::sort(all.begin(),all.end(),); }
/** * Returns the intersection between the TypeSet and the other node. The other * node may also be a type set, in which case this function is called * recursively to resolve the intersect. */ NodePtr intersect(const TypeSet::Ptr& typeSet, const NodePtr& other) { // Intersect all types in the type set with the other type. NodeVector newTypes; const NodeVector& types = typeSet->getTypes(); for (NodeVector::const_iterator it = types.begin(); it != types.end(); it++) { NodePtr type = intersect(*it, other); if (type->isKindOf(kInvalidType)) continue; // skip if the intersect was impossible bool exists = false; for (NodeVector::iterator is = newTypes.begin(); is != newTypes.end(); is++) { if (equal(type, *is)) { exists = true; break; } } if (!exists) newTypes.push_back(type); } // Return the new type set if it contains multiple types, a single type if // there's only one left after the intersect, or InvalidType if the // intersect yielded no types in the set. if (newTypes.empty()) { return NodePtr(new InvalidType); } else if (newTypes.size() == 1) { return newTypes.front(); } else { TypeSet::Ptr ts(new TypeSet); ts->setTypes(newTypes); return ts; } }
void CUniformGrid::GetUnitsInRadius(NodeVector * dstVector, const Vector3 & point, float radius) { const Vector3 radiusPoint(radius, radius, 0); int minX, minY; CellCoordFromMapPoint(&minX, &minY, point - radiusPoint); minX = math::max(0, math::min(minX, (m_Width - 1))); minY = math::max(0, math::min(minY, (m_Height - 1))); int maxX, maxY; CellCoordFromMapPoint(&maxX, &maxY, point + radiusPoint); maxX = math::max(0, math::min(maxX, (m_Width - 1))); maxY = math::max(0, math::min(maxY, (m_Height - 1))); dstVector->clear(); for (int y = minY; y <= maxY; ++y) { for (int x = minX; x <= maxX; ++x) { // FIXME: non optimal - square, refactor me NodeVector * gridVector = GetCell(x, y); dstVector->insert(dstVector->end(), gridVector->begin(), gridVector->end()); } } }
template<class NodeVector> void FileSystem::debugPrintNodes(NodeVector nodes) { if( debug) { unsigned int ix; NodeInfo* node; for (ix = 0; ix < nodes.size(); ++ix) { node = nodes.at(ix); cout << "Node: " << node->getName() << "\t\tSize: " << node->getSize() << "\tModify: " << node->getModifyTime() << "\tPath: " << node->getPath() << "\tSimilars: "; vector<NodeInfo*>::iterator it; vector<NodeInfo*> nodes = node->getSimilar(); for(it=nodes.begin(); it != nodes.end(); ++it) { cout << (*it)->getPath() << ", "; } cout << endl; } } }
bool ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, AttachBehavior attachBehavior) { RefPtr<ContainerNode> protect(this); // Check that this node is not "floating". // If it is, it can be deleted as a side effect of sending mutation events. ASSERT(refCount() || parentOrShadowHostNode()); ec = 0; // Make sure adding the new child is ok if (!checkAddChild(this, newChild.get(), ec)) return false; if (newChild == m_lastChild) // nothing to do return newChild; NodeVector targets; collectChildrenAndRemoveFromOldParent(newChild.get(), targets, ec); if (ec) return false; if (targets.isEmpty()) return true; // We need this extra check because collectChildrenAndRemoveFromOldParent() can fire mutation events. if (!checkAcceptChildGuaranteedNodeTypes(this, newChild.get(), ec)) return false; InspectorInstrumentation::willInsertDOMNode(document(), this); // Now actually add the child(ren) ChildListMutationScope mutation(this); for (NodeVector::const_iterator it = targets.begin(); it != targets.end(); ++it) { Node* child = it->get(); // If the child has a parent again, just stop what we're doing, because // that means someone is doing something with DOM mutation -- can't re-parent // a child that already has a parent. if (child->parentNode()) break; treeScope()->adoptIfNeeded(child); // Append child to the end of the list { NoEventDispatchAssertion assertNoEventDispatch; appendChildToContainer(child, this); } updateTreeAfterInsertion(this, child, attachBehavior); } dispatchSubtreeModifiedEvent(); return true; }
void InitRootTypes::wrapFuncArgs(NodeVector& args, const NodeVector& funcArgs) { for (NodeVector::const_iterator it = funcArgs.begin(); it != funcArgs.end(); it++) { const FuncArg::Ptr& funcArg = FuncArg::from(*it); TupleTypeArg::Ptr arg(new TupleTypeArg); arg->setName(funcArg->getName()); arg->setType(funcArg->getPossibleType()); args.push_back(arg); } }
bool isEmbedded() { if (isAssocClass) for (NodeVector::const_iterator it = oFields.begin(); it != oFields.end(); ++it) { if (*it == NULL) continue; if (CSLTestBoolean(CPLGetXMLValue( *it, "EmbeddedTransfer", "FALSE" ))) return true; } return false; }
void Class::addFields(const NodeVector& fields) { // Make sure all the nodes given as parameters have the right kind for ( Node* field: fields ) { if ( field->nodeKind() != nkFeatherDeclVar ) REP_INTERNAL(field->location(), "Node %1% must be a field") % field; } children_.insert(children_.end(), fields.begin(), fields.end()); }
void Dijkstra::clear_saved_paths() { for (std::map<NodePair, NodePath*>::iterator it = saved_paths.begin(); it != saved_paths.end(); it++) { delete (*it).second; (*it).second = NULL; } saved_paths.clear(); NodeVector nodes = grid->get_nodes(); for (NodeVector::iterator node = nodes.begin(); node != nodes.end(); node++) { (*node)->set_cost_from_start(max_cost); } }
// todo: presorted jumplists NodeVector intersect(NodeVector a, NodeVector b) { NodeVector c; NodeVector::iterator it; for(it = a.begin(); it != a.end(); ++it) if (contains(b, *it)) // c.insert(*it); c.push_back(*it); // for (int i=0; i < a.size(); i++) { // Node* n=a[0]; // if (contains(b, n)) c.push_back(n); // } return c; }
Algorithm* Network::findAlgorithm(const std::string& name) { NodeVector nodes = depthFirstSearch(_visibleNetworkRoot); for (NodeVector::iterator node = nodes.begin(); node != nodes.end(); ++node) { if ((*node)->algorithm()->name() == name) return (*node)->algorithm(); } ostringstream msg; msg << "Could not find algorithm with name '" << name << "'. Known algorithms are: "; if (!nodes.empty()) msg << '\'' << nodes[0]->algorithm()->name() << '\''; for (int i=1; i<(int)nodes.size(); i++) { msg << ", '" << nodes[i]->algorithm()->name() << '\''; } throw EssentiaException(msg); }
void CUniformGrid::Collide(NodeVector * dstVector, IUniformGridDelegate * delegate) { for (int y = 0; y < m_Height; ++y) { for (int x = 0; x < m_Width; ++x) { dstVector->clear(); NodeVector * cellList = GetCell(x, y); dstVector->insert(dstVector->end(), cellList->begin(), cellList->end()); cellList = GetCell(x + 1, y); if (NULL != cellList) { dstVector->insert(dstVector->end(), cellList->begin(), cellList->end()); } cellList = GetCell(x + 1, y + 1); if (NULL != cellList) { dstVector->insert(dstVector->end(), cellList->begin(), cellList->end()); } cellList = GetCell(x, y + 1); if (NULL != cellList) { dstVector->insert(dstVector->end(), cellList->begin(), cellList->end()); } if (dstVector->size() > 0) { delegate->ProcessNeighbourNodes(dstVector); } } } }
/** * Returns true if the types in vector %a are all present in %b, and vice versa. * Useful for equality checks on TypeSet and UnionType nodes. The algorithm is * quite allergic to vectors that contain duplicate types. */ bool equalTypes(const NodeVector& a, const NodeVector& b) { // Catch the trivial case of vectors that are not of equal length. if (a.size() != b.size()) return false; // Iterate through the first vector, counting the removed nodes in the other. // If a node cannot be found in the other, equality fails. If any nodes are // left in the other afterwards, equality fails as well. int found = 0; for (NodeVector::const_iterator ia = a.begin(); ia != a.end(); ia++) { bool anythingFound = false; for (NodeVector::const_iterator ib = b.begin(); ib != b.end(); ib++) { if (equal(*ia,*ib)) { found++; anythingFound = true; } } if (!anythingFound) return false; // since *ia is not present in b } // If 'found' does not equal b's length, there are elements left in // b that were not present in a, in which case the equality fails. return (found == b.size()); }
void Network::deleteAlgorithms() { E_DEBUG(ENetwork, "Network::deleteAlgorithms()"); NodeVector nodes = depthFirstSearch(_visibleNetworkRoot); for (NodeVector::iterator node = nodes.begin(); node != nodes.end(); ++node) { E_DEBUG(ENetwork, "deleting " << (*node)->algorithm()->name()); delete (*node)->algorithm(); } // we need to set this to false anyway, because it doesn't make sense anymore // to have it to true and it would cause the destructor to crash _takeOwnership = false; E_DEBUG(ENetwork, "Network::deleteAlgorithms() ok!"); }
void GenImplicitAccessors::process(const NodePtr& node) { // Process children. processChildren(node); // Gather implicit accessors for root type definitions. if (const TypeDef::Ptr& typeDef = TypeDef::from(node)) { NodeVector implicits; gatherImplAccessors(typeDef, implicits); println(0, "Gathered " + lexical_cast<string>(implicits.size()) + " implicit accessors of " + typeDef->getId().str() + "."); // Add the accessors to the repository. for (NodeVector::iterator it = implicits.begin(); it != implicits.end(); it++) { repository.addExportedSymbol((*it)->getId(), (*it)->needNamed()->getName()); } } }
virtual void encode(const NodeVector& nodes) { if (nodes.empty()) { out << "[] "; } else { out << "[ "; bool first = true; for (NodeVector::const_iterator it = nodes.begin(); it != nodes.end(); it++) { if (first) { first = false; } else { out << ", "; } encode(*it); } out << "] "; } }
void TrueTimeSourceVisitor::Visit_Deployment( const Semantics::Deployment & deployment ) { // Must be second pass // Iterate over all of the bus objects and create a header file list for each of them. CommMediumSet cmSet = deployment.CommMedium_children(); for ( CommMediumSet::iterator cmIter = cmSet.begin(); cmIter != cmSet.end(); cmIter++ ) { string busName = (*cmIter).name(); ostringstream out; out << "#define " << busName << "_HYPERPERIOD " << (*cmIter).hyperperiodsecs(); _BusHeaderLines[ busName ].insert( out.str() ); } _BusHeaderLines[ string( "bus" ) ].insert( string( "#define bus_HYPERPERIOD 0.0" ) ); // Get set of Node children - create _init files NodeVector nodeVector = deployment.Node_children(); // Visit them all NodeVector::iterator nodeIter = nodeVector.begin(); for ( ; nodeIter != nodeVector.end(); nodeIter++ ) { // Visit the node again to gen _init files nodeIter->Accept( *this ); } // Once all is said and done, generate the headers for the buses std::string directoryName = ConfigKeeper::inst().GetDirectoryName(); for ( std::map< std::string, std::set< std::string > >::iterator mapIter = _BusHeaderLines.begin(); mapIter != _BusHeaderLines.end(); mapIter++ ) { if ( !( ( mapIter->first == string( "bus" ) ) && ( mapIter->second.size() < 2 ) ) ) { string filename = directoryName + "\\" + mapIter->first + "_init_defines.h"; ofstream headerFile( filename.c_str() ); for ( std::set< std::string >::iterator lineIter = (mapIter->second).begin(); lineIter != (mapIter->second).end(); lineIter++ ) { headerFile << *lineIter << endl; } headerFile.close(); } } _BusHeaderLines.clear(); }
static void willRemoveChildren(ContainerNode& container) { NodeVector children; getChildNodes(container, children); ChildListMutationScope mutation(container); for (auto it = children.begin(); it != children.end(); ++it) { Node& child = it->get(); mutation.willRemoveChild(child); child.notifyMutationObserversNodeWillDetach(); // fire removed from document mutation events. dispatchChildRemovalEvents(child); } container.document().nodeChildrenWillBeRemoved(container); disconnectSubframesIfNeeded(container, DescendantsOnly); }
static void willRemoveChildren(ContainerNode* container) { NodeVector children; getChildNodes(container, children); container->document()->nodeChildrenWillBeRemoved(container); ChildListMutationScope mutation(container); for (NodeVector::const_iterator it = children.begin(); it != children.end(); it++) { Node* child = it->get(); mutation.willRemoveChild(child); child->notifyMutationObserversNodeWillDetach(); // fire removed from document mutation events. dispatchChildRemovalEvents(child); } ChildFrameDisconnector(container).disconnect(ChildFrameDisconnector::DescendantsOnly); }
void CUniformGrid::RemoveBody(CGameNode * node) { const int Idx = node->GetGridIndex(); if (-1 != Idx) { NodeVector * cellList = (m_GridArray + Idx); NodeVector::iterator it = cellList->begin(); while (cellList->end() != it) { if (node == (*it)) { cellList->erase(it); return; } ++it; } } }
void ps(NodeVector v) { if (quiet) return; NodeVector::iterator it; for(it = v.begin(); it != v.end(); ++it) show(*it); }
bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode& ec, AttachBehavior attachBehavior) { // Check that this node is not "floating". // If it is, it can be deleted as a side effect of sending mutation events. ASSERT(refCount() || parentOrShadowHostNode()); RefPtr<Node> protect(this); ec = 0; if (oldChild == newChild) // nothing to do return true; if (!oldChild) { ec = NOT_FOUND_ERR; return false; } // Make sure replacing the old child with the new is ok if (!checkReplaceChild(this, newChild.get(), oldChild, ec)) return false; // NOT_FOUND_ERR: Raised if oldChild is not a child of this node. if (oldChild->parentNode() != this) { ec = NOT_FOUND_ERR; return false; } ChildListMutationScope mutation(this); RefPtr<Node> next = oldChild->nextSibling(); // Remove the node we're replacing RefPtr<Node> removedChild = oldChild; removeChild(oldChild, ec); if (ec) return false; if (next && (next->previousSibling() == newChild || next == newChild)) // nothing to do return true; // Does this one more time because removeChild() fires a MutationEvent. if (!checkReplaceChild(this, newChild.get(), oldChild, ec)) return false; NodeVector targets; collectChildrenAndRemoveFromOldParent(newChild.get(), targets, ec); if (ec) return false; // Does this yet another check because collectChildrenAndRemoveFromOldParent() fires a MutationEvent. if (!checkReplaceChild(this, newChild.get(), oldChild, ec)) return false; InspectorInstrumentation::willInsertDOMNode(document(), this); // Add the new child(ren) for (NodeVector::const_iterator it = targets.begin(); it != targets.end(); ++it) { Node* child = it->get(); // Due to arbitrary code running in response to a DOM mutation event it's // possible that "next" is no longer a child of "this". // It's also possible that "child" has been inserted elsewhere. // In either of those cases, we'll just stop. if (next && next->parentNode() != this) break; if (child->parentNode()) break; treeScope()->adoptIfNeeded(child); // Add child before "next". { NoEventDispatchAssertion assertNoEventDispatch; if (next) insertBeforeCommon(next.get(), child); else appendChildToContainer(child, this); } updateTreeAfterInsertion(this, child, attachBehavior); } dispatchSubtreeModifiedEvent(); return true; }
bool ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode& ec, AttachBehavior attachBehavior) { // Check that this node is not "floating". // If it is, it can be deleted as a side effect of sending mutation events. ASSERT(refCount() || parentOrShadowHostNode()); RefPtr<Node> protect(this); ec = 0; // insertBefore(node, 0) is equivalent to appendChild(node) if (!refChild) return appendChild(newChild, ec, attachBehavior); // Make sure adding the new child is OK. if (!checkAddChild(this, newChild.get(), ec)) return false; // NOT_FOUND_ERR: Raised if refChild is not a child of this node if (refChild->parentNode() != this) { ec = NOT_FOUND_ERR; return false; } if (refChild->previousSibling() == newChild || refChild == newChild) // nothing to do return true; RefPtr<Node> next = refChild; NodeVector targets; collectChildrenAndRemoveFromOldParent(newChild.get(), targets, ec); if (ec) return false; if (targets.isEmpty()) return true; // We need this extra check because collectChildrenAndRemoveFromOldParent() can fire mutation events. if (!checkAcceptChildGuaranteedNodeTypes(this, newChild.get(), ec)) return false; InspectorInstrumentation::willInsertDOMNode(document(), this); ChildListMutationScope mutation(this); for (NodeVector::const_iterator it = targets.begin(); it != targets.end(); ++it) { Node* child = it->get(); // Due to arbitrary code running in response to a DOM mutation event it's // possible that "next" is no longer a child of "this". // It's also possible that "child" has been inserted elsewhere. // In either of those cases, we'll just stop. if (next->parentNode() != this) break; if (child->parentNode()) break; treeScope()->adoptIfNeeded(child); insertBeforeCommon(next.get(), child); updateTreeAfterInsertion(this, child, attachBehavior); } dispatchSubtreeModifiedEvent(); return true; }
void AddFieldDefinitions(NodeVector oArcLineTypes) { for (NodeVector::const_iterator it = oFields.begin(); it != oFields.end(); ++it) { if (*it == NULL) continue; const char* psName = CPLGetXMLValue( *it, "Name", NULL ); const char* psTypeRef = CPLGetXMLValue( *it, "Type.REF", NULL ); if (psTypeRef == NULL) //Assoc Role AddField(psName, OFTString); //FIXME: numeric? else { CPLXMLNode* psElementNode = oTidLookup[psTypeRef]; const char* typeName = psElementNode->pszValue; if (EQUAL(typeName, "IlisMeta07.ModelData.TextType")) { //Kind Text,MText AddField(psName, OFTString); } else if (EQUAL(typeName, "IlisMeta07.ModelData.EnumType")) { AddField(psName, (iliVersion == 1) ? OFTInteger : OFTString); } else if (EQUAL(typeName, "IlisMeta07.ModelData.BooleanType")) { AddField(psName, OFTString); //?? } else if (EQUAL(typeName, "IlisMeta07.ModelData.NumType")) { //// Unit INTERLIS.ANYUNIT, INTERLIS.TIME, INTERLIS.h, INTERLIS.min, INTERLIS.s, INTERLIS.M, INTERLIS.d AddField(psName, OFTReal); } else if (EQUAL(typeName, "IlisMeta07.ModelData.BlackboxType")) { AddField(psName, OFTString); } else if (EQUAL(typeName, "IlisMeta07.ModelData.FormattedType")) { AddField(psName, GetFormattedType(*it)); } else if (EQUAL(typeName, "IlisMeta07.ModelData.MultiValue")) { //min -> Multiplicity/IlisMeta07.ModelData.Multiplicity/Min //max -> Multiplicity/IlisMeta07.ModelData.Multiplicity/Max const char* psClassRef = CPLGetXMLValue( psElementNode, "BaseType.REF", NULL ); if (psClassRef) { IliClass* psParentClass = oClasses[oTidLookup[psClassRef]]; poStructFieldInfos[psName] = psParentClass->GetName(); CPLDebug( "OGR_ILI", "Register table %s for struct field '%s'", poStructFieldInfos[psName].c_str(), psName); /* Option: Embed fields if max == 1 CPLDebug( "OGR_ILI", "Adding embedded struct members of MultiValue field '%s' from Class %s", psName, psClassRef); AddFieldDefinitions(psParentClass->oFields); */ } } else if (EQUAL(typeName, "IlisMeta07.ModelData.CoordType")) { AddCoord(psName, psElementNode); } else if (EQUAL(typeName, "IlisMeta07.ModelData.LineType")) { const char* psKind = CPLGetXMLValue( psElementNode, "Kind", NULL ); poGeomFieldInfos[psName].iliGeomType = psKind; bool isLinearType = (std::find(oArcLineTypes.begin(), oArcLineTypes.end(), psElementNode) == oArcLineTypes.end()); bool linearGeom = isLinearType || CSLTestBoolean(CPLGetConfigOption("OGR_STROKE_CURVE", "FALSE")); OGRwkbGeometryType multiLineType = linearGeom ? wkbMultiLineString : wkbMultiCurve; OGRwkbGeometryType polyType = linearGeom ? wkbPolygon : wkbCurvePolygon; if (iliVersion == 1) { if (EQUAL(psKind, "Area")) { CPLString lineLayerName = GetName() + CPLString("_") + psName; AddGeomTable(lineLayerName, psName, multiLineType); //Add geometry field for polygonized areas AddGeomField(psName, wkbPolygon); //We add the area helper point geometry after polygon //for better behaviour of clients with limited multi geometry support CPLString areaPointGeomName = psName + CPLString("__Point"); AddCoord(areaPointGeomName, psElementNode); } else if (EQUAL(psKind, "Surface")) { CPLString geomLayerName = GetName() + CPLString("_") + psName; AddGeomTable(geomLayerName, psName, multiLineType, true); AddGeomField(psName, polyType); } else { // Polyline, DirectedPolyline AddGeomField(psName, multiLineType); } } else { if (EQUAL(psKind, "Area") || EQUAL(psKind, "Surface")) { AddGeomField(psName, polyType); } else { // Polyline, DirectedPolyline AddGeomField(psName, multiLineType); } } } else { //ClassRefType CPLError(CE_Warning, CPLE_NotSupported, "Field '%s' of class %s has unsupported type %s", psName, GetName(), typeName); } } } }
void Network::reset() { NodeVector nodes = depthFirstSearch(_visibleNetworkRoot); for (NodeVector::iterator node = nodes.begin(); node != nodes.end(); ++node) { (*node)->algorithm()->reset(); } }
void mergeVectors(NodeSet* some, NodeVector more) { some->insert(more.begin(), more.end()); }