-typedef struct{
- float XPos;
- float YPos;
- float radius;
- float length;
- float width;
- float angle;
- float tape[2];
- float value1;
- float value2;
- float alpha1;
- float alpha2;
- float teXpos;
- float texYpos;
- int variable;
- GLfloat vertices[20];
-}Pointer;
-
-void fgEraseArea(GLfloat *array, int NumVerti, GLfloat texXPos, GLfloat texYPos, GLfloat XPos, GLfloat YPos, int Texid, float ScaleFactor);
-void DrawScale(float XPos, float YPos, float InnerRadius, float OuterRadius, float alpha1, float alpha2, int steps, float LineWidth, float red, float green, float blue, bool filled);
-void DrawBeechcraftLogo(float XPos, float YPos, float Width, float Height);
-
-void PrintMatrix( void);
-
-#endif // _PANEL_HXX
+
+/**
+ * An instrument layer containing a group of sublayers.
+ *
+ * This class is useful for gathering together a group of related
+ * layers, either to hold in an external file or to work under
+ * the same condition.
+ */
+class FGGroupLayer : public FGInstrumentLayer
+{
+public:
+ FGGroupLayer ();
+ virtual ~FGGroupLayer ();
+ virtual void draw (osg::State& state);
+ // transfer pointer ownership
+ virtual void addLayer (FGInstrumentLayer * layer);
+protected:
+ std::vector<FGInstrumentLayer *> _layers;
+};
+
+
+/**
+ * A textured layer of an instrument.
+ *
+ * This is a layer holding a single texture. Normally, the texture's
+ * backgound should be transparent so that lower layers and the panel
+ * background can show through.
+ */
+class FGTexturedLayer : public FGInstrumentLayer
+{
+public:
+ FGTexturedLayer (int w = -1, int h = -1) : FGInstrumentLayer(w, h) {}
+ FGTexturedLayer (const FGCroppedTexture &texture, int w = -1, int h = -1);
+ virtual ~FGTexturedLayer ();
+
+ virtual void draw (osg::State& state);
+
+ virtual void setTexture (const FGCroppedTexture &texture) {
+ _texture = texture;
+ }
+ virtual const FGCroppedTexture &getTexture () const { return _texture; }
+ virtual FGCroppedTexture *getTexture() { return &_texture; }
+
+ void setEmissive(bool e) { _emissive = e; }
+
+private:
+ FGCroppedTexture _texture;
+ bool _emissive;
+};
+
+
+/**
+ * A text layer of an instrument.
+ *
+ * This is a layer holding a string of static and/or generated text.
+ * It is useful for instruments that have text displays, such as
+ * a chronometer, GPS, or NavCom radio.
+ */
+class FGTextLayer : public FGInstrumentLayer
+{
+public:
+ enum ChunkType {
+ TEXT,
+ TEXT_VALUE,
+ DOUBLE_VALUE
+ };
+
+ class Chunk : public SGConditional
+ {
+ public:
+ Chunk (const std::string &text, const std::string &fmt = "%s");
+ Chunk (ChunkType type, const SGPropertyNode * node,
+ const std::string &fmt = "", float mult = 1.0, float offs = 0.0,
+ bool truncation = false);
+
+ const char * getValue () const;
+ private:
+ ChunkType _type;
+ std::string _text;
+ SGConstPropertyNode_ptr _node;
+ std::string _fmt;
+ float _mult;
+ float _offs;
+ bool _trunc;
+ mutable char _buf[1024];
+ };
+
+ FGTextLayer (int w = -1, int h = -1);
+ virtual ~FGTextLayer ();
+
+ virtual void draw (osg::State& state);
+
+ // Transfer pointer!!
+ virtual void addChunk (Chunk * chunk);
+ virtual void setColor (float r, float g, float b);
+ virtual void setPointSize (float size);
+ virtual void setFontName ( const std::string &name );
+ virtual void setFont (fntFont * font);
+
+private:
+
+ void recalc_value () const;
+
+ typedef std::vector<Chunk *> chunk_list;
+ chunk_list _chunks;
+ float _color[4];
+
+ float _pointSize;
+ mutable std::string _font_name;
+ mutable std::string _value;
+ mutable SGTimeStamp _then;
+ mutable SGTimeStamp _now;
+};
+
+
+/**
+ * A group layer that switches among its children.
+ *
+ * The first layer that passes its condition will be drawn, and
+ * any following layers will be ignored.
+ */
+class FGSwitchLayer : public FGGroupLayer
+{
+public:
+ // Transfer pointers!!
+ FGSwitchLayer ();
+ virtual void draw (osg::State& state);
+
+};\f
+#endif // __PANEL_HXX
+
+// end of panel.hxx
+
+
+