本文整理汇总了C++中basicgl::Graphic::lcRestoreMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ Graphic::lcRestoreMatrix方法的具体用法?C++ Graphic::lcRestoreMatrix怎么用?C++ Graphic::lcRestoreMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类basicgl::Graphic
的用法示例。
在下文中一共展示了Graphic::lcRestoreMatrix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
//.........这里部分代码省略.........
LCreal north = 0;
LCreal east = 0;
if (symbols[i]->isPositionLL()) {
// 2a) we were give L/L so convert to NED coordinates
double lat = symbols[i]->getXPosition();
double lon = symbols[i]->getYPosition();
latLon2Earth(lat, lon, &north, &east);
}
else {
// 2b) we were give NED coordinates
north = (LCreal) symbols[i]->getXPosition();
east = (LCreal) symbols[i]->getYPosition();
}
// 2c) convert the NED coordinates to aircraft coordinates
earth2Aircraft(north, east, &acX, &acY);
}
// 3) Convert the aircraft coordinates to screen coordinates
aircraft2Screen(acX, acY, &xScn, &yScn);
// 4) Save the screen coordinates (inches)
symbols[i]->setXScreenPos(xScn);
symbols[i]->setYScreenPos(yScn);
}
// In range? Do we care?
bool inRange = !showInRangeOnly || (((xScn * xScn) + (yScn * yScn)) <= radius2);
if (inRange) {
// set symbol's visibility
g->setVisibility(true);
// and set the symbol's position
g->lcSaveMatrix();
g->lcTranslate(xScn, yScn + displacement);
// pass the argument value to the symbol (if needed)
if (symbols[i]->getValue() != 0) {
g->event(UPDATE_VALUE, symbols[i]->getValue());
}
// rotate the symbol's heading subcomponent (if needed)
// -- sending a 'Z' rotation event to a component named 'hdg'
if (symbols[i]->isHeadingValid()) {
BasicGL::Graphic* phdg = symbols[i]->getHdgGraphics();
if (phdg == 0) {
Basic::Pair* hpair = (Basic::Pair*) g->findByName("hdg");
if (hpair != 0) {
phdg = dynamic_cast<Graphic*>(hpair->object());
symbols[i]->setHdgGraphics(phdg);
}
}
if (phdg != 0) {
Basic::Degrees* angObj = symbols[i]->getHdgAngleObj();
if (angObj == 0) {
angObj = new Basic::Degrees();
symbols[i]->setHdgAngleObj(angObj);
}
double relHeading = symbols[i]->getHeadingDeg() - getHeadingDeg();
angObj->set(-relHeading);
phdg->event(UPDATE_VALUE6, angObj);
}
}
}
else {
// out of range, so clear the graphical component's visibility flag
g->setVisibility(false);
}
}
// When the symbol visibility flag is false ...
else {
Basic::Pair* p = symbols[i]->getSymbolPair();
BasicGL::Graphic* g = (BasicGL::Graphic*)p->object();
g->setVisibility(false);
}
}
}
// ---
// Let our base class handle the drawing
// ---
BaseClass::draw();
// ---
// now restore the matrices on all of our graphical components
// ---
for (int i = 0; i < MAX_SYMBOLS; i++) {
if (symbols[i] != 0) {
Basic::Pair* p = symbols[i]->getSymbolPair();
BasicGL::Graphic* g = (BasicGL::Graphic*)p->object();
if (g->isVisible()) g->lcRestoreMatrix();
}
}
}
}