]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/hud.hxx
In the process of changing, adding and removing files the last few years
[flightgear.git] / src / Cockpit / hud.hxx
index 56afcbc6e45f02f8e0ce1fc78b3f4cd3f3f73a6e..50365f35aaff4f5c54ca1e10d05f7865f060c08f 100644 (file)
 
 #include <Include/fg_typedefs.h>
 #include <Aircraft/aircraft.hxx>
+#include <Aircraft/controls.hxx>
 #include <FDM/flight.hxx>
-#include <Controls/controls.hxx>
 #include <GUI/gui.h>
 #include <Main/globals.hxx>
 #include <Main/viewmgr.hxx>
+#include <Airports/runways.hxx>
 
 #include "hud_opts.hxx"
+#include <plib/sg.h>
 
 SG_USING_STD(deque);
 SG_USING_STD(vector);
@@ -249,7 +251,7 @@ public:
 
     ~fgLineSeg2D() {}
     
-    void draw()
+    void draw() const
     {
         glVertex2f(x0, y0);
         glVertex2f(x1, y1);
@@ -258,7 +260,7 @@ public:
 
 class DrawLineSeg2D {
     public:
-        void operator() (fgLineSeg2D elem) const {
+        void operator() (const fgLineSeg2D& elem) const {
             elem.draw();
         }
 };
@@ -373,7 +375,7 @@ class fgLineList {
 public:
     fgLineList( void ) {}
     ~fgLineList( void ) {}
-    void add( fgLineSeg2D seg ) { List.push_back(seg); }
+    void add( const fgLineSeg2D& seg ) { List.push_back(seg); }
     void erase( void ) { List.erase( List.begin(), List.end() ); }
     void draw( void ) {
         glBegin(GL_LINES);
@@ -390,7 +392,7 @@ public:
     ~fgTextList( void ) {}
     
     void setFont( fntRenderer *Renderer ) { Font = Renderer; }
-    void add( fgText String ) { List.push_back(String); }
+    void add( const fgText& String ) { List.push_back(String); }
     void erase( void ) { List.erase( List.begin(), List.end() ); }
     
     void draw( void ) {
@@ -422,7 +424,7 @@ inline void Text( fgTextList &List, float x, float y, char *s)
     List.add( fgText( x, y, s) );
 }
 
-inline void Text( fgTextList &List, fgText &me)
+inline void Text( fgTextList &List, const fgText &me)
 {
     List.add(me);
 }
@@ -680,6 +682,50 @@ public:
 
 typedef lon_label * pLonlabel;
 
+//
+// fgRunway_instr      This class is responsible for rendering the active runway
+//                     in the hud (if visible).
+class runway_instr : public instr_item 
+{
+private:       
+       void boundPoint(const sgdVec3& v, sgdVec3& m);
+       bool boundOutsidePoints(sgdVec3& v, sgdVec3& m);
+       bool drawLine(const sgdVec3& a1, const sgdVec3& a2, const sgdVec3& p1, const sgdVec3& p2);
+       void drawArrow();
+       bool get_active_runway(FGRunway& rwy);
+       void get_rwy_points(sgdVec3 *points);
+       void setLineWidth(void);
+
+       sgdVec3 points3d[6],points2d[6];
+       double mm[16],pm[16], arrowScale, arrowRad, lnScale, scaleDist, default_pitch, default_heading;
+       GLint view[4];
+       FGRunway runway;
+       FGViewer* cockpit_view; 
+       unsigned short stippleOut,stippleCen;
+       bool drawIA,drawIAAlways;
+       RECT location;
+       POINT center; 
+       
+public:
+    runway_instr( int    x,
+                  int    y,                    
+                                 int    width,
+                                 int    height,
+                         float  scale_data,
+                         bool   working = true);
+
+    virtual void draw( void );       // Required method in base class
+       void setArrowRotationRadius(double radius);
+       void setArrowScale(double scale); // Scales the runway indication arrow
+       void setDrawArrow(bool draw);    // Draws arrow when runway is not visible in HUD if draw=true
+       void setDrawArrowAlways(bool draw); //Always draws arrow if draw=true;
+       void setLineScale(double scale); //Sets the maximum line scale
+       void setScaleDist(double dist_nm); //Sets the distance where to start scaling the lines
+       void setStippleOutline(unsigned short stipple); //Sets the stipple pattern of the outline of the runway
+       void setStippleCenterline(unsigned short stipple); //Sets the stipple patter of the center line of the runway
+};
+
+
 //
 // instr_scale           This class is an abstract base class for both moving
 //                       scale and moving needle (fixed scale) indicators. It
@@ -928,7 +974,7 @@ private:
     fgLineList         StippleLineList;
 
 public:
-    HudLadder( string    name,
+    HudLadder( const string&    name,
               int       x,
                int       y,
                UINT      width,