dmpmaplayer.h
3.1 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
/**************************************************************************
* file: dmpmaplayer.h
* Author: wanzhongping
* Date: 2021-07-05 16:37:01
* Email: zhongpingw@chinadci.com
* copyright: 广州城市信息研究所有限公司
***************************************************************************/
#ifndef __dmpmaplayer_h__
#define __dmpmaplayer_h__
#include "dmap_core.h"
#include <string>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <boost/foreach.hpp>
// #include "dmprendercontext.h"
#include "dmpcoordinatereferencesystem.h"
#include "dmpmaplayerrenderer.h"
#include "dmprectangle.h"
class DmpDataProvider;
// class DmpMapLayerRenderer;
enum class DmpMapLayerType : int
{
VectorLayer,
RasterLayer,
TileLayer
};
class CORE_EXPORT DmpMapLayer
{
public:
DmpMapLayer(DmpMapLayerType type = DmpMapLayerType::VectorLayer, const std::string &name = "", const std::string &source = "");
~DmpMapLayer();
DmpMapLayer(DmpMapLayer const &) = delete;
DmpMapLayer &operator = (DmpMapLayer const &) = delete;
std::string id() const { return id_;}
std::string name() const { return name_; }
DmpMapLayerType type() const ;
std::string source() const;
DmpRectangle extent() const;
void setTitle(const std::string &title) { title_ = title; }
std::string title() const { return title_; }
void setAbstract(const std::string &abstract) { abstract_ = abstract; }
std::string abstract() const { return abstract_; }
void setKeywordList(const std::string &keywordList) { keywordList_ = keywordList; }
std::string keywordList() const { return keywordList_; }
DmpCoordinateReferenceSystem crs() const { return crs_;}
void setCrs( const DmpCoordinateReferenceSystem &srs) { crs_ = srs; }
double minScale() const { return maxScale_; }
void setMinScale( double scale ) { maxScale_ = scale; }
double maxScale() const { return minScale_; }
void setMaxScale( double scale ) { minScale_ = scale; }
void setProviderType( const std::string &providerType ) { providerKey_ = providerType; }
void setExtent(const DmpRectangle &r);
virtual DmpMapLayerRenderer *createMapRenderer(DmpRenderContext &rendererContext);
virtual DmpDataProvider *dataProvider();
virtual bool readXml(const boost::property_tree::ptree &layerNode);
virtual bool writeXml(boost::property_tree::ptree &layerNode);
bool writeLayerXml(boost::property_tree::ptree &layerElement) const;
protected:
std::string id_;
std::string name_;
std::string title_;
std::string abstract_;
std::string keywordList_;
//! Data provider key (name of the data provider)
std::string providerKey_;
bool isValid_ = false;
std::string dataSource_;
DmpRectangle extent_;
private:
std::string GenerateId(const std::string &layerName);
DmpMapLayerType layerType_;
DmpCoordinateReferenceSystem crs_;
double minScale_ = 0;
double maxScale_ = 100000000;
};
#endif //__dmpmaplayer_h__