dmpvectorlayer.h
3.4 KB
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
81
82
83
84
85
86
87
88
89
90
91
/**************************************************************************
* file: dmpvectorlayer.h
* Author: wanzhongping
* Date: 2021-07-05 16:36:44
* Email: zhongpingw@chinadci.com
* copyright: 广州城市信息研究所有限公司
***************************************************************************/
#ifndef __dmpvectorlayer_h__
#define __dmpvectorlayer_h__
#include "dmap_core.h"
#include "dmprendercontext.h"
#include "dmpmaplayer.h"
#include "dmpwkbtypes.h"
#include "dmpvectordataprovider.h"
#include "dmpvectorvacuatelayer.h"
#include "Renderer.h"
#include <vector>
class DmpFeatureRenderer;
class CORE_EXPORT DmpVectorLayer : public DmpMapLayer
{
public:
struct LayerOptions
{
explicit LayerOptions( bool loadDefaultStyle = true,
bool readExtentFromXml = false )
: loadDefaultStyle( loadDefaultStyle )
, readExtentFromXml( readExtentFromXml )
{}
bool loadDefaultStyle = true;
bool readExtentFromXml = false;
DmpWkbTypes::Type fallbackWkbType = DmpWkbTypes::Unknown;
bool skipCrsValidation = false;
};
explicit DmpVectorLayer(const std::string &path = "", const std::string &baseName = "",
const std::string &providerKey = "ogr", const DmpVectorLayer::LayerOptions &options = DmpVectorLayer::LayerOptions());
~DmpVectorLayer();
DmpMapLayerRenderer *createMapRenderer(DmpRenderContext &rendererContext);
bool readXml(const boost::property_tree::ptree &layerNode);
bool writeXml(boost::property_tree::ptree &layerNode);
bool writejson(std::string& json);
DmpFeatureRenderer *renderer() { return renderer_; }
void setRenderer(DmpFeatureRenderer *renderer);
void setDataSource(const std::string &dataSource, const std::string &baseName, const std::string &provider, bool loadDefaultStyleFlag);
DmpWkbTypes::GeometryType GeometryType() const;
DmpWkbTypes::Type GeomWkbType() const{ return wkbType_;}
bool setDataProvider(std::string const &provider);
shared_ptr<DmapCore_30::Renderer> GetRenderer30() { return renderer_30_; }
vector<shared_ptr<DmpVectorVacuateLayer>> vacuateLayers() const { return vacuateLayers_; }
shared_ptr<DmpVectorVacuateLayer> GetCurrentScaleTable(double dx);
void ApplendCurrentScaleTable(shared_ptr<DmpVectorVacuateLayer> pVectorVacuateLayer);
std::string schema() { return schema_;}
std::string geom() { return geom_;}
std::string wherestr() { return wherestr_;}
std::string GeomTypeString(){return wkbTypeString_;}
std::string srid(){return srid_;}
size_t featurecount(){return featurecount_;}
bool IsInit(){return isinit_;}
void setSrid(string srid){ srid_ = srid;}
private:
bool readExtentFromXml_;
DmpWkbTypes::Type wkbType_ = DmpWkbTypes::Unknown;
DmpFeatureRenderer *renderer_ = nullptr;
DmpVectorDataProvider *dataProvider_ = nullptr;
std::string schema_;
std::string geom_;
size_t featurecount_;
std::string wkbTypeString_;
std::string srid_;
std::string wherestr_;
bool isinit_ = false;
shared_ptr<DmapCore_30::Renderer> renderer_30_ = nullptr;
vector<shared_ptr<DmpVectorVacuateLayer>> vacuateLayers_;
};
#endif //__dmpvectorlayer_h__