本文整理汇总了C++中GNEEdge::getNBEdge方法的典型用法代码示例。如果您正苦于以下问题:C++ GNEEdge::getNBEdge方法的具体用法?C++ GNEEdge::getNBEdge怎么用?C++ GNEEdge::getNBEdge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GNEEdge
的用法示例。
在下文中一共展示了GNEEdge::getNBEdge方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteEdge
void
GNENet::deleteLane(GNELane* lane, GNEUndoList* undoList) {
GNEEdge* edge = &lane->getParentEdge();
if (edge->getNBEdge()->getNumLanes() == 1) {
// remove the whole edge instead
deleteEdge(edge, undoList);
} else {
undoList->p_begin("delete lane");
const NBEdge::Lane& laneAttrs = edge->getNBEdge()->getLaneStruct(lane->getIndex());
const bool sidewalk = laneAttrs.permissions == SVC_PEDESTRIAN;
undoList->add(new GNEChange_Lane(edge, lane, laneAttrs, false), true);
if (gSelected.isSelected(GLO_LANE, lane->getGlID())) {
std::set<GUIGlID> deselected;
deselected.insert(lane->getGlID());
undoList->add(new GNEChange_Selection(std::set<GUIGlID>(), deselected, true), true);
}
if (sidewalk) {
edge->getSource()->removeFromCrossings(edge, undoList);
edge->getDest()->removeFromCrossings(edge, undoList);
edge->getSource()->setLogicValid(false, undoList);
edge->getDest()->setLogicValid(false, undoList);
}
requireRecompute();
undoList->p_end();
}
}
示例2:
long
GNEConnectorFrame::onCmdSelectDeadStarts(FXObject*, FXSelector, void*) {
GNENet* net = myViewNet->getNet();
std::set<GUIGlID> selectIDs;
// every edge knows only its outgoing connections so we look at whole junctions
const std::vector<GNEJunction*> junctions = net->retrieveJunctions();
for (std::vector<GNEJunction*>::const_iterator junction_it = junctions.begin(); junction_it != junctions.end(); junction_it++) {
// first collect all outgoing lanes
const EdgeVector& outgoing = (*junction_it)->getNBNode()->getOutgoingEdges();
for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) {
GNEEdge* edge = net->retrieveEdge((*it)->getID());
const std::set<GUIGlID> laneIDs = edge->getLaneGlIDs();
for (std::set<GUIGlID>::const_iterator lid_it = laneIDs.begin(); lid_it != laneIDs.end(); lid_it++) {
selectIDs.insert(*lid_it);
}
}
// then remove all approached lanes
const EdgeVector& incoming = (*junction_it)->getNBNode()->getIncomingEdges();
for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); it++) {
GNEEdge* edge = net->retrieveEdge((*it)->getID());
NBEdge* nbe = edge->getNBEdge();
const std::vector<NBEdge::Connection>& connections = nbe->getConnections();
for (std::vector<NBEdge::Connection>::const_iterator con_it = connections.begin(); con_it != connections.end(); con_it++) {
GNEEdge* approachedEdge = net->retrieveEdge(con_it->toEdge->getID());
GNELane* approachedLane = approachedEdge->getLanes()[con_it->toLane];
selectIDs.erase(approachedLane->getGlID());
}
}
}
myViewNet->getViewParent()->getSelectorFrame()->handleIDs(
std::vector<GUIGlID>(selectIDs.begin(), selectIDs.end()),
false, GNESelectorFrame::SET_REPLACE);
return 1;
}
示例3: GNENetElement
GNELane::GNELane(GNEEdge& edge, const int index) :
GNENetElement(edge.getNet(), edge.getNBEdge()->getLaneID(index), GLO_LANE, SUMO_TAG_LANE),
myParentEdge(edge),
myIndex(index),
mySpecialColor(0),
myTLSEditor(0) {
updateGeometry();
}
示例4: GNELane
void
GNENet::duplicateLane(GNELane* lane, GNEUndoList* undoList) {
undoList->p_begin("duplicate lane");
GNEEdge* edge = &lane->getParentEdge();
const NBEdge::Lane& laneAttrs = edge->getNBEdge()->getLaneStruct(lane->getIndex());
GNELane* newLane = new GNELane(*edge, lane->getIndex());
undoList->add(new GNEChange_Lane(edge, newLane, laneAttrs, true), true);
requireRecompute();
undoList->p_end();
}
示例5: assert
void
GNENet::replaceJunctionByGeometry(GNEJunction* junction, GNEUndoList* undoList) {
undoList->p_begin("Replace junction by geometry");
assert(junction->getNBNode()->checkIsRemovable());
std::vector<std::pair<NBEdge*, NBEdge*> > toJoin = junction->getNBNode()->getEdgesToJoin();
for (std::vector<std::pair<NBEdge*, NBEdge*> >::iterator j = toJoin.begin(); j != toJoin.end(); j++) {
GNEEdge* begin = myEdges[(*j).first->getID()];
GNEEdge* continuation = myEdges[(*j).second->getID()];
deleteEdge(begin, undoList);
deleteEdge(continuation, undoList);
GNEEdge* newEdge = createEdge(begin->getSource(), continuation->getDest(), begin, undoList, begin->getMicrosimID(), false, true);
PositionVector newShape = begin->getNBEdge()->getInnerGeometry();
newShape.push_back(junction->getNBNode()->getPosition());
newShape.append(continuation->getNBEdge()->getInnerGeometry());
newEdge->setAttribute(SUMO_ATTR_SHAPE, toString(newShape), undoList);
// @todo what about trafficlights at the end of oontinuation?
}
deleteJunction(junction, undoList);
undoList->p_end();
}
示例6: toString
void
GNECreateEdgeFrame::processClick(const Position& clickedPosition, GNEViewNetHelper::ObjectsUnderCursor& objectsUnderCursor, bool opossiteEdge, bool chainEdge) {
if (!myViewNet->getUndoList()->hasCommandGroup()) {
myViewNet->getUndoList()->p_begin("create new " + toString(SUMO_TAG_EDGE));
}
if (!objectsUnderCursor.getJunctionFront()) {
objectsUnderCursor.setCreatedJunction(myViewNet->getNet()->createJunction(myViewNet->snapToActiveGrid(clickedPosition), myViewNet->getUndoList()));
}
if (myCreateEdgeSource == nullptr) {
myCreateEdgeSource = objectsUnderCursor.getJunctionFront();
myCreateEdgeSource->markAsCreateEdgeSource();
update();
} else {
if (myCreateEdgeSource != objectsUnderCursor.getJunctionFront()) {
// may fail to prevent double edges
GNEEdge* newEdge = myViewNet->getNet()->createEdge(
myCreateEdgeSource, objectsUnderCursor.getJunctionFront(), myViewNet->getViewParent()->getInspectorFrame()->getTemplateEditor()->getEdgeTemplate(), myViewNet->getUndoList());
if (newEdge) {
// create another edge, if create opposite edge is enabled
if (opossiteEdge) {
myViewNet->getNet()->createEdge(objectsUnderCursor.getJunctionFront(), myCreateEdgeSource, myViewNet->getViewParent()->getInspectorFrame()->getTemplateEditor()->getEdgeTemplate(), myViewNet->getUndoList(), "-" + newEdge->getNBEdge()->getID());
}
myCreateEdgeSource->unMarkAsCreateEdgeSource();
if (myViewNet->getUndoList()->hasCommandGroup()) {
myViewNet->getUndoList()->p_end();
} else {
std::cout << "edge created without an open CommandGroup )-:\n";
}
if (chainEdge) {
myCreateEdgeSource = objectsUnderCursor.getJunctionFront();
myCreateEdgeSource->markAsCreateEdgeSource();
myViewNet->getUndoList()->p_begin("create new " + toString(SUMO_TAG_EDGE));
} else {
myCreateEdgeSource = nullptr;
}
} else {
myViewNet->setStatusBarText("An " + toString(SUMO_TAG_EDGE) + " with the same geometry already exists!");
}
} else {
myViewNet->setStatusBarText("Start- and endpoint for an " + toString(SUMO_TAG_EDGE) + " must be distinct!");
}
update();
}
}