This file is indexed.

/usr/include/SFCGAL/Geometry.h is in libsfcgal-dev 1.3.0-4+b2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
/**
 *   SFCGAL
 *
 *   Copyright (C) 2012-2013 Oslandia <infos@oslandia.com>
 *   Copyright (C) 2012-2013 IGN (http://www.ign.fr)
 *
 *   This library is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU Library General Public
 *   License as published by the Free Software Foundation; either
 *   version 2 of the License, or (at your option) any later version.
 *
 *   This library is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *   Library General Public License for more details.

 *   You should have received a copy of the GNU Library General Public
 *   License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _SFCGAL_GEOMETRY_H_
#define _SFCGAL_GEOMETRY_H_

#include <SFCGAL/config.h>

#include <boost/shared_ptr.hpp>

#include <memory>
#include <string>
#include <sstream>

#include <boost/assert.hpp>

namespace CGAL {
class Object;
}

namespace SFCGAL {
class Geometry ;
class Point ;
class LineString ;
class Polygon ;
class GeometryCollection ;
class MultiPoint ;
class MultiLineString ;
class MultiPolygon ;

class Triangle ;
class TriangulatedSurface ;
class PolyhedralSurface ;

//not SFA, appears in GML/CityGML
class Solid ;
//not SFA, appears in GML/CityGML
class MultiSolid ;

class Envelope ;

class GeometryVisitor ;
class ConstGeometryVisitor ;
}

namespace SFCGAL {

/**
 * [OGC/SFA]8.2.3 "A common list of codes for geometric types"
 *
 * @todo solid and triangles as non OGC/SFA geometric types?
 * @warning codes for abstract classes and unimplemented classes are hidden
 * @warning code values have are important for WKB
 *
 * @ingroup public_api
 */
enum GeometryType {
//      TYPE_GEOMETRY            = 0, //abstract
    TYPE_POINT               = 1,
    TYPE_LINESTRING          = 2,
    TYPE_POLYGON             = 3,
    TYPE_MULTIPOINT          = 4,
    TYPE_MULTILINESTRING     = 5,
    TYPE_MULTIPOLYGON        = 6,
    TYPE_GEOMETRYCOLLECTION  = 7,
//     TYPE_CIRCULARSTRING      = 8, // not yet supported
//     TYPE_COMPOUNDCURVE       = 9, // not yet supported
//     TYPE_CURVEPOLYGON        = 10, // not yet supported
//     TYPE_MULTICURVE          = 11, //abstract
//     TYPE_MULTISURFACE        = 12, //abstract
//     TYPE_CURVE               = 13, //abstract
//     TYPE_SURFACE             = 14, //abstract
    TYPE_POLYHEDRALSURFACE   = 15,
    TYPE_TRIANGULATEDSURFACE = 16,

    //-- not official codes
    TYPE_TRIANGLE            = 100, //17 in Wikipedia???
    TYPE_SOLID               = 101,
    TYPE_MULTISOLID          = 102
};


/**
 * @brief coordinate types (XY, XYZ, XYM, etc.)
 * @see SFA 2.8.3 LineStringZ = 1003 ( coordinateType + geometryType)
 * @ingroup public_api
 */
typedef enum {
    COORDINATE_XY   = 0 ,
    COORDINATE_XYZ  = 1000,
    COORDINATE_XYM  = 2000,
    COORDINATE_XYZM = 3000
} CoordinateType ;

/**
 * @brief OGC/SFA based Geometry abstract class
 *
 * @ingroup public_api
 */
class SFCGAL_API Geometry {
public:
    virtual ~Geometry();

    /**
     * @brief Get a deep copy of the geometry
     */
    virtual Geometry*   clone() const = 0 ;

    /**
     * @brief [OGC/SFA]returns the geometry type
     * @warning use CamelCase (LineString, not LINESTRING)
     */
    virtual std::string  geometryType() const = 0 ;
    /**
     * @brief Returns a code corresponding to the type
     * @warning not standard
     */
    virtual GeometryType geometryTypeId() const = 0 ;

    /**
     * [OGC/SFA]Dimension of the Geometry ( 0 : punctual, 1 : curve, ...)
     * @warning empty geometries provide the dimension corresponding to the object
     */
    virtual int          dimension() const = 0 ;
    /**
     * [OGC/SFA]returns the dimension of the coordinates
     * @pre suppose no mix of 2D/3D coordinates
     */
    virtual int          coordinateDimension() const = 0 ;
    /**
     * [OGC/SFA]test if geometry is empty
     */
    virtual bool         isEmpty() const = 0 ;

