/usr/include/OpenLayer/RawLineStrip.hpp is in libopenlayer-dev 2.1-2.1build1.
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 | #ifndef OL_RAW_LINE_STRIP
#define OL_RAW_LINE_STRIP
#include "Rgba.hpp"
#include "Bitmap.hpp"
#include "Declspec.hpp"
namespace ol {
template< class std_container1, class std_container2 >
class OL_LIB_DECLSPEC RawLineStrip {
public:
RawLineStrip() : totalLength( 0.0 ) {}
// Add a vertex to the end of the line strip //
inline void AddToEnd( Vec2D vertex ) {
Vec2D *previous = vertices.empty()? 0 : &vertices.back();
vertices.push_back( vertex );
if( vertices.size() > 1 ) {
float length = ( vertex - ( *previous )).GetMagnitude();
lengths.push_back( length );
totalLength += length;
}
}
// Add a vertex to the beginning of the line strip //
inline void AddToBegin( Vec2D vertex ) {
Vec2D *previous = vertices.empty()? 0 : &vertices.front();
vertices.push_front( vertex );
if( vertices.size() > 1 ) {
float length = (( *previous ) - vertex ).GetMagnitude();
lengths.push_front( length );
totalLength += length;
}
}
// Delete the first vertex of the line strip //
inline void DeleteFirst() {
if( !vertices.empty() ) {
vertices.pop_front();
totalLength -= lengths.front();
lengths.pop_front();
}
}
// Delete the first last of the line strip //
inline void DeleteLast() {
if( !vertices.empty() ) {
vertices.pop_back();
totalLength -= lengths.back();
lengths.pop_back();
}
}
void LineStripRender( const Rgba *color1, const Rgba *color2, const Bitmap *texture, float lineWidth,
const Placement &placement, bool connectFirstAndLast ) const;
inline const std_container1 &GetVertices() const {
return vertices;
}
inline std_container1 &GetVertices() {
return vertices;
}
inline const std_container2 &GetLengths() const {
return lengths;
}
inline float GetTotalLength() const {
return totalLength;
}
private:
std_container1 vertices;
std_container2 lengths;
float totalLength;
};
}
#endif // OL_RAW_LINE_STRIP
|