-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathprpl-layer.h
168 lines (141 loc) · 5.96 KB
/
prpl-layer.h
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#ifndef PRPL_LAYER_H
#define PRPL_LAYER_H
#include "prpl-basicTypes.h"
#include "prpl-cellspace.h"
#include "prpl-subCellspace.h"
#include "prpl-smplDcmp.h"
namespace pRPL {
class Layer {
public:
/* Constructors and destructor */
Layer(const char *aName = NULL);
~Layer();
/* Information */
const char* name() const;
void name(const char *aName);
const pRPL::SpaceDims* glbDims() const;
const char* dataType() const;
size_t dataSize() const;
long tileSize() const;
const pRPL::CellspaceGeoinfo * glbGeoinfo() const;
/* GDAL */
bool openGdalDS(const char *aFileName,
GDALAccess ioOption = GA_ReadOnly);
int dsBand() const;
void dsBand(int iBand);
void closeGdalDS();
bool createGdalDS(const char *aFileName,
const char *aGdalFormat,
char **aGdalOptions = NULL);
/*PGTIOL*/
bool openPgtiolDS(const char *aFileName,
int prc,
PGTIOLAccess ioOption = PG_ReadOnly);
void closePgtiolDS();
bool createPgtiolDS(const char *aFileName,
int _prc,
char **aPgtOptions = NULL);
/* Decompose & Distribution */
bool decompose(int nRowSubspcs,
int nColSubspcs,
const pRPL::Neighborhood *pNbrhd = NULL);
bool copyDcmp(const Layer *pFromLyr);
bool isDecomposed() const;
/* CellspaceInfo */
void initCellspaceInfo();
void initCellspaceInfo(const pRPL::SpaceDims &dims,
const char *aTypeName,
size_t typeSize,
const pRPL::CellspaceGeoinfo *pGeoinfo = NULL,
long tileSize = TILEWIDTH);
void initCellspaceInfo(const pRPL::CellspaceInfo &cellspcInfo);
bool initCellspaceInfoByGDAL();
bool initCellspaceInfoByPGTIOL();
void delCellspaceInfo();
pRPL::CellspaceInfo* cellspaceInfo();
const pRPL::CellspaceInfo* cellspaceInfo() const;
/* Cellspace */
bool createCellspace(double *pInitVal = NULL);
bool loadCellspaceByGDAL();
bool writeCellspaceByGDAL();
bool loadCellspaceByPGTIOL();
bool writeCellspaceByPGTIOL();
void delCellspace();
pRPL::Cellspace* cellspace();
const pRPL::Cellspace* cellspace() const;
/* SubCellspaceInfo */
int nSubCellspaceInfos() const;
const list<pRPL::SubCellspaceInfo>* allSubCellspaceInfos() const;
bool delSubCellspaceInfo_glbID(int glbID);
bool delSubCellspaceInfo_lclID(int lclID);
void clearSubCellspaceInfos();
const pRPL::IntVect allSubCellspaceIDs() const;
int maxSubCellspaceID() const;
bool calcAllBRs(bool onlyUpdtCtrCell,
const pRPL::Neighborhood *pNbrhd);
pRPL::SubCellspaceInfo* subCellspaceInfo_glbID(int glbID,
bool warning = false);
const pRPL::SubCellspaceInfo* subCellspaceInfo_glbID(int glbID,
bool warning = false) const;
pRPL::SubCellspaceInfo* subCellspaceInfo_lclID(int lclID,
bool warning = false);
const pRPL::SubCellspaceInfo* subCellspaceInfo_lclID(int lclID,
bool warning = false) const;
/* SubCellspace */
int nSubCellspaces() const;
pRPL::SubCellspace* addSubCellspace(int glbID,
double *pInitVal = NULL);
bool delSubCellspace_glbID(int glbID);
bool delSubCellspace_lclID(int lclID);
void clearSubCellspaces();
pRPL::SubCellspace* subCellspace_glbID(int glbID,
bool warning = false);
const pRPL::SubCellspace* subCellspace_glbID(int glbID,
bool warning = false) const;
pRPL::SubCellspace* subCellspace_lclID(int lclID,
bool warning = false);
const pRPL::SubCellspace* subCellspace_lclID(int lclID,
bool warning = false) const;
void setUpdateTracking(bool toTrack);
void allUpdatedIdxs(vector<long> &vUpdtGlbIdxs) const;
void clearUpdateTracks();
bool loadCellStream(void *aStream, int nCells);
/*ByGDAL------------*/
bool loadSubCellspaceByGDAL(int glbID);
bool writeSubCellspaceByGDAL(int glbID);
bool writeTmpSubCellspaceByGDAL(int glbID,
int alias = 0);
bool loadTmpSubCellspaceByGDAL(int glbID,
int alias = 0);
bool mergeSubCellspaceByGDAL(int glbID,
int alias = 0);
/*-------byPGTIOL--------------------*/
bool loadSubCellspaceByPGTIOL(int glbID);
bool writeSubCellspaceByPGTIOL(int glbID);
/*
bool writeTmpSubCellspaceByPGTIOL(int glbID,
int alias = 0);
bool loadTmpSubCellspaceByPGTIOL(int glbID,
int alias = 0);
bool mergeSubCellspaceByPGTIOL(int glbID,
int alias = 0);
*/
private:
const string _tmpSubCellspaceFileName(int glbID,
int alias = 0) const;
bool _parseDsName(const char *aFileName);
private:
string _name;
pRPL::CellspaceInfo *_pCellspcInfo;
pRPL::Cellspace *_pCellspc;
list<pRPL::SubCellspaceInfo> _lSubInfos;
list<pRPL::CellspaceInfo> _lCellspcInfos;
list<pRPL::SubCellspace> _lSubCellspcs;
GDALDataset *_pGdalDS;
PGTIOLDataset *_pPgtiolDS;
int _iBand;
string _dsPath;
string _dsName;
};
};
#endif