Skip to content

File WktReader.h

File List > detail > io > WktReader.h

Go to the documentation of this file

// Copyright (c) 2012-2013, IGN France.
// Copyright (c) 2012-2022, Oslandia.
// SPDX-License-Identifier: LGPL-2.0-or-later

#ifndef _SFCGAL_IO_WKTREADER_H_
#define _SFCGAL_IO_WKTREADER_H_

#include <sstream>

#include "SFCGAL/config.h"

#include "SFCGAL/Geometry.h"
#include "SFCGAL/PreparedGeometry.h"

#include "SFCGAL/detail/tools/InputStreamReader.h"

namespace SFCGAL {
namespace detail {
namespace io {

class SFCGAL_API WktReader {
public:
  WktReader(std::istream &s);

  srid_t
  readSRID();

  Geometry *
  readGeometry();

  GeometryType
  readGeometryType();
  CoordinateType
  readCoordinateType();

  void
  readInnerPoint(Point &g);
  void
  readInnerLineString(LineString &g);
  void
  readInnerPolygon(Polygon &g);
  void
  readInnerTriangle(Triangle &g);

  void
  readInnerMultiPoint(MultiPoint &g);
  void
  readInnerMultiLineString(MultiLineString &g);
  void
  readInnerMultiPolygon(MultiPolygon &g);

  void
  readInnerGeometryCollection(GeometryCollection &g);

  void
  readInnerTriangulatedSurface(TriangulatedSurface &g);

  void
  readInnerPolyhedralSurface(PolyhedralSurface &g);

  void
  readInnerSolid(Solid &g);

  void
  readInnerMultiSolid(MultiSolid &g);

  bool
  readPointCoordinate(Point &p);

private:
  tools::InputStreamReader _reader;

  bool _is3D;
  bool _isMeasured;

  std::string
  parseErrorMessage();
};

} // namespace io
} // namespace detail
} // namespace SFCGAL

#endif