CoastalME (Coastal Modelling Environment)
Simulates the long-term behaviour of complex coastlines
Loading...
Searching...
No Matches
gis_vector.cpp
Go to the documentation of this file.
1
12
13/*===============================================================================================================================
14
15This file is part of CoastalME, the Coastal Modelling Environment.
16
17CoastalME is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
18
19This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23===============================================================================================================================*/
24#include <cfloat>
25
26#include <iostream>
27using std::cerr;
28using std::cout;
29using std::endl;
30using std::ios;
31
32#include <sstream>
33using std::stringstream;
34
35#include <gdal_priv.h>
36
37#include <ogrsf_frmts.h>
38
39#include "cme.h"
40#include "simulation.h"
41#include "coast.h"
42#include "cliff.h"
43
44//===============================================================================================================================
46//===============================================================================================================================
47int CSimulation::nReadVectorGISFile(int const nDataItem)
48{
49 int nMaxLayer = 0;
50 int nNeedGeometry = 0;
51
52 string strGISFile;
53 string strGeometry;
54
55 // Set up file name and constraints
56 switch (nDataItem)
57 {
62 break;
63
71 break;
72
73 case (FLOOD_LOCATION_VEC):
74 strGISFile = m_strFloodLocationShapefile;
75 nMaxLayer = FLOOD_LOCATION_MAX_LAYER;
76 nNeedGeometry = FLOOD_LOCATION_POINT_GEOMETRY;
77 break;
78 }
79
80 // Open the GDAL/OGR datasource
81 GDALDataset* pOGRDataSource = static_cast<GDALDataset*>(GDALOpenEx(strGISFile.c_str(), GDAL_OF_VECTOR, NULL, NULL, NULL));
82 if (pOGRDataSource == NULL)
83 {
84 // Can't open file (note will already have sent GDAL error message to stdout)
85 cerr << ERR << "cannot open " << strGISFile << " for input: " << CPLGetLastErrorMsg() << endl;
87 }
88
89 // Find out number of layers, and compare with the required number
90 int nLayer = pOGRDataSource->GetLayerCount();
91 if (nLayer > nMaxLayer)
92 LogStream << WARN << "need " << nMaxLayer << (nMaxLayer > 1 ? "layers" : "layer") << " in " << strGISFile << ", " << nLayer << " found. Only the first " << nMaxLayer << (nMaxLayer > 1 ? "layers" : "layer") << " will be read." << endl;
93
94 for (int n = 0; n < nMaxLayer; n++)
95 {
96 // Open this layer
97 OGRLayer* pOGRLayer;
98 pOGRLayer = pOGRDataSource->GetLayer(n);
99
100 // Get features from the layer
101 OGRFeature* pOGRFeature;
102
103 // Make sure we are at the beginning of the layer
104 pOGRLayer->ResetReading();
105
106 // Now iterate for all features in the layer
107 while ((pOGRFeature = pOGRLayer->GetNextFeature()) != NULL)
108 {
109 // First get the geometry for this feature
110 OGRGeometry* pOGRGeometry;
111 pOGRGeometry = pOGRFeature->GetGeometryRef();
112 if (pOGRGeometry == NULL)
113 {
114 cerr << ERR << " null geometry in " << strGISFile << "." << endl;
116 }
117
118 // Now get the geometry type
119 int nGeometry = wkbFlatten(pOGRGeometry->getGeometryType());
120 int nThisGeometry = 0;
121
122 switch (nGeometry)
123 {
124 case wkbPoint:
125 nThisGeometry = VEC_GEOMETRY_POINT;
126 strGeometry = "point";
127 break;
128
129 case wkbLineString:
130 nThisGeometry = VEC_GEOMETRY_LINE;
131 strGeometry = "line";
132 break;
133
134 case wkbPolygon:
135 nThisGeometry = VEC_GEOMETRY_POLYGON;
136 strGeometry = "polygon";
137 break;
138
139 default:
140 nThisGeometry = VEC_GEOMETRY_OTHER;
141 strGeometry = "other";
142 break;
143 }
144
145 // Have we got the expected geometry type?
146 if (nThisGeometry != nNeedGeometry)
147 {
148 // Error, we do not have the desired geometry
149 string strNeedGeometry;
150 switch (nNeedGeometry)
151 {
153 strNeedGeometry = "point";
154 break;
155
157 strNeedGeometry = "line";
158 break;
159
161 strNeedGeometry = "polygon";
162 break;
163
165 strNeedGeometry = "other";
166 break;
167 }
168
169 cerr << strGeometry << " data found in " << strGISFile << ", but " << strNeedGeometry << " data is needed" << endl;
171 }
172
173 // The geometry type is OK, so process the geometry data
174 int nPoints = 0;
175 OGRPoint* pOGRPoint;
176 OGRLineString* pOGRLineString;
177 double dPointGridX;
178 double dPointGridY;
179 switch (nDataItem)
180 {
182 // Point data: convert the wave station coordinates from ext CRS to grid CRS
183 pOGRPoint = static_cast<OGRPoint*>(pOGRGeometry);
184 dPointGridX = dExtCRSXToGridX(pOGRPoint->getX());
185 dPointGridY = dExtCRSYToGridY(pOGRPoint->getY());
186
187 // Safety check to ensure that point is inside the grid in the +ve direction
188 if (dPointGridX >= m_nXGridSize)
190
191 if (dPointGridY >= m_nYGridSize)
193
194 // Now store the wave station coordinates, we will use these in the spatial interpolation of deep water waves
195 m_VdDeepWaterWaveStationX.push_back(dExtCRSXToGridX(dPointGridX));
196 m_VdDeepWaterWaveStationY.push_back(dExtCRSYToGridY(dPointGridY));
197 break;
198
201 {
202 // Point data: convert the sediment input coordinates from ext CRS to grid CRS
203 pOGRPoint = static_cast<OGRPoint*>(pOGRGeometry);
204 dPointGridX = dExtCRSXToGridX(pOGRPoint->getX());
205 dPointGridY = dExtCRSYToGridY(pOGRPoint->getY());
206
207 // Check point data is inside the grid in the +ve direction
208 if (dPointGridX >= m_nXGridSize)
210
211 if (dPointGridY >= m_nYGridSize)
213
214 // Now store the sediment input coordinates
215 m_VdSedimentInputLocationX.push_back(dPointGridX);
216 m_VdSedimentInputLocationY.push_back(dPointGridY);
217 }
219 {
220 // Line data: convert the sediment input coordinates from ext CRS to grid CRS
221 pOGRLineString = static_cast<OGRLineString*>(pOGRGeometry);
222
223 nPoints = pOGRLineString->getNumPoints();
224 for (int i = 0; i < nPoints; i++)
225 {
226 double dX = dExtCRSXToGridX(pOGRLineString->getX(i));
227 double dY = dExtCRSYToGridY(pOGRLineString->getY(i));
228
229 // Check point data is inside the grid in the +ve direction
230 if (dX >= m_nXGridSize)
231 continue;
232
233 if (dY >= m_nYGridSize)
234 continue;
235
236 // Now store the sediment input coordinates
237 m_VdSedimentInputLocationX.push_back(dX);
238 m_VdSedimentInputLocationY.push_back(dY);
239 }
240 }
241 break;
242
243 case (FLOOD_LOCATION_VEC):
244 // Point data: convert the flood location coordinates from ext CRS to grid CRS
245 pOGRPoint = static_cast<OGRPoint*>(pOGRGeometry);
246 dPointGridX = dExtCRSXToGridX(pOGRPoint->getX());
247 dPointGridY = dExtCRSYToGridY(pOGRPoint->getY());
248
249 // Check point data is inside the grid in the +ve direction
250 if (dPointGridX >= m_nXGridSize)
252
253 if (dPointGridY >= m_nYGridSize)
255
256 // Now stote the flood location coordinates
257 m_VdFloodLocationX.push_back(dPointGridX);
258 m_VdFloodLocationY.push_back(dPointGridY);
259 break;
260 }
261
262 // Next get the attributes of this feature
263 OGRFeatureDefn* pOGRFeatureDefn = pOGRLayer->GetLayerDefn();
264
265 int nFieldIndex = -1;
266 int nID = -1;
267
268 switch (nDataItem)
269 {
271 // First get the station ID
272 nFieldIndex = pOGRFeatureDefn->GetFieldIndex(DEEP_WATER_WAVE_STATION_ID.c_str());
273 if (nFieldIndex == -1)
274 {
275 // Can't find this field in the vector file
276 cerr << ERR << "cannot find " << DEEP_WATER_WAVE_STATION_ID << " field in " << strGISFile << ": " << CPLGetLastErrorMsg() << endl;
278 }
279
280 // Get the Station ID for this point
281 nID = pOGRFeature->GetFieldAsInteger(nFieldIndex);
282 m_VnDeepWaterWaveStationID.push_back(nID);
283
284 break;
285
287 // First get the station ID
288 nFieldIndex = pOGRFeatureDefn->GetFieldIndex(SEDIMENT_INPUT_EVENT_LOCATION_ID.c_str());
289 if (nFieldIndex == -1)
290 {
291 // Can't find this field in the vector file
292 cerr << ERR << "cannot find " << SEDIMENT_INPUT_EVENT_LOCATION_ID << " field in " << strGISFile << ": " << CPLGetLastErrorMsg() << endl;
294 }
295
296 // Get the Station ID for this point (note that we read it as an integer, not caring what type of field is actually in the shapefile)
297 nID = pOGRFeature->GetFieldAsInteger(nFieldIndex);
298
300 // Save the ID for the point
301 m_VnSedimentInputLocationID.push_back(nID);
302
304 {
305 // Save the ID for every point in the line
306 for (int i = 0; i < nPoints; i++)
307 m_VnSedimentInputLocationID.push_back(nID);
308 }
309
310 break;
311
312 case (FLOOD_LOCATION_VEC):
313 // First get the station ID
314 nFieldIndex = pOGRFeatureDefn->GetFieldIndex(FLOOD_LOCATION_ID.c_str());
315 if (nFieldIndex == -1)
316 {
317 // Can't find this field in the vector file
318 cerr << ERR << "cannot find " << FLOOD_LOCATION_ID << " field in " << strGISFile << ": " << CPLGetLastErrorMsg() << endl;
320 }
321
322 // Get the Station ID for this point (note that we read it as an integer, not caring what type of field is actually in the shapefile)
323 nID = pOGRFeature->GetFieldAsInteger(nFieldIndex);
324
325 // Save the ID for the point
326 m_VnFloodLocationID.push_back(nID);
327 break;
328 }
329 }
330
331 // Get rid of the Feature object
332 OGRFeature::DestroyFeature(pOGRFeature);
333 }
334
335 // Save some info, to be shown in the text output
336 switch (nDataItem)
337 {
339 m_strOGRDWWVDriverCode = pOGRDataSource->GetDriverName();
340 for (auto&& oFeatureLayerPair:pOGRDataSource->GetFeatures())
341 {
342 m_strOGRDWWVDriverDesc += oFeatureLayerPair.layer->GetName();
344 }
345 m_strOGRDWWVDataType = "integer";
346 m_strOGRDWWVGeometry = strGeometry;
347 break;
348
350 m_strOGRSedInputDriverCode = pOGRDataSource->GetDriverName();
351 for (auto&& oFeatureLayerPair:pOGRDataSource->GetFeatures())
352 {
353 m_strOGRSedInputDriverDesc += oFeatureLayerPair.layer->GetName();
355 }
356 m_strOGRSedInputGeometry = "integer";
357 m_strOGRSedInputDataType = strGeometry;
358 break;
359
360 case (FLOOD_LOCATION_VEC):
361 m_strOGRFloodDriverCode = pOGRDataSource->GetDriverName();
362 for (auto&& oFeatureLayerPair:pOGRDataSource->GetFeatures())
363 {
364 m_strOGRFloodDriverDesc += oFeatureLayerPair.layer->GetName();
366 }
367 m_strOGRFloodGeometry = "integer";
368 m_strOGRFloodDataType = strGeometry;
369 break;
370 }
371
372 // Clean up: get rid of the data source object
373 GDALClose(pOGRDataSource);
374
375 return RTN_OK;
376}
377
378//===============================================================================================================================
380//===============================================================================================================================
381bool CSimulation::bWriteVectorGISFile(int const nDataItem, string const *strPlotTitle)
382{
383 // Begin constructing the file name for this save
384 string strFilePathName(m_strOutPath);
385 stringstream strstrFileName;
386
387 switch (nDataItem)
388 {
389 case (VECTOR_PLOT_COAST):
390 strFilePathName.append(VECTOR_COAST_NAME);
391 strstrFileName << VECTOR_COAST_NAME;
392 break;
393
394 case (VECTOR_PLOT_NORMALS):
395 strFilePathName.append(VECTOR_NORMALS_NAME);
396 strstrFileName << VECTOR_NORMALS_NAME;
397 break;
398
400 strFilePathName.append(VECTOR_INVALID_NORMALS_NAME);
401 break;
402
404 strFilePathName.append(VECTOR_COAST_CURVATURE_NAME);
405 break;
406
408 strFilePathName.append(VECTOR_WAVE_ANGLE_AND_HEIGHT_NAME);
409 break;
410
412 strFilePathName.append(VECTOR_AVG_WAVE_ANGLE_AND_HEIGHT_NAME);
413 break;
414
416 strFilePathName.append(VECTOR_WAVE_ENERGY_SINCE_COLLAPSE_NAME);
417 break;
418
420 strFilePathName.append(VECTOR_MEAN_WAVE_ENERGY_NAME);
421 break;
422
424 strFilePathName.append(VECTOR_BREAKING_WAVE_HEIGHT_NAME);
425 break;
426
428 strFilePathName.append(VECTOR_POLYGON_NODE_NAME);
429 break;
430
432 strFilePathName.append(VECTOR_POLYGON_BOUNDARY_NAME);
433 break;
434
436 strFilePathName.append(VECTOR_CLIFF_NOTCH_SIZE_NAME);
437 break;
438
440 strFilePathName.append(VECTOR_SHADOW_BOUNDARY_NAME);
441 break;
442
444 strFilePathName.append(VECTOR_DOWNDRIFT_BOUNDARY_NAME);
445 break;
446
448 strFilePathName.append(VECTOR_DEEP_WATER_WAVE_ANGLE_AND_HEIGHT_NAME);
449 break;
450
452 strFilePathName.append(VECTOR_WAVE_SETUP_NAME);
453 break;
454
456 strFilePathName.append(VECTOR_STORM_SURGE_NAME);
457 break;
458
459 case (VECTOR_PLOT_RUN_UP):
460 strFilePathName.append(VECTOR_RUN_UP_NAME);
461 break;
462
464 strFilePathName.append(VECTOR_FLOOD_LINE_NAME);
465 strstrFileName << VECTOR_FLOOD_LINE_NAME;
466 break;
467
468 // case (VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_LINE):
469 // strFilePathName.append(VECTOR_FLOOD_SWL_SETUP_SURGE_LINE_NAME);
470 // strstrFileName << VECTOR_FLOOD_SWL_SETUP_SURGE_LINE_NAME;
471 // break;
472
473 // case (VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_RUNUP_LINE):
474 // strFilePathName.append(VECTOR_FLOOD_SWL_SETUP_SURGE_RUNUP_LINE_NAME);
475 // strstrFileName << VECTOR_FLOOD_SWL_SETUP_SURGE_RUNUP_LINE_NAME;
476 // break;
477 }
478
479 // Append the 'save number' to the filename, and prepend zeros to the save number
480 strFilePathName.append("_");
481 stringstream ststrTmp;
483 {
484 // Save number is sequential
485 ststrTmp << FillToWidth('0', m_nGISMaxSaveDigits) << m_nGISSave;
486 }
487 else
488 {
489 // Save number is iteration
490 ststrTmp << FillToWidth('0', m_nGISMaxSaveDigits) << m_ulIter;
491 }
492 strFilePathName.append(ststrTmp.str());
493 strstrFileName << ststrTmp.str();
494
495 // Make a copy of the filename without any extension
496 // string strFilePathNameNoExt = strFilePathName;
497
498 // If desired, append an extension
499 if (! m_strOGRVectorOutputExtension.empty())
500 strFilePathName.append(m_strOGRVectorOutputExtension);
501
502 // Set up the vector driver
503 GDALDriver* pGDALDriver = GetGDALDriverManager()->GetDriverByName(m_strVectorGISOutFormat.c_str());
504 if (pGDALDriver == NULL)
505 {
506 cerr << ERR << "vector GIS output driver " << m_strVectorGISOutFormat << CPLGetLastErrorMsg() << endl;
507 return false;
508 }
509
510 // Now create the dataset
511 GDALDataset* pGDALDataSet = pGDALDriver->Create(strFilePathName.c_str(), 0, 0, 0, GDT_Unknown, m_papszGDALVectorOptions);
512 if (pGDALDataSet == NULL)
513 {
514 cerr << ERR << "cannot create " << m_strVectorGISOutFormat << " named " << strFilePathName << endl
515 << CPLGetLastErrorMsg() << endl;
516 return false;
517 }
518
519 // Create a spatial reference object
520 OGRSpatialReference OGRSpatialRef;
521
522 // And tell it about the coordinate system used by the basement raster layer
524 {
525 OGRSpatialRef.importFromWkt(m_strGDALBasementDEMProjection.c_str());
526 }
527 else
528 {
529 OGRSpatialRef.importFromEPSG(25830); // TODO 035 Also handle other EPSG for vector spatial reference systems
530 }
531
532 OGRwkbGeometryType eGType = wkbUnknown;
533 string strType = "unknown";
534
535 // Now create the output layer
536 // // OGRLayer* pOGRLayer = pGDALDataSet->CreateLayer(strFilePathNameNoExt.c_str(), &OGRSpatialRef, eGType, m_papszGDALVectorOptions);
537 // if (EQUAL(m_strVectorGISOutFormat.c_str(), "geojson"))
538 // {
539 // CPLSetConfigOption("GDAL_VALIDATE_CREATION_OPTIONS", "NO");
540 // m_papszGDALVectorOptions = CSLSetNameValue(m_papszGDALVectorOptions, "COORDINATE_PRECISION", "2");
541 // }
542
543 OGRLayer* pOGRLayer = pGDALDataSet->CreateLayer(strstrFileName.str().c_str(), &OGRSpatialRef, eGType, m_papszGDALVectorOptions);
544
545 if (pOGRLayer == NULL)
546 {
547 cerr << ERR << "cannot create '" << strType << "' layer in " << strFilePathName << endl
548 << CPLGetLastErrorMsg() << endl;
549 return false;
550 }
551
552 // Need to switch off OGR error messages here, since real (floating point) fields in ESRI shapefiles are treated as width 24 with 15 decimal places of precision (unless an explicit width is given). If fields exceed this, then a "not successfully written. Possibly due to too larger number with respect to field width" error message is shown. Get this to fail silently
553 CPLPushErrorHandler(CPLQuietErrorHandler);
554
555 switch (nDataItem)
556 {
557 case (VECTOR_PLOT_COAST):
558 {
559 eGType = wkbLineString;
560 strType = "line";
561
562 // The layer has been created, so create an integer-numbered value (the number of the coast object) for the multi-line
563 string strFieldValue1 = "Coast";
564 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTInteger);
565 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
566 {
567 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
568 << CPLGetLastErrorMsg() << endl;
569 return false;
570 }
571
572 // OK, now do features
573 OGRLineString OGRls;
574
575 for (int i = 0; i < static_cast<int>(m_VCoast.size()); i++)
576 {
577 // Create a feature object, one per coast
578 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
579
580 // Set the feature's attribute (the coast number)
581 pOGRFeature->SetField(strFieldValue1.c_str(), i);
582
583 // Now attach a geometry to the feature object
584 for (int j = 0; j < m_VCoast[i].pLGetCoastlineExtCRS()->nGetSize(); j++)
585 // In external CRS
586 OGRls.addPoint(m_VCoast[i].pPtGetCoastlinePointExtCRS(j)->dGetX(), m_VCoast[i].pPtGetCoastlinePointExtCRS(j)->dGetY());
587
588 pOGRFeature->SetGeometry(&OGRls);
589
590 // Create the feature in the output layer
591 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
592 {
593 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " for coast " << i << " in " << strFilePathName << endl
594 << CPLGetLastErrorMsg() << endl;
595 return false;
596 }
597
598 // Tidy up: empty the line string and get rid of the feature object
599 OGRls.empty();
600 OGRFeature::DestroyFeature(pOGRFeature);
601 }
602
603 break;
604 }
605
607 {
608 eGType = wkbLineString;
609 strType = "line";
610
611 // The layer has been created, so create an integer-numbered value (the number of the coast object) for the multi-line
612 string strFieldValue1 = "NMR";
613 string strFieldValue2 = "tiempo";
614 string strFieldValue3 = "surge_mm";
615 // string strFieldValue4 = "eta-surge(mm)";
616 string strFieldValue4 = "runup_mm";
617
618 // Create a feature with general properties
619 // OGRLineString OGRls;
620 // OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
621
622 // Testing coordinate system
623 // if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
624 // {
625 // cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
626 // << CPLGetLastErrorMsg() << endl;
627 // return false;
628 // }
629 // if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
630 // {
631 // cerr << ERR << "cannot create " << strType << " attribute field 2 '" << strFieldValue2 << "' in " << strFilePathName << endl
632 // << CPLGetLastErrorMsg() << endl;
633 // return false;
634 // }
635
636 // pOGRFeature->SetGeometry(&OGRls);
637 // Create the feature in the output layer
638 // if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
639 // {
640 // cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " in " << strFilePathName << endl
641 // << CPLGetLastErrorMsg() << endl;
642 // return false;
643 // }
644 // OGRFeature::DestroyFeature(pOGRFeature);
645 // Create a feature object, one per coast
646
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)
651 {
652 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
653 << CPLGetLastErrorMsg() << endl;
654 return false;
655 }
656 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
657 {
658 cerr << ERR << "cannot create " << strType << " attribute field 2 '" << strFieldValue2 << "' in " << strFilePathName << endl
659 << CPLGetLastErrorMsg() << endl;
660 return false;
661 }
662 if (pOGRLayer->CreateField(&OGRField3) != OGRERR_NONE)
663 {
664 cerr << ERR << "cannot create " << strType << " attribute field 3 '" << strFieldValue3 << "' in " << strFilePathName << endl
665 << CPLGetLastErrorMsg() << endl;
666 return false;
667 }
668
669 // OK, now do features
670 OGRLineString OGR2ls;
671 // for (int i = 0; i < static_cast<int>(m_VFloodWaveSetupSurge.size()); i++)
672 // {
673 // OGRFeature* pOGR2Feature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
674 // pOGR2Feature->SetField(strFieldValue1.c_str(), m_dThisIterSWL);
675 // pOGR2Feature->SetField(strFieldValue2.c_str(), m_ulIter);
676 // int setup_level = int(m_dThisIterDiffWaveSetupWaterLevel * 1000);
677 // pOGR2Feature->SetField(strFieldValue3.c_str(), setup_level);
678 // // Set the feature's attribute (the coast number)
679 // // Now attach a geometry to the feature object
680 // for (int j = 0; j < m_VFloodWaveSetup[i].pLGetCoastlineExtCRS()->nGetSize(); j++)
681 // {
682 // // In external CRS
683 // // Add SWL + wave setup line
684 // OGR2ls.addPoint(m_VFloodWaveSetup[i].pPtGetCoastlinePointExtCRS(j)->dGetX(), m_VFloodWaveSetup[i].pPtGetCoastlinePointExtCRS(j)->dGetY());
685 // }
686
687 // pOGR2Feature->SetGeometry(&OGR2ls);
688 // OGR2ls.empty();
689
690 // // Create the feature in the output layer
691 // if (pOGRLayer->CreateFeature(pOGR2Feature) != OGRERR_NONE)
692 // {
693 // cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " for coast " << i << " in " << strFilePathName << endl
694 // << CPLGetLastErrorMsg() << endl;
695 // return false;
696 // }
697
698 // // Tidy up: empty the line string and get rid of the feature object
699 // // OGRls.empty();
700 // OGRFeature::DestroyFeature(pOGR2Feature);
701 // }
703 {
704 // Create a feature object, one per coast
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)
710 {
711 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
712 << CPLGetLastErrorMsg() << endl;
713 return false;
714 }
715 if (pOGRLayer->CreateField(&OGRField7) != OGRERR_NONE)
716 {
717 cerr << ERR << "cannot create " << strType << " attribute field 2 '" << strFieldValue2 << "' in " << strFilePathName << endl
718 << CPLGetLastErrorMsg() << endl;
719 return false;
720 }
721 if (pOGRLayer->CreateField(&OGRField4) != OGRERR_NONE)
722 {
723 cerr << ERR << "cannot create " << strType << " attribute field 4 '" << strFieldValue4 << "' in " << strFilePathName << endl
724 << CPLGetLastErrorMsg() << endl;
725 return false;
726 }
727
728 // OK, now do features
729 OGRLineString OGR3ls;
730 for (int i = 0; i < static_cast<int>(m_VFloodWaveSetupSurge.size()); i++)
731 {
732
733 pOGR3Feature->SetField(strFieldValue1.c_str(), m_dThisIterSWL);
734 pOGR3Feature->SetField(strFieldValue2.c_str(), static_cast<double>(m_bGISSaveDigitsSequential ? m_nGISSave : m_ulIter));
735 int surge_level = int(m_dThisIterDiffWaveSetupSurgeWaterLevel * 1000);
736 pOGR3Feature->SetField(strFieldValue3.c_str(), surge_level);
737 // Set the feature's attribute (the coast number)
738 // Now attach a geometry to the feature object
739 for (int j = 0; j < m_VFloodWaveSetupSurge[i].pLGetCoastlineExtCRS()->nGetSize(); j++)
740 {
741 // In external CRS
742 // Add SWL + wave setup + storm surge line
743 OGR3ls.addPoint(m_VFloodWaveSetupSurge[i].pPtGetCoastlinePointExtCRS(j)->dGetX(), m_VFloodWaveSetupSurge[i].pPtGetCoastlinePointExtCRS(j)->dGetY());
744 }
745
746 pOGR3Feature->SetGeometry(&OGR3ls);
747 OGR3ls.empty();
748
749 // Create the feature in the output layer
750 if (pOGRLayer->CreateFeature(pOGR3Feature) != OGRERR_NONE)
751 {
752 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " for coast " << i << " in " << strFilePathName << endl
753 << CPLGetLastErrorMsg() << endl;
754 return false;
755 }
756
757 // Tidy up: empty the line string and get rid of the feature object
758 // OGRls.empty();
759 OGRFeature::DestroyFeature(pOGR3Feature);
760 }
761 }
763 {
764 // Create a feature object, one per coast
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)
770 {
771 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
772 return false;
773 }
774 if (pOGRLayer->CreateField(&OGRField9) != OGRERR_NONE)
775 {
776 cerr << ERR << "cannot create " << strType << " attribute field 2 '" << strFieldValue2 << "' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
777 return false;
778 }
779 if (pOGRLayer->CreateField(&OGRField5) != OGRERR_NONE)
780 {
781 cerr << ERR << "cannot create " << strType << " attribute field 5 '" << strFieldValue4 << "' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
782 return false;
783 }
784 // OK, now do features
785 OGRLineString OGR4ls;
786 for (int i = 0; i < static_cast<int>(m_VFloodWaveSetupSurgeRunup.size()); i++)
787 {
788 pOGR4Feature->SetField(strFieldValue1.c_str(), m_dThisIterSWL);
789 pOGR4Feature->SetField(strFieldValue2.c_str(), static_cast<double>(m_bGISSaveDigitsSequential ? m_nGISSave : m_ulIter));
790 int runup_level = int(m_dThisIterDiffWaveSetupSurgeRunupWaterLevel * 1000);
791 pOGR4Feature->SetField(strFieldValue4.c_str(), runup_level);
792
793 // Set the feature's attribute (the coast number)
794 // Now attach a geometry to the feature object
795 for (int j = 0; j < m_VFloodWaveSetupSurgeRunup[i].pLGetCoastlineExtCRS()->nGetSize(); j++)
796 {
797 // In external CRS
798 // Add SWL + wave setup + surge + runup line
799 OGR4ls.addPoint(m_VFloodWaveSetupSurgeRunup[i].pPtGetCoastlinePointExtCRS(j)->dGetX(), m_VFloodWaveSetupSurgeRunup[i].pPtGetCoastlinePointExtCRS(j)->dGetY());
800 }
801
802 pOGR4Feature->SetGeometry(&OGR4ls);
803 OGR4ls.empty();
804
805 // Create the feature in the output layer
806 if (pOGRLayer->CreateFeature(pOGR4Feature) != OGRERR_NONE)
807 {
808 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " for coast " << i << " in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
809 return false;
810 }
811
812 // Tidy up: empty the line string and get rid of the feature object
813 // OGRls.empty();
814 OGRFeature::DestroyFeature(pOGR4Feature);
815 }
816 }
817 // OGRls.empty();
818
819 break;
820 }
821
822 case (VECTOR_PLOT_NORMALS):
824 {
825 eGType = wkbLineString;
826 strType = "line";
827
828 // The layer has been created, so create an integer-numbered value (the number of the normal) associated with the line
829 string strFieldValue1 = "Normal";
830 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTInteger);
831 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
832 {
833 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
834 << CPLGetLastErrorMsg() << endl;
835 return false;
836 }
837
838 // Also create other integer-numbered values for the category codes of the coastline-normalprofile
839 string strFieldValue2 = "StartCoast";
840 string strFieldValue3 = "EndCoast";
841 string strFieldValue4 = "HitLand";
842 string strFieldValue5 = "HitCoast";
843 string strFieldValue6 = "HitNormal";
844 string strFieldValue7 = "CShore";
845
846 OGRFieldDefn OGRField2(strFieldValue2.c_str(), OFTInteger);
847 OGRFieldDefn OGRField3(strFieldValue3.c_str(), OFTInteger);
848 OGRFieldDefn OGRField4(strFieldValue4.c_str(), OFTInteger);
849 OGRFieldDefn OGRField5(strFieldValue5.c_str(), OFTInteger);
850 OGRFieldDefn OGRField6(strFieldValue6.c_str(), OFTInteger);
851 OGRFieldDefn OGRField7(strFieldValue7.c_str(), OFTInteger);
852
853 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
854 {
855 cerr << ERR << "cannot create " << strType << " attribute field 2 '" << strFieldValue2 << "' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
856 return false;
857 }
858 if (pOGRLayer->CreateField(&OGRField3) != OGRERR_NONE)
859 {
860 cerr << ERR << "cannot create " << strType << " attribute field 3 '" << strFieldValue3 << "' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
861 return false;
862 }
863 if (pOGRLayer->CreateField(&OGRField4) != OGRERR_NONE)
864 {
865 cerr << ERR << "cannot create " << strType << " attribute field 4 '" << strFieldValue4 << "' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
866 return false;
867 }
868 if (pOGRLayer->CreateField(&OGRField5) != OGRERR_NONE)
869 {
870 cerr << ERR << "cannot create " << strType << " attribute field 5 '" << strFieldValue5 << "' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
871 return false;
872 }
873 if (pOGRLayer->CreateField(&OGRField6) != OGRERR_NONE)
874 {
875 cerr << ERR << "cannot create " << strType << " attribute field 6 '" << strFieldValue6 << "' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
876 return false;
877 }
878 if (pOGRLayer->CreateField(&OGRField7) != OGRERR_NONE)
879 {
880 cerr << ERR << "cannot create " << strType << " attribute field 7 '" << strFieldValue7 << "' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
881 return false;
882 }
883
884 // OK, now create features
885 OGRLineString OGRls;
886
887 for (int i = 0; i < static_cast<int>(m_VCoast.size()); i++)
888 {
889 for (int j = 0; j < m_VCoast[i].nGetNumProfiles(); j++)
890 {
891 CGeomProfile* pProfile = m_VCoast[i].pGetProfile(j);
892
893 if (((nDataItem == VECTOR_PLOT_NORMALS) && (pProfile->bOKIncStartAndEndOfCoast())) || ((nDataItem == VECTOR_PLOT_INVALID_NORMALS) && (! pProfile->bOKIncStartAndEndOfCoast())))
894 {
895 // Create a feature object, one per profile
896 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
897
898 // Set the feature's attributes
899 pOGRFeature->SetField(strFieldValue1.c_str(), j);
900 pOGRFeature->SetField(strFieldValue2.c_str(), 0);
901 pOGRFeature->SetField(strFieldValue3.c_str(), 0);
902 pOGRFeature->SetField(strFieldValue4.c_str(), 0);
903 pOGRFeature->SetField(strFieldValue5.c_str(), 0);
904 pOGRFeature->SetField(strFieldValue6.c_str(), 0);
905 pOGRFeature->SetField(strFieldValue7.c_str(), 0);
906 if (pProfile->bStartOfCoast())
907 pOGRFeature->SetField(strFieldValue2.c_str(), 1);
908 if (pProfile->bEndOfCoast())
909 pOGRFeature->SetField(strFieldValue3.c_str(), 1);
910 if (pProfile->bHitLand())
911 pOGRFeature->SetField(strFieldValue4.c_str(), 1);
912 if (pProfile->bHitCoast())
913 pOGRFeature->SetField(strFieldValue5.c_str(), 1);
914 if (pProfile->bHitAnotherProfileBadly())
915 pOGRFeature->SetField(strFieldValue6.c_str(), 1);
916 if (pProfile->bCShoreProblem())
917 pOGRFeature->SetField(strFieldValue7.c_str(), 1);
918
919 // Now attach a geometry to the feature object
920 for (int k = 0; k < pProfile->nGetProfileSize(); k++)
921 OGRls.addPoint(pProfile->pPtGetPointInProfile(k)->dGetX(), pProfile->pPtGetPointInProfile(k)->dGetY());
922
923 pOGRFeature->SetGeometry(&OGRls);
924 OGRls.empty();
925
926 // Create the feature in the output layer
927 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
928 {
929 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " for coast " << i << " and profile " << j << " in " << strFilePathName << endl
930 << CPLGetLastErrorMsg() << endl;
931 return false;
932 }
933
934 // Tidy up: get rid of the feature object
935 OGRFeature::DestroyFeature(pOGRFeature);
936 }
937 }
938 }
939
940 break;
941 }
942
950 case (VECTOR_PLOT_RUN_UP):
952 {
953 eGType = wkbPoint;
954 strType = "point";
955
956 // The layer has been created, so create a real-numbered value associated with each point
957 string strFieldValue1;
958 if (nDataItem == VECTOR_PLOT_COAST_CURVATURE)
959 strFieldValue1 = "Curve";
960 else if (nDataItem == VECTOR_PLOT_WAVE_ENERGY_SINCE_COLLAPSE)
961 strFieldValue1 = "SC_Energy";
962 else if (nDataItem == VECTOR_PLOT_MEAN_WAVE_ENERGY)
963 strFieldValue1 = "MeanEnergy";
964 else if (nDataItem == VECTOR_PLOT_BREAKING_WAVE_HEIGHT)
965 strFieldValue1 = "Height";
966 else if (nDataItem == VECTOR_PLOT_POLYGON_NODES)
967 strFieldValue1 = "Node";
968 else if (nDataItem == VECTOR_PLOT_CLIFF_NOTCH_SIZE)
969 strFieldValue1 = "Notch";
970 else if (nDataItem == VECTOR_PLOT_WAVE_SETUP)
971 strFieldValue1 = "Wavesetup";
972 else if (nDataItem == VECTOR_PLOT_STORM_SURGE)
973 strFieldValue1 = "Stormsurge";
974 else if (nDataItem == VECTOR_PLOT_RUN_UP)
975 strFieldValue1 = "Runup";
976
977 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTReal);
978 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
979 {
980 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
981 << CPLGetLastErrorMsg() << endl;
982 return false;
983 }
984
985 // OK, now create features
986 OGRLineString OGRls;
987 OGRMultiLineString OGRmls;
988 OGRPoint OGRPt;
989
990 for (int i = 0; i < static_cast<int>(m_VCoast.size()); i++)
991 {
992 for (int j = 0; j < m_VCoast[i].pLGetCoastlineExtCRS()->nGetSize(); j++)
993 {
994 // Create a feature object, one per coastline point
995 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
996
997 // Set the feature's geometry (in external CRS)
998 OGRPt.setX(m_VCoast[i].pPtGetCoastlinePointExtCRS(j)->dGetX());
999 OGRPt.setY(m_VCoast[i].pPtGetCoastlinePointExtCRS(j)->dGetY());
1000 pOGRFeature->SetGeometry(&OGRPt);
1001
1002 if (nDataItem == VECTOR_PLOT_COAST_CURVATURE)
1003 {
1004 double dCurvature = m_VCoast[i].dGetDetailedCurvature(j);
1005 if (bFPIsEqual(dCurvature, DBL_NODATA, TOLERANCE))
1006 continue;
1007
1008 // Set the feature's attribute
1009 pOGRFeature->SetField(strFieldValue1.c_str(), dCurvature);
1010 }
1011 else if (nDataItem == VECTOR_PLOT_WAVE_ENERGY_SINCE_COLLAPSE)
1012 {
1013 // Set the feature's attribute
1014 if (m_VCoast[i].pGetCoastLandform(j) == NULL)
1015 pOGRFeature->SetField(strFieldValue1.c_str(), DBL_NODATA);
1016 else
1017 pOGRFeature->SetField(strFieldValue1.c_str(), m_VCoast[i].pGetCoastLandform(j)->dGetTotAccumWaveEnergy());
1018 }
1019 else if (nDataItem == VECTOR_PLOT_MEAN_WAVE_ENERGY)
1020 {
1021 // Set the feature's attribute
1022 if (m_VCoast[i].pGetCoastLandform(j) == NULL)
1023 pOGRFeature->SetField(strFieldValue1.c_str(), DBL_NODATA);
1024 else
1025 {
1026 double dEnergy = m_VCoast[i].pGetCoastLandform(j)->dGetTotAccumWaveEnergy();
1027 dEnergy *= 24;
1028 dEnergy /= m_dSimElapsed; // Is in energy units per day
1029
1030 pOGRFeature->SetField(strFieldValue1.c_str(), dEnergy);
1031 }
1032 }
1033 else if (nDataItem == VECTOR_PLOT_BREAKING_WAVE_HEIGHT)
1034 {
1035 // Set the feature's attribute
1036 double dHeight = m_VCoast[i].dGetBreakingWaveHeight(j);
1037 pOGRFeature->SetField(strFieldValue1.c_str(), dHeight);
1038 }
1039 else if (nDataItem == VECTOR_PLOT_WAVE_SETUP)
1040 {
1041 // Set the feature's attribute
1042 double dWaveSetupSurge = m_VCoast[i].dGetWaveSetupSurge(j);
1043 pOGRFeature->SetField(strFieldValue1.c_str(), dWaveSetupSurge);
1044 }
1045 // else if (nDataItem == VECTOR_PLOT_STORM_SURGE)
1046 // {
1047 // // Set the feature's attribute
1048 // double dStormSurge = m_VCoast[i].dGetStormSurge(j);
1049 // pOGRFeature->SetField(strFieldValue1.c_str(), dStormSurge);
1050 // }
1051 else if (nDataItem == VECTOR_PLOT_RUN_UP)
1052 {
1053 // Set the feature's attribute
1054 double dRunUp = m_VCoast[i].dGetRunUp(j);
1055 pOGRFeature->SetField(strFieldValue1.c_str(), dRunUp);
1056 }
1057 else if (nDataItem == VECTOR_PLOT_POLYGON_NODES)
1058 {
1059 int nNode = m_VCoast[i].nGetPolygonNode(j);
1060 if (nNode == INT_NODATA)
1061 continue;
1062
1063 // Set the feature's attribute
1064 pOGRFeature->SetField(strFieldValue1.c_str(), nNode);
1065 }
1066 else if (nDataItem == VECTOR_PLOT_CLIFF_NOTCH_SIZE)
1067 {
1068 CACoastLandform* pCoastLandform = m_VCoast[i].pGetCoastLandform(j);
1069 if (pCoastLandform == NULL)
1070 pOGRFeature->SetField(strFieldValue1.c_str(), DBL_NODATA);
1071 else
1072 {
1073 int nCategory = pCoastLandform->nGetLandFormCategory();
1074 double dNotchDepth = 0.0;
1075
1076 if (nCategory == LF_CAT_CLIFF)
1077 {
1078 CRWCliff const* pCliff = reinterpret_cast<CRWCliff*>(pCoastLandform);
1079
1080 // Get attribute values from the cliff object
1081 dNotchDepth = pCliff->dGetNotchDepth();
1082 }
1083
1084 // Set the feature's attribute
1085 pOGRFeature->SetField(strFieldValue1.c_str(), dNotchDepth);
1086 }
1087 }
1088
1089 // Create the feature in the output layer
1090 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1091 {
1092 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " for coast " << i << " point " << j << " in " << strFilePathName << endl
1093 << CPLGetLastErrorMsg() << endl;
1094 return false;
1095 }
1096
1097 // Get rid of the feature object
1098 OGRFeature::DestroyFeature(pOGRFeature);
1099 }
1100 }
1101
1102 break;
1103 }
1104
1106 {
1107 eGType = wkbPoint;
1108 strType = "point";
1109
1110 // The layer has been created, so create real-numbered values associated with each point
1111 string
1112 strFieldValue1 = "Angle",
1113 strFieldValue2 = "Height";
1114
1115 // Create the first field
1116 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTReal);
1117 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1118 {
1119 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
1120 << CPLGetLastErrorMsg() << endl;
1121 return false;
1122 }
1123
1124 // Create the second field
1125 OGRFieldDefn OGRField2(strFieldValue2.c_str(), OFTReal);
1126 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1127 {
1128 cerr << ERR << "cannot create " << strType << " attribute field 2 '" << strFieldValue2 << "' in " << strFilePathName << endl
1129 << CPLGetLastErrorMsg() << endl;
1130 return false;
1131 }
1132
1133 // OK, now create features
1134 OGRLineString OGRls;
1135 OGRMultiLineString OGRmls;
1136 OGRPoint OGRPt;
1137
1138 for (int nX = 0; nX < m_nXGridSize; nX++)
1139 {
1140 for (int nY = 0; nY < m_nYGridSize; nY++)
1141 {
1142 // Only output a value if the cell is a sea cell which is not in the active zone (wave height and angle values are meaningless if in the active zone)
1143 if ((m_pRasterGrid->m_Cell[nX][nY].bIsInContiguousSea()) && (! m_pRasterGrid->m_Cell[nX][nY].bIsInActiveZone()))
1144 {
1145 // Create a feature object, one per sea cell
1146 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1147
1148 // Set the feature's geometry (in external CRS)
1149 OGRPt.setX(dGridCentroidXToExtCRSX(nX));
1150 OGRPt.setY(dGridCentroidYToExtCRSY(nY));
1151 pOGRFeature->SetGeometry(&OGRPt);
1152
1153 double
1154 dOrientation = m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle(),
1155 dHeight = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1156
1157 if (bFPIsEqual(dHeight, DBL_NODATA, TOLERANCE) || bFPIsEqual(dOrientation, DBL_NODATA, TOLERANCE))
1158 continue;
1159
1160 // Set the feature's attributes
1161 pOGRFeature->SetField(strFieldValue1.c_str(), dOrientation);
1162 pOGRFeature->SetField(strFieldValue2.c_str(), dHeight);
1163
1164 // Create the feature in the output layer
1165 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1166 {
1167 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " for cell [" << nX << "][" << nY << "] in " << strFilePathName << endl
1168 << CPLGetLastErrorMsg() << endl;
1169 return false;
1170 }
1171
1172 // Get rid of the feature object
1173 OGRFeature::DestroyFeature(pOGRFeature);
1174 }
1175 }
1176 }
1177
1178 break;
1179 }
1180
1182 {
1183 eGType = wkbPoint;
1184 strType = "point";
1185
1186 // The layer has been created, so create real-numbered values associated with each point
1187 string
1188 strFieldValue1 = "Angle",
1189 strFieldValue2 = "Height";
1190
1191 // Create the first field
1192 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTReal);
1193 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1194 {
1195 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
1196 << CPLGetLastErrorMsg() << endl;
1197 return false;
1198 }
1199
1200 // Create the second field
1201 OGRFieldDefn OGRField2(strFieldValue2.c_str(), OFTReal);
1202 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1203 {
1204 cerr << ERR << "cannot create " << strType << " attribute field 2 '" << strFieldValue2 << "' in " << strFilePathName << endl
1205 << CPLGetLastErrorMsg() << endl;
1206 return false;
1207 }
1208
1209 // OK, now create features
1210 OGRLineString OGRls;
1211 OGRMultiLineString OGRmls;
1212 OGRPoint OGRPt;
1213
1214 for (int nX = 0; nX < m_nXGridSize; nX++)
1215 {
1216 for (int nY = 0; nY < m_nYGridSize; nY++)
1217 {
1218 // Create a feature object, one per sea cell
1219 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1220
1221 // Set the feature's geometry (in external CRS)
1222 OGRPt.setX(dGridCentroidXToExtCRSX(nX));
1223 OGRPt.setY(dGridCentroidYToExtCRSY(nY));
1224 pOGRFeature->SetGeometry(&OGRPt);
1225
1226 double
1227 dOrientation = m_pRasterGrid->m_Cell[nX][nY].dGetTotWaveAngle() / static_cast<double>(m_ulIter),
1228 dHeight = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight() / static_cast<double>(m_ulIter);
1229
1230 if (bFPIsEqual(dHeight, DBL_NODATA, TOLERANCE) || bFPIsEqual(dOrientation, DBL_NODATA, TOLERANCE))
1231 continue;
1232
1233 // Set the feature's attributes
1234 pOGRFeature->SetField(strFieldValue1.c_str(), dOrientation);
1235 pOGRFeature->SetField(strFieldValue2.c_str(), dHeight);
1236
1237 // Create the feature in the output layer
1238 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1239 {
1240 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " for cell [" << nX << "][" << nY << "] in " << strFilePathName << endl
1241 << CPLGetLastErrorMsg() << endl;
1242 return false;
1243 }
1244
1245 // Get rid of the feature object
1246 OGRFeature::DestroyFeature(pOGRFeature);
1247 }
1248 }
1249
1250 break;
1251 }
1252
1254 {
1255 eGType = wkbPolygon;
1256 strType = "polygon";
1257
1258 // The layer has been created, so create two integer-numbered values (the number of the polygon object, and the number of the coast point which is the polygon's node) for the polygon
1259 string
1260 strFieldValue1 = "Polygon",
1261 strFieldValue2 = "CoastNode",
1262 strFieldValue3 = "TotSedChng",
1263 strFieldValue4 = "FinSedChng",
1264 strFieldValue5 = "SndSedChng",
1265 strFieldValue6 = "CrsSedChng";
1266
1267 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTInteger);
1268 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1269 {
1270 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
1271 << CPLGetLastErrorMsg() << endl;
1272 return false;
1273 }
1274
1275 OGRFieldDefn OGRField2(strFieldValue2.c_str(), OFTInteger);
1276 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1277 {
1278 cerr << ERR << "cannot create " << strType << " attribute field 2 '" << strFieldValue2 << "' in " << strFilePathName << endl
1279 << CPLGetLastErrorMsg() << endl;
1280 return false;
1281 }
1282
1283 OGRFieldDefn OGRField3(strFieldValue3.c_str(), OFTReal);
1284 if (pOGRLayer->CreateField(&OGRField3) != OGRERR_NONE)
1285 {
1286 cerr << ERR << "cannot create " << strType << " attribute field 3 '" << strFieldValue3 << "' in " << strFilePathName << endl
1287 << CPLGetLastErrorMsg() << endl;
1288 return false;
1289 }
1290
1291 OGRFieldDefn OGRField4(strFieldValue4.c_str(), OFTReal);
1292 if (pOGRLayer->CreateField(&OGRField4) != OGRERR_NONE)
1293 {
1294 cerr << ERR << "cannot create " << strType << " attribute field 4 '" << strFieldValue4 << "' in " << strFilePathName << endl
1295 << CPLGetLastErrorMsg() << endl;
1296 return false;
1297 }
1298
1299 OGRFieldDefn OGRField5(strFieldValue5.c_str(), OFTReal);
1300 if (pOGRLayer->CreateField(&OGRField5) != OGRERR_NONE)
1301 {
1302 cerr << ERR << "cannot create " << strType << " attribute field 5 '" << strFieldValue5 << "' in " << strFilePathName << endl
1303 << CPLGetLastErrorMsg() << endl;
1304 return false;
1305 }
1306
1307 OGRFieldDefn OGRField6(strFieldValue6.c_str(), OFTReal);
1308 if (pOGRLayer->CreateField(&OGRField6) != OGRERR_NONE)
1309 {
1310 cerr << ERR << "cannot create " << strType << " attribute field 6 '" << strFieldValue6 << "' in " << strFilePathName << endl
1311 << CPLGetLastErrorMsg() << endl;
1312 return false;
1313 }
1314
1315 // OK, now do features
1316 OGRLineString OGRls;
1317
1318 for (int i = 0; i < static_cast<int>(m_VCoast.size()); i++)
1319 {
1320 for (int j = 0; j < m_VCoast[i].nGetNumPolygons(); j++)
1321 {
1322 // Create a feature object, one per polygon
1323 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1324
1325 CGeomCoastPolygon* pPolygon = m_VCoast[i].pGetPolygon(j);
1326
1327 // Set the feature's attributes
1328 pOGRFeature->SetField(strFieldValue1.c_str(), j);
1329 pOGRFeature->SetField(strFieldValue2.c_str(), pPolygon->nGetNodeCoastPoint());
1330 pOGRFeature->SetField(strFieldValue3.c_str(), pPolygon->dGetBeachDepositionAndSuspensionAllUncons());
1331 pOGRFeature->SetField(strFieldValue4.c_str(), pPolygon->dGetSuspensionUnconsFine());
1332 pOGRFeature->SetField(strFieldValue5.c_str(), pPolygon->dGetBeachDepositionUnconsSand());
1333 pOGRFeature->SetField(strFieldValue6.c_str(), pPolygon->dGetBeachDepositionUnconsCoarse());
1334
1335 // Now attach a geometry to the feature object
1336 for (int n = 0; n < pPolygon->nGetBoundarySize(); n++)
1337 // In external CRS
1338 OGRls.addPoint(pPolygon->pPtGetBoundaryPoint(n)->dGetX(), pPolygon->pPtGetBoundaryPoint(n)->dGetY());
1339
1340 pOGRFeature->SetGeometry(&OGRls);
1341
1342 // Create the feature in the output layer
1343 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1344 {
1345 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " for coast " << i << " polygon " << j << " in " << strFilePathName << endl
1346 << CPLGetLastErrorMsg() << endl;
1347 return false;
1348 }
1349
1350 // Tidy up: empty the line string and get rid of the feature object
1351 OGRls.empty();
1352 OGRFeature::DestroyFeature(pOGRFeature);
1353 }
1354 }
1355
1356 break;
1357 }
1358
1360 {
1361 eGType = wkbLineString;
1362 strType = "line";
1363
1364 // Create an integer-numbered value (the number of the shadow boundary line object) for the multi-line
1365 string strFieldValue1 = "ShadowLine";
1366 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTInteger);
1367 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1368 {
1369 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
1370 << CPLGetLastErrorMsg() << endl;
1371 return false;
1372 }
1373
1374 // OK, now do features
1375 OGRLineString OGRls;
1376
1377 for (int i = 0; i < static_cast<int>(m_VCoast.size()); i++)
1378 {
1379 for (int j = 0; j < m_VCoast[i].nGetNumShadowBoundaries(); j++)
1380 {
1381 // Create a feature object, one per coast
1382 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1383
1384 // Set the feature's attribute (the shadow boundary line number)
1385 pOGRFeature->SetField(strFieldValue1.c_str(), j);
1386
1387 // Now attach a geometry to the feature object
1388 CGeomLine LShadow = *m_VCoast[i].pGetShadowBoundary(j);
1389 for (int nn = 0; nn < LShadow.nGetSize(); nn++)
1390 OGRls.addPoint(LShadow.dGetXAt(nn), LShadow.dGetYAt(nn));
1391
1392 pOGRFeature->SetGeometry(&OGRls);
1393
1394 // Create the feature in the output layer
1395 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1396 {
1397 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << j << " for coast " << i << " in " << strFilePathName << endl
1398 << CPLGetLastErrorMsg() << endl;
1399 return false;
1400 }
1401
1402 // Tidy up: empty the line string and get rid of the feature object
1403 OGRls.empty();
1404 OGRFeature::DestroyFeature(pOGRFeature);
1405 }
1406 }
1407
1408 break;
1409 }
1410
1412 {
1413 eGType = wkbLineString;
1414 strType = "line";
1415
1416 // Create an integer-numbered value (the number of the downdrift boundary line object) for the multi-line
1417 string strFieldValue1 = "DdriftLine";
1418 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTInteger);
1419 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1420 {
1421 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
1422 << CPLGetLastErrorMsg() << endl;
1423 return false;
1424 }
1425
1426 // OK, now do features
1427 OGRLineString OGRls;
1428
1429 for (int i = 0; i < static_cast<int>(m_VCoast.size()); i++)
1430 {
1431 for (int j = 0; j < m_VCoast[i].nGetNumShadowDowndriftBoundaries(); j++)
1432 {
1433 // Create a feature object, one per coast
1434 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1435
1436 // Set the feature's attribute (the downdrift boundary line number)
1437 pOGRFeature->SetField(strFieldValue1.c_str(), j);
1438
1439 // Now attach a geometry to the feature object
1440 CGeomLine LDowndrift = *m_VCoast[i].pGetShadowDowndriftBoundary(j);
1441 for (int nn = 0; nn < LDowndrift.nGetSize(); nn++)
1442 OGRls.addPoint(LDowndrift.dGetXAt(nn), LDowndrift.dGetYAt(nn));
1443
1444 pOGRFeature->SetGeometry(&OGRls);
1445
1446 // Create the feature in the output layer
1447 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1448 {
1449 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << j << " for coast " << i << " in " << strFilePathName << endl
1450 << CPLGetLastErrorMsg() << endl;
1451 return false;
1452 }
1453
1454 // Tidy up: empty the line string and get rid of the feature object
1455 OGRls.empty();
1456 OGRFeature::DestroyFeature(pOGRFeature);
1457 }
1458 }
1459
1460 break;
1461 }
1462
1464 {
1465 eGType = wkbPoint;
1466 strType = "point";
1467
1468 // The layer has been created, so create real-numbered values associated with each point
1469 string
1470 strFieldValue1 = "Angle",
1471 strFieldValue2 = "Height";
1472
1473 // Create the first field
1474 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTReal);
1475 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1476 {
1477 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
1478 << CPLGetLastErrorMsg() << endl;
1479 return false;
1480 }
1481
1482 // Create the second field
1483 OGRFieldDefn OGRField2(strFieldValue2.c_str(), OFTReal);
1484 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1485 {
1486 cerr << ERR << "cannot create " << strType << " attribute field 2 '" << strFieldValue2 << "' in " << strFilePathName << endl
1487 << CPLGetLastErrorMsg() << endl;
1488 return false;
1489 }
1490
1491 // OK, now create features
1492 OGRLineString OGRls;
1493 OGRMultiLineString OGRmls;
1494 OGRPoint OGRPt;
1495
1496 for (int nX = 0; nX < m_nXGridSize; nX++)
1497 {
1498 for (int nY = 0; nY < m_nYGridSize; nY++)
1499 {
1500 // Create a feature object, one per cell (does this whether the sea is a sea cell or a land cell)
1501 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1502
1503 // Set the feature's geometry (in external CRS)
1504 OGRPt.setX(dGridCentroidXToExtCRSX(nX));
1505 OGRPt.setY(dGridCentroidYToExtCRSY(nY));
1506 pOGRFeature->SetGeometry(&OGRPt);
1507
1508 double dOrientation = m_pRasterGrid->m_Cell[nX][nY].dGetCellDeepWaterWaveAngle();
1509 double dHeight = m_pRasterGrid->m_Cell[nX][nY].dGetCellDeepWaterWaveHeight();
1510
1511 if (bFPIsEqual(dHeight, DBL_NODATA, TOLERANCE) || bFPIsEqual(dOrientation, DBL_NODATA, TOLERANCE) || (! m_pRasterGrid->m_Cell[nX][nY].bIsInContiguousSea()))
1512 continue;
1513
1514 // Set the feature's attributes
1515 pOGRFeature->SetField(strFieldValue1.c_str(), dOrientation);
1516 pOGRFeature->SetField(strFieldValue2.c_str(), dHeight);
1517
1518 // Create the feature in the output layer
1519 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1520 {
1521 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " for cell [" << nX << "][" << nY << "] in " << strFilePathName << endl
1522 << CPLGetLastErrorMsg() << endl;
1523 return false;
1524 }
1525
1526 // Get rid of the feature object
1527 OGRFeature::DestroyFeature(pOGRFeature);
1528 }
1529 }
1530 break;
1531 }
1532 }
1533
1534 CPLPopErrorHandler();
1535
1536 // Get rid of the dataset object
1537 GDALClose(pGDALDataSet);
1538
1539 return true;
1540}
int nGetSize(void) const
Definition 2d_shape.cpp:56
Abstract class, used as a base class for landform objects on the coastline.
int nGetLandFormCategory(void) const
Get the landform category.
double dGetY(void) const
Returns the CGeom2DPoint object's double Y coordinate.
Definition 2d_point.cpp:46
double dGetX(void) const
Returns the CGeom2DPoint object's double X coordinate.
Definition 2d_point.cpp:40
Geometry class used for coast polygon objects.
double dGetBeachDepositionUnconsSand(void) const
Returns the depth of sand-sized unconsolidated sediment deposited on this polygon during this timeste...
double dGetBeachDepositionUnconsCoarse(void) const
Returns the depth of coarse-sized unconsolidated sediment deposited on this polygon during this times...
CGeom2DPoint * pPtGetBoundaryPoint(int const)
Get the coordinates (external CRS) of a specified point on the polygon's boundary.
double dGetBeachDepositionAndSuspensionAllUncons(void) const
Returns this timestep's total (all size classes) deposition and to-suspension movement of unconsolida...
int nGetNodeCoastPoint(void) const
Get the coast node point.
int nGetBoundarySize(void) const
Get the number of points in the polygon's boundary.
double dGetSuspensionUnconsFine(void) const
Returns this timestep's to-suspension movement of fine unconsolidated sediment on this polygon,...
Geometry class used to represent 2D vector line objects.
Definition line.h:31
double dGetYAt(int const)
Returns the Y value at a given place in the line.
Definition line.cpp:66
double dGetXAt(int const)
Returns the X value at a given place in the line.
Definition line.cpp:60
Geometry class used to represent coast profile objects.
Definition profile.h:35
bool bHitAnotherProfileBadly(void) const
Returns the switch which indicates whether this profile hits another profile badly.
Definition profile.cpp:192
bool bHitLand(void) const
Returns the switch which indicates whether this profile has hit land.
Definition profile.cpp:144
bool bHitCoast(void) const
Returns the switch which indicates whether this profile has hit a coast.
Definition profile.cpp:156
CGeom2DPoint * pPtGetPointInProfile(int const)
Returns a single point in the profile.
Definition profile.cpp:332
bool bOKIncStartAndEndOfCoast(void) const
Returns true if this is a problem-free profile (however it could be a start-of-coast or an end-of-coa...
Definition profile.cpp:231
int nGetProfileSize(void) const
Returns the number of points in the profile.
Definition profile.cpp:325
bool bStartOfCoast(void) const
Returns the switch to indicate whether this is a start-of-coast profile.
Definition profile.cpp:108
bool bEndOfCoast(void) const
Returns the switch to indicate whether this is an end-of-coast profile.
Definition profile.cpp:120
bool bCShoreProblem(void) const
Returns the switch which indicates whether this profile has a CShore problem.
Definition profile.cpp:132
Real-world class used to represent the 'cliff' category of coastal landform object.
Definition cliff.h:33
double dGetNotchDepth(void) const
Returns the horizontal depth of the cliff's erosional notch (the 'overhang')
Definition cliff.cpp:94
int m_nGISMaxSaveDigits
The maximum number of digits in GIS filenames. These can be sequential, or the iteration number.
Definition simulation.h:458
string m_strOGRVectorOutputExtension
GDAL-OGR vector output drive file extension.
bool m_bFloodSWLSetupSurgeLine
Are we saving the flood still water level setup surge line? TODO 007.
Definition simulation.h:416
bool m_bSedimentInputAtPoint
Do we have sediment inputat a point?
Definition simulation.h:371
double m_dThisIterSWL
The still water level for this timestep (this includes tidal changes and any long-term SWL change)
Definition simulation.h:667
CGeomRasterGrid * m_pRasterGrid
Pointer to the raster grid object.
int m_nXGridSize
The size of the grid in the x direction.
Definition simulation.h:431
vector< double > m_VdDeepWaterWaveStationY
Y coordinate (grid CRS) for deep water wave station.
ofstream LogStream
char ** m_papszGDALVectorOptions
Options for GDAL when handling vector files.
Definition simulation.h:428
vector< CRWCoast > m_VFloodWaveSetupSurgeRunup
TODO 007 Info needed.
vector< CRWCoast > m_VCoast
The coastline objects.
string m_strOGRSedInputDataType
GDAL data type for the sediment input event locations vector file.
bool bWriteVectorGISFile(int const, string const *)
Writes vector GIS files using OGR.
double m_dThisIterDiffWaveSetupSurgeWaterLevel
TODO 007 Info needed.
Definition simulation.h:688
vector< int > m_VnSedimentInputLocationID
ID for sediment input location, this corresponds with the ID in the sediment input time series file.
int m_nYGridSize
The size of the grid in the y direction.
Definition simulation.h:434
string m_strSedimentInputEventShapefile
The name of the sediment input events shape file.
string m_strVectorGISOutFormat
Base name for CME vector GIS output files.
string m_strDeepWaterWaveStationsShapefile
The name of the deep water wave stations shape file.
vector< CRWCoast > m_VFloodWaveSetupSurge
TODO 007 Info needed.
string m_strOGRFloodGeometry
GDAL geometry for the flood input locations point or vector file.
string m_strOGRSedInputDriverDesc
string m_strOGRDWWVDriverCode
GDAL code for the deep water wave stations vector file.
vector< double > m_VdFloodLocationX
X coordinate (grid CRS) for total water level flooding.
bool m_bSedimentInputAlongLine
Do we have sediment input along a line?
Definition simulation.h:377
int nReadVectorGISFile(int const)
Reads vector GIS datafiles using OGR.
vector< double > m_VdDeepWaterWaveStationX
X coordinate (grid CRS) for deep water wave station.
vector< double > m_VdSedimentInputLocationX
X coordinate (grid CRS) for sediment input event.
bool m_bSedimentInputAtCoast
Do we have sediment input at the coast?
Definition simulation.h:374
double dGridCentroidYToExtCRSY(int const) const
Given the integer Y-axis ordinate of a cell in the raster grid CRS, returns the external CRS Y-axis o...
Definition gis_utils.cpp:71
string m_strOGRDWWVDriverDesc
string m_strOGRFloodDriverCode
GDAL code for the flood input locations point or vector file.
double m_dSimElapsed
Time simulated so far, in hours.
Definition simulation.h:634
vector< int > m_VnDeepWaterWaveStationID
ID for deep water wave station, this corresponds with the ID in the wave time series file.
vector< int > m_VnFloodLocationID
ID for flood location.
string m_strFloodLocationShapefile
The name of the flood loction events shape file.
bool m_bGISSaveDigitsSequential
Are the GIS save digits (which are part of each GIS file name) sequential, or are they the iteration ...
Definition simulation.h:422
double dExtCRSXToGridX(double const) const
Transforms an X-axis ordinate in the external CRS to the equivalent X-axis ordinate in the raster gri...
string m_strOGRDWWVGeometry
GDAL geometry for the deep water wave stations vector file.
string m_strOutPath
Path for all output files.
vector< double > m_VdSedimentInputLocationY
X coordinate (grid CRS) for sediment input event.
int m_nGISSave
The save number for GIS files (can be sequential, or the iteration number)
Definition simulation.h:461
double dExtCRSYToGridY(double const) const
Transforms a Y-axis ordinate in the external CRS to the equivalent Y-axis ordinate in the raster grid...
string m_strOGRSedInputGeometry
GDAL geometry for the sediment input event locations vector file.
string m_strOGRSedInputDriverCode
GDAL code for the sediment input event locations vector file.
string m_strOGRFloodDriverDesc
string m_strOGRFloodDataType
GDAL data type for the flood input locations point or vector file.
string m_strGDALBasementDEMProjection
GDAL projection string for the basement DEM raster file.
unsigned long m_ulIter
The number of the current iteration (time step)
Definition simulation.h:553
double dGridCentroidXToExtCRSX(int const) const
Given the integer X-axis ordinate of a cell in the raster grid CRS, returns the external CRS X-axis o...
Definition gis_utils.cpp:62
string m_strOGRDWWVDataType
GDAL data type for the deep water wave stations vector file.
double m_dThisIterDiffWaveSetupSurgeRunupWaterLevel
TODO 007 Info needed.
Definition simulation.h:691
vector< double > m_VdFloodLocationY
X coordinate (grid CRS) for total water level flooding.
bool m_bFloodSWLSetupSurgeRunupLine
Are we saving the flood still water level setup surge runup line? TODO 007.
Definition simulation.h:419
Contains CRWCliff definitions.
This file contains global definitions for CoastalME.
int const INT_NODATA
Definition cme.h:362
double const TOLERANCE
Definition cme.h:698
int const VECTOR_PLOT_STORM_SURGE
Definition cme.h:569
int const VECTOR_PLOT_BREAKING_WAVE_HEIGHT
Definition cme.h:554
int const VECTOR_PLOT_POLYGON_NODES
Definition cme.h:564
int const FLOOD_LOCATION_POINT_GEOMETRY
Definition cme.h:484
int const VECTOR_PLOT_NORMALS
Definition cme.h:562
string const VECTOR_WAVE_ANGLE_AND_HEIGHT_NAME
Definition cme.h:1018
int const SEDIMENT_INPUT_EVENT_LOCATION_MAX_LAYER
Definition cme.h:482
string const VECTOR_POLYGON_BOUNDARY_NAME
Definition cme.h:1030
int const SEDIMENT_INPUT_EVENT_LOCATION_VEC
Definition cme.h:481
string const ERR
Definition cme.h:775
int const RTN_ERR_WAVESTATION_LOCATION
Definition cme.h:644
string const VECTOR_BREAKING_WAVE_HEIGHT_NAME
Definition cme.h:1026
int const VECTOR_PLOT_DOWNDRIFT_BOUNDARY
Definition cme.h:559
int const VECTOR_PLOT_COAST_CURVATURE
Definition cme.h:557
string const VECTOR_COAST_NAME
Definition cme.h:1010
string const VECTOR_SHADOW_BOUNDARY_NAME
Definition cme.h:1034
bool bFPIsEqual(const T d1, const T d2, const T dEpsilon)
Definition cme.h:1176
int const VECTOR_PLOT_RUN_UP
Definition cme.h:570
int const VECTOR_PLOT_INVALID_NORMALS
Definition cme.h:560
string const FLOOD_LOCATION_ID
Definition cme.h:812
string const VECTOR_STORM_SURGE_NAME
Definition cme.h:1042
int const FLOOD_LOCATION_VEC
Definition cme.h:486
int const DEEP_WATER_WAVE_STATIONS_VEC
Definition cme.h:478
int const RTN_ERR_SEDIMENT_INPUT_EVENT_LOCATION
Definition cme.h:643
string const DEEP_WATER_WAVE_STATION_ID
Definition cme.h:807
string const VECTOR_AVG_WAVE_ANGLE_AND_HEIGHT_NAME
Definition cme.h:1019
string const VECTOR_RUN_UP_NAME
Definition cme.h:1044
int const VECTOR_PLOT_COAST
Definition cme.h:556
int const VECTOR_PLOT_FLOOD_LINE
Definition cme.h:571
string const VECTOR_FLOOD_LINE_NAME
Definition cme.h:1046
string const VECTOR_CLIFF_NOTCH_SIZE_NAME
Definition cme.h:1032
int const DEEP_WATER_WAVE_STATIONS_POINT_GEOMETRY
Definition cme.h:480
int const VECTOR_PLOT_CLIFF_NOTCH_SIZE
Definition cme.h:555
int const RTN_ERR_VECTOR_FILE_READ
Definition cme.h:592
string const VECTOR_WAVE_ENERGY_SINCE_COLLAPSE_NAME
Definition cme.h:1022
int const VEC_GEOMETRY_POLYGON
Definition cme.h:474
int const VECTOR_PLOT_WAVE_ENERGY_SINCE_COLLAPSE
Definition cme.h:567
string const WARN
Definition cme.h:776
int const VECTOR_PLOT_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:566
string const VECTOR_DEEP_WATER_WAVE_ANGLE_AND_HEIGHT_NAME
Definition cme.h:1038
int const SEDIMENT_INPUT_EVENT_LOCATION_LINE_GEOMETRY
Definition cme.h:485
string const SEDIMENT_INPUT_EVENT_LOCATION_ID
Definition cme.h:811
int const VECTOR_PLOT_POLYGON_BOUNDARY
Definition cme.h:563
int const VEC_GEOMETRY_LINE
Definition cme.h:473
int const VECTOR_PLOT_MEAN_WAVE_ENERGY
Definition cme.h:561
int const RTN_OK
Definition cme.h:577
int const VEC_GEOMETRY_POINT
Definition cme.h:472
double const DBL_NODATA
Definition cme.h:707
string const VECTOR_COAST_CURVATURE_NAME
Definition cme.h:1016
int const VECTOR_PLOT_AVG_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:553
int const VECTOR_PLOT_DEEP_WATER_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:558
string const VECTOR_INVALID_NORMALS_NAME
Definition cme.h:1014
int const SEDIMENT_INPUT_EVENT_LOCATION_POINT_GEOMETRY
Definition cme.h:483
int const VECTOR_PLOT_WAVE_SETUP
Definition cme.h:568
int const LF_CAT_CLIFF
Definition cme.h:429
int const VEC_GEOMETRY_OTHER
Definition cme.h:475
int const DEEP_WATER_WAVE_STATIONS_MAX_LAYER
Definition cme.h:479
int const FLOOD_LOCATION_MAX_LAYER
Definition cme.h:487
string const VECTOR_POLYGON_NODE_NAME
Definition cme.h:1028
string const VECTOR_DOWNDRIFT_BOUNDARY_NAME
Definition cme.h:1036
string const VECTOR_NORMALS_NAME
Definition cme.h:1012
string const VECTOR_WAVE_SETUP_NAME
Definition cme.h:1040
int const VECTOR_PLOT_SHADOW_BOUNDARY
Definition cme.h:565
string const VECTOR_MEAN_WAVE_ENERGY_NAME
Definition cme.h:1024
char const SPACE
Definition cme.h:341
Contains CRWCoast definitions.
Contains CSimulation definitions.