dmpvectorlayer.cpp
2.3 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
/**************************************************************************
* file: dmpvectorlayer.cpp
* Author: wanzhongping
* Date: 2021-07-05 16:37:23
* Email: zhongpingw@chinadci.com
* copyright: 广州城市信息研究所有限公司
***************************************************************************/
#include "dmpvectorlayer.h"
#include "dmpvectorlayerrenderer.h"
#include "dmpproviderregistry.h"
DmpVectorLayer::DmpVectorLayer(const std::string &path,
const std::string &baseName,
const std::string &providerKey,
const DmpVectorLayer::LayerOptions &options)
: DmpMapLayer(DmpMapLayerType::VectorLayer, baseName, path)
, readExtentFromXml_(options.readExtentFromXml)
{
wkbType_ = options.fallbackWkbType;
setProviderType(providerKey);
if (!path.empty() && !providerKey.empty())
{
setDataSource(path, baseName, providerKey, options.loadDefaultStyle );
}
}
DmpVectorLayer::~DmpVectorLayer()
{
}
DmpMapLayerRenderer *DmpVectorLayer::createMapRenderer(DmpRenderContext &rendererContext)
{
return new DmpVectorLayerRenderer(this, rendererContext);
}
bool DmpVectorLayer::readXml(const boost::property_tree::ptree &layerNode)
{
return false;
}
bool DmpVectorLayer::writeXml(boost::property_tree::ptree &layerNode)
{
return false;
}
void DmpVectorLayer::setRenderer(DmpFeatureRenderer *renderer)
{
}
void DmpVectorLayer::setDataSource(const std::string &dataSource, const std::string &baseName, const std::string &provider, bool loadDefaultStyleFlag)
{
DmpWkbTypes::GeometryType geomType = GeometryType();
}
DmpWkbTypes::GeometryType DmpVectorLayer::GeometryType() const
{
return DmpWkbTypes::GeometryType(wkbType_);
}
bool DmpVectorLayer::setDataProvider(std::string const &provider)
{
providerKey_ = provider;
delete dataProvider_;
dataProvider_ = dynamic_cast<DmpVectorDataProvider *>(DmpProviderRegistry::Instance()->CreateProvider(provider, dataSource_));
if (!dataProvider_)
{
isValid_ = false;
return false;
}
isValid_ = dataProvider_->IsValid();
if (!isValid_)
{
return false;
}
wkbType_ = dataProvider_->WkbType();
return true;
}