本文整理汇总了C++中Boundary类的典型用法代码示例。如果您正苦于以下问题:C++ Boundary类的具体用法?C++ Boundary怎么用?C++ Boundary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Boundary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST_F
/* Test the method 'getBoxBoundary'*/
TEST_F(PositionVectorTest, test_method_getBoxBoundary) {
Boundary bound = vectorPolygon->getBoxBoundary();
EXPECT_DOUBLE_EQ(bound.xmax(), 4);
EXPECT_DOUBLE_EQ(bound.xmin(), 0);
EXPECT_DOUBLE_EQ(bound.ymax(), 4);
EXPECT_DOUBLE_EQ(bound.ymin(), 0);
}
示例2: 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;
}
示例3: getMainWindow
// ===========================================================================
// method definitions
// ===========================================================================
bool
TraCIServerAPI_GUI::processGet(TraCIServer& server, tcpip::Storage& inputStorage,
tcpip::Storage& outputStorage) {
// variable & id
int variable = inputStorage.readUnsignedByte();
std::string id = inputStorage.readString();
// check variable
if (variable != ID_LIST && variable != VAR_VIEW_ZOOM && variable != VAR_VIEW_OFFSET
&& variable != VAR_VIEW_SCHEMA && variable != VAR_VIEW_BOUNDARY) {
return server.writeErrorStatusCmd(CMD_GET_GUI_VARIABLE, "Get GUI Variable: unsupported variable specified", outputStorage);
}
// begin response building
tcpip::Storage tempMsg;
// response-code, variableID, objectID
tempMsg.writeUnsignedByte(RESPONSE_GET_GUI_VARIABLE);
tempMsg.writeUnsignedByte(variable);
tempMsg.writeString(id);
// process request
if (variable == ID_LIST) {
std::vector<std::string> ids = getMainWindow()->getViewIDs();
tempMsg.writeUnsignedByte(TYPE_STRINGLIST);
tempMsg.writeStringList(ids);
} else {
GUISUMOAbstractView* v = getNamedView(id);
if (v == 0) {
return server.writeErrorStatusCmd(CMD_GET_GUI_VARIABLE, "View '" + id + "' is not known", outputStorage);
}
switch (variable) {
case VAR_VIEW_ZOOM:
tempMsg.writeUnsignedByte(TYPE_DOUBLE);
tempMsg.writeDouble(v->getChanger().getZoom());
break;
case VAR_VIEW_OFFSET:
tempMsg.writeUnsignedByte(POSITION_2D);
tempMsg.writeDouble(v->getChanger().getXPos());
tempMsg.writeDouble(v->getChanger().getYPos());
break;
case VAR_VIEW_SCHEMA: {
FXComboBox& c = v->getColoringSchemesCombo();
tempMsg.writeUnsignedByte(TYPE_STRING);
tempMsg.writeString((std::string)c.getItem(c.getCurrentItem()).text());
break;
}
case VAR_VIEW_BOUNDARY: {
tempMsg.writeUnsignedByte(TYPE_BOUNDINGBOX);
Boundary b = v->getVisibleBoundary();
tempMsg.writeDouble(b.xmin());
tempMsg.writeDouble(b.ymin());
tempMsg.writeDouble(b.xmax());
tempMsg.writeDouble(b.ymax());
break;
}
default:
break;
}
}
server.writeStatusCmd(CMD_GET_GUI_VARIABLE, RTYPE_OK, "", outputStorage);
server.writeResponseWithLength(outputStorage, tempMsg);
return true;
}
示例4: glBegin
void WaterPhysicsSystem::renderWireframe()
{
for (unsigned int i = 0; i != edges.size(); i++)
{
Edge* edge = edges[i];
glBegin(GL_LINES);
{
glColor3f(1,1,1);
glVertex2f(edge->aPosition().x, edge->aPosition().y);
glVertex2f(edge->bPosition().x, edge->bPosition().y);
}
glEnd();
glBegin(GL_POINTS);
{
glColor3f(1,0,0);
glVertex2f(edge->aPosition().x, edge->aPosition().y);
glVertex2f(edge->bPosition().x, edge->bPosition().y);
}
glEnd();
}
glColor3f(0,0,1);
for (unsigned int i = 0; i != volumes.size(); i++)
{
Volume* volume = volumes[i];
Vec2f center;
center = volume->getLeft()->aPosition();
center += volume->getLeft()->bPosition();
center += volume->getRight()->aPosition();
center += volume->getRight()->bPosition();
center /= 4.0f;
glBegin(GL_LINES);
{
glVertex2f(volume->getLeft()->aPosition().x, volume->getLeft()->aPosition().y);
glVertex2f(center.x, center.y);
glVertex2f(volume->getRight()->aPosition().x, volume->getRight()->aPosition().y);
glVertex2f(center.x, center.y);
glVertex2f(volume->getRight()->bPosition().x, volume->getRight()->bPosition().y);
glVertex2f(center.x, center.y);
glVertex2f(volume->getLeft()->bPosition().x, volume->getLeft()->bPosition().y);
glVertex2f(center.x, center.y);
}
glEnd();
}
glBegin(GL_LINES);
glColor3f(1,1,0.5f);
// for (Boundary* boundary = boundaries.front(); boundary; boundary = boundary->getNextObject())
for (unsigned int i = 0; i != boundaries.size(); i++)
{
Boundary* boundary = boundaries[i];
if (boundary)
{
Vec2f p = boundary->getLeftPosition();
glVertex2f(p.x, p.y);
p = boundary->getRightPosition();
glVertex2f(p.x, p.y);
}
}
glEnd();
}
示例5:
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;
}
示例6: TEST
/* Test the method 'around'*/
TEST(Boundary, test_method_around) {
Boundary *bound = new Boundary(1,2,3,6);
EXPECT_TRUE(bound->around(Position(2,4)));
EXPECT_FALSE(bound->around(Position(0,4)));
EXPECT_FALSE(bound->around(Position(2,7)));
EXPECT_TRUE(bound->around(Position(0,7),2));
}
示例7: NIVissimConnectionCluster
void
NIVissimNodeDef_Edges::searchAndSetConnections() {
std::vector<int> connections;
std::vector<int> edges;
Boundary boundary;
for (NIVissimNodeParticipatingEdgeVector::const_iterator i = myEdges.begin(); i != myEdges.end(); i++) {
NIVissimNodeParticipatingEdge* edge = *i;
NIVissimConnection* c =
NIVissimConnection::dictionary(edge->getID());
NIVissimEdge* e =
NIVissimEdge::dictionary(edge->getID());
if (c != 0) {
connections.push_back(edge->getID());
boundary.add(c->getFromGeomPosition());
boundary.add(c->getToGeomPosition());
c->setNodeCluster(myID);
}
if (e != 0) {
edges.push_back(edge->getID());
boundary.add(e->getGeomPosition(edge->getFromPos()));
boundary.add(e->getGeomPosition(edge->getToPos()));
}
}
NIVissimConnectionCluster* c =
new NIVissimConnectionCluster(connections, boundary, myID, edges);
for (std::vector<int>::iterator j = edges.begin(); j != edges.end(); j++) {
NIVissimEdge* edge = NIVissimEdge::dictionary(*j);
edge->myConnectionClusters.push_back(c);
}
}
示例8:
Boundary
GUIPolygon::getCenteringBoundary() const {
Boundary b;
b.add(myShape.getBoxBoundary());
b.grow(10);
return b;
}
示例9:
bool
PCPolyContainer::insert(const std::string& id, Polygon* poly,
int layer, bool ignorePruning) {
// check whether the polygon lies within the wished area
// - if such an area was given
if (myDoPrune && !ignorePruning) {
Boundary b = poly->getShape().getBoxBoundary();
if (!b.partialWithin(myPruningBoundary)) {
delete poly;
return false;
}
}
// check whether the polygon was named to be a removed one
if (find(myRemoveByNames.begin(), myRemoveByNames.end(), id) != myRemoveByNames.end()) {
delete poly;
return false;
}
//
PolyCont::iterator i = myPolyCont.find(id);
if (i != myPolyCont.end()) {
WRITE_ERROR("Polygon '" + id + "' could not be added.");
delete poly;
return false;
}
myPolyCont[id] = poly;
myPolyLayerMap[poly] = layer;
return true;
}
示例10: save_bc
bool save_bc(hid_t parent_group_id, Mesh *mesh) {
herr_t status;
// create main group
hid_t group_id = H5Gcreate(parent_group_id, "bc", 0);
// count
hid_t dataspace_id = H5Screate(H5S_SCALAR);
hid_t attr_count = H5Acreate(group_id, "count", H5T_NATIVE_UINT32, dataspace_id, H5P_DEFAULT);
uint count = mesh->boundaries.count();
status = H5Awrite(attr_count, H5T_NATIVE_UINT32, &count);
H5Aclose(attr_count);
H5Sclose(dataspace_id);
///
///
JudyArray<Boundary *> tri, quad;
for (int i = 0; i < count; i++) {
Boundary *bnd = mesh->boundaries[i];
switch (bnd->get_mode()) {
case HERMES_MODE_TRIANGLE: tri.add(bnd); break;
case HERMES_MODE_QUAD: quad.add(bnd); break;
}
}
save_tri_bc(group_id, tri);
save_quad_bc(group_id, quad);
status = H5Gclose(group_id); // close the group
}
示例11: writeAttr
void BinaryFormatter::writeAttr(std::ostream& into, const SumoXMLAttr attr, const Boundary& val) {
BinaryFormatter::writeAttrHeader(into, attr, BF_BOUNDARY);
FileHelpers::writeFloat(into, val.xmin());
FileHelpers::writeFloat(into, val.ymin());
FileHelpers::writeFloat(into, val.xmax());
FileHelpers::writeFloat(into, val.ymax());
}
示例12: fillGraph_
void fillGraph_(Graph & graph, Cell & c, double slowness){
std::vector< Node * > ni(c.nodes());
for (Index i(0); i < c.boundaryCount(); i++){
Boundary *b = c.boundary(i);
if (b){
for (auto & n : b->secondaryNodes()){
ni.push_back(n);
}
} else {
log(Critical, "No boundary found.");
}
}
for (auto & n : c.secondaryNodes()){
ni.push_back(n);
}
for (Index j = 0; j < ni.size()-1; j ++) {
for (Index k = j + 1; k < ni.size(); k ++) {
fillGraph_(graph, *ni[j], *ni[k], slowness, c.id());
}
}
}
示例13:
Boundary
GUILane::getCenteringBoundary() const {
Boundary b;
b.add(myShape[0]);
b.add(myShape[-1]);
b.grow(20);
return b;
}
示例14: Position
Position
GUISUMOAbstractView::getPositionInformation() const {
Boundary bound = myChanger->getViewport();
SUMOReal x = bound.xmin() + bound.getWidth() * myWindowCursorPositionX / getWidth();
// cursor origin is in the top-left corner
SUMOReal y = bound.ymin() + bound.getHeight() * (getHeight() - myWindowCursorPositionY) / getHeight();
return Position(x, y);
}
示例15: throw
Boundary
GUILaneWrapper::getCenteringBoundary() const throw() {
Boundary b;
b.add(myShape[0]);
b.add(myShape[-1]);
b.grow(20);
return b;
}