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