42WX_DECLARE_STRING_HASH_MAP(wxString, EnvHash);
82s57mgr::s57mgr(
const wxString &csv_dir) {
94 wxString envs1(
"S57_CSV=");
95 envs1.Append(csv_dir);
96 _putenv(envs1.mb_str());
98 wxSetEnv(
"S57_CSV", csv_dir.mb_str());
110 set1 =
"LNAM_REFS=ON";
111 set1.Append(
",SPLIT_MULTIPOINT=OFF");
112 set1.Append(
",ADD_SOUNDG_DEPTH=OFF");
113 set1.Append(
",PRESERVE_EMPTY_NUMBERS=OFF");
114 set1.Append(
",RETURN_PRIMITIVES=OFF");
115 set1.Append(
",RETURN_LINKAGES=OFF");
117 const char *version_string = GDALVersionInfo(
"VERSION_NUM");
118 int ver_num = (int)CPLScanLong((
char *)version_string, 4);
121 set2 =
",UPDATES=BUGBUG";
123 set2 =
",UPDATES=APPLY";
128 wxString envs2(
"OGR_S57_OPTIONS=");
130 _putenv(envs2.mb_str());
133 wxSetEnv(
"OGR_S57_OPTIONS", set1.mb_str());
136 pcsv_locn =
new wxString(csv_dir);
157bool s57mgr::GetChartFirstM_COVR(
char *pFullPath, OGRDataSource **pDS,
158 OGRFeature **pFeature, OGRLayer **pLayer,
160 OGRDataSource *poDS = OGRSFDriverRegistrar::Open(pFullPath);
169 OGRLayer *pLay = poDS->GetLayerByName(
"M_COVR");
171 pLay->ResetReading();
172 OGRFeature *objectDef = pLay->GetNextFeature();
173 *pFeature = objectDef;
177 for (
int iField = 0; iField < objectDef->GetFieldCount(); iField++) {
178 if (objectDef->IsFieldSet(iField)) {
179 OGRFieldDefn *poFDefn = objectDef->GetDefnRef()->GetFieldDefn(iField);
180 if (!strcmp(poFDefn->GetNameRef(),
"CATCOV"))
181 catcov = objectDef->GetFieldAsInteger(iField);
199bool s57mgr::GetChartNextM_COVR(OGRDataSource *pDS, OGRLayer *pLayer,
200 OGRFeature *pLastFeature, OGRFeature **pFeature,
202 if (pDS == NULL)
return false;
206 int fid = pLastFeature->GetFID();
208 OGRFeature *objectDef = pLayer->GetFeature(fid + 1);
209 *pFeature = objectDef;
212 for (
int iField = 0; iField < objectDef->GetFieldCount(); iField++) {
213 if (objectDef->IsFieldSet(iField)) {
214 OGRFieldDefn *poFDefn = objectDef->GetDefnRef()->GetFieldDefn(iField);
215 if (!strcmp(poFDefn->GetNameRef(),
"CATCOV"))
216 catcov = objectDef->GetFieldAsInteger(iField);
227bool s57mgr::GetChartExtent(
char *pFullPath,
Extent *pext) {
253int s57mgr::GetChartScale(
char *pFullPath) {
256 if (!poModule.Open(pFullPath)) {
260 DDFRecord *poRecord = poModule.ReadRecord();
261 if (poRecord == NULL) {
267 for (; poRecord != NULL; poRecord = poModule.ReadRecord()) {
268 if (poRecord->FindField(
"DSPM") != NULL) {
269 scale = poRecord->GetIntSubfield(
"DSPM", 0,
"CSCL", 0);