GEOS: SweepLineEvent.h Source File

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

- File List

# SweepLineEvent.h

    00001 /**********************************************************************
    00002  * $Id: SweepLineEvent.h 2556 2009-06-06 22:22:28Z strk $
    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
    00021 #include <geos/export.h>
    00022 #include <string>
    00023
    00024 // Forward declarations
    00025 namespace geos {
    00026         namespace geomgraph {
    00027                 namespace index {
    00028                         class SweepLineEventOBJ;
    00029                 }
    00030         }
    00031 }
    00032
    00033 namespace geos {
    00034 namespace geomgraph { // geos::geomgraph
    00035 namespace index { // geos::geomgraph::index
    00036
    00037 //class SweepLineEventLessThen; // needed ??
    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;    // used for red-blue intersection detection
    00074
    00075 protected:
    00076
    00077         SweepLineEventOBJ* obj;
    00078
    00079 private:
    00080
    00081         double xValue;
    00082
    00083         int eventType;
    00084
    00085         SweepLineEvent *insertEvent; // null if this is an INSERT_EVENT event
    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 } // namespace geos.geomgraph.index
    00104 } // namespace geos.geomgraph
    00105 } // namespace geos
    00106
    00107 #endif
    00108
    00109 /**********************************************************************
    00110  * $Log$
    00111  * Revision 1.2  2006/03/15 17:17:42  strk
    00112  * Added missing forward declarations
    00113  *
    00114  * Revision 1.1  2006/03/14 12:55:56  strk
    00115  * Headers split: geomgraphindex.h, nodingSnapround.h
    00116  *
    00117  **********************************************************************/
    00118