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


C++ Boundary::grow方法代码示例

本文整理汇总了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);
}
开发者ID:sagarc,项目名称:Indian_traffic_control,代码行数:58,代码来源:GUINet.cpp

示例2:

Boundary
GUIPolygon::getCenteringBoundary() const {
    Boundary b;
    b.add(myShape.getBoxBoundary());
    b.grow(10);
    return b;
}
开发者ID:nnaren1902,项目名称:Secure-Vehicle-Platoon,代码行数:7,代码来源:GUIPolygon.cpp

示例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;
}
开发者ID:planetsumo,项目名称:sumo,代码行数:26,代码来源:GUIEdge.cpp

示例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;
}
开发者ID:kbleeck,项目名称:customSumo26,代码行数:26,代码来源:GUISUMOAbstractView.cpp

示例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;
}
开发者ID:planetsumo,项目名称:sumo,代码行数:8,代码来源:GUIPerson.cpp

示例6:

Boundary
GUILane::getCenteringBoundary() const {
    Boundary b;
    b.add(myShape[0]);
    b.add(myShape[-1]);
    b.grow(20);
    return b;
}
开发者ID:p1tt1,项目名称:sumo,代码行数:8,代码来源:GUILane.cpp

示例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;
}
开发者ID:planetsumo,项目名称:sumo,代码行数:8,代码来源:GUIEdge.cpp

示例8: throw

Boundary
GUILaneWrapper::getCenteringBoundary() const throw() {
    Boundary b;
    b.add(myShape[0]);
    b.add(myShape[-1]);
    b.grow(20);
    return b;
}
开发者ID:NeziheSozen,项目名称:sumo,代码行数:8,代码来源:GUILaneWrapper.cpp

示例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;
}
开发者ID:fieryzig,项目名称:sumo,代码行数:9,代码来源:GUIParkingArea.cpp

示例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;
}
开发者ID:RamonHPSilveira,项目名称:urbansim,代码行数:9,代码来源:GUIEdge.cpp

示例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;
}
开发者ID:smendez-hi,项目名称:SUMO-hib,代码行数:54,代码来源:GUISUMOAbstractView.cpp

示例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;
}
开发者ID:rudhir-upretee,项目名称:SUMO_Src,代码行数:12,代码来源:GUIEdge.cpp

示例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);
    }
}
开发者ID:michele-segata,项目名称:plexe-sumo,代码行数:13,代码来源:GNEDemandElement.cpp

示例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;
}
开发者ID:kbleeck,项目名称:customSumo26,代码行数:13,代码来源:GUITrafficLightLogicWrapper.cpp

示例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;
}
开发者ID:cathyyul,项目名称:sumo-0.18,代码行数:14,代码来源:TraCIServerAPI_Lane.cpp


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