dmppgsqlutils.h
2.7 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
#ifndef __dmppgsqlutils_h__
#define __dmppgsqlutils_h__
#include <iostream>
#include <map>
#include <boost/property_tree/ptree.hpp>
#include <libpq-fe.h>
#include <string>
//typedef std::map<int,std::map<std::string,std::string>> resMap;
struct DMapService
{
std::string name;
std::string alias;
std::string state;
std::string create_time;
std::string update_time;
std::string type;
std::string description;
std::string node;
std::string service_guid;
std::string catalog_guid;
};
struct DMapWmtsService
{
std::string name;
std::string type;
std::string vendor;
std::string crs;
std::string create_time;
std::string datasource;
std::string metadata_url;
std::string description;
std::string layername;
std::string layer_alias;
std::string layer_tile;
std::string layer_style;
std::string layer_format;
std::string layer_extent;
std::string layer_description;
std::string tile_id;
};
struct TileScheme
{
std::string guid;
std::string name;
std::string alias;
std::string crs;
std::string datasource;
std::string top_left;
std::string levels;
std::string update_time;
std::string dpi;
std::string rows;
std::string cols;
std::string wkt ;
std::string layer_extent;
};
class DmpPgsqlUtils
{
private:
const char* conn_;
PGconn* basepconn_;
void FinishConnection(PGconn *conn);
void Reset();
public:
DmpPgsqlUtils(const char* strConn_ ,std::string& Msg_);
DmpPgsqlUtils();
~DmpPgsqlUtils();
void do_exit(PGconn *conn_);
//bool ExecuteQuery(const std::string& sqlstr,resMap& resMap_,std::string& Msg_);
bool GetDMapServices(std::map<int,DMapService> &dmapServices_,std::string& Msg_);
bool GetDMapService(DMapService &dmapService_,const std::string& servicename_,std::string& Msg_);
bool GetDMapwmts(const std::string& serviceGuid_, DMapWmtsService& resWmts_,std::string& Msg_);
bool GetDMapwmtsFromName(const std::string& serviceName_, DMapWmtsService& resWmts_,std::string& Msg_);
bool GetTileScheme(const std::string& guid_, TileScheme& tileScheme_,std::string& Msg_);
bool CreatServerPTree(const DMapService &dmapServices_,const DMapWmtsService& resWmts_,boost::property_tree::ptree& pt_root);
bool GetDMapServices(DMapService &dmapService_,const std::string serviceName_,std::string& Msg_);
std::string StringToVendor(const std::string str);
};
#endif //__dmpwmtsutils_h__