// longitude: returns the value of the runway end longitude field inline double Runway::longitude(const WhichEnd whichEnd) const { if (whichEnd == LOW_END) return dsLongitude( makePointer(RW_LE_LONGITUDE_POS) ); else return dsLongitude( makePointer(RW_HE_LONGITUDE_POS) ); }
// magHeading: returns the value of the runway end mag heading field inline float Runway::magHeading(const WhichEnd whichEnd) const { if (whichEnd == LOW_END) return dsMagHeading( makePointer(RW_LE_MAGHDG_POS) ); else return dsMagHeading( makePointer(RW_HE_MAGHDG_POS) ); }
// elevation: returns the value of the runway end elevation field inline float Runway::elevation(const WhichEnd whichEnd) const { if (whichEnd == LOW_END) return dsElevation1( makePointer(RW_LE_ELEVATION_POS) ); else return dsElevation1( makePointer(RW_HE_ELEVATION_POS) ); }
// ident: returns the runway identifier field inline void Runway::ident(char ident[], const WhichEnd whichEnd) const { if (whichEnd == LOW_END) dsGetString(ident, makePointer(RW_LE_IDENT_POS), RW_XE_IDENT_LEN); else dsGetString(ident, makePointer(RW_HE_IDENT_POS), RW_XE_IDENT_LEN); }
// isIdent: returns true if id runway the identifier field inline int Runway::isIdent(const char id[], const WhichEnd whichEnd) const { if (whichEnd == LOW_END) return dsIsString( makePointer(RW_LE_IDENT_POS), id ); else return dsIsString( makePointer(RW_HE_IDENT_POS), id ); }
// slope: returns the value of the runway end slope field inline float Runway::slope(const WhichEnd whichEnd) const { if (whichEnd == LOW_END) return static_cast<float>(dsAtoln( makePointer(RW_LE_SLOPE_POS), RW_XE_SLOPE_LEN )); else return static_cast<float>(dsAtoln( makePointer(RW_HE_SLOPE_POS), RW_XE_SLOPE_LEN )); }
// build the scene with a single instance, to create glsl_dataflag.osg osg::Node* makeDataflagScene1() { osg::Geode* pointer = makePointer(); osg::StateSet* ss = pointer->getOrCreateStateSet(); setupSceneResources( ss, osg::Vec2(8,4) ); return pointer; }
// transactionCode: returns the Transaction Code field char Record::transactionCode() const { const char* p = makePointer(TRANSACTION_CODE_POS); if (p != 0) return *p; else return '\0'; }
// 2 dataflags with gl_Fog info osg::Node* makeDataflagSceneFog() { osg::Group* group = new osg::Group; osg::StateSet* ss = group->getOrCreateStateSet(); // load font image as a texture osg::Texture2D* fontTex = new osg::Texture2D; fontTex->setImage( osgDB::readImageFile( "verasansmono.png" ) ); ss->setTextureAttributeAndModes( GLYPHTEXUNIT, fontTex, osg::StateAttribute::ON ); ss->addUniform( new osg::Uniform( "GlyphTexSampler", GLYPHTEXUNIT ) ); ss->addUniform( new osg::Uniform( "CellSpan", osg::Vec2(6,5) ) ); ss->setMode( GL_LIGHTING, osg::StateAttribute::OFF ); osg::Shader* drawtext = svUtil::createShaderFromFile( osg::Shader::FRAGMENT, "drawtext" ); osg::Geode* pointer = makePointer(); { osg::PositionAttitudeTransform* xform = new osg::PositionAttitudeTransform; osg::StateSet* ss = xform->getOrCreateStateSet(); xform->setPosition( osg::Vec3(0,0,1) ); xform->addChild( pointer ); group->addChild( xform ); const char* str = "Fog1"; osg::Vec4 word( str[0], str[1], str[2], str[3] ); ss->addUniform( new osg::Uniform( "Word", word ) ); osg::Program* pgm = new osg::Program; pgm->setName( "fog1pgm" ); pgm->addShader( drawtext ); pgm->addShader( svUtil::createShaderFromFile( osg::Shader::FRAGMENT, "fogdata1" ) ); ss->setAttributeAndModes( pgm, osg::StateAttribute::ON ); svUtil::GlslProgramManager::instance().addProgram(pgm); } { osg::PositionAttitudeTransform* xform = new osg::PositionAttitudeTransform; osg::StateSet* ss = xform->getOrCreateStateSet(); xform->setPosition( osg::Vec3(0,0,-1) ); xform->addChild( pointer ); group->addChild( xform ); const char* str = "Fog2"; osg::Vec4 word( str[0], str[1], str[2], str[3] ); ss->addUniform( new osg::Uniform( "Word", word ) ); osg::Program* pgm = new osg::Program; pgm->setName( "fog2pgm" ); pgm->addShader( drawtext ); pgm->addShader( svUtil::createShaderFromFile( osg::Shader::FRAGMENT, "fogdata2" ) ); ss->setAttributeAndModes( pgm, osg::StateAttribute::ON ); svUtil::GlslProgramManager::instance().addProgram(pgm); } return group; }
// range: returns the value of the Range field. inline float Navaid::range() const { double rng = 0.0; const char* p = makePointer(NA_RANGE_POS); if (*p != 'U') { rng = dsAtofn(p, NA_RANGE_LEN); } return static_cast<float>(rng); }
// build the scene with 3 copies of the dataflag osg::Node* makeDataflagScene3() { osg::Group* group = new osg::Group; osg::StateSet* ss = group->getOrCreateStateSet(); setupSceneResources( ss, osg::Vec2(8,4) ); osg::Geode* pointer = makePointer(); group->addChild( modelInstance( pointer, osg::Vec3(-2.5,0,0), "Open" ) ); group->addChild( modelInstance( pointer, osg::Vec3(0,0,0), "GL &" ) ); group->addChild( modelInstance( pointer, osg::Vec3(2.5,0,0), "GLSL" ) ); return group; }
// power: returns the value of the Power field. inline float Navaid::power() const { const char* p = makePointer(NA_POWER_POS); double w = dsAtofn(p, NA_POWER_LEN); if (w != 0.0) return static_cast<float>(w); if (*p == 'U') return 2000.0f; return 50.0f; }
osg::Node* makeDataflagScene99() { const char* str = " !\"#$%&'()*+,-./0123456789:;<=>?" "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" "`abcdefghijklmnopqrstuvwxyz[|]~\177"; const char* s = str; osg::Group* group = new osg::Group; osg::StateSet* ss = group->getOrCreateStateSet(); setupSceneResources( ss, osg::Vec2(4,1) ); osg::Geode* pointer = makePointer(); for( int y=0; y<6; ++y ) for( int x=0; x<4; ++x ) { osg::Vec3 pos(3*x-6,0,3*y-9); group->addChild( modelInstance( pointer, pos, s ) ); s += 4; } return group; }
// channel: returns the value of the channel field inline int Navaid::channel() const { return dsAtoln( makePointer(NA_CHANNEL_POS), NA_CHANNEL_LEN ); }
// keyCode: returns the value of the NAVAID Key Code field inline int Navaid::keyCode() const { return dsAtoln( makePointer(NA_KEY_CODE_POS), NA_KEY_CODE_LEN ); }
// slaveVariance: returns the value of the slave variance field inline float Navaid::slaveVariance() const { return dsSlaveVariance( makePointer(NA_SLAVE_VAR_POS) ); }
// frequency: returns the value of the frequency field inline float Navaid::frequency() const { return dsFrequency( makePointer(NA_FREQUENCY_POS) ); }
// radioClass: returns the value of the radio class field inline void Navaid::radioClass(char rc[]) const { dsGetString( rc, makePointer(NA_RADIO_CLASS_POS), NA_RADIO_CLASS_LEN ); }
// elevation: returns the value of the elevation field float Record::elevation() const { return dsElevation( makePointer(ptbl->elevation) ); }
// formatCode: returns the value of the Format Code field int Record::formatCode() const { return dsAtoln( makePointer(FORMAT_CODE_POS), FORMAT_CODE_LEN ); }
// dafifRecordNumber: returns the value of the DAFIF Record Number field int Record::dafifRecordNumber() const { return dsAtoln( makePointer(RECORD_NUMBER_POS), RECORD_NUMBER_LEN ); }
// airportKey: returns the value of the airport identifier inline void Runway::airportKey(char apKey[]) const { dsGetString( apKey, makePointer(RW_APKEY_POS), AP_KEY_LEN ); }
// length: returns the value of the runway length field inline int Runway::length() const { return dsAtoln( makePointer(RW_LENGTH_POS), RW_LENGTH_LEN ); }
// width: returns the value of the runway width field inline int Runway::width() const { return dsAtoln( makePointer(RW_WIDTH_POS), RW_WIDTH_LEN ); }
// cycleData: returns the Cycle Date field void Record::cycleDate(char date[]) const { dsGetString( date, makePointer(CYCLE_DATE_POS), CYCLE_DATE_LEN ); }
// longitude: returns the value of the longitude field double Record::longitude() const { return dsLongitude( makePointer(ptbl->longitude) ); }
// isCycleDate: returns true if date matches the Cycle Date field bool Record::isCycleDate(const char date[]) const { return dsIsString( makePointer(CYCLE_DATE_POS), date ); }
// channelType: returns the value of the channel type field inline char Navaid::channelType() const { return *makePointer(NA_CHANNEL_TYPE_POS); }
// latitude: returns the value of the latitude field double Record::latitude() const { return dsLatitude( makePointer(ptbl->latitude) ); }
// magVariance: returns the value of the magnetic variance field float Record::magVariance() const { return dsMagVariance( makePointer(ptbl->magVariance) ); }