File: geojson_processor.h

package info (click to toggle)
tilemaker 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 78,284 kB
  • sloc: cpp: 28,715; ansic: 4,052; makefile: 180; ruby: 77; sh: 6
file content (46 lines) | stat: -rw-r--r-- 1,325 bytes parent folder | download
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
/*! \file */ 
#ifndef _GEOJSON_PROCESSOR_H
#define _GEOJSON_PROCESSOR_H

#include <unordered_map>
#include <string>
#include <vector>
#include <map>
#include "geom.h"
#include "output_object.h"
#include "osm_lua_processing.h"
#include "attribute_store.h"

class GeoJSONProcessor {

public:
	GeoJSONProcessor(Box &clippingBox, 
	                 uint threadNum,
	                 class ShpMemTiles &shpMemTiles,
	                 OsmLuaProcessing &osmLuaProcessing) : 
		 clippingBox(clippingBox), threadNum(threadNum),
		 shpMemTiles(shpMemTiles), osmLuaProcessing(osmLuaProcessing)
	{}

	void read(class LayerDef &layer, uint layerNum);

private:	
	Box clippingBox;
	unsigned threadNum;
	ShpMemTiles &shpMemTiles;
	OsmLuaProcessing &osmLuaProcessing;
	std::mutex attributeMutex;

	template <bool Flag, typename T>
	void processFeature(rapidjson::GenericObject<Flag, T> feature, class LayerDef &layer, uint layerNum);

	template <bool Flag, typename T>
	Polygon polygonFromGeoJSONArray(const rapidjson::GenericArray<Flag, T> &coords);

	template <bool Flag, typename T>
	std::vector<Point> pointsFromGeoJSONArray(const rapidjson::GenericArray<Flag, T> &arr);
	
	AttributeIndex readProperties(const rapidjson::Value &pr, bool &hasName, std::string &name, LayerDef &layer, unsigned &minzoom);
};

#endif //_GEOJSON_PROCESSOR_H