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
|
/**********************************************************************
*
* PostGIS - Spatial Types for PostgreSQL
* http://postgis.net
*
* PostGIS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* PostGIS 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PostGIS. If not, see <http://www.gnu.org/licenses/>.
*
**********************************************************************
*
* Copyright 2021 Björn Harrtell
*
**********************************************************************/
#ifndef FLATGEOBUF_GEOMETRYREADER_H
#define FLATGEOBUF_GEOMETRYREADER_H
#ifdef __cplusplus
extern "C" {
#endif
#include "lwgeom_log.h"
#include "liblwgeom.h"
#ifdef __cplusplus
}
#endif
#include "feature_generated.h"
namespace FlatGeobuf {
class GeometryReader {
private:
const FlatGeobuf::Geometry *m_geometry;
FlatGeobuf::GeometryType m_geometry_type;
bool m_has_z;
bool m_has_m;
uint32_t m_length = 0;
uint32_t m_offset = 0;
LWPOINT *readPoint();
LWMPOINT *readMultiPoint();
LWLINE *readLineString();
LWMLINE *readMultiLineString();
LWPOLY *readPolygon();
LWMPOLY *readMultiPolygon();
LWCOLLECTION *readGeometryCollection();
POINTARRAY *readPA();
public:
GeometryReader(
const FlatGeobuf::Geometry *geometry,
FlatGeobuf::GeometryType geometry_type,
bool has_z,
bool has_m) :
m_geometry (geometry),
m_geometry_type (geometry_type),
m_has_z (has_z),
m_has_m (has_m)
{ }
LWGEOM *read();
};
}
#endif /* FLATGEOBUF_GEOMETRYREADER_H */
|