00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef GEOS_GEOMGRAPH_INDEX_SWEEPLINEEVENT_H
00018 #define GEOS_GEOMGRAPH_INDEX_SWEEPLINEEVENT_H
00019
00020 #include <string>
00021
00022
00023 namespace geos {
00024 namespace geomgraph {
00025 namespace index {
00026 class SweepLineEventOBJ;
00027 }
00028 }
00029 }
00030
00031 namespace geos {
00032 namespace geomgraph {
00033 namespace index {
00034
00035
00036
00037 class SweepLineEvent{
00038 friend class SweepLineEventLessThen;
00039
00040 public:
00041
00042 enum {
00043 INSERT_EVENT = 1,
00044 DELETE_EVENT
00045 };
00046
00047 SweepLineEvent(void* newEdgeSet, double x,
00048 SweepLineEvent *newInsertEvent,
00049 SweepLineEventOBJ *newObj);
00050
00051 virtual ~SweepLineEvent();
00052
00053 bool isInsert() { return insertEvent==NULL; }
00054
00055 bool isDelete() { return insertEvent!=NULL; }
00056
00057 SweepLineEvent* getInsertEvent() { return insertEvent; }
00058
00059 int getDeleteEventIndex() { return deleteEventIndex; }
00060
00061 void setDeleteEventIndex(int newDeleteEventIndex) {
00062 deleteEventIndex=newDeleteEventIndex;
00063 }
00064
00065 SweepLineEventOBJ* getObject() const { return obj; }
00066
00067 int compareTo(SweepLineEvent *sle);
00068
00069 std::string print();
00070
00071 void* edgeSet;
00072
00073 protected:
00074
00075 SweepLineEventOBJ* obj;
00076
00077 private:
00078
00079 double xValue;
00080
00081 int eventType;
00082
00083 SweepLineEvent *insertEvent;
00084
00085 int deleteEventIndex;
00086 };
00087
00088 class SweepLineEventLessThen {
00089 public:
00090 bool operator()(const SweepLineEvent *f, const SweepLineEvent *s) const
00091 {
00092 if (f->xValue<s->xValue) return true;
00093 if (f->xValue>s->xValue) return false;
00094 if (f->eventType<s->eventType) return true;
00095 return false;
00096 }
00097 };
00098
00099
00100
00101 }
00102 }
00103 }
00104
00105 #endif
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116