GEOS: TaggedLinesSimplifier.h Source File

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

- File List

# TaggedLinesSimplifier.h

    00001 /**********************************************************************
    00002  * $Id: TaggedLinesSimplifier.h 2958 2010-03-29 11:29:40Z mloskot $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2006 Refractions Research Inc.
    00008  *
    00009  * This is free software; you can redistribute and/or modify it under
    00010  * the terms of the GNU Lesser General Licence as published
    00011  * by the Free Software Foundation.
    00012  * See the COPYING file for more information.
    00013  *
    00014  **********************************************************************
    00015  *
    00016  * Last port: simplify/TaggedLinesSimplifier.java rev. 1.4 (JTS-1.7.1)
    00017  *
    00018  **********************************************************************
    00019  *
    00020  * NOTES: changed from JTS design adding a private
    00021  *        TaggedLineStringSimplifier member and making
    00022  *        simplify(collection) method become a templated
    00023  *        function.
    00024  *
    00025  **********************************************************************/
    00026
    00027 #ifndef GEOS_SIMPLIFY_TAGGEDLINESSIMPLIFIER_H
    00028 #define GEOS_SIMPLIFY_TAGGEDLINESSIMPLIFIER_H
    00029
    00030 #include <geos/export.h>
    00031 #include <vector>
    00032 #include <memory>
    00033 #include <cassert>
    00034
    00035 #include <geos/simplify/LineSegmentIndex.h> // for templated function body
    00036 #include <geos/simplify/TaggedLineStringSimplifier.h>
    00037
    00038 #ifdef _MSC_VER
    00039 #pragma warning(push)
    00040 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
    00041 #endif
    00042
    00043 // Forward declarations
    00044 namespace geos {
    00045         namespace simplify {
    00046                 class TaggedLineString;
    00047         }
    00048 }
    00049
    00050 namespace geos {
    00051 namespace simplify { // geos::simplify
    00052
    00057 class GEOS_DLL TaggedLinesSimplifier {
    00058
    00059 public:
    00060
    00061         TaggedLinesSimplifier();
    00062
    00071         void setDistanceTolerance(double tolerance);
    00072
    00086         template <class iterator_type>
    00087         void simplify(
    00088                 iterator_type begin,
    00089                 iterator_type end)
    00090         {
    00091                 // add lines to the index
    00092                 for (iterator_type it=begin; it != end; ++it) {
    00093                         assert(*it);
    00094                         inputIndex->add(*(*it));
    00095                 }
    00096
    00097                 // Simplify lines
    00098                 for (iterator_type it=begin; it != end; ++it) {
    00099                         assert(*it);
    00100                         simplify(*(*it));
    00101                 }
    00102         }
    00103
    00104
    00105 private:
    00106
    00107         void simplify(TaggedLineString& line);
    00108
    00109         std::auto_ptr<LineSegmentIndex> inputIndex;
    00110
    00111         std::auto_ptr<LineSegmentIndex> outputIndex;
    00112
    00113         std::auto_ptr<TaggedLineStringSimplifier> taggedlineSimplifier;
    00114 };
    00115
    00116 } // namespace geos::simplify
    00117 } // namespace geos
    00118
    00119 #ifdef _MSC_VER
    00120 #pragma warning(pop)
    00121 #endif
    00122
    00123 #endif // GEOS_SIMPLIFY_TAGGEDLINESSIMPLIFIER_H
    00124
    00125 /**********************************************************************
    00126  * $Log$
    00127  * Revision 1.4  2006/05/24 15:32:11  strk
    00128  * * source/headers/geos/simplify/TaggedLinesSimplifier.h: added LineSegmentIndex.h include so that every use of the templated simplify() function get all the required definitions.
    00129  *
    00130  * Revision 1.3  2006/05/24 11:41:23  strk
    00131  *         * source/headers/geos/simplify/TaggedLinesSimplifier.h,
    00132  *         source/simplify/TaggedLinesSimplifier.cpp,
    00133  *         source/simplify/TopologyPreservingSimplifier.cpp:
    00134  *         fixed bug in TopologyPreservingSimplifier failing to
    00135  *         detect intersections, refactored TaggedLinesSimplifier
    00136  *         class to more closely match JTS and use templated
    00137  *         functions.
    00138  *
    00139  * Revision 1.2  2006/04/13 14:25:17  strk
    00140  * TopologyPreservingSimplifier initial port
    00141  *
    00142  * Revision 1.1  2006/04/13 10:39:12  strk
    00143  * Initial implementation of TaggedLinesSimplifier class
    00144  *
    00145  **********************************************************************/