libosmscout 1.1.1
Loading...
Searching...
No Matches
ShapeFileScanner.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_IMPORT_SHAPEFILESCANNER_H
2#define OSMSCOUT_IMPORT_SHAPEFILESCANNER_H
3
4/*
5 This source is part of the libosmscout library
6 Copyright (C) 2017 Tim Teulings
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23#include <cstdio>
24#include <string>
25#include <vector>
26
28
30
32
33namespace osmscout {
34
42 {
43 public:
44 virtual ~ShapeFileVisitor() = default;
45 virtual void OnFileBoundingBox(const GeoBox& boundingBox);
46 virtual void OnProgress(double current, double total);
47 virtual void OnPolyline(int32_t recordNumber,
48 const GeoBox& boundingBox,
49 const std::vector<GeoCoord>& coords);
50 };
51
59 class OSMSCOUT_IMPORT_API ShapeFileScanner CLASS_FINAL
60 {
61 private:
62 std::string filename;
63 FILE *file;
64 std::vector<GeoCoord> buffer;
65
66 private:
67 uint8_t ReadByte();
68 int32_t ReadIntegerBE();
69 int32_t ReadIntegerLE();
70 double ReadDoubleLE();
71
72 public:
73 explicit ShapeFileScanner(const std::string& filename);
75
76 void Open();
77 void Close();
78
79 void Visit(ShapeFileVisitor& visitor);
80 };
81}
82
83#endif
#define OSMSCOUT_IMPORT_API
Definition ImportImportExport.h:45
Definition Area.h:88
void Visit(ShapeFileVisitor &visitor)
ShapeFileScanner(const std::string &filename)
Definition ShapeFileScanner.h:42
virtual void OnPolyline(int32_t recordNumber, const GeoBox &boundingBox, const std::vector< GeoCoord > &coords)
virtual ~ShapeFileVisitor()=default
virtual void OnProgress(double current, double total)
virtual void OnFileBoundingBox(const GeoBox &boundingBox)
Definition Area.h:39