1#ifndef OSMSCOUT_FILESCANNER_H
2#define OSMSCOUT_FILESCANNER_H
29#include <osmscout/lib/CoreFeatures.h>
74 std::FILE *file=
nullptr;
75 mutable bool hasError=
true;
83 uint8_t *byteBuffer=
nullptr;
84 size_t byteBufferSize=0;
87#if defined(__WIN32__) || defined(WIN32)
92 void AssureByteBufferSize(
size_t size);
107 char* ReadInternal(
size_t bytes);
120 GeoCoord CreateCoord(
const uint32_t &latDat,
121 const uint32_t &lonDat)
127 throw IOException(filename,
"Cannot read coordinate",
"Coordinate is not normalised");
131 return {latDat/latConversionFactor-90.0,
132 lonDat/lonConversionFactor-180.0};
146 void SetCoord(
const uint32_t &latDat,
147 const uint32_t &lonDat,
151 if (latDat > maxRawCoordValue ||
152 lonDat > maxRawCoordValue){
154 throw IOException(filename,
"Cannot read coordinate",
"Coordinate is not normalised");
158 point.SetCoord(GeoCoord(latDat/latConversionFactor-90.0,
159 lonDat/lonConversionFactor-180.0));
172 bool ConvertBool(
const char &value)
175 if (value != 0 && value != 1){
177 throw IOException(filename,
"Cannot read bool",
"Bool value is not normalised");
187 void Open(
const std::string& filename,
195 return file!=
nullptr;
202 return file==
nullptr || hasError;
260 std::vector<SegmentGeoBox> &
segments,
#define OSMSCOUT_API
Definition CoreImportExport.h:45
uint32_t ReadUInt32(size_t bytes)
std::string GetFilename() const
bool HasError() const
Definition FileScanner.h:200
uint64_t ReadUInt64Number()
std::tuple< GeoCoord, bool > ReadConditionalCoord()
uint16_t ReadUInt16Number()
std::vector< Point > nodes
List of nodes.
Definition Way.h:57
FileOffset ReadFileOffset()
uint16_t Read(size_t bytes)
void Read(std::vector< Point > &nodes, std::vector< SegmentGeoBox > &segments, GeoBox &bbox, bool readIds)
int32_t ReadInt32Number()
FileOffset GetPos() const
bool IsOpen() const
Definition FileScanner.h:193
std::vector< Segment > segments
Definition Route.h:68
uint32_t ReadUInt32Number()
Mode
Definition FileScanner.h:65
@ Normal
Definition FileScanner.h:69
@ LowMemRandom
Definition FileScanner.h:68
@ Sequential
Definition FileScanner.h:66
@ FastRandom
Definition FileScanner.h:67
int64_t ReadInt64Number()
ObjectFileRef ReadObjectFileRef()
std::vector< ObjectFileRef > ReadObjectFileRefs(size_t count)
FileOffset ReadFileOffset(size_t bytes)
void Open(const std::string &filename, Mode mode, bool useMmap)
int16_t ReadInt16Number()
TypeId ReadTypeId(uint8_t maxBytes)
Vertex2D * buffer
Definition Transformation.h:343
void SetPos(FileOffset pos)
void Read(char *buffer, size_t bytes)
GeoBox bbox
Precomputed (cache) bounding box.
Definition DataAgent.h:53
uint64_t ReadUInt64(size_t bytes)
Definition Exception.h:73
void Read(ObjectFileRef &ref)
ObjectFileRefStreamReader(FileScanner &reader)
uint16_t TypeId
Definition OSMScoutTypes.h:52
uint64_t FileOffset
Definition OSMScoutTypes.h:46
constexpr uint32_t maxRawCoordValue
Definition GeoCoord.h:58