This file is indexed.

/usr/include/OpenLayer/Shape.hpp is in libopenlayer-dev 2.1-2.1+b1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#ifndef OL_SHAPE_HPP
#define OL_SHAPE_HPP


#include "Includes.hpp"
#include "Rgba.hpp"
#include "Vec2D.hpp"
#include "Collisions.hpp"
#include "Declspec.hpp"


#ifdef OL_NO_STATE_CHANGE
   #define OL_SHAPE_START_RENDERING() \
      GLboolean texturesEnabled; \
      glGetBooleanv( GL_TEXTURE_2D, &texturesEnabled ); \
      glDisable( GL_TEXTURE_2D );

#else // OL_NO_STATE_CHANGE

   #define OL_SHAPE_START_RENDERING() glDisable( GL_TEXTURE_2D );

#endif // OL_NO_STATE_CHANGE


#ifdef OL_NO_STATE_CHANGE
   #define OL_SHAPE_FINISH_RENDERING() \
      if( texturesEnabled ) \
         glEnable( GL_TEXTURE_2D );

#else // OL_NO_STATE_CHANGE

   #define OL_SHAPE_FINISH_RENDERING() (void) 0;

#endif // OL_NO_STATE_CHANGE

namespace ol {

class Poly;


// The base class of all Shapes //

class OL_LIB_DECLSPEC Shape {
public:
   Shape( float lineWidth = 1.0 )
      : lineWidth( lineWidth ), displayList( 0 ) {}

   virtual ~Shape();
   
   void Draw( const Rgba &color ) const {
      OL_SHAPE_START_RENDERING()

      color.Select();
      ExecDraw();

      OL_SHAPE_FINISH_RENDERING()
   }

   void DrawOutline( const Rgba &color ) const {
   #ifdef OL_NO_STATE_CHANGE
      GLboolean texturesEnabled;
      glGetBooleanv( GL_TEXTURE_2D, &texturesEnabled );
   #endif
      glDisable( GL_TEXTURE_2D );
      color.Select();

      ExecDrawOutline();

   #ifdef OL_NO_STATE_CHANGE
      if( texturesEnabled )
         glEnable( GL_TEXTURE_2D );
   #endif
   }


   // Returns true if this and the other Shape collide //
   bool Collides( const Shape &other, const Placement &thisPlacement, const Placement &otherPlacement );


   // Returns true if this and the other Shape collide //
   Collision GetCollision( const Shape &other, const Placement &thisPlacement,
                           const Placement &otherPlacement );


   // Records the results of the drawing function instead of actually drawing the primitive //
   inline void RecordDraw() {
      StartRecording();
      ExecDraw();
      FinishRecording();
   }

   // Same as above but with outlines //
   inline void RecordDrawOutline() {
      StartRecording();
      ExecDrawOutline();
      FinishRecording();
   }

   inline void DrawRecord( const Rgba &color ) const {
   #ifdef OL_NO_STATE_CHANGE
      GLboolean texturesEnabled;
      glGetBooleanv( GL_TEXTURE_2D, &texturesEnabled );
   #endif
      glDisable( GL_TEXTURE_2D );
      color.Select();

      glCallList( displayList );

   #ifdef OL_NO_STATE_CHANGE
      if( texturesEnabled )
         glEnable( GL_TEXTURE_2D );
   #endif
   }

   inline void DrawRecord( const Rgba &color, const Vec2D &displacement ) const {
      glPushMatrix();
      glTranslatef( displacement.x, displacement.y, 0.0 );
      DrawRecord( color );
      glPopMatrix();
   }

   // Moves the shape by the specified amount //
   virtual void MoveBy( const Vec2D &amount ) = 0;

   // Moves the shape to the specified position //
   virtual void MoveTo( const Vec2D &position ) = 0;

   // Rotates the shape by the specified angle //
   virtual void RotateBy( float angle );
   
   // Transforms the shape by a Placement //
   virtual void TransformBy( const Placement &placement );
   
   // Sets the line width of the shape //
   inline void SetLineWidth( float lineWidth ) {
      this->lineWidth = lineWidth;
   }
   
   //virtual Poly ToPolygon() const = 0;

   // Returns the line width of the shape //
   inline float GetLineWidth() {
      return lineWidth;
   }
   
   virtual std::string ToString() const = 0;

protected:
   template< class std_container1, class std_container2 >
   Collision LineStripCollision( const std_container1 &vertices, const std_container2 &otherVertices,
                                 const Placement &thisPlacement, const Placement &otherPlacement,
                                 bool getResults, bool thisConnectFirstAndLast, bool otherConnectFirstAndLast ) const;
   
   virtual void ExecDraw() const = 0;

   virtual void ExecDrawOutline() const = 0;

   inline void StartRecording() {
      displayList = glGenLists( 1 );
      glNewList( displayList, GL_COMPILE );
   }


   inline void FinishRecording() {
      glEndList();
   }

   inline void RotateMatrix( float angle ) const {
      #ifdef OL_ANGLES_IN_DEGREES
         glRotatef( angle, 0.0, 0.0, 1.0 );
      #else // OL_ANGLES_IN_DEGREES
         glRotatef( angle * ( 180.0/AL_PI ), 0.0, 0.0, 1.0 );
      #endif // OL_ANGLES_IN_DEGREES
   }

   float lineWidth;
   int displayList;
};


}



#endif // OL_SHAPES_HPP