36 int iNext = (i+1)%numPts;
37 iNextY = ossim::round<ossim_int32>(polygon[iNext].y-theRectOrigin.y);
38 iY = ossim::round<ossim_int32>(polygon[i].y-theRectOrigin.y);
39 int dy = (iNextY - iY);
44 double m = (polygon[iNext].x-polygon[i].x)/
45 (polygon[iNext].
y-polygon[i].
y);
51 addEdgeToTable(edge, iY);
56 double m = (polygon[i].x-polygon[iNext].x)/
57 (polygon[i].
y-polygon[iNext].
y);
63 addEdgeToTable(edge, iNextY);
73 theBoundingRect.makeNan();
74 theRectOrigin.makeNan();
79 if(!theBoundingRect.hasNans())
81 theTable.resize(theBoundingRect.height()+1);
82 theRectOrigin = theBoundingRect.ul();
90 theTable[scanLine].push_back(edge);
96 for(i=0;i<(int)theTable.size();++i)
98 if(theTable[i].
size())
100 theActiveList = theTable[i];
102 theCurrentScanLine = i;
103 theActiveList.sort();
111 std::list<ossimActiveEdgeTableNode>::iterator current = theActiveList.begin();
113 while(current != theActiveList.end())
115 (*current).theCurrentX += (*current).theSlope;
117 if((*current).theMaxY == theCurrentScanLine)
119 current = theActiveList.erase(current);
130 if((theCurrentScanLine < (
int)theTable.size())&&
131 theTable[theCurrentScanLine].
size())
133 theTable[theCurrentScanLine].sort();
134 theActiveList.merge(theTable[theCurrentScanLine]);
135 theActiveList.sort();
137 theTable[theCurrentScanLine].clear();
143 copy(theActiveList.begin(),
150 :theEdgeTable(edgeTable),
151 theTableInitializedFlag(false)
190 start =
ossimIpt(ossim::round<int>((*theIterator).theCurrentX),
199 end =
ossimIpt( ossim::round<int>((*theIterator).theCurrentX),
208 swap(start.
x, end.
x);
void mergeCurrentScanLine()
ossim_int32 getYShift() const
void addEdgeToTable(const ossimActiveEdgeTableNode &edge, ossim_int32 scanLine)
void addPolygon(const ossimPolygon &polygon)
void initializeActiveList()
ossimActiveEdgeTableHelper(ossimActiveEdgeTable *edgeTable)
ossim_uint32 getVertexCount() const
unsigned int ossim_uint32
void printActiveEdgeList() const
ossim_int32 getCurrentScanLine() const
void getBoundingRect(ossimIrect &rect) const
std::list< ossimActiveEdgeTableNode > theActiveList
std::list< ossimActiveEdgeTableNode >::const_iterator theIterator
bool theTableInitializedFlag
ossim_int32 theCurrentScanLine
void createTable(const ossimPolygon &polygon)
bool getNextLineSegment(ossimIpt &start, ossimIpt &end)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossimActiveEdgeTable * theEdgeTable