GEOS 3.3.4

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

- File List

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