本文整理汇总了C++中Boundary::getWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ Boundary::getWidth方法的具体用法?C++ Boundary::getWidth怎么用?C++ Boundary::getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boundary
的用法示例。
在下文中一共展示了Boundary::getWidth方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
GUIDanielPerspectiveChanger::centerTo(const Boundary &netBoundary,
Boundary bound,
bool applyZoom) {
myViewCenter.set(bound.getCenter());
myViewCenter.sub(netBoundary.getCenter());
myViewCenter.mul(-1.0);
if (applyZoom) {
myZoom =
bound.getWidth() > bound.getHeight() ?
(SUMOReal) 100.0 * (SUMOReal) netBoundary.getWidth() / (SUMOReal) bound.getWidth() :
(SUMOReal) 100.0 * (SUMOReal) netBoundary.getHeight() / (SUMOReal) bound.getHeight();
}
}
示例2: 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);
}
示例3: GUIPerspectiveChanger
// ===========================================================================
// method definitions
// ===========================================================================
GUIDanielPerspectiveChanger::GUIDanielPerspectiveChanger(
GUISUMOAbstractView& callBack, const Boundary& viewPort) :
GUIPerspectiveChanger(callBack, viewPort),
myOrigWidth(viewPort.getWidth()),
myOrigHeight(viewPort.getHeight()),
myRotation(0),
myMouseButtonState(MOUSEBTN_NONE),
myMoveOnClick(false),
myDragDelay(0) {}
示例4:
Boundary
GUIPerspectiveChanger::patchedViewPort() {
// avoid division by zero
if (myCallback.getHeight() == 0 ||
myCallback.getWidth() == 0 ||
myViewPort.getHeight() == 0 ||
myViewPort.getWidth() == 0) {
return myViewPort;
}
Boundary result = myViewPort;
SUMOReal canvasRatio = (SUMOReal)myCallback.getWidth() / myCallback.getHeight();
SUMOReal ratio = result.getWidth() / result.getHeight();
if (ratio < canvasRatio) {
result.growWidth(result.getWidth() * (canvasRatio / ratio - 1) / 2);
} else {
result.growHeight(result.getHeight() * (ratio / canvasRatio - 1) / 2);
}
return result;
}
示例5: glMatrixMode
void
GUISUMOAbstractView::applyGLTransform(bool fixRatio) {
Boundary bound = myChanger->getViewport(fixRatio);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// as a rough rule, each GLObject is drawn at z = -GUIGlObjectType
// thus, objects with a higher value will be closer (drawn on top)
// // @todo last param should be 0 after modifying all glDraw methods
glOrtho(0, getWidth(), 0, getHeight(), -GLO_MAX - 1, GLO_MAX + 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
SUMOReal scaleX = (SUMOReal)getWidth() / bound.getWidth();
SUMOReal scaleY = (SUMOReal)getHeight() / bound.getHeight();
glScaled(scaleX, scaleY, 1);
glTranslated(-bound.xmin(), -bound.ymin(), 0);
}
示例6: Boundary
/* Test the method 'getWidth' and getHeight*/
TEST(Boundary, test_method_getWidthHeight) {
Boundary *bound = new Boundary(-2,-4,4,8);
EXPECT_DOUBLE_EQ(bound->getHeight(), 12);
EXPECT_DOUBLE_EQ(bound->getWidth(), 6);
}
示例7: locker
void
GUIPolygon::drawGL(const GUIVisualizationSettings& s) const {
Boundary boundary = myShape.getBoxBoundary();
if (s.scale * MAX2(boundary.getWidth(), boundary.getHeight()) < s.minPolySize) {
return;
}
if (getFill()) {
if (myShape.size() < 3) {
return;
}
} else {
if (myShape.size() < 2) {
return;
}
}
AbstractMutex::ScopedLocker locker(myLock);
//if (myDisplayList == 0 || (!getFill() && myLineWidth != s.polyExaggeration)) {
// storeTesselation(s.polyExaggeration);
//}
glPushName(getGlID());
glPushMatrix();
glTranslated(0, 0, getLayer());
// XXX shape should be rotated around its center when initializing the polygon. do we even need this?
//glRotated(getAngle(), 0, 0, 1);
GLHelper::setColor(getColor());
int textureID = -1;
if (getFill()) {
const std::string& file = getImgFile();
if (file != "") {
textureID = GUITexturesHelper::getTextureID(file);
}
}
// init generation of texture coordinates
if (textureID >= 0) {
glEnable(GL_TEXTURE_2D);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST); // without DEPTH_TEST vehicles may be drawn below roads
glDisable(GL_LIGHTING);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_ALPHA_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
// http://www.gamedev.net/topic/133564-glutesselation-and-texture-mapping/
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, xPlane);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_T, GL_OBJECT_PLANE, yPlane);
}
// recall tesselation
//glCallList(myDisplayList);
performTesselation(s.polyExaggeration);
// de-init generation of texture coordinates
if (textureID >= 0) {
glEnable(GL_DEPTH_TEST);
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
}
glPopMatrix();
drawName(myShape.getPolygonCenter(), s.scale, s.polyName);
glPopName();
}
示例8: locker
void
GUIPolygon::drawGL(const GUIVisualizationSettings& s) const {
if (s.polySize.getExaggeration(s) == 0) {
return;
}
Boundary boundary = myShape.getBoxBoundary();
if (s.scale * MAX2(boundary.getWidth(), boundary.getHeight()) < s.polySize.minSize) {
return;
}
if (getFill()) {
if (myShape.size() < 3) {
return;
}
} else {
if (myShape.size() < 2) {
return;
}
}
AbstractMutex::ScopedLocker locker(myLock);
//if (myDisplayList == 0 || (!getFill() && myLineWidth != s.polySize.getExaggeration(s))) {
// storeTesselation(s.polySize.getExaggeration(s));
//}
glPushName(getGlID());
glPushMatrix();
glTranslated(0, 0, getLayer());
glRotated(-getNaviDegree(), 0, 0, 1);
GLHelper::setColor(getColor());
int textureID = -1;
if (getFill()) {
const std::string& file = getImgFile();
if (file != "") {
textureID = GUITexturesHelper::getTextureID(file, true);
}
}
// init generation of texture coordinates
if (textureID >= 0) {
glEnable(GL_TEXTURE_2D);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST); // without DEPTH_TEST vehicles may be drawn below roads
glDisable(GL_LIGHTING);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_ALPHA_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
// http://www.gamedev.net/topic/133564-glutesselation-and-texture-mapping/
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, xPlane);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_T, GL_OBJECT_PLANE, yPlane);
}
// recall tesselation
//glCallList(myDisplayList);
performTesselation(myLineWidth * s.polySize.getExaggeration(s));
// de-init generation of texture coordinates
if (textureID >= 0) {
glEnable(GL_DEPTH_TEST);
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
}
#ifdef GUIPolygon_DEBUG_DRAW_VERTICES
GLHelper::debugVertices(myShape, 80 / s.scale);
#endif
glPopMatrix();
const Position namePos = myShape.getPolygonCenter();
drawName(namePos, s.scale, s.polyName);
if (s.polyType.show) {
GLHelper::drawText(myType, namePos + Position(0, -0.6 * s.polyType.size / s.scale),
GLO_MAX, s.polyType.size / s.scale, s.polyType.color);
}
glPopName();
}