385 stringstream strstrFileName;
480 strFilePathName.append(
"_");
481 stringstream ststrTmp;
492 strFilePathName.append(ststrTmp.str());
493 strstrFileName << ststrTmp.str();
504 if (pGDALDriver == NULL)
511 GDALDataset* pGDALDataSet = pGDALDriver->Create(strFilePathName.c_str(), 0, 0, 0, GDT_Unknown,
m_papszGDALVectorOptions);
512 if (pGDALDataSet == NULL)
515 << CPLGetLastErrorMsg() << endl;
520 OGRSpatialReference OGRSpatialRef;
529 OGRSpatialRef.importFromEPSG(25830);
532 OGRwkbGeometryType eGType = wkbUnknown;
533 string strType =
"unknown";
543 OGRLayer* pOGRLayer = pGDALDataSet->CreateLayer(strstrFileName.str().c_str(), &OGRSpatialRef, eGType,
m_papszGDALVectorOptions);
545 if (pOGRLayer == NULL)
547 cerr <<
ERR <<
"cannot create '" << strType <<
"' layer in " << strFilePathName << endl
548 << CPLGetLastErrorMsg() << endl;
553 CPLPushErrorHandler(CPLQuietErrorHandler);
559 eGType = wkbLineString;
563 string strFieldValue1 =
"Coast";
564 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTInteger);
565 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
567 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl
568 << CPLGetLastErrorMsg() << endl;
575 for (
int i = 0; i < static_cast<int>(
m_VCoast.size()); i++)
578 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
581 pOGRFeature->SetField(strFieldValue1.c_str(), i);
584 for (
int j = 0; j <
m_VCoast[i].pLGetCoastlineExtCRS()->nGetSize(); j++)
586 OGRls.addPoint(
m_VCoast[i].pPtGetCoastlinePointExtCRS(j)->dGetX(),
m_VCoast[i].pPtGetCoastlinePointExtCRS(j)->dGetY());
588 pOGRFeature->SetGeometry(&OGRls);
591 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
593 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for coast " << i <<
" in " << strFilePathName << endl
594 << CPLGetLastErrorMsg() << endl;
600 OGRFeature::DestroyFeature(pOGRFeature);
608 eGType = wkbLineString;
612 string strFieldValue1 =
"NMR";
613 string strFieldValue2 =
"tiempo";
614 string strFieldValue3 =
"surge_mm";
616 string strFieldValue4 =
"runup_mm";
647 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTReal);
648 OGRFieldDefn OGRField2(strFieldValue2.c_str(), OFTReal);
649 OGRFieldDefn OGRField3(strFieldValue3.c_str(), OFTInteger64);
650 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
652 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl
653 << CPLGetLastErrorMsg() << endl;
656 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
658 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl
659 << CPLGetLastErrorMsg() << endl;
662 if (pOGRLayer->CreateField(&OGRField3) != OGRERR_NONE)
664 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 3 '" << strFieldValue3 <<
"' in " << strFilePathName << endl
665 << CPLGetLastErrorMsg() << endl;
670 OGRLineString OGR2ls;
705 OGRFeature* pOGR3Feature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
706 OGRFieldDefn OGRField6(strFieldValue1.c_str(), OFTReal);
707 OGRFieldDefn OGRField7(strFieldValue2.c_str(), OFTReal);
708 OGRFieldDefn OGRField4(strFieldValue3.c_str(), OFTInteger64);
709 if (pOGRLayer->CreateField(&OGRField6) != OGRERR_NONE)
711 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl
712 << CPLGetLastErrorMsg() << endl;
715 if (pOGRLayer->CreateField(&OGRField7) != OGRERR_NONE)
717 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl
718 << CPLGetLastErrorMsg() << endl;
721 if (pOGRLayer->CreateField(&OGRField4) != OGRERR_NONE)
723 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 4 '" << strFieldValue4 <<
"' in " << strFilePathName << endl
724 << CPLGetLastErrorMsg() << endl;
729 OGRLineString OGR3ls;
736 pOGR3Feature->SetField(strFieldValue3.c_str(), surge_level);
746 pOGR3Feature->SetGeometry(&OGR3ls);
750 if (pOGRLayer->CreateFeature(pOGR3Feature) != OGRERR_NONE)
752 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for coast " << i <<
" in " << strFilePathName << endl
753 << CPLGetLastErrorMsg() << endl;
759 OGRFeature::DestroyFeature(pOGR3Feature);
765 OGRFeature* pOGR4Feature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
766 OGRFieldDefn OGRField8(strFieldValue1.c_str(), OFTReal);
767 OGRFieldDefn OGRField9(strFieldValue2.c_str(), OFTReal);
768 OGRFieldDefn OGRField5(strFieldValue4.c_str(), OFTInteger64);
769 if (pOGRLayer->CreateField(&OGRField8) != OGRERR_NONE)
771 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
774 if (pOGRLayer->CreateField(&OGRField9) != OGRERR_NONE)
776 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
779 if (pOGRLayer->CreateField(&OGRField5) != OGRERR_NONE)
781 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 5 '" << strFieldValue4 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
785 OGRLineString OGR4ls;
791 pOGR4Feature->SetField(strFieldValue4.c_str(), runup_level);
802 pOGR4Feature->SetGeometry(&OGR4ls);
806 if (pOGRLayer->CreateFeature(pOGR4Feature) != OGRERR_NONE)
808 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for coast " << i <<
" in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
814 OGRFeature::DestroyFeature(pOGR4Feature);
825 eGType = wkbLineString;
829 string strFieldValue1 =
"Normal";
830 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTInteger);
831 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
833 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl
834 << CPLGetLastErrorMsg() << endl;
839 string strFieldValue2 =
"StartCoast";
840 string strFieldValue3 =
"EndCoast";
841 string strFieldValue4 =
"HitLand";
842 string strFieldValue5 =
"HitIntervention";
843 string strFieldValue6 =
"HitCoast";
844 string strFieldValue7 =
"HitNormal";
845 string strFieldValue8 =
"CShore";
847 OGRFieldDefn OGRField2(strFieldValue2.c_str(), OFTInteger);
848 OGRFieldDefn OGRField3(strFieldValue3.c_str(), OFTInteger);
849 OGRFieldDefn OGRField4(strFieldValue4.c_str(), OFTInteger);
850 OGRFieldDefn OGRField5(strFieldValue5.c_str(), OFTInteger);
851 OGRFieldDefn OGRField6(strFieldValue6.c_str(), OFTInteger);
852 OGRFieldDefn OGRField7(strFieldValue7.c_str(), OFTInteger);
853 OGRFieldDefn OGRField8(strFieldValue7.c_str(), OFTInteger);
855 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
857 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
860 if (pOGRLayer->CreateField(&OGRField3) != OGRERR_NONE)
862 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 3 '" << strFieldValue3 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
865 if (pOGRLayer->CreateField(&OGRField4) != OGRERR_NONE)
867 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 4 '" << strFieldValue4 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
870 if (pOGRLayer->CreateField(&OGRField5) != OGRERR_NONE)
872 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 5 '" << strFieldValue5 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
875 if (pOGRLayer->CreateField(&OGRField6) != OGRERR_NONE)
877 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 6 '" << strFieldValue6 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
880 if (pOGRLayer->CreateField(&OGRField7) != OGRERR_NONE)
882 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 7 '" << strFieldValue7 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
885 if (pOGRLayer->CreateField(&OGRField8) != OGRERR_NONE)
887 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 8 '" << strFieldValue8 <<
"' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
894 for (
int i = 0; i < static_cast<int>(
m_VCoast.size()); i++)
896 for (
int j = 0; j <
m_VCoast[i].nGetNumProfiles(); j++)
903 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
906 pOGRFeature->SetField(strFieldValue1.c_str(), j);
907 pOGRFeature->SetField(strFieldValue2.c_str(), 0);
908 pOGRFeature->SetField(strFieldValue3.c_str(), 0);
909 pOGRFeature->SetField(strFieldValue4.c_str(), 0);
910 pOGRFeature->SetField(strFieldValue5.c_str(), 0);
911 pOGRFeature->SetField(strFieldValue6.c_str(), 0);
912 pOGRFeature->SetField(strFieldValue7.c_str(), 0);
913 pOGRFeature->SetField(strFieldValue8.c_str(), 0);
915 pOGRFeature->SetField(strFieldValue2.c_str(), 1);
917 pOGRFeature->SetField(strFieldValue3.c_str(), 1);
919 pOGRFeature->SetField(strFieldValue4.c_str(), 1);
921 pOGRFeature->SetField(strFieldValue5.c_str(), 1);
923 pOGRFeature->SetField(strFieldValue6.c_str(), 1);
925 pOGRFeature->SetField(strFieldValue7.c_str(), 1);
927 pOGRFeature->SetField(strFieldValue8.c_str(), 1);
933 pOGRFeature->SetGeometry(&OGRls);
937 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
939 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for coast " << i <<
" and profile " << j <<
" in " << strFilePathName << endl
940 << CPLGetLastErrorMsg() << endl;
945 OGRFeature::DestroyFeature(pOGRFeature);
967 string strFieldValue1;
969 strFieldValue1 =
"Curve";
971 strFieldValue1 =
"SC_Energy";
973 strFieldValue1 =
"MeanEnergy";
975 strFieldValue1 =
"Height";
977 strFieldValue1 =
"Node";
979 strFieldValue1 =
"Notch";
981 strFieldValue1 =
"Wavesetup";
983 strFieldValue1 =
"Stormsurge";
985 strFieldValue1 =
"Runup";
987 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTReal);
988 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
990 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl
991 << CPLGetLastErrorMsg() << endl;
997 OGRMultiLineString OGRmls;
1000 for (
int i = 0; i < static_cast<int>(
m_VCoast.size()); i++)
1002 for (
int j = 0; j <
m_VCoast[i].pLGetCoastlineExtCRS()->nGetSize(); j++)
1005 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1008 OGRPt.setX(
m_VCoast[i].pPtGetCoastlinePointExtCRS(j)->dGetX());
1009 OGRPt.setY(
m_VCoast[i].pPtGetCoastlinePointExtCRS(j)->dGetY());
1010 pOGRFeature->SetGeometry(&OGRPt);
1014 double dCurvature =
m_VCoast[i].dGetDetailedCurvature(j);
1019 pOGRFeature->SetField(strFieldValue1.c_str(), dCurvature);
1024 if (
m_VCoast[i].pGetCoastLandform(j) == NULL)
1025 pOGRFeature->SetField(strFieldValue1.c_str(),
DBL_NODATA);
1027 pOGRFeature->SetField(strFieldValue1.c_str(),
m_VCoast[i].pGetCoastLandform(j)->dGetTotAccumWaveEnergy());
1032 if (
m_VCoast[i].pGetCoastLandform(j) == NULL)
1033 pOGRFeature->SetField(strFieldValue1.c_str(),
DBL_NODATA);
1036 double dEnergy =
m_VCoast[i].pGetCoastLandform(j)->dGetTotAccumWaveEnergy();
1040 pOGRFeature->SetField(strFieldValue1.c_str(), dEnergy);
1046 double dHeight =
m_VCoast[i].dGetBreakingWaveHeight(j);
1047 pOGRFeature->SetField(strFieldValue1.c_str(), dHeight);
1052 double dWaveSetupSurge =
m_VCoast[i].dGetWaveSetupSurge(j);
1053 pOGRFeature->SetField(strFieldValue1.c_str(), dWaveSetupSurge);
1064 double dRunUp =
m_VCoast[i].dGetRunUp(j);
1065 pOGRFeature->SetField(strFieldValue1.c_str(), dRunUp);
1069 int nNode =
m_VCoast[i].nGetPolygonNode(j);
1074 pOGRFeature->SetField(strFieldValue1.c_str(), nNode);
1079 if (pCoastLandform == NULL)
1080 pOGRFeature->SetField(strFieldValue1.c_str(),
DBL_NODATA);
1084 double dNotchDepth = 0.0;
1095 pOGRFeature->SetField(strFieldValue1.c_str(), dNotchDepth);
1100 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1102 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for coast " << i <<
" point " << j <<
" in " << strFilePathName << endl
1103 << CPLGetLastErrorMsg() << endl;
1108 OGRFeature::DestroyFeature(pOGRFeature);
1122 strFieldValue1 =
"Angle",
1123 strFieldValue2 =
"Height";
1126 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTReal);
1127 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1129 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl
1130 << CPLGetLastErrorMsg() << endl;
1135 OGRFieldDefn OGRField2(strFieldValue2.c_str(), OFTReal);
1136 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1138 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl
1139 << CPLGetLastErrorMsg() << endl;
1144 OGRLineString OGRls;
1145 OGRMultiLineString OGRmls;
1156 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1161 pOGRFeature->SetGeometry(&OGRPt);
1164 dOrientation =
m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle(),
1171 pOGRFeature->SetField(strFieldValue1.c_str(), dOrientation);
1172 pOGRFeature->SetField(strFieldValue2.c_str(), dHeight);
1175 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1177 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for cell [" << nX <<
"][" << nY <<
"] in " << strFilePathName << endl
1178 << CPLGetLastErrorMsg() << endl;
1183 OGRFeature::DestroyFeature(pOGRFeature);
1198 strFieldValue1 =
"Angle",
1199 strFieldValue2 =
"Height";
1202 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTReal);
1203 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1205 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl
1206 << CPLGetLastErrorMsg() << endl;
1211 OGRFieldDefn OGRField2(strFieldValue2.c_str(), OFTReal);
1212 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1214 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl
1215 << CPLGetLastErrorMsg() << endl;
1220 OGRLineString OGRls;
1221 OGRMultiLineString OGRmls;
1229 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1234 pOGRFeature->SetGeometry(&OGRPt);
1244 pOGRFeature->SetField(strFieldValue1.c_str(), dOrientation);
1245 pOGRFeature->SetField(strFieldValue2.c_str(), dHeight);
1248 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1250 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for cell [" << nX <<
"][" << nY <<
"] in " << strFilePathName << endl
1251 << CPLGetLastErrorMsg() << endl;
1256 OGRFeature::DestroyFeature(pOGRFeature);
1265 eGType = wkbPolygon;
1266 strType =
"polygon";
1270 strFieldValue1 =
"Polygon",
1271 strFieldValue2 =
"CoastNode",
1272 strFieldValue3 =
"TotSedChng",
1273 strFieldValue4 =
"FinSedChng",
1274 strFieldValue5 =
"SndSedChng",
1275 strFieldValue6 =
"CrsSedChng";
1277 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTInteger);
1278 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1280 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl
1281 << CPLGetLastErrorMsg() << endl;
1285 OGRFieldDefn OGRField2(strFieldValue2.c_str(), OFTInteger);
1286 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1288 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl
1289 << CPLGetLastErrorMsg() << endl;
1293 OGRFieldDefn OGRField3(strFieldValue3.c_str(), OFTReal);
1294 if (pOGRLayer->CreateField(&OGRField3) != OGRERR_NONE)
1296 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 3 '" << strFieldValue3 <<
"' in " << strFilePathName << endl
1297 << CPLGetLastErrorMsg() << endl;
1301 OGRFieldDefn OGRField4(strFieldValue4.c_str(), OFTReal);
1302 if (pOGRLayer->CreateField(&OGRField4) != OGRERR_NONE)
1304 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 4 '" << strFieldValue4 <<
"' in " << strFilePathName << endl
1305 << CPLGetLastErrorMsg() << endl;
1309 OGRFieldDefn OGRField5(strFieldValue5.c_str(), OFTReal);
1310 if (pOGRLayer->CreateField(&OGRField5) != OGRERR_NONE)
1312 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 5 '" << strFieldValue5 <<
"' in " << strFilePathName << endl
1313 << CPLGetLastErrorMsg() << endl;
1317 OGRFieldDefn OGRField6(strFieldValue6.c_str(), OFTReal);
1318 if (pOGRLayer->CreateField(&OGRField6) != OGRERR_NONE)
1320 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 6 '" << strFieldValue6 <<
"' in " << strFilePathName << endl
1321 << CPLGetLastErrorMsg() << endl;
1326 OGRLineString OGRls;
1328 for (
int i = 0; i < static_cast<int>(
m_VCoast.size()); i++)
1330 for (
int j = 0; j <
m_VCoast[i].nGetNumPolygons(); j++)
1333 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1338 pOGRFeature->SetField(strFieldValue1.c_str(), j);
1350 pOGRFeature->SetGeometry(&OGRls);
1353 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1355 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for coast " << i <<
" polygon " << j <<
" in " << strFilePathName << endl
1356 << CPLGetLastErrorMsg() << endl;
1362 OGRFeature::DestroyFeature(pOGRFeature);
1371 eGType = wkbLineString;
1375 string strFieldValue1 =
"ShadowLine";
1376 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTInteger);
1377 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1379 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl
1380 << CPLGetLastErrorMsg() << endl;
1385 OGRLineString OGRls;
1387 for (
int i = 0; i < static_cast<int>(
m_VCoast.size()); i++)
1389 for (
int j = 0; j <
m_VCoast[i].nGetNumShadowBoundaries(); j++)
1392 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1395 pOGRFeature->SetField(strFieldValue1.c_str(), j);
1399 for (
int nn = 0; nn < LShadow.
nGetSize(); nn++)
1402 pOGRFeature->SetGeometry(&OGRls);
1405 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1407 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle << j <<
" for coast " << i <<
" in " << strFilePathName << endl
1408 << CPLGetLastErrorMsg() << endl;
1414 OGRFeature::DestroyFeature(pOGRFeature);
1423 eGType = wkbLineString;
1427 string strFieldValue1 =
"DdriftLine";
1428 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTInteger);
1429 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1431 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl
1432 << CPLGetLastErrorMsg() << endl;
1437 OGRLineString OGRls;
1439 for (
int i = 0; i < static_cast<int>(
m_VCoast.size()); i++)
1441 for (
int j = 0; j <
m_VCoast[i].nGetNumShadowDowndriftBoundaries(); j++)
1444 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1447 pOGRFeature->SetField(strFieldValue1.c_str(), j);
1451 for (
int nn = 0; nn < LDowndrift.
nGetSize(); nn++)
1454 pOGRFeature->SetGeometry(&OGRls);
1457 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1459 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle << j <<
" for coast " << i <<
" in " << strFilePathName << endl
1460 << CPLGetLastErrorMsg() << endl;
1466 OGRFeature::DestroyFeature(pOGRFeature);
1480 strFieldValue1 =
"Angle",
1481 strFieldValue2 =
"Height";
1484 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTReal);
1485 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1487 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 1 '" << strFieldValue1 <<
"' in " << strFilePathName << endl
1488 << CPLGetLastErrorMsg() << endl;
1493 OGRFieldDefn OGRField2(strFieldValue2.c_str(), OFTReal);
1494 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1496 cerr <<
ERR <<
"cannot create " << strType <<
" attribute field 2 '" << strFieldValue2 <<
"' in " << strFilePathName << endl
1497 << CPLGetLastErrorMsg() << endl;
1502 OGRLineString OGRls;
1503 OGRMultiLineString OGRmls;
1511 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1516 pOGRFeature->SetGeometry(&OGRPt);
1518 double dOrientation =
m_pRasterGrid->m_Cell[nX][nY].dGetCellDeepWaterWaveAngle();
1519 double dHeight =
m_pRasterGrid->m_Cell[nX][nY].dGetCellDeepWaterWaveHeight();
1525 pOGRFeature->SetField(strFieldValue1.c_str(), dOrientation);
1526 pOGRFeature->SetField(strFieldValue2.c_str(), dHeight);
1529 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1531 cerr <<
ERR <<
"cannot create " << strType <<
" feature " << strPlotTitle <<
" for cell [" << nX <<
"][" << nY <<
"] in " << strFilePathName << endl
1532 << CPLGetLastErrorMsg() << endl;
1537 OGRFeature::DestroyFeature(pOGRFeature);
1544 CPLPopErrorHandler();
1547 GDALClose(pGDALDataSet);