/usr/include/ossim/base/ossimActiveEdgeTable.h is in libossim-dev 2.2.2-1.
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 | //*****************************************************************************
//
// License: See top level LICENSE.txt file.
//
// AUTHOR: Garrett Potts
//
//*****************************************************************************
// $Id: ossimActiveEdgeTable.h 14799 2009-06-30 08:54:44Z dburken $
#include <iostream>
#include <vector>
#include <list>
#include <ossim/base/ossimIrect.h>
class ossimPolygon;
class OSSIMDLLEXPORT ossimActiveEdgeTableNode
{
public:
friend std::ostream& operator <<(std::ostream& out,
const ossimActiveEdgeTableNode& rhs)
{
return out <<"| maxy="<<rhs.theMaxY<<" |dx="
<<rhs.theSlope<<" |"<<"x="
<<rhs.theCurrentX << "|"<< std::endl;
// return out <<"|dy="<<rhs.theDeltaY<<" |dx="
// <<rhs.theSlope<<" |"<<"x="
// <<rhs.theCurrentX << "|"<<endl;
}
ossimActiveEdgeTableNode(ossim_int32 maxY = 0,
double slope = 0.0,
double currentX = 0.0)
// :theDeltaY(deltaY),
:theMaxY(maxY),
theSlope(slope),
theCurrentX(currentX)
{
}
bool operator()(const ossimActiveEdgeTableNode& left,
const ossimActiveEdgeTableNode& right)const
{
return (left.theCurrentX < right.theCurrentX);
}
bool operator<(const ossimActiveEdgeTableNode& right)const
{
return (theCurrentX < right.theCurrentX);
}
bool operator>(const ossimActiveEdgeTableNode& right)const
{
return (theCurrentX > right.theCurrentX);
}
ossim_int32 theMaxY;
// ossim_int32 theDeltaY;
double theSlope;
double theCurrentX;
};
class ossimActiveEdgeTableHelper;
/*!
* This class is used in fast efficient scanliine rasterization. It will take a polygon and insert
* it into the table sorted by y's
*/
class ossimActiveEdgeTable
{
public:
friend class ossimActiveEdgeTableHelper;
ossimActiveEdgeTable();
/*!
* Currently will only work on a single polygon. If you call this
* twice it currently will use the last called polygon and
* will wipe out the previous one.
*
* Note: this is used for scanline rasterization and will round
* to integer values all vertices as they are initially added
* to the Active Edge Table.
*/
void addPolygon(const ossimPolygon& polygon);
const std::list<ossimActiveEdgeTableNode>& getActiveList()const;
// bool getNextScanline(list<ossimActiveEdgeTable>::const_iterator& iterator)const;
ossim_int32 getCurrentScanLine()const
{
return theCurrentScanLine;
}
ossim_int32 getYShift()const
{
return theRectOrigin.y;
}
void initializeActiveList();
void updateActiveEdges();
void mergeCurrentScanLine();
void printActiveEdgeList()const;
protected:
std::vector< std::list<ossimActiveEdgeTableNode> > theTable;
std::list<ossimActiveEdgeTableNode> theActiveList;
void createTable(const ossimPolygon& polygon);
void addEdgeToTable(const ossimActiveEdgeTableNode& edge,
ossim_int32 scanLine);
/*!
* Used in computing the number of scanlines of the passed in polygon and
* is also used to shift the y's relative to 0,0
*/
ossimIrect theBoundingRect;
ossimIpt theRectOrigin;
ossim_int32 theLastScanLine;
ossim_int32 theCurrentScanLine;
};
class ossimActiveEdgeTableHelper
{
public:
ossimActiveEdgeTableHelper(ossimActiveEdgeTable* edgeTable);
bool advanceScanLine();
bool getNextLineSegment(ossimIpt& start,
ossimIpt& end);
ossim_int32 getCurrentScanLine()const
{
if(theEdgeTable)
{
return theEdgeTable->getCurrentScanLine();
}
return 0;
}
ossim_int32 getYShift()const
{
if(theEdgeTable)
{
return theEdgeTable->getYShift();
}
return 0;
}
protected:
ossimActiveEdgeTable* theEdgeTable;
bool theTableInitializedFlag;
std::list<ossimActiveEdgeTableNode>::const_iterator theIterator;
};
|