    /**
     * [OGC/SFA]test if geometry is 3d
     * @pre suppose no mix of 2D/3D coordinates
     */
    virtual bool         is3D() const = 0 ;
    /**
     * [OGC/SFA]test if geometry is measured (has an m)
     * @pre suppose no mix of M/!M points
     */
    virtual bool         isMeasured() const = 0 ;

    //virtual bool         isSimple() const = 0 ;

    
    /**
     * Force the state of the validity flag. The validity flag allows to bypass validity checks
     * If the flag is true, it means the geometry is considered valid
     * If the flag is false, it means the validity state of the geometry is unknown
     * The flag is only changed for this geometry and not the internal geometries.
     * @see propagateValidityFlag
     */
    void forceValidityFlag( bool validity );

    /** Returns the validity flag */
    bool hasValidityFlag() const;

    /**
     * [OGC/SFA]returns the WKT string
     * @param numDecimals extension specify fix precision output
     */
    std::string          asText( const int& numDecimals = -1 ) const ;

    /**
     * [OGC/SFA]Returns a polygon representing the BBOX of the geometry
     * @todo In order to adapt to 3D, would be better to define an "Envelope type",
     * otherway would lead to Polygon and PolyhedralSurface
     */
    //std::auto_ptr< Geometry > envelope() const = 0 ;
    Envelope              envelope() const ;

    /**
     * @brief [OGC/SFA]Returns the boundary of the geometry
     */
    virtual std::auto_ptr< Geometry > boundary() const ;

    /**
     * @brief Computes the distance to an other geometry
     */
    double distance( const Geometry& other ) const ;
    /**
     * @brief Computes the 3D distance to an other geometry
     */
    double distance3D( const Geometry& other ) const ;


    //-- helpers

    /**
     * @brief round the geometry with a corresponding scale factor
     * @param scale the scale factor (1 corresponds to the nearest integer, 1000 to a 0.001 tolerance)
     */
    void round( const long& scale = 1 ) ;


    /**
     * @brief [OGC/SFA]Gets the number of geometries in a collection of geometries
     * @warning 1 for Point, LineString, Polygon, Triangle
     */
    virtual size_t             numGeometries() const ;
    /**
     * @brief [OGC/SFA]Returns the n-th geometry
     * @warning *this for Point, LineString, Polygon, Triangle
     */
    virtual const Geometry&    geometryN( size_t const& n ) const ;
    /**
     * @brief [OGC/SFA]Returns the n-th geometry
     * @warning *this for Point, LineString, Polygon, Triangle
     */
    virtual Geometry&           geometryN( size_t const& n ) ;


    /**
     * @brief Tests if geometry is of "Derived" type given as template parameter
     * @warning not optimized (slow with dynamic_cast)
     */
    template < typename Derived >
    inline bool is() const {
        return dynamic_cast< Derived const* >( this ) != NULL ;
    }


    /**
     * @brief Downcast to a "Derived" class
     * @warning performs check if boost assertions are enabled
    * @pre The cast must be doable
           */
    template < typename Derived >
    inline const Derived&   as() const {
        BOOST_ASSERT( is< Derived >() );
        return *static_cast< Derived const* >( this );
    }
    /**
     * @brief Downcast to a "Derived" class
     * @warning performs check if boost assertions are enabled
    * @pre The cast must be doable
           */
    template < typename Derived >
    inline Derived&         as() {
        BOOST_ASSERT( is< Derived >() );
        return *static_cast< Derived* >( this );
    }

    /**
     * @brief [visitor]dispatch visitor
    * @ingroup detail
           */
    virtual void accept( GeometryVisitor& visitor ) = 0 ;
    /**
     * @brief [visitor]dispatch visitor
    * @ingroup detail
           */
    virtual void accept( ConstGeometryVisitor& visitor ) const = 0 ;

    /**
     * Serializer
    * @ingroup detail
           */
    template <class Archive>
    void serialize( Archive& /*ar*/, const unsigned int /*version*/ ) {
    }
protected:
    Geometry();
    Geometry( const Geometry& );
    const Geometry& operator=( const Geometry& );

    bool validityFlag_;
};

/**
 * Equality operator
 * @todo only compare coordinate points
 * @pre the two geometries must be valid
 */
SFCGAL_API bool operator==( const Geometry&, const Geometry& );

} // namespace SFCGAL

#endif