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