GEOS: OffsetCurveBuilder.h Source File

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

- File List

# OffsetCurveBuilder.h

    00001 /**********************************************************************
    00002  * $Id: OffsetCurveBuilder.h 3301 2011-04-27 09:42:31Z strk $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2009-2011  Sandro Santilli <strk@keybit.net>
    00008  * Copyright (C) 2006-2007 Refractions Research 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  * Last port: operation/buffer/OffsetCurveBuilder.java r378 (JTS-1.12)
    00018  *
    00019  **********************************************************************/
    00020
    00021 #ifndef GEOS_OP_BUFFER_OFFSETCURVEBUILDER_H
    00022 #define GEOS_OP_BUFFER_OFFSETCURVEBUILDER_H
    00023
    00024 #include <geos/export.h>
    00025
    00026 #include <geos/operation/buffer/BufferParameters.h> // for composition
    00027 #include <geos/operation/buffer/OffsetSegmentGenerator.h>
    00028
    00029 #include <vector>
    00030 #include <memory> // for auto_ptr
    00031
    00032 #ifdef _MSC_VER
    00033 #pragma warning(push)
    00034 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
    00035 #endif
    00036
    00037 // Forward declarations
    00038 namespace geos {
    00039         namespace geom {
    00040                 class CoordinateSequence;
    00041                 class PrecisionModel;
    00042         }
    00043 }
    00044
    00045 namespace geos {
    00046 namespace operation { // geos.operation
    00047 namespace buffer { // geos.operation.buffer
    00048
    00063 class GEOS_DLL OffsetCurveBuilder {
    00064 public:
    00065
    00066         /*
    00067          * @param nBufParams buffer parameters, this object will
    00068          *                   keep a reference to the passed parameters
    00069          *                   so caller must make sure the object is
    00070          *                   kept alive for the whole lifetime of
    00071          *                   the buffer builder.
    00072          */
    00073         OffsetCurveBuilder(const geom::PrecisionModel *newPrecisionModel,
    00074                         const BufferParameters& nBufParams)
    00075                 :
    00076                 distance(0.0),
    00077                 precisionModel(newPrecisionModel),
    00078                 bufParams(nBufParams)
    00079   {}
    00080
    00086   const BufferParameters& getBufferParameters() const
    00087   {
    00088     return bufParams;
    00089   }
    00090
    00100         void getLineCurve(const geom::CoordinateSequence* inputPts,
    00101                           double distance,
    00102                           std::vector<geom::CoordinateSequence*>& lineList);
    00103
    00120         void getSingleSidedLineCurve(const geom::CoordinateSequence* inputPts,
    00121              double distance, std::vector<geom::CoordinateSequence*>& lineList,
    00122              bool leftSide, bool rightSide ) ;
    00123
    00131         void getRingCurve(const geom::CoordinateSequence *inputPts, int side,
    00132                           double distance,
    00133                           std::vector<geom::CoordinateSequence*>& lineList);
    00134
    00135
    00136 private:
    00137
    00138         double distance;
    00139
    00140         const geom::PrecisionModel* precisionModel;
    00141
    00142         const BufferParameters& bufParams;
    00143
    00151         static const double SIMPLIFY_FACTOR; // 100.0;
    00152
    00160         double simplifyTolerance(double bufDistance);
    00161
    00162         void computeLineBufferCurve(const geom::CoordinateSequence& inputPts,
    00163                               OffsetSegmentGenerator& segGen);
    00164
    00165   void computeSingleSidedBufferCurve(const geom::CoordinateSequence& inputPts,
    00166                                      bool isRightSide,
    00167                                      OffsetSegmentGenerator& segGen);
    00168
    00169         void computeRingBufferCurve(const geom::CoordinateSequence& inputPts,
    00170                                     int side, OffsetSegmentGenerator& segGen);
    00171
    00172   std::auto_ptr<OffsetSegmentGenerator> getSegGen(double dist);
    00173
    00174   void computePointCurve(const geom::Coordinate& pt,
    00175                          OffsetSegmentGenerator& segGen);
    00176
    00177
    00178     // Declare type as noncopyable
    00179     OffsetCurveBuilder(const OffsetCurveBuilder& other);
    00180     OffsetCurveBuilder& operator=(const OffsetCurveBuilder& rhs);
    00181 };
    00182
    00183 } // namespace geos::operation::buffer
    00184 } // namespace geos::operation
    00185 } // namespace geos
    00186
    00187 #ifdef _MSC_VER
    00188 #pragma warning(pop)
    00189 #endif
    00190
    00191 #endif // ndef GEOS_OP_BUFFER_OFFSETCURVEBUILDER_H
    00192