本文整理汇总了C++中Boundary::grow方法的典型用法代码示例。如果您正苦于以下问题:C++ Boundary::grow方法的具体用法?C++ Boundary::grow怎么用?C++ Boundary::grow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boundary
的用法示例。
在下文中一共展示了Boundary::grow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initDetectors
void
GUINet::initGUIStructures() {
// initialise detector storage for gui
initDetectors();
// initialise the tl-map
initTLMap();
// initialise edge storage for gui
GUIEdge::fill(myEdgeWrapper);
// initialise junction storage for gui
size_t size = myJunctions->size();
myJunctionWrapper.reserve(size);
const std::map<std::string, MSJunction*> &junctions = myJunctions->getMyMap();
for (std::map<std::string, MSJunction*>::const_iterator i=junctions.begin(); i!=junctions.end(); ++i) {
myJunctionWrapper.push_back(new GUIJunctionWrapper(GUIGlObjectStorage::gIDStorage, *(*i).second));
}
// build the visualization tree
float *cmin = new float[2];
float *cmax = new float[2];
for (std::vector<GUIEdge*>::iterator i=myEdgeWrapper.begin(); i!=myEdgeWrapper.end(); ++i) {
GUIEdge *edge = *i;
Boundary b;
const std::vector<MSLane*> &lanes = edge->getLanes();
for (std::vector<MSLane*>::const_iterator j=lanes.begin(); j!=lanes.end(); ++j) {
b.add((*j)->getShape().getBoxBoundary());
}
b.grow(2.);
cmin[0] = b.xmin();
cmin[1] = b.ymin();
cmax[0] = b.xmax();
cmax[1] = b.ymax();
myGrid->Insert(cmin, cmax, edge);
myBoundary.add(b);
}
for (std::vector<GUIJunctionWrapper*>::iterator i=myJunctionWrapper.begin(); i!=myJunctionWrapper.end(); ++i) {
GUIJunctionWrapper *junction = *i;
Boundary b = junction->getBoundary();
b.grow(2.);
cmin[0] = b.xmin();
cmin[1] = b.ymin();
cmax[0] = b.xmax();
cmax[1] = b.ymax();
myGrid->Insert(cmin, cmax, junction);
myBoundary.add(b);
}
const std::vector<GUIGlObject_AbstractAdd*> &a = GUIGlObject_AbstractAdd::getObjectList();
for (std::vector<GUIGlObject_AbstractAdd*>::const_iterator i=a.begin(); i!=a.end(); ++i) {
GUIGlObject_AbstractAdd *o = *i;
Boundary b = o->getCenteringBoundary();
cmin[0] = b.xmin();
cmin[1] = b.ymin();
cmax[0] = b.xmax();
cmax[1] = b.ymax();
myGrid->Insert(cmin, cmax, o);
}
delete[] cmin;
delete[] cmax;
myGrid->add(myBoundary);
}
示例2:
Boundary
GUIPolygon::getCenteringBoundary() const {
Boundary b;
b.add(myShape.getBoxBoundary());
b.grow(10);
return b;
}
示例3:
Boundary
GUIEdge::getBoundary() const {
Boundary ret;
if (getPurpose() != MSEdge::EDGEFUNCTION_DISTRICT) {
for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
ret.add((*i)->getShape().getBoxBoundary());
}
} else {
// take the starting coordinates of all follower edges and the endpoints
// of all successor edges
for (MSEdgeVector::const_iterator it = mySuccessors.begin(); it != mySuccessors.end(); ++it) {
const std::vector<MSLane*>& lanes = (*it)->getLanes();
for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
ret.add((*it_lane)->getShape().front());
}
}
for (MSEdgeVector::const_iterator it = myPredecessors.begin(); it != myPredecessors.end(); ++it) {
const std::vector<MSLane*>& lanes = (*it)->getLanes();
for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
ret.add((*it_lane)->getShape().back());
}
}
}
ret.grow(10);
return ret;
}
示例4: getObjectsInBoundary
std::vector<GUIGlID>
GUISUMOAbstractView::getObjectsAtPosition(Position pos, SUMOReal radius) {
Boundary selection;
selection.add(pos);
selection.grow(radius);
const std::vector<GUIGlID> ids = getObjectsInBoundary(selection);
std::vector<GUIGlID> result;
// Interpret results
for (std::vector<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
GUIGlID id = *it;
GUIGlObject* o = GUIGlObjectStorage::gIDStorage.getObjectBlocking(id);
if (o == 0) {
continue;
}
if (o->getGlID() == 0) {
continue;
}
//std::cout << "point selection hit " << o->getMicrosimID() << "\n";
GUIGlObjectType type = o->getType();
if (type != 0) {
result.push_back(id);
}
GUIGlObjectStorage::gIDStorage.unblockObject(id);
}
return result;
}
示例5: getVehicleType
Boundary
GUIPerson::getCenteringBoundary() const {
Boundary b;
// ensure that the vehicle is drawn, otherwise myPositionInVehicle will not be updated
b.add(getPosition());
b.grow(MAX2(getVehicleType().getWidth(), getVehicleType().getLength()));
return b;
}
示例6:
Boundary
GUILane::getCenteringBoundary() const {
Boundary b;
b.add(myShape[0]);
b.add(myShape[-1]);
b.grow(20);
return b;
}
示例7: getBoundary
Boundary
GUIEdge::getCenteringBoundary() const {
Boundary b = getBoundary();
// ensure that vehicles and persons on the side are drawn even if the edge
// is outside the view
b.grow(10);
return b;
}
示例8: throw
Boundary
GUILaneWrapper::getCenteringBoundary() const throw() {
Boundary b;
b.add(myShape[0]);
b.add(myShape[-1]);
b.grow(20);
return b;
}
示例9:
Boundary
GUIParkingArea::getCenteringBoundary() const {
Boundary b = myShape.getBoxBoundary();
for (std::map<unsigned int, LotSpaceDefinition >::const_iterator i = mySpaceOccupancies.begin(); i != mySpaceOccupancies.end(); i++) {
b.add((*i).second.myPosition);
}
b.grow(20);
return b;
}
示例10:
Boundary
GUIEdge::getBoundary() const {
Boundary ret;
for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
ret.add((*i)->getShape().getBoxBoundary());
}
ret.grow(10);
return ret;
}
示例11: getObjectsInBoundary
GUIGlID
GUISUMOAbstractView::getObjectAtPosition(Position pos) {
const SUMOReal SENSITIVITY = 0.1; // meters
Boundary selection;
selection.add(pos);
selection.grow(SENSITIVITY);
const std::vector<GUIGlID> ids = getObjectsInBoundary(selection);
// Interpret results
unsigned int idMax = 0;
int prevLayer = -1000;
for (std::vector<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
GUIGlID id = *it;
GUIGlObject* o = GUIGlObjectStorage::gIDStorage.getObjectBlocking(id);
if (o == 0) {
continue;
}
if (o->getGlID() == 0) {
continue;
}
//std::cout << "point selection hit " << o->getMicrosimID() << "\n";
GUIGlObjectType type = o->getType();
if (type != 0) {
int clayer = (int) type;
// determine an "abstract" layer for shapes
// this "layer" resembles the layer of the shape
// taking into account the stac of other objects
if (type == GLO_SHAPE) {
if (dynamic_cast<GUIPolygon*>(o) != 0) {
if (dynamic_cast<GUIPolygon*>(o)->getLayer() > 0) {
clayer = GLO_MAX + dynamic_cast<GUIPolygon*>(o)->getLayer();
}
if (dynamic_cast<GUIPolygon*>(o)->getLayer() < 0) {
clayer = dynamic_cast<GUIPolygon*>(o)->getLayer();
}
}
if (dynamic_cast<GUIPointOfInterest*>(o) != 0) {
if (dynamic_cast<GUIPointOfInterest*>(o)->getLayer() > 0) {
clayer = GLO_MAX + dynamic_cast<GUIPointOfInterest*>(o)->getLayer();
}
if (dynamic_cast<GUIPointOfInterest*>(o)->getLayer() < 0) {
clayer = dynamic_cast<GUIPointOfInterest*>(o)->getLayer();
}
}
}
// check whether the current object is above a previous one
if (prevLayer == -1000 || prevLayer < clayer) {
idMax = id;
prevLayer = clayer;
}
}
GUIGlObjectStorage::gIDStorage.unblockObject(id);
}
return idMax;
}
示例12:
Boundary
GUIEdge::getBoundary() const {
Boundary ret;
for (LaneWrapperVector::const_iterator i = myLaneGeoms.begin(); i != myLaneGeoms.end(); ++i) {
const PositionVector& g = (*i)->getShape();
for (unsigned int j = 0; j < g.size(); j++) {
ret.add(g[j]);
}
}
ret.grow(10);
return ret;
}
示例13: Boundary
Boundary
GNEDemandElement::getCenteringBoundary() const {
// Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
if (myMove.movingGeometryBoundary.isInitialised()) {
return myMove.movingGeometryBoundary;
} else if (myGeometry.shape.size() > 0) {
Boundary b = myGeometry.shape.getBoxBoundary();
b.grow(20);
return b;
} else {
return Boundary(-0.1, -0.1, 0.1, 0.1);
}
}
示例14:
Boundary
GUITrafficLightLogicWrapper::getCenteringBoundary() const {
Boundary ret;
const MSTrafficLightLogic::LaneVectorVector& lanes = myTLLogic.getLaneVectors();
for (MSTrafficLightLogic::LaneVectorVector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
const MSTrafficLightLogic::LaneVector& lanes2 = (*i);
for (MSTrafficLightLogic::LaneVector::const_iterator j = lanes2.begin(); j != lanes2.end(); ++j) {
ret.add((*j)->getShape()[-1]);
}
}
ret.grow(20);
return ret;
}
示例15: TraCIRTree
TraCIRTree*
TraCIServerAPI_Lane::getTree() {
TraCIRTree* t = new TraCIRTree();
const std::vector<MSEdge*>& edges = MSNet::getInstance()->getEdgeControl().getEdges();
for (std::vector<MSEdge*>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
const std::vector<MSLane*>& lanes = (*i)->getLanes();
for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
Boundary b = (*j)->getShape().getBoxBoundary();
b.grow(3.);
t->addObject(*j, b);
}
}
return t;
}