include(FlightGearComponent)
set(SOURCES
- adf.cxx
- agradar.cxx
- airspeed_indicator.cxx
- altimeter.cxx
- attitude_indicator.cxx
- clock.cxx
- dclgps.cxx
- dme.cxx
- gps.cxx
- groundradar.cxx
- gsdi.cxx
- gyro.cxx
- heading_indicator.cxx
- heading_indicator_dg.cxx
- heading_indicator_fg.cxx
- inst_vertical_speed_indicator.cxx
- instrument_mgr.cxx
- kr_87.cxx
- kt_70.cxx
- mag_compass.cxx
- marker_beacon.cxx
- mk_viii.cxx
- mrg.cxx
- navradio.cxx
- od_gauge.cxx
- rad_alt.cxx
- render_area_2d.cxx
- rnav_waypt_controller.cxx
- slip_skid_ball.cxx
- tacan.cxx
- tcas.cxx
- transponder.cxx
- turn_indicator.cxx
- vertical_speed_indicator.cxx
- wxradar.cxx
- NavDisplay.cxx
+ adf.cxx
+ agradar.cxx
+ airspeed_indicator.cxx
+ altimeter.cxx
+ attitude_indicator.cxx
+ clock.cxx
+ dclgps.cxx
+ dme.cxx
+ gps.cxx
+ groundradar.cxx
+ gsdi.cxx
+ gyro.cxx
+ heading_indicator.cxx
+ heading_indicator_dg.cxx
+ heading_indicator_fg.cxx
+ inst_vertical_speed_indicator.cxx
+ instrument_mgr.cxx
+ kr_87.cxx
+ kt_70.cxx
+ mag_compass.cxx
+ marker_beacon.cxx
+ mk_viii.cxx
+ mrg.cxx
+ navradio.cxx
+ od_gauge.cxx
+ rad_alt.cxx
+ render_area_2d.cxx
+ rnav_waypt_controller.cxx
+ slip_skid_ball.cxx
+ tacan.cxx
+ tcas.cxx
+ transponder.cxx
+ turn_indicator.cxx
+ vertical_speed_indicator.cxx
+ wxradar.cxx
+ NavDisplay.cxx
HUD/HUD.cxx
HUD/HUD_dial.cxx
HUD/HUD_gauge.cxx
KLN89/kln89_page_usr.cxx
KLN89/kln89_page_vor.cxx
KLN89/kln89_page_alt.cxx
- )
-
-
-flightgear_component(Instruments "${SOURCES}")
\ No newline at end of file
+ )
+
+set(HEADERS
+ adf.hxx
+ agradar.hxx
+ airspeed_indicator.hxx
+ altimeter.hxx
+ attitude_indicator.hxx
+ clock.hxx
+ dclgps.hxx
+ dme.hxx
+ gps.hxx
+ groundradar.hxx
+ gsdi.hxx
+ gyro.hxx
+ heading_indicator.hxx
+ heading_indicator_dg.hxx
+ heading_indicator_fg.hxx
+ inst_vertical_speed_indicator.hxx
+ instrument_mgr.hxx
+ kr_87.hxx
+ kt_70.hxx
+ mag_compass.hxx
+ marker_beacon.hxx
+ mk_viii.hxx
+ mrg.hxx
+ navradio.hxx
+ od_gauge.hxx
+ rad_alt.hxx
+ render_area_2d.hxx
+ rnav_waypt_controller.hxx
+ slip_skid_ball.hxx
+ tacan.hxx
+ tcas.hxx
+ transponder.hxx
+ turn_indicator.hxx
+ vertical_speed_indicator.hxx
+ wxradar.hxx
+ NavDisplay.hxx
+ HUD/HUD.hxx
+ KLN89/kln89.hxx
+ KLN89/kln89_page.hxx
+ KLN89/kln89_page_act.hxx
+ KLN89/kln89_page_apt.hxx
+ KLN89/kln89_page_cal.hxx
+ KLN89/kln89_page_dir.hxx
+ KLN89/kln89_page_fpl.hxx
+ KLN89/kln89_page_int.hxx
+ KLN89/kln89_page_nav.hxx
+ KLN89/kln89_page_ndb.hxx
+ KLN89/kln89_page_nrst.hxx
+ KLN89/kln89_page_oth.hxx
+ KLN89/kln89_page_set.hxx
+ KLN89/kln89_page_usr.hxx
+ KLN89/kln89_page_vor.hxx
+ KLN89/kln89_page_alt.hxx
+ )
+
+flightgear_component(Instruments "${SOURCES}" "${HEADERS}")
\ No newline at end of file
{
assert(nd);
static char buf[512];
- if (format.find('d') >= 0) {
+ if (format.find('d') != string::npos) {
::snprintf(buf, 512, format.c_str(), nd->getIntValue());
return buf;
}
- if (format.find('s') >= 0) {
+ if (format.find('s') != string::npos) {
::snprintf(buf, 512, format.c_str(), nd->getStringValue());
return buf;
}
class SymbolDef
{
public:
- void initFromNode(SGPropertyNode* node)
+ bool initFromNode(SGPropertyNode* node)
{
type = node->getStringValue("type");
enable = sgReadCondition(fgGetNode("/"), node->getChild("enable"));
stretchV2 = node->getFloatValue("v2");
stretchV3 = node->getFloatValue("v3");
}
+
+ return true;
}
SGCondition* enable;
assert(definition->hasText);
string r;
- int pos = 0;
+ size_t pos = 0;
int lastPos = 0;
- for (; pos < (int) definition->textTemplate.size();) {
+ for (; pos < definition->textTemplate.size();) {
pos = definition->textTemplate.find('{', pos);
- if (pos == -1) { // no more replacements
+ if (pos == string::npos) { // no more replacements
r.append(definition->textTemplate.substr(lastPos));
break;
}
r.append(definition->textTemplate.substr(lastPos, pos - lastPos));
- int endReplacement = definition->textTemplate.find('}', pos+1);
+ size_t endReplacement = definition->textTemplate.find('}', pos+1);
if (endReplacement <= pos) {
return "bad replacement";
}
string spec = definition->textTemplate.substr(pos + 1, endReplacement - (pos + 1));
// look for formatter in spec
- int colonPos = spec.find(':');
- if (colonPos < 0) {
+ size_t colonPos = spec.find(':');
+ if (colonPos == string::npos) {
// simple replacement
r.append(props->getStringValue(spec));
} else {
INITFONT("color/alpha", 1, Float);
#undef INITFONT
+ SGPropertyNode* symbolsNode = node->getNode("symbols");
+ SGPropertyNode* symbol;
+
+ for (int i = 0; (symbol = symbolsNode->getChild("symbol", i)) != NULL; ++i) {
+ SymbolDef* def = new SymbolDef;
+ if (!def->initFromNode(symbol)) {
+ delete def;
+ continue;
+ }
+
+ _rules.push_back(def);
+ } // of symbol definition parsing
}
tpath = path;
}
-#if (FG_OSG_VERSION >= 21000)
osg::ref_ptr<osgDB::ReaderWriter::Options> fontOptions = new osgDB::ReaderWriter::Options("monochrome");
osg::ref_ptr<osgText::Font> font = osgText::readFontFile(tpath.c_str(), fontOptions.get());
-#else
- osg::ref_ptr<osgText::Font> font = osgText::readFontFile(tpath.c_str());
-#endif
if (font != 0) {
_font = font;
try {
readProperties( config.str(), config_props );
if (!build(config_props)) {
- throw sg_error(
+ throw sg_exception(
"Detected an internal inconsistency in the instrumentation\n"
"system specification file. See earlier errors for details.");
}
- } catch (const sg_exception&) {
+ } catch (const sg_exception& e) {
SG_LOG(SG_COCKPIT, SG_ALERT, "Failed to load instrumentation system model: "
- << config.str() );
+ << config.str() << ":" << e.getFormattedMessage() );
}