| 1 | // groundradar.hxx - Background layer for the ATC radar. |
| 2 | // |
| 3 | // Copyright (C) 2007 Csaba Halasz. |
| 4 | // |
| 5 | // This program is free software; you can redistribute it and/or |
| 6 | // modify it under the terms of the GNU General Public License as |
| 7 | // published by the Free Software Foundation; either version 2 of the |
| 8 | // License, or (at your option) any later version. |
| 9 | // |
| 10 | // This program is distributed in the hope that it will be useful, but |
| 11 | // WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | // General Public License for more details. |
| 14 | // |
| 15 | // You should have received a copy of the GNU General Public License |
| 16 | // along with this program; if not, write to the Free Software |
| 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | |
| 19 | |
| 20 | #ifndef __INST_GROUNDRADAR_HXX |
| 21 | #define __INST_GROUNDRADAR_HXX |
| 22 | |
| 23 | #include <osg/ref_ptr> |
| 24 | #include <osg/Geometry> |
| 25 | |
| 26 | #include <simgear/props/props.hxx> |
| 27 | #include <simgear/structure/subsystem_mgr.hxx> |
| 28 | |
| 29 | #include "od_gauge.hxx" |
| 30 | |
| 31 | // forward decls |
| 32 | class FGRunwayBase; |
| 33 | class FGPavement; |
| 34 | |
| 35 | //////////////////////////////////////////////////////////////////////// |
| 36 | // Built-in layer for the atc radar. |
| 37 | //////////////////////////////////////////////////////////////////////// |
| 38 | |
| 39 | class GroundRadar : public SGSubsystem, |
| 40 | public SGPropertyChangeListener, |
| 41 | private FGODGauge |
| 42 | { |
| 43 | public: |
| 44 | // Subsystem identification. |
| 45 | static const char* staticSubsystemClassId() { return "groundradar"; } |
| 46 | |
| 47 | static const int TextureHalfSize = 256; |
| 48 | GroundRadar(SGPropertyNode* node); |
| 49 | virtual ~GroundRadar(); |
| 50 | void updateTexture(); |
| 51 | virtual void valueChanged(SGPropertyNode*); |
| 52 | virtual void update (double dt); |
| 53 | |
| 54 | protected: |
| 55 | void createTexture(const std::string& texture_name); |
| 56 | |
| 57 | void addRunwayVertices(const FGRunwayBase* aRunway, double aTowerLat, double aTowerLon, double aScale, osg::Vec3Array* aVertices); |
| 58 | osg::Geometry *addPavementGeometry(const FGPavement* aPavement, double aTowerLat, double aTowerLon, double aScale); |
| 59 | |
| 60 | osg::ref_ptr<osg::Geode> _geode; |
| 61 | SGPropertyNode_ptr _airport_node; |
| 62 | SGPropertyNode_ptr _range_node; |
| 63 | }; |
| 64 | |
| 65 | #endif // __INST_GROUNDRADAR_HXX |