GEOS: TaggedLinesSimplifier.h Source File

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

- File List

# TaggedLinesSimplifier.h

    00001 /**********************************************************************
    00002  * $Id: TaggedLinesSimplifier.h 2785 2009-12-03 19:55:11Z 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 // Forward declarations
    00039 namespace geos {
    00040         namespace simplify {
    00041                 class TaggedLineString;
    00042         }
    00043 }
    00044
    00045 namespace geos {
    00046 namespace simplify { // geos::simplify
    00047
    00052 class GEOS_DLL TaggedLinesSimplifier {
    00053
    00054 public:
    00055
    00056         TaggedLinesSimplifier();
    00057
    00066         void setDistanceTolerance(double tolerance);
    00067
    00081         template <class iterator_type>
    00082         void simplify(
    00083                 iterator_type begin,
    00084                 iterator_type end)
    00085         {
    00086                 // add lines to the index
    00087                 for (iterator_type it=begin; it != end; ++it) {
    00088                         assert(*it);
    00089                         inputIndex->add(*(*it));
    00090                 }
    00091
    00092                 // Simplify lines
    00093                 for (iterator_type it=begin; it != end; ++it) {
    00094                         assert(*it);
    00095                         simplify(*(*it));
    00096                 }
    00097         }
    00098
    00099
    00100 private:
    00101
    00102         void simplify(TaggedLineString& line);
    00103
    00104         std::auto_ptr<LineSegmentIndex> inputIndex;
    00105
    00106         std::auto_ptr<LineSegmentIndex> outputIndex;
    00107
    00108         std::auto_ptr<TaggedLineStringSimplifier> taggedlineSimplifier;
    00109
    00110 };
    00111
    00112
    00113 } // namespace geos::simplify
    00114 } // namespace geos
    00115
    00116 #endif // GEOS_SIMPLIFY_TAGGEDLINESSIMPLIFIER_H
    00117
    00118 /**********************************************************************
    00119  * $Log$
    00120  * Revision 1.4  2006/05/24 15:32:11  strk
    00121  * * source/headers/geos/simplify/TaggedLinesSimplifier.h: added LineSegmentIndex.h include so that every use of the templated simplify() function get all the required definitions.
    00122  *
    00123  * Revision 1.3  2006/05/24 11:41:23  strk
    00124  *         * source/headers/geos/simplify/TaggedLinesSimplifier.h,
    00125  *         source/simplify/TaggedLinesSimplifier.cpp,
    00126  *         source/simplify/TopologyPreservingSimplifier.cpp:
    00127  *         fixed bug in TopologyPreservingSimplifier failing to
    00128  *         detect intersections, refactored TaggedLinesSimplifier
    00129  *         class to more closely match JTS and use templated
    00130  *         functions.
    00131  *
    00132  * Revision 1.2  2006/04/13 14:25:17  strk
    00133  * TopologyPreservingSimplifier initial port
    00134  *
    00135  * Revision 1.1  2006/04/13 10:39:12  strk
    00136  * Initial implementation of TaggedLinesSimplifier class
    00137  *
    00138  **********************************************************************/