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 = "HitIntervention";
843 string strFieldValue6 = "HitCoast";
844 string strFieldValue7 = "HitNormal";
845 string strFieldValue8 = "CShore";
846
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);
854
855 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
856 {
857 cerr << ERR << "cannot create " << strType << " attribute field 2 '" << strFieldValue2 << "' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
858 return false;
859 }
860 if (pOGRLayer->CreateField(&OGRField3) != OGRERR_NONE)
861 {
862 cerr << ERR << "cannot create " << strType << " attribute field 3 '" << strFieldValue3 << "' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
863 return false;
864 }
865 if (pOGRLayer->CreateField(&OGRField4) != OGRERR_NONE)
866 {
867 cerr << ERR << "cannot create " << strType << " attribute field 4 '" << strFieldValue4 << "' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
868 return false;
869 }
870 if (pOGRLayer->CreateField(&OGRField5) != OGRERR_NONE)
871 {
872 cerr << ERR << "cannot create " << strType << " attribute field 5 '" << strFieldValue5 << "' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
873 return false;
874 }
875 if (pOGRLayer->CreateField(&OGRField6) != OGRERR_NONE)
876 {
877 cerr << ERR << "cannot create " << strType << " attribute field 6 '" << strFieldValue6 << "' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
878 return false;
879 }
880 if (pOGRLayer->CreateField(&OGRField7) != OGRERR_NONE)
881 {
882 cerr << ERR << "cannot create " << strType << " attribute field 7 '" << strFieldValue7 << "' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
883 return false;
884 }
885 if (pOGRLayer->CreateField(&OGRField8) != OGRERR_NONE)
886 {
887 cerr << ERR << "cannot create " << strType << " attribute field 8 '" << strFieldValue8 << "' in " << strFilePathName << endl << CPLGetLastErrorMsg() << endl;
888 return false;
889 }
890
891 // OK, now create features
892 OGRLineString OGRls;
893
894 for (int i = 0; i < static_cast<int>(m_VCoast.size()); i++)
895 {
896 for (int j = 0; j < m_VCoast[i].nGetNumProfiles(); j++)
897 {
898 CGeomProfile* pProfile = m_VCoast[i].pGetProfile(j);
899
900 if (((nDataItem == VECTOR_PLOT_NORMALS) && (pProfile->bOKIncStartAndEndOfCoast())) || ((nDataItem == VECTOR_PLOT_INVALID_NORMALS) && (! pProfile->bOKIncStartAndEndOfCoast())))
901 {
902 // Create a feature object, one per profile
903 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
904
905 // Set the feature's attributes
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);
914 if (pProfile->bStartOfCoast())
915 pOGRFeature->SetField(strFieldValue2.c_str(), 1);
916 if (pProfile->bEndOfCoast())
917 pOGRFeature->SetField(strFieldValue3.c_str(), 1);
918 if (pProfile->bHitLand())
919 pOGRFeature->SetField(strFieldValue4.c_str(), 1);
920 if (pProfile->bHitIntervention())
921 pOGRFeature->SetField(strFieldValue5.c_str(), 1);
922 if (pProfile->bHitCoast())
923 pOGRFeature->SetField(strFieldValue6.c_str(), 1);
924 if (pProfile->bHitAnotherProfile())
925 pOGRFeature->SetField(strFieldValue7.c_str(), 1);
926 if (pProfile->bCShoreProblem())
927 pOGRFeature->SetField(strFieldValue8.c_str(), 1);
928
929 // Now attach a geometry to the feature object
930 for (int k = 0; k < pProfile->nGetProfileSize(); k++)
931 OGRls.addPoint(pProfile->pPtGetPointInProfile(k)->dGetX(), pProfile->pPtGetPointInProfile(k)->dGetY());
932
933 pOGRFeature->SetGeometry(&OGRls);
934 OGRls.empty();
935
936 // Create the feature in the output layer
937 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
938 {
939 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " for coast " << i << " and profile " << j << " in " << strFilePathName << endl
940 << CPLGetLastErrorMsg() << endl;
941 return false;
942 }
943
944 // Tidy up: get rid of the feature object
945 OGRFeature::DestroyFeature(pOGRFeature);
946 }
947 }
948 }
949
950 break;
951 }
952
960 case (VECTOR_PLOT_RUN_UP):
962 {
963 eGType = wkbPoint;
964 strType = "point";
965
966 // The layer has been created, so create a real-numbered value associated with each point
967 string strFieldValue1;
968 if (nDataItem == VECTOR_PLOT_COAST_CURVATURE)
969 strFieldValue1 = "Curve";
970 else if (nDataItem == VECTOR_PLOT_WAVE_ENERGY_SINCE_COLLAPSE)
971 strFieldValue1 = "SC_Energy";
972 else if (nDataItem == VECTOR_PLOT_MEAN_WAVE_ENERGY)
973 strFieldValue1 = "MeanEnergy";
974 else if (nDataItem == VECTOR_PLOT_BREAKING_WAVE_HEIGHT)
975 strFieldValue1 = "Height";
976 else if (nDataItem == VECTOR_PLOT_POLYGON_NODES)
977 strFieldValue1 = "Node";
978 else if (nDataItem == VECTOR_PLOT_CLIFF_NOTCH_SIZE)
979 strFieldValue1 = "Notch";
980 else if (nDataItem == VECTOR_PLOT_WAVE_SETUP)
981 strFieldValue1 = "Wavesetup";
982 else if (nDataItem == VECTOR_PLOT_STORM_SURGE)
983 strFieldValue1 = "Stormsurge";
984 else if (nDataItem == VECTOR_PLOT_RUN_UP)
985 strFieldValue1 = "Runup";
986
987 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTReal);
988 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
989 {
990 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
991 << CPLGetLastErrorMsg() << endl;
992 return false;
993 }
994
995 // OK, now create features
996 OGRLineString OGRls;
997 OGRMultiLineString OGRmls;
998 OGRPoint OGRPt;
999
1000 for (int i = 0; i < static_cast<int>(m_VCoast.size()); i++)
1001 {
1002 for (int j = 0; j < m_VCoast[i].pLGetCoastlineExtCRS()->nGetSize(); j++)
1003 {
1004 // Create a feature object, one per coastline point
1005 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1006
1007 // Set the feature's geometry (in external CRS)
1008 OGRPt.setX(m_VCoast[i].pPtGetCoastlinePointExtCRS(j)->dGetX());
1009 OGRPt.setY(m_VCoast[i].pPtGetCoastlinePointExtCRS(j)->dGetY());
1010 pOGRFeature->SetGeometry(&OGRPt);
1011
1012 if (nDataItem == VECTOR_PLOT_COAST_CURVATURE)
1013 {
1014 double dCurvature = m_VCoast[i].dGetDetailedCurvature(j);
1015 if (bFPIsEqual(dCurvature, DBL_NODATA, TOLERANCE))
1016 continue;
1017
1018 // Set the feature's attribute
1019 pOGRFeature->SetField(strFieldValue1.c_str(), dCurvature);
1020 }
1021 else if (nDataItem == VECTOR_PLOT_WAVE_ENERGY_SINCE_COLLAPSE)
1022 {
1023 // Set the feature's attribute
1024 if (m_VCoast[i].pGetCoastLandform(j) == NULL)
1025 pOGRFeature->SetField(strFieldValue1.c_str(), DBL_NODATA);
1026 else
1027 pOGRFeature->SetField(strFieldValue1.c_str(), m_VCoast[i].pGetCoastLandform(j)->dGetTotAccumWaveEnergy());
1028 }
1029 else if (nDataItem == VECTOR_PLOT_MEAN_WAVE_ENERGY)
1030 {
1031 // Set the feature's attribute
1032 if (m_VCoast[i].pGetCoastLandform(j) == NULL)
1033 pOGRFeature->SetField(strFieldValue1.c_str(), DBL_NODATA);
1034 else
1035 {
1036 double dEnergy = m_VCoast[i].pGetCoastLandform(j)->dGetTotAccumWaveEnergy();
1037 dEnergy *= 24;
1038 dEnergy /= m_dSimElapsed; // Is in energy units per day
1039
1040 pOGRFeature->SetField(strFieldValue1.c_str(), dEnergy);
1041 }
1042 }
1043 else if (nDataItem == VECTOR_PLOT_BREAKING_WAVE_HEIGHT)
1044 {
1045 // Set the feature's attribute
1046 double dHeight = m_VCoast[i].dGetBreakingWaveHeight(j);
1047 pOGRFeature->SetField(strFieldValue1.c_str(), dHeight);
1048 }
1049 else if (nDataItem == VECTOR_PLOT_WAVE_SETUP)
1050 {
1051 // Set the feature's attribute
1052 double dWaveSetupSurge = m_VCoast[i].dGetWaveSetupSurge(j);
1053 pOGRFeature->SetField(strFieldValue1.c_str(), dWaveSetupSurge);
1054 }
1055 // else if (nDataItem == VECTOR_PLOT_STORM_SURGE)
1056 // {
1057 // // Set the feature's attribute
1058 // double dStormSurge = m_VCoast[i].dGetStormSurge(j);
1059 // pOGRFeature->SetField(strFieldValue1.c_str(), dStormSurge);
1060 // }
1061 else if (nDataItem == VECTOR_PLOT_RUN_UP)
1062 {
1063 // Set the feature's attribute
1064 double dRunUp = m_VCoast[i].dGetRunUp(j);
1065 pOGRFeature->SetField(strFieldValue1.c_str(), dRunUp);
1066 }
1067 else if (nDataItem == VECTOR_PLOT_POLYGON_NODES)
1068 {
1069 int nNode = m_VCoast[i].nGetPolygonNode(j);
1070 if (nNode == INT_NODATA)
1071 continue;
1072
1073 // Set the feature's attribute
1074 pOGRFeature->SetField(strFieldValue1.c_str(), nNode);
1075 }
1076 else if (nDataItem == VECTOR_PLOT_CLIFF_NOTCH_SIZE)
1077 {
1078 CACoastLandform* pCoastLandform = m_VCoast[i].pGetCoastLandform(j);
1079 if (pCoastLandform == NULL)
1080 pOGRFeature->SetField(strFieldValue1.c_str(), DBL_NODATA);
1081 else
1082 {
1083 int nCategory = pCoastLandform->nGetLandFormCategory();
1084 double dNotchDepth = 0.0;
1085
1086 if (nCategory == LF_CAT_CLIFF)
1087 {
1088 CRWCliff const* pCliff = reinterpret_cast<CRWCliff*>(pCoastLandform);
1089
1090 // Get attribute values from the cliff object
1091 dNotchDepth = pCliff->dGetNotchDepth();
1092 }
1093
1094 // Set the feature's attribute
1095 pOGRFeature->SetField(strFieldValue1.c_str(), dNotchDepth);
1096 }
1097 }
1098
1099 // Create the feature in the output layer
1100 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1101 {
1102 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " for coast " << i << " point " << j << " in " << strFilePathName << endl
1103 << CPLGetLastErrorMsg() << endl;
1104 return false;
1105 }
1106
1107 // Get rid of the feature object
1108 OGRFeature::DestroyFeature(pOGRFeature);
1109 }
1110 }
1111
1112 break;
1113 }
1114
1116 {
1117 eGType = wkbPoint;
1118 strType = "point";
1119
1120 // The layer has been created, so create real-numbered values associated with each point
1121 string
1122 strFieldValue1 = "Angle",
1123 strFieldValue2 = "Height";
1124
1125 // Create the first field
1126 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTReal);
1127 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1128 {
1129 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
1130 << CPLGetLastErrorMsg() << endl;
1131 return false;
1132 }
1133
1134 // Create the second field
1135 OGRFieldDefn OGRField2(strFieldValue2.c_str(), OFTReal);
1136 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1137 {
1138 cerr << ERR << "cannot create " << strType << " attribute field 2 '" << strFieldValue2 << "' in " << strFilePathName << endl
1139 << CPLGetLastErrorMsg() << endl;
1140 return false;
1141 }
1142
1143 // OK, now create features
1144 OGRLineString OGRls;
1145 OGRMultiLineString OGRmls;
1146 OGRPoint OGRPt;
1147
1148 for (int nX = 0; nX < m_nXGridSize; nX++)
1149 {
1150 for (int nY = 0; nY < m_nYGridSize; nY++)
1151 {
1152 // 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)
1153 if ((m_pRasterGrid->m_Cell[nX][nY].bIsInContiguousSea()) && (! m_pRasterGrid->m_Cell[nX][nY].bIsInActiveZone()))
1154 {
1155 // Create a feature object, one per sea cell
1156 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1157
1158 // Set the feature's geometry (in external CRS)
1159 OGRPt.setX(dGridCentroidXToExtCRSX(nX));
1160 OGRPt.setY(dGridCentroidYToExtCRSY(nY));
1161 pOGRFeature->SetGeometry(&OGRPt);
1162
1163 double
1164 dOrientation = m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle(),
1165 dHeight = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1166
1167 if (bFPIsEqual(dHeight, DBL_NODATA, TOLERANCE) || bFPIsEqual(dOrientation, DBL_NODATA, TOLERANCE))
1168 continue;
1169
1170 // Set the feature's attributes
1171 pOGRFeature->SetField(strFieldValue1.c_str(), dOrientation);
1172 pOGRFeature->SetField(strFieldValue2.c_str(), dHeight);
1173
1174 // Create the feature in the output layer
1175 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1176 {
1177 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " for cell [" << nX << "][" << nY << "] in " << strFilePathName << endl
1178 << CPLGetLastErrorMsg() << endl;
1179 return false;
1180 }
1181
1182 // Get rid of the feature object
1183 OGRFeature::DestroyFeature(pOGRFeature);
1184 }
1185 }
1186 }
1187
1188 break;
1189 }
1190
1192 {
1193 eGType = wkbPoint;
1194 strType = "point";
1195
1196 // The layer has been created, so create real-numbered values associated with each point
1197 string
1198 strFieldValue1 = "Angle",
1199 strFieldValue2 = "Height";
1200
1201 // Create the first field
1202 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTReal);
1203 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1204 {
1205 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
1206 << CPLGetLastErrorMsg() << endl;
1207 return false;
1208 }
1209
1210 // Create the second field
1211 OGRFieldDefn OGRField2(strFieldValue2.c_str(), OFTReal);
1212 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1213 {
1214 cerr << ERR << "cannot create " << strType << " attribute field 2 '" << strFieldValue2 << "' in " << strFilePathName << endl
1215 << CPLGetLastErrorMsg() << endl;
1216 return false;
1217 }
1218
1219 // OK, now create features
1220 OGRLineString OGRls;
1221 OGRMultiLineString OGRmls;
1222 OGRPoint OGRPt;
1223
1224 for (int nX = 0; nX < m_nXGridSize; nX++)
1225 {
1226 for (int nY = 0; nY < m_nYGridSize; nY++)
1227 {
1228 // Create a feature object, one per sea cell
1229 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1230
1231 // Set the feature's geometry (in external CRS)
1232 OGRPt.setX(dGridCentroidXToExtCRSX(nX));
1233 OGRPt.setY(dGridCentroidYToExtCRSY(nY));
1234 pOGRFeature->SetGeometry(&OGRPt);
1235
1236 double
1237 dOrientation = m_pRasterGrid->m_Cell[nX][nY].dGetTotWaveAngle() / static_cast<double>(m_ulIter),
1238 dHeight = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight() / static_cast<double>(m_ulIter);
1239
1240 if (bFPIsEqual(dHeight, DBL_NODATA, TOLERANCE) || bFPIsEqual(dOrientation, DBL_NODATA, TOLERANCE))
1241 continue;
1242
1243 // Set the feature's attributes
1244 pOGRFeature->SetField(strFieldValue1.c_str(), dOrientation);
1245 pOGRFeature->SetField(strFieldValue2.c_str(), dHeight);
1246
1247 // Create the feature in the output layer
1248 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1249 {
1250 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " for cell [" << nX << "][" << nY << "] in " << strFilePathName << endl
1251 << CPLGetLastErrorMsg() << endl;
1252 return false;
1253 }
1254
1255 // Get rid of the feature object
1256 OGRFeature::DestroyFeature(pOGRFeature);
1257 }
1258 }
1259
1260 break;
1261 }
1262
1264 {
1265 eGType = wkbPolygon;
1266 strType = "polygon";
1267
1268 // 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
1269 string
1270 strFieldValue1 = "Polygon",
1271 strFieldValue2 = "CoastNode",
1272 strFieldValue3 = "TotSedChng",
1273 strFieldValue4 = "FinSedChng",
1274 strFieldValue5 = "SndSedChng",
1275 strFieldValue6 = "CrsSedChng";
1276
1277 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTInteger);
1278 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1279 {
1280 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
1281 << CPLGetLastErrorMsg() << endl;
1282 return false;
1283 }
1284
1285 OGRFieldDefn OGRField2(strFieldValue2.c_str(), OFTInteger);
1286 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1287 {
1288 cerr << ERR << "cannot create " << strType << " attribute field 2 '" << strFieldValue2 << "' in " << strFilePathName << endl
1289 << CPLGetLastErrorMsg() << endl;
1290 return false;
1291 }
1292
1293 OGRFieldDefn OGRField3(strFieldValue3.c_str(), OFTReal);
1294 if (pOGRLayer->CreateField(&OGRField3) != OGRERR_NONE)
1295 {
1296 cerr << ERR << "cannot create " << strType << " attribute field 3 '" << strFieldValue3 << "' in " << strFilePathName << endl
1297 << CPLGetLastErrorMsg() << endl;
1298 return false;
1299 }
1300
1301 OGRFieldDefn OGRField4(strFieldValue4.c_str(), OFTReal);
1302 if (pOGRLayer->CreateField(&OGRField4) != OGRERR_NONE)
1303 {
1304 cerr << ERR << "cannot create " << strType << " attribute field 4 '" << strFieldValue4 << "' in " << strFilePathName << endl
1305 << CPLGetLastErrorMsg() << endl;
1306 return false;
1307 }
1308
1309 OGRFieldDefn OGRField5(strFieldValue5.c_str(), OFTReal);
1310 if (pOGRLayer->CreateField(&OGRField5) != OGRERR_NONE)
1311 {
1312 cerr << ERR << "cannot create " << strType << " attribute field 5 '" << strFieldValue5 << "' in " << strFilePathName << endl
1313 << CPLGetLastErrorMsg() << endl;
1314 return false;
1315 }
1316
1317 OGRFieldDefn OGRField6(strFieldValue6.c_str(), OFTReal);
1318 if (pOGRLayer->CreateField(&OGRField6) != OGRERR_NONE)
1319 {
1320 cerr << ERR << "cannot create " << strType << " attribute field 6 '" << strFieldValue6 << "' in " << strFilePathName << endl
1321 << CPLGetLastErrorMsg() << endl;
1322 return false;
1323 }
1324
1325 // OK, now do features
1326 OGRLineString OGRls;
1327
1328 for (int i = 0; i < static_cast<int>(m_VCoast.size()); i++)
1329 {
1330 for (int j = 0; j < m_VCoast[i].nGetNumPolygons(); j++)
1331 {
1332 // Create a feature object, one per polygon
1333 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1334
1335 CGeomCoastPolygon* pPolygon = m_VCoast[i].pGetPolygon(j);
1336
1337 // Set the feature's attributes
1338 pOGRFeature->SetField(strFieldValue1.c_str(), j);
1339 pOGRFeature->SetField(strFieldValue2.c_str(), pPolygon->nGetNodeCoastPoint());
1340 pOGRFeature->SetField(strFieldValue3.c_str(), pPolygon->dGetBeachDepositionAndSuspensionAllUncons());
1341 pOGRFeature->SetField(strFieldValue4.c_str(), pPolygon->dGetSuspensionUnconsFine());
1342 pOGRFeature->SetField(strFieldValue5.c_str(), pPolygon->dGetBeachDepositionUnconsSand());
1343 pOGRFeature->SetField(strFieldValue6.c_str(), pPolygon->dGetBeachDepositionUnconsCoarse());
1344
1345 // Now attach a geometry to the feature object
1346 for (int n = 0; n < pPolygon->nGetBoundarySize(); n++)
1347 // In external CRS
1348 OGRls.addPoint(pPolygon->pPtGetBoundaryPoint(n)->dGetX(), pPolygon->pPtGetBoundaryPoint(n)->dGetY());
1349
1350 pOGRFeature->SetGeometry(&OGRls);
1351
1352 // Create the feature in the output layer
1353 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1354 {
1355 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " for coast " << i << " polygon " << j << " in " << strFilePathName << endl
1356 << CPLGetLastErrorMsg() << endl;
1357 return false;
1358 }
1359
1360 // Tidy up: empty the line string and get rid of the feature object
1361 OGRls.empty();
1362 OGRFeature::DestroyFeature(pOGRFeature);
1363 }
1364 }
1365
1366 break;
1367 }
1368
1370 {
1371 eGType = wkbLineString;
1372 strType = "line";
1373
1374 // Create an integer-numbered value (the number of the shadow boundary line object) for the multi-line
1375 string strFieldValue1 = "ShadowLine";
1376 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTInteger);
1377 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1378 {
1379 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
1380 << CPLGetLastErrorMsg() << endl;
1381 return false;
1382 }
1383
1384 // OK, now do features
1385 OGRLineString OGRls;
1386
1387 for (int i = 0; i < static_cast<int>(m_VCoast.size()); i++)
1388 {
1389 for (int j = 0; j < m_VCoast[i].nGetNumShadowBoundaries(); j++)
1390 {
1391 // Create a feature object, one per coast
1392 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1393
1394 // Set the feature's attribute (the shadow boundary line number)
1395 pOGRFeature->SetField(strFieldValue1.c_str(), j);
1396
1397 // Now attach a geometry to the feature object
1398 CGeomLine LShadow = *m_VCoast[i].pGetShadowBoundary(j);
1399 for (int nn = 0; nn < LShadow.nGetSize(); nn++)
1400 OGRls.addPoint(LShadow.dGetXAt(nn), LShadow.dGetYAt(nn));
1401
1402 pOGRFeature->SetGeometry(&OGRls);
1403
1404 // Create the feature in the output layer
1405 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1406 {
1407 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << j << " for coast " << i << " in " << strFilePathName << endl
1408 << CPLGetLastErrorMsg() << endl;
1409 return false;
1410 }
1411
1412 // Tidy up: empty the line string and get rid of the feature object
1413 OGRls.empty();
1414 OGRFeature::DestroyFeature(pOGRFeature);
1415 }
1416 }
1417
1418 break;
1419 }
1420
1422 {
1423 eGType = wkbLineString;
1424 strType = "line";
1425
1426 // Create an integer-numbered value (the number of the downdrift boundary line object) for the multi-line
1427 string strFieldValue1 = "DdriftLine";
1428 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTInteger);
1429 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1430 {
1431 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
1432 << CPLGetLastErrorMsg() << endl;
1433 return false;
1434 }
1435
1436 // OK, now do features
1437 OGRLineString OGRls;
1438
1439 for (int i = 0; i < static_cast<int>(m_VCoast.size()); i++)
1440 {
1441 for (int j = 0; j < m_VCoast[i].nGetNumShadowDowndriftBoundaries(); j++)
1442 {
1443 // Create a feature object, one per coast
1444 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1445
1446 // Set the feature's attribute (the downdrift boundary line number)
1447 pOGRFeature->SetField(strFieldValue1.c_str(), j);
1448
1449 // Now attach a geometry to the feature object
1450 CGeomLine LDowndrift = *m_VCoast[i].pGetShadowDowndriftBoundary(j);
1451 for (int nn = 0; nn < LDowndrift.nGetSize(); nn++)
1452 OGRls.addPoint(LDowndrift.dGetXAt(nn), LDowndrift.dGetYAt(nn));
1453
1454 pOGRFeature->SetGeometry(&OGRls);
1455
1456 // Create the feature in the output layer
1457 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1458 {
1459 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << j << " for coast " << i << " in " << strFilePathName << endl
1460 << CPLGetLastErrorMsg() << endl;
1461 return false;
1462 }
1463
1464 // Tidy up: empty the line string and get rid of the feature object
1465 OGRls.empty();
1466 OGRFeature::DestroyFeature(pOGRFeature);
1467 }
1468 }
1469
1470 break;
1471 }
1472
1474 {
1475 eGType = wkbPoint;
1476 strType = "point";
1477
1478 // The layer has been created, so create real-numbered values associated with each point
1479 string
1480 strFieldValue1 = "Angle",
1481 strFieldValue2 = "Height";
1482
1483 // Create the first field
1484 OGRFieldDefn OGRField1(strFieldValue1.c_str(), OFTReal);
1485 if (pOGRLayer->CreateField(&OGRField1) != OGRERR_NONE)
1486 {
1487 cerr << ERR << "cannot create " << strType << " attribute field 1 '" << strFieldValue1 << "' in " << strFilePathName << endl
1488 << CPLGetLastErrorMsg() << endl;
1489 return false;
1490 }
1491
1492 // Create the second field
1493 OGRFieldDefn OGRField2(strFieldValue2.c_str(), OFTReal);
1494 if (pOGRLayer->CreateField(&OGRField2) != OGRERR_NONE)
1495 {
1496 cerr << ERR << "cannot create " << strType << " attribute field 2 '" << strFieldValue2 << "' in " << strFilePathName << endl
1497 << CPLGetLastErrorMsg() << endl;
1498 return false;
1499 }
1500
1501 // OK, now create features
1502 OGRLineString OGRls;
1503 OGRMultiLineString OGRmls;
1504 OGRPoint OGRPt;
1505
1506 for (int nX = 0; nX < m_nXGridSize; nX++)
1507 {
1508 for (int nY = 0; nY < m_nYGridSize; nY++)
1509 {
1510 // Create a feature object, one per cell (does this whether the sea is a sea cell or a land cell)
1511 OGRFeature* pOGRFeature = OGRFeature::CreateFeature(pOGRLayer->GetLayerDefn());
1512
1513 // Set the feature's geometry (in external CRS)
1514 OGRPt.setX(dGridCentroidXToExtCRSX(nX));
1515 OGRPt.setY(dGridCentroidYToExtCRSY(nY));
1516 pOGRFeature->SetGeometry(&OGRPt);
1517
1518 double dOrientation = m_pRasterGrid->m_Cell[nX][nY].dGetCellDeepWaterWaveAngle();
1519 double dHeight = m_pRasterGrid->m_Cell[nX][nY].dGetCellDeepWaterWaveHeight();
1520
1521 if (bFPIsEqual(dHeight, DBL_NODATA, TOLERANCE) || bFPIsEqual(dOrientation, DBL_NODATA, TOLERANCE) || (! m_pRasterGrid->m_Cell[nX][nY].bIsInContiguousSea()))
1522 continue;
1523
1524 // Set the feature's attributes
1525 pOGRFeature->SetField(strFieldValue1.c_str(), dOrientation);
1526 pOGRFeature->SetField(strFieldValue2.c_str(), dHeight);
1527
1528 // Create the feature in the output layer
1529 if (pOGRLayer->CreateFeature(pOGRFeature) != OGRERR_NONE)
1530 {
1531 cerr << ERR << "cannot create " << strType << " feature " << strPlotTitle << " for cell [" << nX << "][" << nY << "] in " << strFilePathName << endl
1532 << CPLGetLastErrorMsg() << endl;
1533 return false;
1534 }
1535
1536 // Get rid of the feature object
1537 OGRFeature::DestroyFeature(pOGRFeature);
1538 }
1539 }
1540 break;
1541 }
1542 }
1543
1544 CPLPopErrorHandler();
1545
1546 // Get rid of the dataset object
1547 GDALClose(pGDALDataSet);
1548
1549 return true;
1550}
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 bHitAnotherProfile(void) const
Returns the switch which indicates whether this profile hits another profile badly.
Definition profile.cpp:205
bool bHitLand(void) const
Returns the switch which indicates whether this profile has hit land.
Definition profile.cpp:145
bool bHitCoast(void) const
Returns the switch which indicates whether this profile has hit a coast.
Definition profile.cpp:169
CGeom2DPoint * pPtGetPointInProfile(int const)
Returns a single point in the profile.
Definition profile.cpp:349
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:246
int nGetProfileSize(void) const
Returns the number of points in the profile.
Definition profile.cpp:342
bool bStartOfCoast(void) const
Returns the switch to indicate whether this is a start-of-coast profile.
Definition profile.cpp:109
bool bEndOfCoast(void) const
Returns the switch to indicate whether this is an end-of-coast profile.
Definition profile.cpp:121
bool bCShoreProblem(void) const
Returns the switch which indicates whether this profile has a CShore problem.
Definition profile.cpp:133
bool bHitIntervention(void) const
Returns the switch which indicates whether this profile has hit an intervention.
Definition profile.cpp:157
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:459
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:414
bool m_bSedimentInputAtPoint
Do we have sediment inputat a point?
Definition simulation.h:369
double m_dThisIterSWL
The still water level for this timestep (this includes tidal changes and any long-term SWL change)
Definition simulation.h:668
CGeomRasterGrid * m_pRasterGrid
Pointer to the raster grid object.
int m_nXGridSize
The size of the grid in the x direction.
Definition simulation.h:429
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:426
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:689
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:432
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:375
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:372
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:635
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:420
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:462
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:554
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:692
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:417
Contains CRWCliff definitions.
This file contains global definitions for CoastalME.
int const INT_NODATA
Definition cme.h:365
double const TOLERANCE
Definition cme.h:699
int const VECTOR_PLOT_STORM_SURGE
Definition cme.h:572
int const VECTOR_PLOT_BREAKING_WAVE_HEIGHT
Definition cme.h:557
int const VECTOR_PLOT_POLYGON_NODES
Definition cme.h:567
int const FLOOD_LOCATION_POINT_GEOMETRY
Definition cme.h:487
int const VECTOR_PLOT_NORMALS
Definition cme.h:565
string const VECTOR_WAVE_ANGLE_AND_HEIGHT_NAME
Definition cme.h:1020
int const SEDIMENT_INPUT_EVENT_LOCATION_MAX_LAYER
Definition cme.h:485
string const VECTOR_POLYGON_BOUNDARY_NAME
Definition cme.h:1032
int const SEDIMENT_INPUT_EVENT_LOCATION_VEC
Definition cme.h:484
string const ERR
Definition cme.h:777
int const RTN_ERR_WAVESTATION_LOCATION
Definition cme.h:647
string const VECTOR_BREAKING_WAVE_HEIGHT_NAME
Definition cme.h:1028
int const VECTOR_PLOT_DOWNDRIFT_BOUNDARY
Definition cme.h:562
int const VECTOR_PLOT_COAST_CURVATURE
Definition cme.h:560
string const VECTOR_COAST_NAME
Definition cme.h:1012
string const VECTOR_SHADOW_BOUNDARY_NAME
Definition cme.h:1036
bool bFPIsEqual(const T d1, const T d2, const T dEpsilon)
Definition cme.h:1178
int const VECTOR_PLOT_RUN_UP
Definition cme.h:573
int const VECTOR_PLOT_INVALID_NORMALS
Definition cme.h:563
string const FLOOD_LOCATION_ID
Definition cme.h:814
string const VECTOR_STORM_SURGE_NAME
Definition cme.h:1044
int const FLOOD_LOCATION_VEC
Definition cme.h:489
int const DEEP_WATER_WAVE_STATIONS_VEC
Definition cme.h:481
int const RTN_ERR_SEDIMENT_INPUT_EVENT_LOCATION
Definition cme.h:646
string const DEEP_WATER_WAVE_STATION_ID
Definition cme.h:809
string const VECTOR_AVG_WAVE_ANGLE_AND_HEIGHT_NAME
Definition cme.h:1021
string const VECTOR_RUN_UP_NAME
Definition cme.h:1046
int const VECTOR_PLOT_COAST
Definition cme.h:559
int const VECTOR_PLOT_FLOOD_LINE
Definition cme.h:574
string const VECTOR_FLOOD_LINE_NAME
Definition cme.h:1048
string const VECTOR_CLIFF_NOTCH_SIZE_NAME
Definition cme.h:1034
int const DEEP_WATER_WAVE_STATIONS_POINT_GEOMETRY
Definition cme.h:483
int const VECTOR_PLOT_CLIFF_NOTCH_SIZE
Definition cme.h:558
int const RTN_ERR_VECTOR_FILE_READ
Definition cme.h:595
string const VECTOR_WAVE_ENERGY_SINCE_COLLAPSE_NAME
Definition cme.h:1024
int const VEC_GEOMETRY_POLYGON
Definition cme.h:477
int const VECTOR_PLOT_WAVE_ENERGY_SINCE_COLLAPSE
Definition cme.h:570
string const WARN
Definition cme.h:778
int const VECTOR_PLOT_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:569
string const VECTOR_DEEP_WATER_WAVE_ANGLE_AND_HEIGHT_NAME
Definition cme.h:1040
int const SEDIMENT_INPUT_EVENT_LOCATION_LINE_GEOMETRY
Definition cme.h:488
string const SEDIMENT_INPUT_EVENT_LOCATION_ID
Definition cme.h:813
int const VECTOR_PLOT_POLYGON_BOUNDARY
Definition cme.h:566
int const VEC_GEOMETRY_LINE
Definition cme.h:476
int const VECTOR_PLOT_MEAN_WAVE_ENERGY
Definition cme.h:564
int const RTN_OK
Definition cme.h:580
int const VEC_GEOMETRY_POINT
Definition cme.h:475
double const DBL_NODATA
Definition cme.h:709
string const VECTOR_COAST_CURVATURE_NAME
Definition cme.h:1018
int const VECTOR_PLOT_AVG_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:556
int const VECTOR_PLOT_DEEP_WATER_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:561
string const VECTOR_INVALID_NORMALS_NAME
Definition cme.h:1016
int const SEDIMENT_INPUT_EVENT_LOCATION_POINT_GEOMETRY
Definition cme.h:486
int const VECTOR_PLOT_WAVE_SETUP
Definition cme.h:571
int const LF_CAT_CLIFF
Definition cme.h:432
int const VEC_GEOMETRY_OTHER
Definition cme.h:478
int const DEEP_WATER_WAVE_STATIONS_MAX_LAYER
Definition cme.h:482
int const FLOOD_LOCATION_MAX_LAYER
Definition cme.h:490
string const VECTOR_POLYGON_NODE_NAME
Definition cme.h:1030
string const VECTOR_DOWNDRIFT_BOUNDARY_NAME
Definition cme.h:1038
string const VECTOR_NORMALS_NAME
Definition cme.h:1014
string const VECTOR_WAVE_SETUP_NAME
Definition cme.h:1042
int const VECTOR_PLOT_SHADOW_BOUNDARY
Definition cme.h:568
string const VECTOR_MEAN_WAVE_ENERGY_NAME
Definition cme.h:1026
char const SPACE
Definition cme.h:342
Contains CRWCoast definitions.
Contains CSimulation definitions.