404 stringstream strstrFileName;
406 OGRwkbGeometryType eGType = wkbUnknown;
407 string strType =
"unknown";
415 eGType = wkbLineString;
424 eGType = wkbLineString;
433 eGType = wkbLineString;
442 eGType = wkbLineString;
451 eGType = wkbLineString;
459 eGType = wkbLineString;
523 eGType = wkbLineString;
539 eGType = wkbLineString;
547 eGType = wkbLineString;
596 eGType = wkbLineString;
613 strFilePathName.append(
"_");
614 stringstream ststrTmp;
628 strFilePathName.append(ststrTmp.str());
629 strstrFileName << ststrTmp.str();
641 if (pGDALDriver == NULL)
648 GDALDataset* pGDALDataSet = pGDALDriver->Create(strFilePathName.c_str(), 0, 0, 0, GDT_Unknown,
m_papszGDALVectorOptions);
650 if (pGDALDataSet == NULL)
652 cerr <<
ERR <<
"cannot create " <<
m_strVectorGISOutFormat <<
" named " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
657 OGRSpatialReference OGRSpatialRef;
667 OGRSpatialRef.importFromEPSG(25830);
678 OGRLayer* pOGRLayer = pGDALDataSet->CreateLayer(strstrFileName.str().c_str(), &OGRSpatialRef, eGType,
m_papszGDALVectorOptions);
680 if (pOGRLayer == NULL)
682 cerr <<
ERR <<
"cannot create '" << strType <<
"' layer in " << strFilePathName << endl
683 << CPLGetLastErrorMsg() << endl;
688 CPLPushErrorHandler(CPLQuietErrorHandler);
695 string const strFieldValue1 =
"Coast";
696 OGRFieldDefn
const OGRField1(strFieldValue1.c_str(), OFTInteger);
698 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
700 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
707 for (
int i = 0; i < static_cast<int>(
m_VCoast.size()); i++)
710 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
713 pOGRFeature->SetField(strFieldValue1.c_str(), i);
716 for (
int j = 0; j <
m_VCoast[i].pLGetCoastlineExtCRS()->nGetSize(); j++)
718 OGRls.addPoint(
m_VCoast[i].pPtGetCoastlinePointExtCRS(j)->dGetX(),
m_VCoast[i].pPtGetCoastlinePointExtCRS(j)->dGetY());
720 pOGRFeature->SetGeometry(&OGRls);
723 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
725 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for coast " << i <<
" in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
731 OGRFeature::DestroyFeature(pOGRFeature);
740 string const strFieldValue1 =
"Coast";
741 OGRFieldDefn
const OGRField1(strFieldValue1.c_str(), OFTInteger);
743 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
745 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
755 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
758 pOGRFeature->SetField(strFieldValue1.c_str(), i);
765 pOGRFeature->SetGeometry(&OGRls);
768 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
770 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for highest SWL coast " << i <<
" in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
776 OGRFeature::DestroyFeature(pOGRFeature);
785 string const strFieldValue1 =
"Coast";
786 OGRFieldDefn
const OGRField1(strFieldValue1.c_str(), OFTInteger);
788 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
790 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
800 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
803 pOGRFeature->SetField(strFieldValue1.c_str(), i);
810 pOGRFeature->SetGeometry(&OGRls);
813 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
815 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for lowest SWL coast " << i <<
" in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
821 OGRFeature::DestroyFeature(pOGRFeature);
831 string const strFieldValue1 =
"NMR";
832 string const strFieldValue2 =
"tiempo";
833 string const strFieldValue3 =
"surge_mm";
835 string const strFieldValue4 =
"runup_mm";
863 OGRFieldDefn
const OGRField1(strFieldValue1.c_str(), OFTReal);
864 OGRFieldDefn
const OGRField2(strFieldValue2.c_str(), OFTReal);
865 OGRFieldDefn
const OGRField3(strFieldValue3.c_str(), OFTInteger64);
867 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
869 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
873 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
875 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
879 if (pOGRLayer->CreateField(&OGRField3) != OGRERR_NONE)
881 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 3 '" << strFieldValue3 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
886 OGRLineString
const OGR2ls;
921 OGRFeature* pOGR3Feature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
922 OGRFieldDefn
const OGRField6(strFieldValue1.c_str(), OFTReal);
923 OGRFieldDefn
const OGRField7(strFieldValue2.c_str(), OFTReal);
924 OGRFieldDefn
const OGRField4(strFieldValue3.c_str(), OFTInteger64);
926 if (pOGRLayer->CreateField(&OGRField6) != OGRERR_NONE)
928 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
932 if (pOGRLayer->CreateField(&OGRField7) != OGRERR_NONE)
934 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
938 if (pOGRLayer->CreateField(&OGRField4) != OGRERR_NONE)
940 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 4 '" << strFieldValue4 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
945 OGRLineString OGR3ls;
952 pOGR3Feature->SetField(strFieldValue3.c_str(), surge_level);
963 pOGR3Feature->SetGeometry(&OGR3ls);
967 if (pOGRLayer->CreateFeature(pOGR3Feature) != OGRERR_NONE)
969 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for coast " << i <<
" in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
975 OGRFeature::DestroyFeature(pOGR3Feature);
982 OGRFeature* pOGR4Feature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
983 OGRFieldDefn
const OGRField8(strFieldValue1.c_str(), OFTReal);
984 OGRFieldDefn
const OGRField9(strFieldValue2.c_str(), OFTReal);
985 OGRFieldDefn
const OGRField5(strFieldValue4.c_str(), OFTInteger64);
987 if (pOGRLayer->CreateField(&OGRField8) != OGRERR_NONE)
989 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
993 if (pOGRLayer->CreateField(&OGRField9) != OGRERR_NONE)
995 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
999 if (pOGRLayer->CreateField(&OGRField5) != OGRERR_NONE)
1001 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 5 '" << strFieldValue4 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1006 OGRLineString OGR4ls;
1013 pOGR4Feature->SetField(strFieldValue4.c_str(), runup_level);
1024 pOGR4Feature->SetGeometry(&OGR4ls);
1028 if (pOGRLayer->CreateFeature(pOGR4Feature) != OGRERR_NONE)
1030 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for coast " << i <<
" in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1036 OGRFeature::DestroyFeature(pOGR4Feature);
1048 string const strFieldValue1 =
"CliffEdge";
1049 OGRFieldDefn
const OGRField1(strFieldValue1.c_str(), OFTInteger);
1051 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1053 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1058 OGRLineString OGRls;
1060 for (
int i = 0; i < static_cast<int>(
m_VCliffToe.size()); i++)
1063 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1066 pOGRFeature->SetField(strFieldValue1.c_str(), i);
1069 for (
int j = 0; j <
m_VCliffToe[i].nGetSize(); j++)
1075 pOGRFeature->SetGeometry(&OGRls);
1078 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1080 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for cliff edge " << i <<
" in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1086 OGRFeature::DestroyFeature(pOGRFeature);
1096 string const strFieldValue1 =
"NormalID";
1097 OGRFieldDefn
const OGRField1(strFieldValue1.c_str(), OFTInteger);
1099 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1101 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1106 string const strFieldValue2 =
"Coast";
1107 string const strFieldValue3 =
"StartCoast";
1108 string const strFieldValue4 =
"EndCoast";
1109 string const strFieldValue5 =
"HitLand";
1110 string const strFieldValue6 =
"HitIntervention";
1111 string const strFieldValue7 =
"HitCoast";
1112 string const strFieldValue8 =
"HitNormal";
1113 string const strFieldValue9 =
"TooShort";
1114 string const strFieldValue10 =
"TruncSame";
1115 string const strFieldValue11 =
"TruncDiff";
1116 string const strFieldValue12 =
"CShore";
1118 OGRFieldDefn
const OGRField2(strFieldValue2.c_str(), OFTInteger);
1119 OGRFieldDefn
const OGRField3(strFieldValue3.c_str(), OFTInteger);
1120 OGRFieldDefn
const OGRField4(strFieldValue4.c_str(), OFTInteger);
1121 OGRFieldDefn
const OGRField5(strFieldValue5.c_str(), OFTInteger);
1122 OGRFieldDefn
const OGRField6(strFieldValue6.c_str(), OFTInteger);
1123 OGRFieldDefn
const OGRField7(strFieldValue7.c_str(), OFTInteger);
1124 OGRFieldDefn
const OGRField8(strFieldValue8.c_str(), OFTInteger);
1125 OGRFieldDefn
const OGRField9(strFieldValue9.c_str(), OFTInteger);
1126 OGRFieldDefn
const OGRField10(strFieldValue10.c_str(), OFTInteger);
1127 OGRFieldDefn
const OGRField11(strFieldValue11.c_str(), OFTInteger);
1128 OGRFieldDefn
const OGRField12(strFieldValue12.c_str(), OFTInteger);
1130 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1132 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1136 if (pOGRLayer->CreateField(&OGRField3) != OGRERR_NONE)
1138 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 3 '" << strFieldValue3 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1142 if (pOGRLayer->CreateField(&OGRField4) != OGRERR_NONE)
1144 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 4 '" << strFieldValue4 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1148 if (pOGRLayer->CreateField(&OGRField5) != OGRERR_NONE)
1150 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 5 '" << strFieldValue5 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1154 if (pOGRLayer->CreateField(&OGRField6) != OGRERR_NONE)
1156 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 6 '" << strFieldValue6 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1160 if (pOGRLayer->CreateField(&OGRField7) != OGRERR_NONE)
1162 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 7 '" << strFieldValue7 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1166 if (pOGRLayer->CreateField(&OGRField8) != OGRERR_NONE)
1168 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 8 '" << strFieldValue8 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1172 if (pOGRLayer->CreateField(&OGRField9) != OGRERR_NONE)
1174 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 9 '" << strFieldValue9 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1178 if (pOGRLayer->CreateField(&OGRField10) != OGRERR_NONE)
1180 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 10 '" << strFieldValue10 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1184 if (pOGRLayer->CreateField(&OGRField11) != OGRERR_NONE)
1186 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 11 '" << strFieldValue11 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1190 if (pOGRLayer->CreateField(&OGRField12) != OGRERR_NONE)
1192 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 12 '" << strFieldValue12 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1197 OGRLineString OGRls;
1199 for (
int i = 0; i < static_cast<int>(
m_VCoast.size()); i++)
1201 for (
int j = 0; j <
m_VCoast[i].nGetNumProfiles(); j++)
1208 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1211 pOGRFeature->SetField(strFieldValue1.c_str(), j);
1212 pOGRFeature->SetField(strFieldValue2.c_str(), pProfile->
nGetCoastID());
1213 pOGRFeature->SetField(strFieldValue3.c_str(), pProfile->
bStartOfCoast());
1214 pOGRFeature->SetField(strFieldValue4.c_str(), pProfile->
bEndOfCoast());
1215 pOGRFeature->SetField(strFieldValue5.c_str(), pProfile->
bHitLand());
1216 pOGRFeature->SetField(strFieldValue6.c_str(), pProfile->
bHitIntervention());
1217 pOGRFeature->SetField(strFieldValue7.c_str(), pProfile->
bHitCoast());
1219 pOGRFeature->SetField(strFieldValue9.c_str(), pProfile->
bTooShort());
1222 pOGRFeature->SetField(strFieldValue12.c_str(), pProfile->
bCShoreProblem());
1228 pOGRFeature->SetGeometry(&OGRls);
1232 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1234 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for coast " << i <<
" and profile " << j <<
" in " << strFilePathName << endl
1235 << CPLGetLastErrorMsg() << endl;
1240 OGRFeature::DestroyFeature(pOGRFeature);
1259 string strFieldValue1;
1262 strFieldValue1 =
"Curve";
1264 strFieldValue1 =
"SC_Energy";
1266 strFieldValue1 =
"MeanEnergy";
1268 strFieldValue1 =
"Height";
1270 strFieldValue1 =
"Node";
1272 strFieldValue1 =
"Notch";
1274 strFieldValue1 =
"Wavesetup";
1276 strFieldValue1 =
"Stormsurge";
1278 strFieldValue1 =
"Runup";
1280 OGRFieldDefn
const OGRField1(strFieldValue1.c_str(), OFTReal);
1282 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1284 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1289 OGRLineString
const OGRls;
1290 OGRMultiLineString
const OGRmls;
1293 for (
int i = 0; i < static_cast<int>(
m_VCoast.size()); i++)
1295 for (
int j = 0; j <
m_VCoast[i].pLGetCoastlineExtCRS()->nGetSize(); j++)
1298 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1301 OGRPt.setX(
m_VCoast[i].pPtGetCoastlinePointExtCRS(j)->dGetX());
1302 OGRPt.setY(
m_VCoast[i].pPtGetCoastlinePointExtCRS(j)->dGetY());
1303 pOGRFeature->SetGeometry(&OGRPt);
1307 double const dCurvature =
m_VCoast[i].dGetDetailedCurvature(j);
1313 pOGRFeature->SetField(strFieldValue1.c_str(), dCurvature);
1319 if (
m_VCoast[i].pGetCoastLandform(j) == NULL)
1320 pOGRFeature->SetField(strFieldValue1.c_str(),
DBL_NODATA);
1322 pOGRFeature->SetField(strFieldValue1.c_str(),
m_VCoast[i].pGetCoastLandform(j)->dGetTotAccumWaveEnergy());
1328 if (
m_VCoast[i].pGetCoastLandform(j) == NULL)
1329 pOGRFeature->SetField(strFieldValue1.c_str(),
DBL_NODATA);
1332 double dEnergy =
m_VCoast[i].pGetCoastLandform(j)->dGetTotAccumWaveEnergy();
1336 pOGRFeature->SetField(strFieldValue1.c_str(), dEnergy);
1342 double const dHeight =
m_VCoast[i].dGetBreakingWaveHeight(j);
1343 pOGRFeature->SetField(strFieldValue1.c_str(), dHeight);
1348 double const dWaveSetupSurge =
m_VCoast[i].dGetWaveSetupSurge(j);
1349 pOGRFeature->SetField(strFieldValue1.c_str(), dWaveSetupSurge);
1361 double const dRunUp =
m_VCoast[i].dGetRunUp(j);
1362 pOGRFeature->SetField(strFieldValue1.c_str(), dRunUp);
1366 int const nNode =
m_VCoast[i].nGetPolygonNode(j);
1372 pOGRFeature->SetField(strFieldValue1.c_str(), nNode);
1378 if (pCoastLandform == NULL)
1379 pOGRFeature->SetField(strFieldValue1.c_str(),
DBL_NODATA);
1383 double dNotchDepth = 0.0;
1397 pOGRFeature->SetField(strFieldValue1.c_str(), dNotchDepth);
1402 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1404 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for coast " << i <<
" point " << j <<
" in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1409 OGRFeature::DestroyFeature(pOGRFeature);
1419 string const strFieldValue1 =
"Angle";
1420 string const strFieldValue2 =
"Height";
1423 OGRFieldDefn
const OGRField1(strFieldValue1.c_str(), OFTReal);
1425 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1427 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1432 OGRFieldDefn
const OGRField2(strFieldValue2.c_str(), OFTReal);
1434 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1436 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1441 OGRLineString
const OGRls;
1442 OGRMultiLineString
const OGRmls;
1453 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1458 pOGRFeature->SetGeometry(&OGRPt);
1460 double const dOrientation =
m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle();
1461 double const dHeight =
m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1467 pOGRFeature->SetField(strFieldValue1.c_str(), dOrientation);
1468 pOGRFeature->SetField(strFieldValue2.c_str(), dHeight);
1471 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1473 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for cell [" << nX <<
"][" << nY <<
"] in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1478 OGRFeature::DestroyFeature(pOGRFeature);
1489 string const strFieldValue1 =
"ProfileID";
1490 string const strFieldValue2 =
"CoastID";
1491 string const strFieldValue3 =
"HeightX";
1492 string const strFieldValue4 =
"HeightY";
1493 string const strFieldValue5 =
"Height";
1494 string const strFieldValue6 =
"Angle";
1495 string const strFieldValue7 =
"Breaking";
1496 string const strFieldValue8 =
"IsSynthetic";
1499 OGRFieldDefn
const OGRField1(strFieldValue1.c_str(), OFTInteger);
1500 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1502 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1506 OGRFieldDefn
const OGRField2(strFieldValue2.c_str(), OFTInteger);
1507 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1509 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1513 OGRFieldDefn
const OGRField3(strFieldValue3.c_str(), OFTReal);
1514 if (pOGRLayer->CreateField(&OGRField3) != OGRERR_NONE)
1516 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 3 '" << strFieldValue3 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1520 OGRFieldDefn
const OGRField4(strFieldValue4.c_str(), OFTReal);
1521 if (pOGRLayer->CreateField(&OGRField4) != OGRERR_NONE)
1523 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 4 '" << strFieldValue4 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1527 OGRFieldDefn
const OGRField5(strFieldValue5.c_str(), OFTReal);
1528 if (pOGRLayer->CreateField(&OGRField5) != OGRERR_NONE)
1530 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 5 '" << strFieldValue5 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1534 OGRFieldDefn
const OGRField6(strFieldValue6.c_str(), OFTReal);
1535 if (pOGRLayer->CreateField(&OGRField6) != OGRERR_NONE)
1537 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 6 '" << strFieldValue6 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1541 OGRFieldDefn
const OGRField7(strFieldValue7.c_str(), OFTInteger);
1542 if (pOGRLayer->CreateField(&OGRField7) != OGRERR_NONE)
1544 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 7 '" << strFieldValue7 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1548 OGRFieldDefn
const OGRField8(strFieldValue8.c_str(), OFTInteger);
1549 if (pOGRLayer->CreateField(&OGRField8) != OGRERR_NONE)
1551 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 8 '" << strFieldValue8 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1562 for (
size_t nPoint = 0; nPoint < transect.VdX.size(); nPoint++)
1565 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1570 pOGRFeature->SetGeometry(&OGRPt);
1573 double const dHeightX = transect.VdHeightX[nPoint];
1574 double const dHeightY = transect.VdHeightY[nPoint];
1575 double const dHeight = sqrt(dHeightX * dHeightX + dHeightY * dHeightY);
1576 double dAngle = atan2(dHeightX, dHeightY) * 180.0 /
PI;
1581 pOGRFeature->SetField(strFieldValue1.c_str(), transect.nProfileID);
1582 pOGRFeature->SetField(strFieldValue2.c_str(), transect.nCoastID);
1583 pOGRFeature->SetField(strFieldValue3.c_str(), dHeightX);
1584 pOGRFeature->SetField(strFieldValue4.c_str(), dHeightY);
1585 pOGRFeature->SetField(strFieldValue5.c_str(), dHeight);
1586 pOGRFeature->SetField(strFieldValue6.c_str(), dAngle);
1587 pOGRFeature->SetField(strFieldValue7.c_str(), transect.VbBreaking[nPoint] ? 1 : 0);
1588 pOGRFeature->SetField(strFieldValue8.c_str(), (transect.nProfileID == -1) ? 1 : 0);
1591 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1593 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for transect " << nTransect <<
" point " << nPoint <<
" in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1598 OGRFeature::DestroyFeature(pOGRFeature);
1608 string const strFieldValue1 =
"Angle";
1609 string const strFieldValue2 =
"Height";
1612 OGRFieldDefn
const OGRField1(strFieldValue1.c_str(), OFTReal);
1614 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1616 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1621 OGRFieldDefn
const OGRField2(strFieldValue2.c_str(), OFTReal);
1623 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1625 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1630 OGRLineString
const OGRls;
1631 OGRMultiLineString
const OGRmls;
1639 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1644 pOGRFeature->SetGeometry(&OGRPt);
1646 double const dOrientation =
m_pRasterGrid->m_Cell[nX][nY].dGetTotWaveAngle() /
static_cast<double>(
m_ulIter);
1647 double const dHeight =
m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight() /
static_cast<double>(
m_ulIter);
1653 pOGRFeature->SetField(strFieldValue1.c_str(), dOrientation);
1654 pOGRFeature->SetField(strFieldValue2.c_str(), dHeight);
1657 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1659 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for cell [" << nX <<
"][" << nY <<
"] in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1664 OGRFeature::DestroyFeature(pOGRFeature);
1674 string const strFieldValue1 =
"Coast";
1675 string const strFieldValue2 =
"Polygon";
1676 string const strFieldValue3 =
"CoastNode";
1677 string const strFieldValue4 =
"TotSedChng";
1678 string const strFieldValue5 =
"FinSedChng";
1679 string const strFieldValue6 =
"SndSedChng";
1680 string const strFieldValue7 =
"CrsSedChng";
1682 OGRFieldDefn
const OGRField1(strFieldValue1.c_str(), OFTInteger);
1683 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1685 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1689 OGRFieldDefn
const OGRField2(strFieldValue2.c_str(), OFTInteger);
1690 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1692 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1696 OGRFieldDefn
const OGRField3(strFieldValue3.c_str(), OFTReal);
1697 if (pOGRLayer->CreateField(&OGRField3) != OGRERR_NONE)
1699 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 3 '" << strFieldValue3 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1703 OGRFieldDefn
const OGRField4(strFieldValue4.c_str(), OFTReal);
1704 if (pOGRLayer->CreateField(&OGRField4) != OGRERR_NONE)
1706 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 4 '" << strFieldValue4 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1710 OGRFieldDefn
const OGRField5(strFieldValue5.c_str(), OFTReal);
1711 if (pOGRLayer->CreateField(&OGRField5) != OGRERR_NONE)
1713 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 5 '" << strFieldValue5 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1717 OGRFieldDefn
const OGRField6(strFieldValue6.c_str(), OFTReal);
1718 if (pOGRLayer->CreateField(&OGRField6) != OGRERR_NONE)
1720 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 6 '" << strFieldValue6 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1724 OGRFieldDefn
const OGRField7(strFieldValue7.c_str(), OFTReal);
1725 if (pOGRLayer->CreateField(&OGRField7) != OGRERR_NONE)
1727 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 7 '" << strFieldValue6 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1732 OGRLineString OGRls;
1734 for (
int i = 0; i < static_cast<int>(
m_VCoast.size()); i++)
1736 for (
int j = 0; j <
m_VCoast[i].nGetNumPolygons(); j++)
1739 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1744 pOGRFeature->SetField(strFieldValue1.c_str(), i);
1745 pOGRFeature->SetField(strFieldValue2.c_str(), j);
1757 pOGRFeature->SetGeometry(&OGRls);
1760 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1762 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for coast " << i <<
" polygon " << j <<
" in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1768 OGRFeature::DestroyFeature(pOGRFeature);
1778 string const strFieldValue1 =
"ShadowLine";
1779 OGRFieldDefn
const OGRField1(strFieldValue1.c_str(), OFTInteger);
1781 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1783 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1788 OGRLineString OGRls;
1790 for (
int i = 0; i < static_cast<int>(
m_VCoast.size()); i++)
1792 for (
int j = 0; j <
m_VCoast[i].nGetNumShadowBoundaries(); j++)
1795 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1798 pOGRFeature->SetField(strFieldValue1.c_str(), j);
1803 for (
int nn = 0; nn < LShadow.
nGetSize(); nn++)
1806 pOGRFeature->SetGeometry(&OGRls);
1809 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1811 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle << j <<
" for coast " << i <<
" in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1817 OGRFeature::DestroyFeature(pOGRFeature);
1827 string const strFieldValue1 =
"DdriftLine";
1828 OGRFieldDefn
const OGRField1(strFieldValue1.c_str(), OFTInteger);
1830 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1832 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1837 OGRLineString OGRls;
1839 for (
int i = 0; i < static_cast<int>(
m_VCoast.size()); i++)
1841 for (
int j = 0; j <
m_VCoast[i].nGetNumShadowDowndriftBoundaries(); j++)
1844 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1847 pOGRFeature->SetField(strFieldValue1.c_str(), j);
1852 for (
int nn = 0; nn < LDowndrift.
nGetSize(); nn++)
1855 pOGRFeature->SetGeometry(&OGRls);
1858 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1860 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle << j <<
" for coast " << i <<
" in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1866 OGRFeature::DestroyFeature(pOGRFeature);
1876 string const strFieldValue1 =
"Angle";
1877 string const strFieldValue2 =
"Height";
1880 OGRFieldDefn
const OGRField1(strFieldValue1.c_str(), OFTReal);
1882 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1884 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1889 OGRFieldDefn
const OGRField2(strFieldValue2.c_str(), OFTReal);
1891 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1893 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1898 OGRLineString
const OGRls;
1899 OGRMultiLineString
const OGRmls;
1907 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1912 pOGRFeature->SetGeometry(&OGRPt);
1914 double const dOrientation =
m_pRasterGrid->m_Cell[nX][nY].dGetCellDeepWaterWaveAngle();
1915 double const dHeight =
m_pRasterGrid->m_Cell[nX][nY].dGetCellDeepWaterWaveHeight();
1921 pOGRFeature->SetField(strFieldValue1.c_str(), dOrientation);
1922 pOGRFeature->SetField(strFieldValue2.c_str(), dHeight);
1925 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1927 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for cell [" << nX <<
"][" << nY <<
"] in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
1932 OGRFeature::DestroyFeature(pOGRFeature);
1940 CPLPopErrorHandler();
1943 GDALClose(pGDALDataSet);