OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimActiveEdgeTable.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // AUTHOR: Garrett Potts
6 //
7 //*****************************************************************************
8 // $Id: ossimActiveEdgeTable.h 14799 2009-06-30 08:54:44Z dburken $
9 #include <iostream>
10 #include <vector>
11 #include <list>
12 #include <ossim/base/ossimIrect.h>
13 
14 class ossimPolygon;
15 
16 
18 {
19 public:
21  const ossimActiveEdgeTableNode& rhs)
22  {
23  return out <<"| maxy="<<rhs.theMaxY<<" |dx="
24  <<rhs.theSlope<<" |"<<"x="
25  <<rhs.theCurrentX << "|"<< std::endl;
26 // return out <<"|dy="<<rhs.theDeltaY<<" |dx="
27 // <<rhs.theSlope<<" |"<<"x="
28 // <<rhs.theCurrentX << "|"<<endl;
29  }
31  double slope = 0.0,
32  double currentX = 0.0)
33 // :theDeltaY(deltaY),
34  :theMaxY(maxY),
35  theSlope(slope),
36  theCurrentX(currentX)
37  {
38  }
40  const ossimActiveEdgeTableNode& right)const
41  {
42  return (left.theCurrentX < right.theCurrentX);
43  }
44  bool operator<(const ossimActiveEdgeTableNode& right)const
45  {
46  return (theCurrentX < right.theCurrentX);
47  }
48  bool operator>(const ossimActiveEdgeTableNode& right)const
49  {
50  return (theCurrentX > right.theCurrentX);
51  }
52 
54 // ossim_int32 theDeltaY;
55  double theSlope;
56  double theCurrentX;
57 };
58 
65 {
66 public:
69 
79  void addPolygon(const ossimPolygon& polygon);
80 
81  const std::list<ossimActiveEdgeTableNode>& getActiveList()const;
82 
83 // bool getNextScanline(list<ossimActiveEdgeTable>::const_iterator& iterator)const;
84 
86  {
87  return theCurrentScanLine;
88  }
90  {
91  return theRectOrigin.y;
92  }
93 
94  void initializeActiveList();
95  void updateActiveEdges();
96  void mergeCurrentScanLine();
97  void printActiveEdgeList()const;
98 
99 protected:
100  std::vector< std::list<ossimActiveEdgeTableNode> > theTable;
101  std::list<ossimActiveEdgeTableNode> theActiveList;
102 
103  void createTable(const ossimPolygon& polygon);
104  void addEdgeToTable(const ossimActiveEdgeTableNode& edge,
105  ossim_int32 scanLine);
114 };
115 
117 {
118 public:
120 
121  bool advanceScanLine();
122 
123  bool getNextLineSegment(ossimIpt& start,
124  ossimIpt& end);
125 
127  {
128  if(theEdgeTable)
129  {
131  }
132  return 0;
133  }
135  {
136  if(theEdgeTable)
137  {
138  return theEdgeTable->getYShift();
139  }
140  return 0;
141  }
142 protected:
145 
146  std::list<ossimActiveEdgeTableNode>::const_iterator theIterator;
147 };
#define OSSIMDLLEXPORT
void addEdgeToTable(const ossimActiveEdgeTableNode &edge, ossim_int32 scanLine)
const std::list< ossimActiveEdgeTableNode > & getActiveList() const
void addPolygon(const ossimPolygon &polygon)
ostream & operator<<(ostream &out, const ossimAxes &axes)
Definition: ossimAxes.h:88
ossim_int32 getCurrentScanLine() const
ossimActiveEdgeTableHelper(ossimActiveEdgeTable *edgeTable)
bool operator()(const ossimActiveEdgeTableNode &left, const ossimActiveEdgeTableNode &right) const
std::vector< std::list< ossimActiveEdgeTableNode > > theTable
ossim_int32 getCurrentScanLine() const
bool operator<(const ossimActiveEdgeTableNode &right) const
std::list< ossimActiveEdgeTableNode > theActiveList
bool operator>(const ossimActiveEdgeTableNode &right) const
std::list< ossimActiveEdgeTableNode >::const_iterator theIterator
ossim_int32 y
Definition: ossimIpt.h:142
ossimActiveEdgeTableNode(ossim_int32 maxY=0, double slope=0.0, double currentX=0.0)
void createTable(const ossimPolygon &polygon)
bool getNextLineSegment(ossimIpt &start, ossimIpt &end)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
ossimActiveEdgeTable * theEdgeTable
int ossim_int32
ossim_int32 getYShift() const