GEOS: BufferInputLineSimplifier.h Source File

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

- File List

# BufferInputLineSimplifier.h

    00001 /**********************************************************************
    00002  * $Id: BufferInputLineSimplifier.h 3246 2011-02-23 17:13:31Z strk $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2009  Sandro Santilli <strk@keybit.net>
    00008  *
    00009  * This is free software; you can redistribute and/or modify it under
    00010  * the terms of the GNU Lesser General Public Licence as published
    00011  * by the Free Software Foundation.
    00012  * See the COPYING file for more information.
    00013  *
    00014  **********************************************************************
    00015  *
    00016  * Last port: operation/buffer/BufferInputLineSimplifier.java r320 (JTS-1.12)
    00017  *
    00018  **********************************************************************/
    00019
    00020 #ifndef GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
    00021 #define GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
    00022
    00023 #include <geos/geom/CoordinateSequence.h> // complete type required
    00024 #include <geos/algorithm/CGAlgorithms.h> // for enum
    00025
    00026 #include <memory>
    00027 #include <vector> // for composition
    00028
    00029
    00030 // Forward declarations
    00031 namespace geos {
    00032         namespace geom {
    00033                 class CoordinateSequence;
    00034                 //class PrecisionModel;
    00035         }
    00036 }
    00037
    00038 namespace geos {
    00039 namespace operation { // geos.operation
    00040 namespace buffer { // geos.operation.buffer
    00041
    00074 class BufferInputLineSimplifier
    00075 {
    00076
    00077 public:
    00078
    00091         static std::auto_ptr<geom::CoordinateSequence> simplify(
    00092                 const geom::CoordinateSequence& inputLine, double distanceTol);
    00093
    00094         BufferInputLineSimplifier(const geom::CoordinateSequence& input);
    00095
    00106         std::auto_ptr<geom::CoordinateSequence> simplify(double distanceTol);
    00107
    00108 private:
    00109
    00116         bool deleteShallowConcavities();
    00117
    00126         unsigned int findNextNonDeletedIndex(unsigned int index) const;
    00127
    00128         std::auto_ptr<geom::CoordinateSequence> collapseLine() const;
    00129
    00130         bool isDeletable(int i0, int i1, int i2, double distanceTol) const;
    00131
    00132         bool isShallowConcavity(const geom::Coordinate& p0,
    00133                                 const geom::Coordinate& p1,
    00134                                 const geom::Coordinate& p2,
    00135                                 double distanceTol) const;
    00136
    00150         bool isShallowSampled(const geom::Coordinate& p0,
    00151                               const geom::Coordinate& p2,
    00152                               int i0, int i2, double distanceTol) const;
    00153
    00154         bool isShallow(const geom::Coordinate& p0,
    00155                        const geom::Coordinate& p1,
    00156                        const geom::Coordinate& p2,
    00157                        double distanceTol) const;
    00158
    00159         bool isConcave(const geom::Coordinate& p0,
    00160                        const geom::Coordinate& p1,
    00161                        const geom::Coordinate& p2) const;
    00162
    00163         static const int NUM_PTS_TO_CHECK = 10;
    00164
    00165         static const int INIT = 0;
    00166         static const int DELETE = 1;
    00167         static const int KEEP = 1;
    00168
    00169         const geom::CoordinateSequence& inputLine;
    00170         double distanceTol;
    00171         std::vector<int> isDeleted;
    00172
    00173         int angleOrientation;
    00174
    00175     // Declare type as noncopyable
    00176     BufferInputLineSimplifier(const BufferInputLineSimplifier& other);
    00177     BufferInputLineSimplifier& operator=(const BufferInputLineSimplifier& rhs);
    00178 };
    00179
    00180
    00181 } // namespace geos.operation.buffer
    00182 } // namespace geos.operation
    00183 } // namespace geos
    00184
    00185
    00186 #endif // ndef GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
    00187
    00188 /**********************************************************************
    00189  * $Log$
    00190  **********************************************************************/
    00191