GEOS: SweepLineEvent.h Source File

GEOS 3.5.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

geomgraph/index/SweepLineEvent.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2005-2006 Refractions Research Inc.
7 * Copyright (C) 2001-2002 Vivid Solutions Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************/
15
16 #ifndef GEOS_GEOMGRAPH_INDEX_SWEEPLINEEVENT_H
17 #define GEOS_GEOMGRAPH_INDEX_SWEEPLINEEVENT_H
18
19
20 #include <geos/export.h>
21 #include <string>
22
23 // Forward declarations
24 namespace geos {
25 namespace geomgraph {
26 namespace index {
27 class SweepLineEventOBJ;
28 }
29 }
30 }
31
32 namespace geos {
33 namespace geomgraph { // geos::geomgraph
34 namespace index { // geos::geomgraph::index
35
36 //class SweepLineEventLessThen; // needed ??
37
38 class GEOS_DLL SweepLineEvent{
39 friend class SweepLineEventLessThen;
40
41 public:
42
43 enum {
44 INSERT_EVENT = 1,
45 DELETE_EVENT
46 };
47
48 SweepLineEvent(void* newEdgeSet, double x,
49 SweepLineEvent *newInsertEvent,
50 SweepLineEventOBJ *newObj);
51
52 virtual ~SweepLineEvent();
53
54 bool isInsert() { return insertEvent==NULL; }
55
56 bool isDelete() { return insertEvent!=NULL; }
57
58 SweepLineEvent* getInsertEvent() { return insertEvent; }
59
60 int getDeleteEventIndex() { return deleteEventIndex; }
61
62 void setDeleteEventIndex(int newDeleteEventIndex) {
63 deleteEventIndex=newDeleteEventIndex;
64 }
65
66 SweepLineEventOBJ* getObject() const { return obj; }
67
68 int compareTo(SweepLineEvent *sle);
69
70 std::string print();
71
72 void* edgeSet; // used for red-blue intersection detection
73
74 protected:
75
76 SweepLineEventOBJ* obj;
77
78 private:
79
80 double xValue;
81
82 int eventType;
83
84 SweepLineEvent *insertEvent; // null if this is an INSERT_EVENT event
85
86 int deleteEventIndex;
87 };
88
89 class GEOS_DLL SweepLineEventLessThen {
90 public:
91 bool operator()(const SweepLineEvent *f, const SweepLineEvent *s) const
92 {
93 if (f->xValue<s->xValue) return true;
94 if (f->xValue>s->xValue) return false;
95 if (f->eventType<s->eventType) return true;
96 return false;
97 }
98 };
99
100
101
102 } // namespace geos.geomgraph.index
103 } // namespace geos.geomgraph
104 } // namespace geos
105
106 #endif
107
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25