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

# SweepLineEvent.h

    00001 /**********************************************************************
    00002  * $Id: SweepLineEvent.h 1820 2006-09-06 16:54:23Z mloskot $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2005-2006 Refractions Research Inc.
    00008  * Copyright (C) 2001-2002 Vivid Solutions Inc.
    00009  *
    00010  * This is free software; you can redistribute and/or modify it under
    00011  * the terms of the GNU Lesser General Public Licence as published
    00012  * by the Free Software Foundation.
    00013  * See the COPYING file for more information.
    00014  *
    00015  **********************************************************************/
    00016
    00017 #ifndef GEOS_GEOMGRAPH_INDEX_SWEEPLINEEVENT_H
    00018 #define GEOS_GEOMGRAPH_INDEX_SWEEPLINEEVENT_H
    00019
    00020 #include <string>
    00021
    00022 // Forward declarations
    00023 namespace geos {
    00024         namespace geomgraph {
    00025                 namespace index {
    00026                         class SweepLineEventOBJ;
    00027                 }
    00028         }
    00029 }
    00030
    00031 namespace geos {
    00032 namespace geomgraph { // geos::geomgraph
    00033 namespace index { // geos::geomgraph::index
    00034
    00035 //class SweepLineEventLessThen; // needed ??
    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;    // used for red-blue intersection detection
    00072
    00073 protected:
    00074
    00075         SweepLineEventOBJ* obj;
    00076
    00077 private:
    00078
    00079         double xValue;
    00080
    00081         int eventType;
    00082
    00083         SweepLineEvent *insertEvent; // null if this is an INSERT_EVENT event
    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 } // namespace geos.geomgraph.index
    00102 } // namespace geos.geomgraph
    00103 } // namespace geos
    00104
    00105 #endif
    00106
    00107 /**********************************************************************
    00108  * $Log$
    00109  * Revision 1.2  2006/03/15 17:17:42  strk
    00110  * Added missing forward declarations
    00111  *
    00112  * Revision 1.1  2006/03/14 12:55:56  strk
    00113  * Headers split: geomgraphindex.h, nodingSnapround.h
    00114  *
    00115  **********************************************************************/
    00116