CoastalME (Coastal Modelling Environment)
Simulates the long-term behaviour of complex coastlines
Loading...
Searching...
No Matches
gis_utils.cpp
Go to the documentation of this file.
1
22
23/* ===============================================================================================================================
24
25 This file is part of CoastalME, the Coastal Modelling Environment. CoastalME 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.
26
27 This 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.
28
29 You 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.
30
31===============================================================================================================================*/
32#include <assert.h>
33
34#include <cstdio>
35
36#include <vector>
37using std::vector;
38
39#include <iostream>
40using std::cerr;
41using std::endl;
42using std::ios;
43
44#include <cmath>
45using std::atan2;
46
47#include <cfloat>
48#include <climits>
49#include <cstdint>
50
51#include <cstring>
52using std::strstr;
53
54#include <gdal.h>
55#include <gdal_priv.h>
56#include <cpl_string.h>
57
58#include "cme.h"
59#include "coast.h"
60#include "raster_grid.h"
61#include "2d_point.h"
62#include "2di_point.h"
63
64//===============================================================================================================================
67//===============================================================================================================================
68double CSimulation::dGridCentroidXToExtCRSX(int const nGridX) const
69{
70 // TODO 064
71 return (m_dGeoTransform[0] + (nGridX * m_dGeoTransform[1]) +
72 (m_dGeoTransform[1] / 2));
73}
74
75//===============================================================================================================================
77//===============================================================================================================================
78double CSimulation::dGridCentroidYToExtCRSY(int const nGridY) const
79{
80 // TODO 064
81 return (m_dGeoTransform[3] + (nGridY * m_dGeoTransform[5]) +
82 (m_dGeoTransform[5] / 2));
83}
84
85//===============================================================================================================================
87//===============================================================================================================================
89{
90 // TODO 064
91 double const dX = m_dGeoTransform[0] + (pPtiIn->nGetX() * m_dGeoTransform[1]) + (m_dGeoTransform[1] / 2);
92 double const dY = m_dGeoTransform[3] + (pPtiIn->nGetY() * m_dGeoTransform[5]) + (m_dGeoTransform[5] / 2);
93
94 return CGeom2DPoint(dX, dY);
95}
96
97//===============================================================================================================================
99//===============================================================================================================================
100double CSimulation::dGridXToExtCRSX(double const dGridX) const
101{
102 // TODO 064 Xgeo = GT(0) + Xpixel*GT(1) + Yline*GT(2)
103 return m_dGeoTransform[0] + (dGridX * m_dGeoTransform[1]) - 1;
104}
105
106//===============================================================================================================================
109//===============================================================================================================================
110double CSimulation::dGridYToExtCRSY(double const dGridY) const
111{
112 // TODO 064 Ygeo = GT(3) + Xpixel*GT(4) + Yline*GT(5)
113 return m_dGeoTransform[3] + (dGridY * m_dGeoTransform[5]) - 1;
114}
115
116//===============================================================================================================================
120//===============================================================================================================================
121double CSimulation::dExtCRSXToGridX(double const dExtCRSX) const
122{
123 // TODO 064
124 return ((dExtCRSX - m_dGeoTransform[0]) / m_dGeoTransform[1]) - 1;
125}
126
127//===============================================================================================================================
129//===============================================================================================================================
130double CSimulation::dExtCRSYToGridY(double const dExtCRSY) const
131{
132 // TODO 064
133 return ((dExtCRSY - m_dGeoTransform[3]) / m_dGeoTransform[5]) - 1;
134}
135
136//===============================================================================================================================
138//===============================================================================================================================
140{
141 // TODO 064
142 int const nX = nRound(((pPtIn->dGetX() - m_dGeoTransform[0]) / m_dGeoTransform[1]) - 1);
143 int const nY = nRound(((pPtIn->dGetY() - m_dGeoTransform[3]) / m_dGeoTransform[5]) - 1);
144
145 return CGeom2DIPoint(nX, nY);
146}
147
148//===============================================================================================================================
150//===============================================================================================================================
152{
153 double const dXDist = Pt1->dGetX() - Pt2->dGetX();
154 double const dYDist = Pt1->dGetY() - Pt2->dGetY();
155
156 return hypot(dXDist, dYDist);
157}
158
159//===============================================================================================================================
161//===============================================================================================================================
163 CGeom2DIPoint const *Pti2)
164{
165 double const dXDist = Pti1->nGetX() - Pti2->nGetX();
166 double const dYDist = Pti1->nGetY() - Pti2->nGetY();
167
168 return hypot(dXDist, dYDist);
169}
170
171//===============================================================================================================================
173//===============================================================================================================================
175 CGeom2DPoint const *pPtB,
176 CGeom2DPoint const *pPtC)
177{
178 return (pPtB->dGetX() - pPtA->dGetX()) * (pPtC->dGetY() - pPtA->dGetY()) -
179 (pPtB->dGetY() - pPtA->dGetY()) * (pPtC->dGetX() - pPtA->dGetX());
180}
181
182//===============================================================================================================================
185//===============================================================================================================================
186bool CSimulation::bIsWithinValidGrid(int const nX, int const nY) const
187{
188 if ((nX < 0) || (nX >= m_nXGridSize))
189 return false;
190
191 if ((nY < 0) || (nY >= m_nYGridSize))
192 return false;
193
194 if (m_pRasterGrid->m_Cell[nX][nY].bBasementElevIsMissingValue())
195 return false;
196
197 return true;
198}
199
200//===============================================================================================================================
204//===============================================================================================================================
206{
207 int const nX = Pti->nGetX();
208 int const nY = Pti->nGetY();
209
210 return this->bIsWithinValidGrid(nX, nY);
211}
212
213//===============================================================================================================================
216//===============================================================================================================================
217void CSimulation::KeepWithinValidGrid(int &nX, int &nY) const
218{
219 nX = tMax(nX, 0);
220 nX = tMin(nX, m_nXGridSize - 1);
221
222 nY = tMax(nY, 0);
223 nY = tMin(nY, m_nYGridSize - 1);
224}
225
226//===============================================================================================================================
229//===============================================================================================================================
231 CGeom2DIPoint *Pti1) const
232{
233 KeepWithinValidGrid(Pti0->nGetX(), Pti0->nGetY(), *Pti1->pnGetX(),
234 *Pti1->pnGetY());
235}
236
237//===============================================================================================================================
245//===============================================================================================================================
246void CSimulation::KeepWithinValidGrid(int nX0, int nY0, int &nX1,
247 int &nY1) const
248{
249 // Safety check: make sure that the first point is within the valid grid
250 if (nX0 >= m_nXGridSize)
251 nX0 = m_nXGridSize - 1;
252
253 else if (nX0 < 0)
254 nX0 = 0;
255
256 if (nY0 >= m_nYGridSize)
257 nY0 = m_nYGridSize - 1;
258
259 else if (nY0 < 0)
260 nY0 = 0;
261
262 // OK let's go
263 int const nDiffX = nX0 - nX1;
264 int const nDiffY = nY0 - nY1;
265
266 if (nDiffX == 0)
267 {
268 // The two points have the same x coordinates, so we just need to constrain
269 // the y co-ord
270 if (nY1 < nY0)
271 {
272 nY1 = -1;
273
274 do
275 {
276 nY1++;
277 } while (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue());
278
279 return;
280 }
281
282 else
283 {
284 nY1 = m_nYGridSize;
285
286 do
287 {
288 nY1--;
289 } while (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue());
290
291 return;
292 }
293 }
294
295 else if (nDiffY == 0)
296 {
297 // The two points have the same y coordinates, so we just need to constrain
298 // the x co-ord
299 if (nX1 < nX0)
300 {
301 nX1 = -1;
302
303 do
304 {
305 nX1++;
306 } while (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue());
307
308 return;
309 }
310
311 else
312 {
313 nX1 = m_nXGridSize;
314
315 do
316 {
317 nX1--;
318 } while (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue());
319
320 return;
321 }
322 }
323
324 else
325 {
326 // The two points have different x coordinates and different y coordinates,
327 // so we have to work harder. First find which of the coordinates is the
328 // greatest distance outside the grid, and constrain that co-ord for
329 // efficiency (since this will reduce the number of times round the loop).
330 // Note that both may be inside the grid, if the incorrect co-ord is in the
331 // invalid margin, in which case arbitrarily contrain the x co-ord
332 int nXDistanceOutside = 0;
333 int nYDistanceOutside = 0;
334
335 if (nX1 < 0)
336 nXDistanceOutside = -nX1;
337
338 else if (nX1 >= m_nXGridSize)
339 nXDistanceOutside = nX1 - m_nXGridSize + 1;
340
341 if (nY1 < 0)
342 nYDistanceOutside = -nY1;
343
344 else if (nY1 >= m_nYGridSize)
345 nXDistanceOutside = nY1 - m_nYGridSize + 1;
346
347 if (nXDistanceOutside >= nYDistanceOutside)
348 {
349 // Constrain the x co-ord
350 if (nX1 < nX0)
351 {
352 // The incorrect x co-ord is less than the correct x co-ord: constrain
353 // it and find the y co-ord
354 nX1 = -1;
355
356 do
357 {
358 nX1++;
359
360 nY1 = nY0 +
361 nRound(((nX1 - nX0) * nDiffY) / static_cast<double>(nDiffX));
362 } while (
363 (nY1 < 0) || (nY1 >= m_nYGridSize) ||
364 (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue()));
365
366 return;
367 }
368
369 else
370 {
371 // The incorrect x co-ord is greater than the correct x-co-ord:
372 // constrain it and find the y co-ord
373 nX1 = m_nXGridSize;
374
375 do
376 {
377 nX1--;
378
379 nY1 = nY0 +
380 nRound(((nX1 - nX0) * nDiffY) / static_cast<double>(nDiffX));
381 } while (
382 (nY1 < 0) || (nY1 >= m_nYGridSize) ||
383 (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue()));
384
385 return;
386 }
387 }
388
389 else
390 {
391 // Constrain the y co-ord
392 if (nY1 < nY0)
393 {
394 // The incorrect y co-ord is less than the correct y-co-ord: constrain
395 // it and find the x co-ord
396 nY1 = -1;
397
398 do
399 {
400 nY1++;
401
402 nX1 = nX0 +
403 nRound(((nY1 - nY0) * nDiffX) / static_cast<double>(nDiffY));
404 } while (
405 (nX1 < 0) || (nX1 >= m_nXGridSize) ||
406 (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue()));
407
408 return;
409 }
410
411 else
412 {
413 // The incorrect y co-ord is greater than the correct y co-ord:
414 // constrain it and find the x co-ord
415 nY1 = m_nYGridSize;
416
417 do
418 {
419 nY1--;
420
421 nX1 = nX0 +
422 nRound(((nY1 - nY0) * nDiffX) / static_cast<double>(nDiffY));
423 } while (
424 (nX1 < 0) || (nX1 >= m_nXGridSize) ||
425 (m_pRasterGrid->m_Cell[nX1][nY1].bBasementElevIsMissingValue()));
426
427 return;
428 }
429 }
430 }
431}
432
433//===============================================================================================================================
435//===============================================================================================================================
436double CSimulation::dKeepWithin360(double const dAngle)
437{
438 double dNewAngle = dAngle;
439
440 // Sort out -ve angles
441 while (dNewAngle < 0)
442 dNewAngle += 360;
443
444 // Sort out angles > 360
445 while (dNewAngle > 360)
446 dNewAngle -= 360;
447
448 return dNewAngle;
449}
450
451//===============================================================================================================================
453//===============================================================================================================================
455{
456 double const dPt1X = pPt1->dGetX();
457 double const dPt1Y = pPt1->dGetY();
458 double const dPt2X = pPt2->dGetX();
459 double const dPt2Y = pPt2->dGetY();
460 double const dPtAvgX = (dPt1X + dPt2X) / 2;
461 double const dPtAvgY = (dPt1Y + dPt2Y) / 2;
462
463 return CGeom2DPoint(dPtAvgX, dPtAvgY);
464}
465
466//===============================================================================================================================
468//===============================================================================================================================
470{
471 int nPti1X = pPti1->nGetX();
472 int nPti1Y = pPti1->nGetY();
473 int nPti2X = pPti2->nGetX();
474 int nPti2Y = pPti2->nGetY();
475 int nPtiAvgX = (nPti1X + nPti2X) / 2;
476 int nPtiAvgY = (nPti1Y + nPti2Y) / 2;
477
478 return CGeom2DIPoint(nPtiAvgX, nPtiAvgY);
479}
480
481//===============================================================================================================================
483//===============================================================================================================================
484CGeom2DIPoint CSimulation::PtiWeightedAverage(CGeom2DIPoint const *pPti1, CGeom2DIPoint const *pPti2, double const dWeight)
485{
486 int const nPti1X = pPti1->nGetX();
487 int const nPti1Y = pPti1->nGetY();
488 int const nPti2X = pPti2->nGetX();
489 int const nPti2Y = pPti2->nGetY();
490 double const dOtherWeight = 1.0 - dWeight;
491
492 int const nPtiWeightAvgX = nRound((dWeight * nPti2X) + (dOtherWeight * nPti1X));
493 int const nPtiWeightAvgY = nRound((dWeight * nPti2Y) + (dOtherWeight * nPti1Y));
494
495 return CGeom2DIPoint(nPtiWeightAvgX, nPtiWeightAvgY);
496}
497
498//===============================================================================================================================
500//===============================================================================================================================
501CGeom2DPoint CSimulation::PtAverage(vector<CGeom2DPoint>* pVIn)
502{
503 int const nSize = static_cast<int>(pVIn->size());
504
505 if (nSize == 0)
507
508 double dAvgX = 0;
509 double dAvgY = 0;
510
511 for (int n = 0; n < nSize; n++)
512 {
513 dAvgX += pVIn->at(n).dGetX();
514 dAvgY += pVIn->at(n).dGetY();
515 }
516
517 dAvgX /= nSize;
518 dAvgY /= nSize;
519
520 return CGeom2DPoint(dAvgX, dAvgY);
521}
522
523// //===============================================================================================================================
524// //! Returns a point (grid CRS) which is the average of a vector of grid CRS
525// points
526// //===============================================================================================================================
527// CGeom2DIPoint CSimulation::PtiAverage(vector<CGeom2DIPoint>* pVIn)
528// {
529// int nSize = static_cast<int>(pVIn->size());
530// if (nSize == 0)
531// return CGeom2DIPoint(INT_NODATA, INT_NODATA);
532//
533// double dAvgX = 0;
534// double dAvgY = 0;
535//
536// for (int n = 0; n < nSize; n++)
537// {
538// dAvgX += pVIn->at(n).nGetX();
539// dAvgY += pVIn->at(n).nGetY();
540// }
541//
542// dAvgX /= nSize;
543// dAvgY /= nSize;
544//
545// return CGeom2DIPoint(nRound(dAvgX), nRound(dAvgY));
546// }
547
548//===============================================================================================================================
552//===============================================================================================================================
554{
555 CGeom2DIPoint PtiCentroid(0, 0);
556 int const nSize = static_cast<int>(pVIn->size());
557 int nX0 = 0; // Current vertex X
558 int nY0 = 0; // Current vertex Y
559 int nX1 = 0; // Next vertex X
560 int nY1 = 0; // Next vertex Y
561
562 double dA = 0; // Partial signed area
563 double dSignedArea = 0.0;
564
565 // For all vertices except last
566 for (int i = 0; i < nSize - 1; ++i)
567 {
568 nX0 = pVIn->at(i).nGetX();
569 nY0 = pVIn->at(i).nGetY();
570 nX1 = pVIn->at(i + 1).nGetX();
571 nY1 = pVIn->at(i + 1).nGetY();
572
573 dA = (nX0 * nY1) - (nX1 * nY0);
574 dSignedArea += dA;
575 PtiCentroid.AddXAddY((nX0 + nX1) * dA, (nY0 + nY1) * dA);
576 }
577
578 // Do last vertex separately to avoid performing an expensive modulus
579 // operation in each iteration
580 nX0 = pVIn->at(nSize - 1).nGetX();
581 nY0 = pVIn->at(nSize - 1).nGetY();
582 nX1 = pVIn->at(0).nGetX();
583 nY1 = pVIn->at(0).nGetY();
584
585 dA = (nX0 * nY1) - (nX1 * nY0);
586 dSignedArea += dA;
587 PtiCentroid.AddXAddY((nX0 + nX1) * dA, (nY0 + nY1) * dA);
588
589 dSignedArea *= 0.5;
590 PtiCentroid.DivXDivY(6.0 * dSignedArea, 6.0 * dSignedArea);
591
592 return PtiCentroid;
593}
594
595/* ==============================================================================================================================
596
597 Returns a vector which is perpendicular to an existing vector
598
599===============================================================================================================================*/
600// vector<CGeom2DPoint> CSimulation::VGetPerpendicular(CGeom2DPoint const*
601// PtStart, CGeom2DPoint const* PtNext, double const dDesiredLength, int const
602// nHandedness)
603// {
604// // Returns a two-point vector which passes through PtStart with a scaled
605// length
606// double dXLen = PtNext->dGetX() - PtStart->dGetX();
607// double dYLen = PtNext->dGetY() - PtStart->dGetY();
608//
609// double dLength = hypot(dXLen, dYLen);
610// double dScaleFactor = dDesiredLength / dLength;
611//
612// // The difference vector is (dXLen, dYLen), so the perpendicular
613// difference vector is (-dYLen, dXLen) or (dYLen, -dXLen)
614// CGeom2DPoint EndPt;
615// if (nHandedness == RIGHT_HANDED)
616// {
617// EndPt.SetX(PtStart->dGetX() + (dScaleFactor * dYLen));
618// EndPt.SetY(PtStart->dGetY() - (dScaleFactor * dXLen));
619// }
620// else
621// {
622// EndPt.SetX(PtStart->dGetX() - (dScaleFactor * dYLen));
623// EndPt.SetY(PtStart->dGetY() + (dScaleFactor * dXLen));
624// }
625//
626// vector<CGeom2DPoint> VNew;
627// VNew.push_back(*PtStart);
628// VNew.push_back(EndPt);
629// return VNew;
630// }
631
632//===============================================================================================================================
636//===============================================================================================================================
638 CGeom2DPoint const *PtNext,
639 double const dDesiredLength,
640 int const nHandedness)
641{
642 double const dXLen = PtNext->dGetX() - PtStart->dGetX();
643 double const dYLen = PtNext->dGetY() - PtStart->dGetY();
644 double dLength;
645
646 if (bFPIsEqual(dXLen, 0.0, TOLERANCE))
647 dLength = dYLen;
648
649 else if (bFPIsEqual(dYLen, 0.0, TOLERANCE))
650 dLength = dXLen;
651
652 else
653 dLength = hypot(dXLen, dYLen);
654
655 double const dScaleFactor = dDesiredLength / dLength;
656
657 // The difference vector is (dXLen, dYLen), so the perpendicular difference
658 // vector is (-dYLen, dXLen) or (dYLen, -dXLen)
659 CGeom2DPoint EndPt;
660
661 if (nHandedness == RIGHT_HANDED)
662 {
663 EndPt.SetX(PtStart->dGetX() + (dScaleFactor * dYLen));
664 EndPt.SetY(PtStart->dGetY() - (dScaleFactor * dXLen));
665 }
666
667 else
668 {
669 EndPt.SetX(PtStart->dGetX() - (dScaleFactor * dYLen));
670 EndPt.SetY(PtStart->dGetY() + (dScaleFactor * dXLen));
671 }
672
673 return EndPt;
674}
675
676//===============================================================================================================================
680//===============================================================================================================================
682 CGeom2DIPoint const *PtiNext,
683 double const dDesiredLength,
684 int const nHandedness)
685{
686 double const dXLen = PtiNext->nGetX() - PtiStart->nGetX();
687 double const dYLen = PtiNext->nGetY() - PtiStart->nGetY();
688 double dLength;
689
690 if (bFPIsEqual(dXLen, 0.0, TOLERANCE))
691 dLength = dYLen;
692
693 else if (bFPIsEqual(dYLen, 0.0, TOLERANCE))
694 dLength = dXLen;
695
696 else
697 dLength = hypot(dXLen, dYLen);
698
699 double const dScaleFactor = dDesiredLength / dLength;
700
701 // The difference vector is (dXLen, dYLen), so the perpendicular difference
702 // vector is (-dYLen, dXLen) or (dYLen, -dXLen)
703 CGeom2DIPoint EndPti;
704
705 if (nHandedness == RIGHT_HANDED)
706 {
707 EndPti.SetX(PtiStart->nGetX() + nRound(dScaleFactor * dYLen));
708 EndPti.SetY(PtiStart->nGetY() - nRound(dScaleFactor * dXLen));
709 }
710
711 else
712 {
713 EndPti.SetX(PtiStart->nGetX() - nRound(dScaleFactor * dYLen));
714 EndPti.SetY(PtiStart->nGetY() + nRound(dScaleFactor * dXLen));
715 }
716
717 return EndPti;
718}
719
720//===============================================================================================================================
724//===============================================================================================================================
726 int const nStartX, int const nStartY, int const nNextX, int const nNextY,
727 double const dDesiredLength, int const nHandedness)
728{
729 double const dXLen = nNextX - nStartX;
730 double const dYLen = nNextY - nStartY;
731 double dLength;
732
733 if (bFPIsEqual(dXLen, 0.0, TOLERANCE))
734 dLength = dYLen;
735
736 else if (bFPIsEqual(dYLen, 0.0, TOLERANCE))
737 dLength = dXLen;
738
739 else
740 dLength = hypot(dXLen, dYLen);
741
742 double const dScaleFactor = dDesiredLength / dLength;
743
744 // The difference vector is (dXLen, dYLen), so the perpendicular difference
745 // vector is (-dYLen, dXLen) or (dYLen, -dXLen)
746 CGeom2DIPoint EndPti;
747
748 if (nHandedness == RIGHT_HANDED)
749 {
750 EndPti.SetX(nStartX + nRound(dScaleFactor * dYLen));
751 EndPti.SetY(nStartY - nRound(dScaleFactor * dXLen));
752 }
753
754 else
755 {
756 EndPti.SetX(nStartX - nRound(dScaleFactor * dYLen));
757 EndPti.SetY(nStartY + nRound(dScaleFactor * dXLen));
758 }
759
760 return EndPti;
761}
762
763//===============================================================================================================================
767//===============================================================================================================================
769 CGeom2DIPoint const *pPtiB,
770 CGeom2DIPoint const *pPtiC)
771{
772 double const dXDistBtoA = pPtiB->nGetX() - pPtiA->nGetX();
773 double const dYDistBtoA = pPtiB->nGetY() - pPtiA->nGetY();
774 double const dXDistCtoA = pPtiC->nGetX() - pPtiA->nGetX();
775 double const dYDistCtoA = pPtiC->nGetY() - pPtiA->nGetY();
776 double const dDotProduct = dXDistBtoA * dXDistCtoA + dYDistBtoA * dYDistCtoA;
777 double const dPseudoCrossProduct = dXDistBtoA * dYDistCtoA - dYDistBtoA * dXDistCtoA;
778 double const dAngle = atan2(dPseudoCrossProduct, dDotProduct);
779
780 return dAngle;
781}
782
783//===============================================================================================================================
786//===============================================================================================================================
788{
789 // Register all available GDAL raster and vector drivers (GDAL 2)
790 GDALAllRegister();
791
792 // If the user hasn't specified a GIS output format, assume that we will use
793 // the same GIS format as the input basement DEM
794 if (m_strRasterGISOutFormat.empty())
796
797 // Load the raster GDAL driver
798 GDALDriver *pDriver =
799 GetGDALDriverManager()->GetDriverByName(m_strRasterGISOutFormat.c_str());
800
801 if (NULL == pDriver)
802 {
803 // Can't load raster GDAL driver. Incorrectly specified?
804 cerr << ERR << "Unknown raster GIS output format '"
805 << m_strRasterGISOutFormat << "'." << endl;
806 return false;
807 }
808
809 // Get the metadata for this raster driver
810 char **papszMetadata = pDriver->GetMetadata();
811
812 // for (int i = 0; papszMetadata[i] != NULL; i++)
813 // cout << papszMetadata[i] << endl;
814 // cout << endl;
815
816 // Need to test if this is a raster driver
817 if (!CSLFetchBoolean(papszMetadata, GDAL_DCAP_RASTER, false))
818 {
819 // This is not a raster driver
820 cerr << ERR << "GDAL driver '" << m_strRasterGISOutFormat
821 << "' is not a raster driver. Choose another format." << endl;
822 return false;
823 }
824
825 // This driver is OK, so store its longname and the default file extension
826 string strTmp = CSLFetchNameValue(papszMetadata, "DMD_LONGNAME");
828 strTmp = CSLFetchNameValue(
829 papszMetadata,
830 "DMD_EXTENSIONS"); // Note DMD_EXTENSION (no S, is a single value) appears
831 // not to be implemented for newer drivers
832 strTmp = strTrim(&strTmp);
833
834 // We have a space-separated list of one or more file extensions: use the first extension in the list
835 long unsigned int const nPos = strTmp.find(SPACE);
836
837 if (nPos == string::npos)
838 {
839 // No space i.e. just one extension
841 }
842
843 else
844 {
845 // There's a space, so we must have more than one extension
846 m_strGDALRasterOutputDriverExtension = strTmp.substr(0, nPos);
847 }
848
849 // Set up any defaults for raster files that are created using this driver
851
852 // Now do various tests of the driver's capabilities
853 if (!CSLFetchBoolean(papszMetadata, GDAL_DCAP_CREATE, false))
854 {
855 // This raster driver does not support the Create() method, does it support CreateCopy()?
856 if (!CSLFetchBoolean(papszMetadata, GDAL_DCAP_CREATECOPY, false))
857 {
858 cerr << ERR << "Cannot write using raster GDAL driver '"
860 << " since neither Create() or CreateCopy() are supported'. Choose "
861 "another GDAL raster format."
862 << endl;
863 return false;
864 }
865
866 // Can't use Create() but can use CreateCopy()
867 m_bGDALCanCreate = false;
868 }
869
870 // Next, test to see what data types the driver can write and from this, work
871 // out the largest int and float we can write
872 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"),
873 "Float"))
874 {
876 m_GDALWriteFloatDataType = GDT_Float32;
877 }
878
879 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"),
880 "UInt32"))
881 {
883
884 m_GDALWriteIntDataType = GDT_UInt32;
885 m_lGDALMaxCanWrite = UINT32_MAX;
887
889 m_GDALWriteFloatDataType = GDT_UInt32;
890
891 return true;
892 }
893
894 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"),
895 "Int32"))
896 {
898
899 m_GDALWriteIntDataType = GDT_Int32;
900 m_lGDALMaxCanWrite = INT32_MAX;
901 m_lGDALMinCanWrite = INT32_MIN;
902
904 m_GDALWriteFloatDataType = GDT_Int32;
905
906 return true;
907 }
908
909 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"),
910 "UInt16"))
911 {
912 m_bGDALCanWriteInt32 = false;
913
914 m_GDALWriteIntDataType = GDT_UInt16;
915 m_lGDALMaxCanWrite = UINT16_MAX;
917
919 m_GDALWriteFloatDataType = GDT_UInt16;
920
921 return true;
922 }
923
924 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"),
925 "Int16"))
926 {
927 m_bGDALCanWriteInt32 = false;
928
929 m_GDALWriteIntDataType = GDT_Int16;
930 m_lGDALMaxCanWrite = INT16_MAX;
931 m_lGDALMinCanWrite = INT16_MIN;
932
934 m_GDALWriteFloatDataType = GDT_Int16;
935
936 return true;
937 }
938
939 if (strstr(CSLFetchNameValue(papszMetadata, "DMD_CREATIONDATATYPES"),
940 "Byte"))
941 {
942 m_bGDALCanWriteInt32 = false;
943
944 m_GDALWriteIntDataType = GDT_Byte;
945 m_lGDALMaxCanWrite = UINT8_MAX;
947
949 m_GDALWriteFloatDataType = GDT_Byte;
950
951 return true;
952 }
953
954 // This driver does not even support byte output
955 cerr << ERR << "Cannot write using raster GDAL driver '"
957 << ", not even byte output is supported'. Choose another GIS raster "
958 "format."
959 << endl;
960 return false;
961}
962
963//===============================================================================================================================
965//===============================================================================================================================
967{
968 // Load the vector GDAL driver (this assumes that GDALAllRegister() has
969 // already been called)
970 GDALDriver *pDriver =
971 GetGDALDriverManager()->GetDriverByName(m_strVectorGISOutFormat.c_str());
972
973 if (NULL == pDriver)
974 {
975 // Can't load vector GDAL driver. Incorrectly specified?
976 cerr << ERR << "Unknown vector GIS output format '"
977 << m_strVectorGISOutFormat << "'." << endl;
978 return false;
979 }
980
981 // Get the metadata for this vector driver
982 char **papszMetadata = pDriver->GetMetadata();
983
984 // For GDAL2, need to test if this is a vector driver
985 if (!CSLFetchBoolean(papszMetadata, GDAL_DCAP_VECTOR, false))
986 {
987 // This is not a vector driver
988 cerr << ERR << "GDAL driver '" << m_strVectorGISOutFormat
989 << "' is not a vector driver. Choose another format." << endl;
990 return false;
991 }
992
993 if (!CSLFetchBoolean(papszMetadata, GDAL_DCAP_CREATE, false))
994 {
995 // Driver does not support create() method
996 cerr << ERR << "Cannot write vector GIS files using GDAL driver '"
997 << m_strRasterGISOutFormat << "'. Choose another format." << endl;
998 return false;
999 }
1000
1001 // Driver is OK, now set some options for individual drivers
1002 if (m_strVectorGISOutFormat == "ESRI Shapefile")
1003 {
1004 // Set this, so that just a single dataset-with-one-layer shapefile is
1005 // created, rather than a directory (see
1006 // http://www.gdal.org/ogr/drv_shapefile.html)
1008 }
1009
1010 else if (m_strVectorGISOutFormat == "geojson")
1011 {
1012 m_strOGRVectorOutputExtension = ".geojson";
1013 }
1014
1015 else if (m_strVectorGISOutFormat == "gpkg")
1016 {
1018 }
1019
1020 // TODO 033 Others
1021
1022 return true;
1023}
1024
1025//===============================================================================================================================
1028//===============================================================================================================================
1030{
1031 // Increment file number
1032 m_nGISSave++;
1033
1034 // Set for next save
1035 if (m_bSaveRegular)
1036 {
1038 }
1039
1040 else
1041 {
1042 if (m_nThisSave < m_nUSave - 1)
1043 {
1044 // Still have user-defined save times remaining
1045 m_nThisSave++;
1046 }
1047
1048 else
1049 {
1050 // Finished user-defined times, switch to regular interval using last
1051 // value as interval
1052 double dLastInterval;
1053
1054 if (m_nUSave > 1)
1055 dLastInterval = m_dUSaveTime[m_nUSave - 1] - m_dUSaveTime[m_nUSave - 2];
1056
1057 else
1058 dLastInterval = m_dUSaveTime[m_nUSave - 1];
1059
1060 m_dRegularSaveTime = m_dSimElapsed + dLastInterval;
1061 m_dRegularSaveInterval = dLastInterval;
1062 m_bSaveRegular = true;
1063 }
1064 }
1065
1068 return false;
1069
1070 if (m_bTopSurfSave)
1072 return false;
1073
1076 return false;
1077
1078 if (m_bSlopeSave)
1080 return false;
1081
1082 if (m_bCliffSave)
1084 return false;
1085
1086 if (m_bSeaDepthSave)
1088 return false;
1089
1092 return false;
1093
1094 if (m_bWaveAngleSave)
1096 return false;
1097
1098 // Don't write platform erosion files if there is no platform erosion
1100 {
1103 return false;
1104
1107 return false;
1108
1111 return false;
1112
1115 return false;
1116
1119 return false;
1120
1123 return false;
1124
1127 return false;
1128
1131 return false;
1132
1135 return false;
1136
1139 return false;
1140
1143 return false;
1144
1147 return false;
1148 }
1149
1150 if (m_bLandformSave)
1152 return false;
1153
1156 return false;
1157
1160 return false;
1161
1164 return false;
1165
1168 return false;
1169
1170 // Don't write suspended sediment files if there is no fine sediment
1172 {
1173 if (m_bSuspSedSave)
1175 return false;
1176
1179 return false;
1180 }
1181
1184 return false;
1185
1186 for (int nLayer = 0; nLayer < m_nLayers; nLayer++)
1187 {
1189 {
1191 return false;
1192 }
1193
1195 {
1197 return false;
1198 }
1199
1201 {
1203 return false;
1204 }
1205
1207 {
1209 return false;
1210 }
1211
1213 {
1215 return false;
1216 }
1217
1219 {
1221 return false;
1222 }
1223 }
1224
1225 if (m_bSliceSave)
1226 {
1227 for (int i = 0; i < static_cast<int>(m_VdSliceElev.size()); i++)
1228 {
1230 return false;
1231 }
1232 }
1233
1235 {
1237 return false;
1238 }
1239
1241 {
1243 return false;
1244 }
1245
1247 {
1249 return false;
1250 }
1251
1252 // Don't write cliff collapse files if we aren't considering cliff collapse
1254 {
1256 {
1258 {
1260 return false;
1261 }
1262
1264 {
1266 return false;
1267 }
1268
1270 {
1272 return false;
1273 }
1274 }
1275
1277 {
1279 {
1281 return false;
1282 }
1283
1285 {
1287 return false;
1288 }
1289
1291 {
1293 return false;
1294 }
1295 }
1296
1298 {
1300 {
1302 return false;
1303 }
1304
1306 {
1308 return false;
1309 }
1310 }
1311
1313 {
1315 {
1317 return false;
1318 }
1319
1321 {
1323 return false;
1324 }
1325 }
1326 }
1327
1329 {
1331 return false;
1332 }
1333
1334 if (m_bSeaMaskSave)
1335 {
1337 return false;
1338 }
1339
1340 if (m_bBeachMaskSave)
1341 {
1343 return false;
1344 }
1345
1347 {
1349 return false;
1350 }
1351
1353 {
1355 return false;
1356 }
1357
1359 {
1361 return false;
1362
1364 return false;
1365 }
1366
1368 {
1370 return false;
1371 }
1372
1374 {
1376 return false;
1377 }
1378
1380 {
1382 return false;
1383 }
1384
1386 {
1388 return false;
1389 }
1390
1392 {
1394 return false;
1395 }
1396
1398 {
1400 return false;
1401 }
1402
1404 {
1406 return false;
1407 }
1408
1409 return true;
1410}
1411
1412//===============================================================================================================================
1415//===============================================================================================================================
1417{
1418 // Always written
1419 if (m_bCoastSave)
1420 {
1422 return false;
1423 }
1424
1425 if (m_bCliffEdgeSave)
1426 {
1428 return false;
1429 }
1430
1431 if (m_bNormalsSave)
1432 {
1434 return false;
1435 }
1436
1438 {
1440 return false;
1441 }
1442
1444 {
1446 return false;
1447 }
1448
1450 {
1452 return false;
1453 }
1454
1456 {
1458 return false;
1459 }
1460
1462 {
1464 return false;
1465 }
1466
1468 {
1470 return false;
1471 }
1472
1474 {
1476 return false;
1477 }
1478
1480 {
1482 return false;
1483 }
1484
1486 {
1488 return false;
1489 }
1490
1492 {
1494 return false;
1495 }
1496
1498 {
1500 return false;
1501 }
1502
1504 {
1506 return false;
1507 }
1508
1510 {
1512 return false;
1513 }
1514
1515 if (m_bWaveSetupSave)
1516 {
1518 return false;
1519 }
1520
1522 {
1524 return false;
1525 }
1526
1527 if (m_bRunUpSave)
1528 {
1530 return false;
1531 }
1532
1534 {
1536 return false;
1537
1538 // if (! bWriteVectorGISFile(VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_LINE,
1539 // &VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_LINE_TITLE)) return false;
1540
1541 // if (! bWriteVectorGISFile(VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_RUNUP_LINE,
1542 // &VECTOR_PLOT_FLOOD_SWL_SETUP_SURGE_RUNUP_LINE_TITLE)) return false;
1543 }
1544
1545 return true;
1546}
1547
1548//===============================================================================================================================
1551//===============================================================================================================================
1552void CSimulation::GetRasterOutputMinMax(int const nDataItem, double &dMin,
1553 double &dMax, int const nLayer,
1554 double const dElev)
1555{
1556 // If this is a binary mask layer, we already know the max and min values
1558 (nDataItem == RASTER_PLOT_INUNDATION_MASK) ||
1559 (nDataItem == RASTER_PLOT_BEACH_MASK) ||
1560 (nDataItem == RASTER_PLOT_COAST) ||
1561 (nDataItem == RASTER_PLOT_NORMAL_PROFILE) ||
1562 (nDataItem == RASTER_PLOT_ACTIVE_ZONE) ||
1564 (nDataItem == RASTER_PLOT_SETUP_SURGE_FLOOD_MASK) ||
1566 (nDataItem == RASTER_PLOT_WAVE_FLOOD_LINE))
1567 {
1568 dMin = 0;
1569 dMax = 1;
1570
1571 return;
1572 }
1573
1574 // Not a binary mask layer, so we must find the max and min values
1575 dMin = DBL_MAX;
1576 dMax = DBL_MIN;
1577
1578 double dTmp = 0;
1579
1580 for (int nY = 0; nY < m_nYGridSize; nY++)
1581 {
1582 for (int nX = 0; nX < m_nXGridSize; nX++)
1583 {
1584 switch (nDataItem)
1585 {
1586 case (RASTER_PLOT_SLICE):
1587 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetLayerAtElev(dElev);
1588 break;
1589
1590 case (RASTER_PLOT_LANDFORM):
1591 dTmp = m_pRasterGrid->m_Cell[nX][nY].pGetLandform()->nGetLFCategory();
1592 break;
1593
1595 dTmp = INT_NODATA;
1596
1597 if (bIsInterventionCell(nX, nY))
1598 dTmp =
1599 m_pRasterGrid->m_Cell[nX][nY].pGetLandform()->nGetLFSubCategory();
1600
1601 break;
1602
1604 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetInterventionHeight();
1605 break;
1606
1607 case (RASTER_PLOT_POLYGON):
1608 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1609 break;
1610
1612 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetBasementElev();
1613 break;
1614
1616 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetSedimentTopElev();
1617 break;
1618
1620 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetOverallTopElev();
1621 break;
1622
1624 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetLocalConsSlope();
1625 break;
1626
1627 case (RASTER_PLOT_SEA_DEPTH):
1628 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetSeaDepth();
1629 break;
1630
1632 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotSeaDepth() /
1633 static_cast<double>(m_ulIter);
1634 break;
1635
1637 if (! m_pRasterGrid->m_Cell[nX][nY].bIsInContiguousSea())
1638 dTmp = m_dMissingValue;
1639
1640 else
1641 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1642
1643 break;
1644
1646 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotWaveHeight() /
1647 static_cast<double>(m_ulIter);
1648 break;
1649
1651 if (! m_pRasterGrid->m_Cell[nX][nY].bIsInContiguousSea())
1652 dTmp = m_dMissingValue;
1653
1654 else
1655 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle();
1656
1657 break;
1658
1660 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotWaveAngle() /
1661 static_cast<double>(m_ulIter);
1662 break;
1663
1665 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetBeachProtectionFactor();
1666
1667 if (! bFPIsEqual(dTmp, DBL_NODATA, TOLERANCE))
1668 dTmp = 1 - dTmp; // Output the inverse, seems more intuitive
1669
1670 break;
1671
1673 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetPotentialPlatformErosion();
1674 break;
1675
1677 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetActualPlatformErosion();
1678 break;
1679
1681 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotPotentialPlatformErosion();
1682 break;
1683
1685 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotActualPlatformErosion();
1686 break;
1687
1689 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetPotentialBeachErosion();
1690 break;
1691
1693 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetActualBeachErosion();
1694 break;
1695
1697 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotPotentialBeachErosion();
1698 break;
1699
1701 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotActualBeachErosion();
1702 break;
1703
1705 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetBeachDeposition();
1706 break;
1707
1709 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotBeachDeposition();
1710 break;
1711
1713 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetSuspendedSediment();
1714 break;
1715
1717 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotSuspendedSediment() /
1718 static_cast<double>(m_ulIter);
1719 break;
1720
1722 dTmp = m_pRasterGrid->m_Cell[nX][nY]
1723 .pGetLayerAboveBasement(nLayer)
1724 ->pGetUnconsolidatedSediment()
1725 ->dGetFineDepth();
1726 break;
1727
1729 dTmp = m_pRasterGrid->m_Cell[nX][nY]
1730 .pGetLayerAboveBasement(nLayer)
1731 ->pGetUnconsolidatedSediment()
1732 ->dGetSandDepth();
1733 break;
1734
1736 dTmp = m_pRasterGrid->m_Cell[nX][nY]
1737 .pGetLayerAboveBasement(nLayer)
1738 ->pGetUnconsolidatedSediment()
1739 ->dGetCoarseDepth();
1740 break;
1741
1743 dTmp = m_pRasterGrid->m_Cell[nX][nY]
1744 .pGetLayerAboveBasement(nLayer)
1745 ->pGetConsolidatedSediment()
1746 ->dGetFineDepth();
1747 break;
1748
1750 dTmp = m_pRasterGrid->m_Cell[nX][nY]
1751 .pGetLayerAboveBasement(nLayer)
1752 ->pGetConsolidatedSediment()
1753 ->dGetSandDepth();
1754 break;
1755
1757 dTmp = m_pRasterGrid->m_Cell[nX][nY]
1758 .pGetLayerAboveBasement(nLayer)
1759 ->pGetConsolidatedSediment()
1760 ->dGetCoarseDepth();
1761 break;
1762
1764 dTmp = m_pRasterGrid->m_Cell[nX][nY]
1765 .dGetThisIterCliffCollapseErosionFine();
1766 break;
1767
1769 dTmp = m_pRasterGrid->m_Cell[nX][nY]
1770 .dGetThisIterCliffCollapseErosionSand();
1771 break;
1772
1774 dTmp = m_pRasterGrid->m_Cell[nX][nY]
1775 .dGetThisIterCliffCollapseErosionCoarse();
1776 break;
1777
1779 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotCliffCollapseFine();
1780 break;
1781
1783 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotCliffCollapseSand();
1784 break;
1785
1787 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotCliffCollapseCoarse();
1788 break;
1789
1791 dTmp = m_pRasterGrid->m_Cell[nX][nY]
1792 .dGetThisIterCliffCollapseSandTalusDeposition();
1793 break;
1794
1796 dTmp = m_pRasterGrid->m_Cell[nX][nY]
1797 .dGetThisIterCliffCollapseCoarseTalusDeposition();
1798 break;
1799
1801 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotSandTalusDeposition();
1802 break;
1803
1805 dTmp = m_pRasterGrid->m_Cell[nX][nY].dGetTotCoarseTalusDeposition();
1806 break;
1807
1809 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetShadowZoneNumber();
1810 break;
1811
1813 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetDownDriftZoneNumber();
1814 break;
1815
1817 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetDownDriftZoneNumber();
1818 break;
1819
1821 dTmp = m_pRasterGrid->m_Cell[nX][nY].nGetDownDriftZoneNumber();
1822 break;
1823
1825 int const nPoly = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1826
1827 if (nPoly == INT_NODATA)
1828 dTmp = m_dMissingValue;
1829
1830 else
1831 dTmp = m_pVCoastPolygon[nPoly]
1832 ->dGetBeachDepositionAndSuspensionAllUncons();
1833
1834 break;
1835 }
1836
1837 if (! bFPIsEqual(dTmp, DBL_NODATA, TOLERANCE))
1838 {
1839 if (dTmp > dMax)
1840 dMax = dTmp;
1841
1842 if (dTmp < dMin)
1843 dMin = dTmp;
1844 }
1845 }
1846 }
1847}
1848
1849//===============================================================================================================================
1851//===============================================================================================================================
1853{
1854 string const strDriver = strToLower(&m_strRasterGISOutFormat);
1855 string const strComment = "Created by " + PROGRAM_NAME + " for " + PLATFORM + " " + strGetBuild() + " running on " + strGetComputerName();
1856
1857 // TODO 034 Do these for all commonly-used file types
1858 if (strDriver == "aaigrid")
1859 {
1860 }
1861
1862 else if (strDriver == "bmp")
1863 {
1864 }
1865
1866 else if (strDriver == "gtiff")
1867 {
1868 if (m_bWorldFile)
1870 CSLSetNameValue(m_papszGDALRasterOptions, "TFW", "YES");
1871
1873 CSLSetNameValue(m_papszGDALRasterOptions, "NUM_THREADS", "ALL_CPUS");
1875 CSLSetNameValue(m_papszGDALRasterOptions, "COMPRESS", "LZW");
1876 }
1877
1878 else if (strDriver == "hfa")
1879 {
1881 CSLSetNameValue(m_papszGDALRasterOptions, "NBITS", "4");
1882 }
1883
1884 else if (strDriver == "jpeg")
1885 {
1887 "COMMENT", strComment.c_str());
1889 CSLSetNameValue(m_papszGDALRasterOptions, "QUALITY", "95");
1890 }
1891
1892 else if (strDriver == "png")
1893 {
1894 if (m_bWorldFile)
1896 CSLSetNameValue(m_papszGDALRasterOptions, "WORLDFILE", "YES");
1897
1898 // m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions,
1899 // "TITLE", "This is the title"); m_papszGDALRasterOptions =
1900 // CSLSetNameValue(m_papszGDALRasterOptions, "DESCRIPTION", "This is a
1901 // description"); m_papszGDALRasterOptions =
1902 // CSLSetNameValue(m_papszGDALRasterOptions, "COPYRIGHT", "This is some
1903 // copyright statement");
1905 "COMMENT", strComment.c_str());
1907 CSLSetNameValue(m_papszGDALRasterOptions, "NBITS", "4");
1908 }
1909
1910 else if (strDriver == "rst")
1911 {
1913 "COMMENT", strComment.c_str());
1914 }
1915
1916 else if (strDriver == "geojson")
1917 {
1918 // m_papszGDALRasterOptions = CSLSetNameValue(m_papszGDALRasterOptions,
1919 // "COMMENT", strComment.c_str());
1920 }
1921
1922 else if (strDriver == "gpkg")
1923 {
1924 // TODO 065 Does GDAL support overwriting raster gpkg files yet?
1926 CSLSetNameValue(m_papszGDALRasterOptions, "OVERWRITE", "YES");
1928 CSLSetNameValue(m_papszGDALRasterOptions, "USE_TILE_EXTENT", "YES");
1929 }
1930
1931 else if (strDriver == "netcdf")
1932 {
1933 }
1934}
1935
1936//===============================================================================================================================
1938//===============================================================================================================================
1939int CSimulation::nGetOppositeDirection(int const nDirection)
1940{
1941 switch (nDirection)
1942 {
1943 case NORTH:
1944 return SOUTH;
1945
1946 case NORTH_EAST:
1947 return SOUTH - WEST;
1948
1949 case EAST:
1950 return WEST;
1951
1952 case SOUTH_EAST:
1953 return NORTH - WEST;
1954
1955 case SOUTH:
1956 return NORTH;
1957
1958 case SOUTH_WEST:
1959 return NORTH - EAST;
1960
1961 case WEST:
1962 return EAST;
1963
1964 case NORTH_WEST:
1965 return SOUTH - EAST;
1966 }
1967
1968 // Should never get here
1969 return NO_DIRECTION;
1970}
1971
1972// //===============================================================================================================================
1973// //! Given two integer points, calculates the slope and intercept of the line
1974// passing through the points
1975// //===============================================================================================================================
1976// void CSimulation::GetSlopeAndInterceptFromPoints(CGeom2DIPoint const* pPti1,
1977// CGeom2DIPoint const* pPti2, double& dSlope, double& dIntercept)
1978// {
1979// int
1980// nX1 = pPti1->nGetX(),
1981// nY1 = pPti1->nGetY(),
1982// nX2 = pPti2->nGetX(),
1983// nY2 = pPti2->nGetY();
1984//
1985// double
1986// dXDiff = nX1 - nX2,
1987// dYDiff = nY1 - nY2;
1988//
1989// if (bFPIsEqual(dXDiff, 0.0, TOLERANCE))
1990// dSlope = 0;
1991// else
1992// dSlope = dYDiff / dXDiff;
1993//
1994// dIntercept = nY1 - (dSlope * nX1);
1995// }
1996
1997//===============================================================================================================================
1999//===============================================================================================================================
2001 int const nY)
2002{
2003 unsigned int nMinSqDist = UINT_MAX;
2004 CGeom2DIPoint PtiCoastPoint;
2005
2006 // Do for every coast
2007 for (int nCoast = 0; nCoast < static_cast<int>(m_VCoast.size()); nCoast++)
2008 {
2009 for (int j = 0; j < m_VCoast[nCoast].nGetCoastlineSize(); j++)
2010 {
2011 // Get the coords of the grid cell marked as coastline for the coastal landform object
2012 int const nXCoast = m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(j)->nGetX();
2013 int const nYCoast = m_VCoast[nCoast].pPtiGetCellMarkedAsCoastline(j)->nGetY();
2014
2015 // Calculate the squared distance between this point and the given point
2016 int const nXDist = nX - nXCoast;
2017 int const nYDist = nY - nYCoast;
2018
2019 unsigned int const nSqDist = (nXDist * nXDist) + (nYDist * nYDist);
2020
2021 // Is this the closest so dar?
2022 if (nSqDist < nMinSqDist)
2023 {
2024 nMinSqDist = nSqDist;
2025 PtiCoastPoint.SetXY(nXCoast, nYCoast);
2026 }
2027 }
2028 }
2029
2030 return PtiCoastPoint;
2031}
2032
2033//===============================================================================================================================
2035//===============================================================================================================================
2036int CSimulation::nConvertMetresToNumCells(double const dLen) const
2037{
2038 return nRound(dLen / m_dCellSide);
2039}
Contains CGeom2DPoint definitions.
Contains CGeom2DIPoint definitions.
Geometry class used to represent 2D point objects with integer coordinates.
Definition 2di_point.h:29
void SetY(int const)
The integer parameter sets a value for the CGeom2DIPoint object's Y coordinate.
Definition 2di_point.cpp:79
int nGetY(void) const
Returns the CGeom2DIPoint object's integer Y coordinate.
Definition 2di_point.cpp:55
void SetXY(int const, int const)
The two integer parameters set values for the CGeom2DIPoint object's X and Y coordinates.
Definition 2di_point.cpp:85
void DivXDivY(double const, double const)
Divides the CGeom2DIPoint object's X coordinate by the first double parameter (rounded),...
void SetX(int const)
The integer parameter sets a value for the CGeom2DIPoint object's X coordinate.
Definition 2di_point.cpp:73
int * pnGetY()
Returns a reference to the CGeom2DIPoint object's integer Y coordinate.
Definition 2di_point.cpp:67
void AddXAddY(int const, int const)
The parameter is a pointer to a CGeom2DIPoint object, this is used to set values for the CGeom2DIPoin...
Definition 2di_point.cpp:99
int * pnGetX()
Returns a reference to the CGeom2DIPoint object's integer X coordinate.
Definition 2di_point.cpp:61
int nGetX(void) const
Returns the CGeom2DIPoint object's integer X coordinate.
Definition 2di_point.cpp:49
Geometry class used to represent 2D point objects with floating-point coordinates.
Definition 2d_point.h:27
void SetY(double const)
The double parameter sets a value for the CGeom2DIPoint object's Y coordinate.
Definition 2d_point.cpp:65
double dGetY(void) const
Returns the CGeom2DPoint object's double Y coordinate.
Definition 2d_point.cpp:53
double dGetX(void) const
Returns the CGeom2DPoint object's double X coordinate.
Definition 2d_point.cpp:47
void SetX(double const)
The double parameter sets a value for the CGeom2DIPoint object's X coordinate.
Definition 2d_point.cpp:59
bool m_bCliffCollapseSave
Save cliff collapse raster GIS files?
Definition simulation.h:223
bool m_bAvgSeaDepthSave
Save average sea depth raster GIS files?
Definition simulation.h:112
bool m_bDeepWaterWaveAngleSave
Save deep water wave angle raster GIS files?
Definition simulation.h:250
bool bWriteRasterGISFile(int const, string const *, int const =0, double const =0)
Writes GIS raster files using GDAL, using data from the RasterGrid array.
bool m_bTopSurfSave
Save fop surface (sediment and sea) raster DEMs?
Definition simulation.h:97
string m_strOGRVectorOutputExtension
GDAL-OGR vector output drive file extension.
bool bCheckRasterGISOutputFormat(void)
bool m_bSedimentTopSurfSave
Save sediment top surface raster DEMs?
Definition simulation.h:94
bool m_bFineUnconsSedSave
Save fine unconsolidated sediment raster GIS files?
Definition simulation.h:196
void GetRasterOutputMinMax(int const, double &, double &, int const, double const)
bool m_bCoastSave
Save.
Definition simulation.h:268
CGeomRasterGrid * m_pRasterGrid
Pointer to the raster grid object.
int m_nXGridSize
The size of the grid in the x direction.
Definition simulation.h:457
static int nGetOppositeDirection(int const)
Returns the opposite direction.
CGeom2DIPoint PtiExtCRSToGridRound(CGeom2DPoint const *) const
Transforms a pointer to a CGeom2DPoint in the external CRS to the equivalent CGeom2DIPoint in the ras...
vector< CRWCoast > m_VCoast
The coastline objects.
bool bSaveAllVectorGISFiles(void)
int m_nThisSave
Used in calculations of GIS save intervals.
Definition simulation.h:508
static string strGetComputerName(void)
Returns a string, hopefully giving the name of the computer on which the simulation is running.
Definition utils.cpp:1363
long m_lGDALMaxCanWrite
The maximum integer value which GDAL can write, can be UINT8_MAX, INT16_MAX, UINT16_MAX,...
Definition simulation.h:592
bool m_bAvgWaveAngleAndHeightSave
Save average wave angle and average wave height raster GIS files?
Definition simulation.h:130
bool m_bAvgWaveAngleSave
Save average wave angle raster GIS files?
Definition simulation.h:124
bool m_bCliffEdgeSave
Save cliff edge vector GIS files?
Definition simulation.h:271
bool bWriteVectorGISFile(int const, string const *)
Writes vector GIS files using GDAL/OGR.
bool m_bInvalidNormalsSave
Save invalid coastline-normal vector GIS files?
Definition simulation.h:277
bool m_bShadowBoundarySave
Save wave shadow boundary vector GIS files?
Definition simulation.h:292
bool m_bActualBeachErosionSave
Save actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:163
int m_nYGridSize
The size of the grid in the y direction.
Definition simulation.h:460
bool m_bRunUpSave
Are we saving runup? TODO 007.
Definition simulation.h:418
GDALDataType m_GDALWriteIntDataType
The data type used by GDAL for integer operations, can be GDT_Byte, GDT_Int16, GDT_UInt16,...
Definition simulation.h:586
bool m_bCliffCollapseDepositionSave
Save cliff collapse deposition raster GIS files?
Definition simulation.h:229
bool m_bTotalActualPlatformErosionSave
Save total actual (supply-limited) shore platform erosion raster GIS files?
Definition simulation.h:157
bool m_bPolygonUnconsSedUpOrDownDriftSave
Save polygon unconsolidated sediment up- or down-drift raster GIS files?
Definition simulation.h:259
double m_dGeoTransform[6]
GDAL geotransformation info (see http://www.gdal.org/classGDALDataset.html)
Definition simulation.h:697
static CGeom2DIPoint PtiGetPerpendicular(CGeom2DIPoint const *, CGeom2DIPoint const *, double const, int const)
string m_strVectorGISOutFormat
Base name for CME vector GIS output files.
double m_dMissingValue
Used by CoastalME for floating-point missing values.
Definition simulation.h:961
static double dGetDistanceBetween(CGeom2DPoint const *, CGeom2DPoint const *)
Returns the distance (in external CRS) between two points.
bool m_bBasementElevSave
Save basement raster DEMs?
Definition simulation.h:91
static CGeom2DPoint PtAverage(CGeom2DPoint const *, CGeom2DPoint const *)
Returns a point (external CRS) which is the average of (i.e. is midway between) two other external CR...
bool m_bCoarseUnconsSedSave
Save coarse unconsolidated sediment raster GIS files?
Definition simulation.h:202
static double dKeepWithin360(double const)
Constrains the supplied angle to be within 0 and 360 degrees.
bool m_bPotentialPlatformErosionMaskSave
Save potential platform erosion mask raster GIS files?
Definition simulation.h:238
void KeepWithinValidGrid(int &, int &) const
bool m_bWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:115
bool m_bGDALCanCreate
Is the selected GDAL output file format capable of writing files?
Definition simulation.h:370
bool m_bLandformSave
Save coast landform raster GIS files?
Definition simulation.h:178
static string strTrim(string const *)
Trims whitespace from both sides of a string, does not change the original string.
Definition utils.cpp:2400
string m_strRasterGISOutFormat
Base name for CME raster GIS output files.
bool m_bTotalBeachDepositionSave
Save total beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:175
bool m_bSandUnconsSedSave
Save sand unconsolidated sediment raster GIS files?
Definition simulation.h:199
bool m_bTotCliffCollapseSave
Save total cliff collapse raster GIS files?
Definition simulation.h:226
bool m_bCliffSave
Save cliff region raster grids?
Definition simulation.h:103
bool m_bDoShorePlatformErosion
Simulate shore platform erosion?
Definition simulation.h:361
bool m_bSliceSave
Save slices?
Definition simulation.h:106
bool m_bRasterPolygonSave
Save raster polygon raster GIS files?
Definition simulation.h:235
bool m_bBeachDepositionSave
Save beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:172
bool m_bSaveRegular
Save GIS files at regular intervals?
Definition simulation.h:265
int m_nLayers
The number of sediment layers.
Definition simulation.h:463
bool m_bSedimentInput
Do we have sediment input events?
Definition simulation.h:391
bool m_bNormalsSave
Save coastline-normal vector GIS files?
Definition simulation.h:274
bool m_bAvgWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:118
static string strToLower(string const *)
Returns the lower case version of an string, leaving the original unchanged.
Definition utils.cpp:2425
string m_strGDALBasementDEMDriverCode
GDAL code for the basement DEM raster file type.
bool m_bHaveSandSediment
Does this simulation consider sand-sized sediment?
Definition simulation.h:85
int m_nUSave
If user-defined GIS save intervals, the number of these.
Definition simulation.h:505
bool m_bSeaDepthSave
Save sea depth raster GIS files?
Definition simulation.h:109
bool m_bWaveAngleAndHeightSave
Save wave angle and wave height raster GIS files?
Definition simulation.h:127
bool m_bWorldFile
Write a GIS World file?
Definition simulation.h:382
bool bCheckVectorGISOutputFormat(void)
Checks whether the selected vector GDAL/OGR driver supports file creation etc.
bool m_bRasterNormalProfileSave
Save rasterized coastline-normal profiles GIS files?
Definition simulation.h:217
bool m_bActiveZoneSave
Save active zone raster GIS files?
Definition simulation.h:220
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:78
bool m_bDeepWaterWaveHeightSave
Save deep water wave height raster GIS files?
Definition simulation.h:253
bool m_bMeanWaveEnergySave
Save mean wave energy raster GIS files?
Definition simulation.h:139
double m_dSimElapsed
Time simulated so far, in hours.
Definition simulation.h:679
bool m_bCoastCurvatureSave
Save coastline-curvature vector GIS files?
Definition simulation.h:280
int nConvertMetresToNumCells(double const) const
Given a length in m, this returns the rounded equivalent number of cells.
double dGridYToExtCRSY(double const) const
bool m_bGDALCanWriteInt32
Is the selected GDAL output file format capable of writing 32-bit integers to files?
Definition simulation.h:376
bool m_bBreakingWaveHeightSave
Save breaking wave height raster GIS files?
Definition simulation.h:142
double m_dRegularSaveTime
The time of the next save, in hours from the start of the simulation, if we are saving regularly.
Definition simulation.h:682
bool m_bPolygonNodeSave
Save polygon node vector GIS files?
Definition simulation.h:283
static CGeom2DIPoint PtiAverage(CGeom2DIPoint const *, CGeom2DIPoint const *)
Returns an integer point (grid CRS) which is the approximate average of (i.e. is midway between) two ...
bool m_bTotalPotentialPlatformErosionSave
Save total potential shore platform erosion raster GIS files?
Definition simulation.h:154
void SetRasterFileCreationDefaults(void)
Sets per-driver defaults for raster files created using GDAL.
bool m_bSetupSurgeFloodMaskSave
Are we saving the setup surge flood mask? TODO 007.
Definition simulation.h:421
bool m_bWaveEnergySinceCollapseSave
Save wave energy since cliff collapse raster GIS files?
Definition simulation.h:136
bool m_bPotentialBeachErosionSave
Save potential beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:160
bool m_bSuspSedSave
Save suspended sediment raster GIS files?
Definition simulation.h:190
static double dAngleSubtended(CGeom2DIPoint const *, CGeom2DIPoint const *, CGeom2DIPoint const *)
bool m_bPolygonBoundarySave
Save polygon boundary vector GIS files?
Definition simulation.h:286
bool m_bStormSurgeSave
Are we saving the storm surge? TODO 007.
Definition simulation.h:415
double dExtCRSXToGridX(double const) const
bool m_bActualPlatformErosionSave
Save actual (supply-limited) shore platform erosion raster GIS files?
Definition simulation.h:151
bool bSaveAllRasterGISFiles(void)
bool m_bHaveFineSediment
Does this simulation consider fine-sized sediment?
Definition simulation.h:82
static string strGetBuild(void)
Returns the date and time on which the program was compiled.
Definition utils.cpp:1638
bool m_bTotalPotentialBeachErosionSave
Save total potential beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:166
int m_nGISSave
The save number for GIS files (can be sequential, or the iteration number)
Definition simulation.h:502
static CGeom2DIPoint PtiWeightedAverage(CGeom2DIPoint const *, CGeom2DIPoint const *, double const)
Returns an integer point (grid CRS) which is the weighted average of two other grid CRS integer point...
bool m_bSeaMaskSave
Save sea mask raster GIS files?
Definition simulation.h:241
bool m_bInterventionClassSave
Save intervention class raster GIS files?
Definition simulation.h:184
CGeom2DIPoint PtiFindClosestCoastPoint(int const, int const)
Finds the closest point on any coastline to a given point.
bool m_bTotalActualBeachErosionSave
Save total actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:169
bool m_bRasterCoastlineSave
Save rasterized coastline GIS files?
Definition simulation.h:214
static CGeom2DPoint PtGetPerpendicular(CGeom2DPoint const *, CGeom2DPoint const *, double const, int const)
bool m_bInterventionHeightSave
Save intervention height raster GIS files?
Definition simulation.h:187
bool m_bRiverineFlooding
Are we doing flooding? TODO 007.
Definition simulation.h:409
long m_lGDALMinCanWrite
The minimum integer value which GDAL can write, can be zero, INT16_MIN, INT32_MIN.
Definition simulation.h:595
bool m_bSandConsSedSave
Save sand consolidated sediment raster GIS files?
Definition simulation.h:208
bool m_bSedimentInputEventSave
Save sediment inut data?
Definition simulation.h:403
static double dTriangleAreax2(CGeom2DPoint const *, CGeom2DPoint const *, CGeom2DPoint const *)
Returns twice the signed area of a triangle.
bool m_bHaveCoarseSediment
Does this simulation consider coarse-sized sediment?
Definition simulation.h:88
double m_dRegularSaveInterval
The interval between regular saves, in hours.
Definition simulation.h:685
bool m_bPolygonUnconsSedGainOrLossSave
Save polygon unconsolidated sediment gain or loss raster GIS files?
Definition simulation.h:262
string m_strGDALRasterOutputDriverLongname
GDAL raster output driver long name.
bool m_bDeepWaterWaveAngleAndHeightSave
Save deep water wave angle and wave height raster GIS files?
Definition simulation.h:133
double dExtCRSYToGridY(double const) const
Transforms a Y-axis ordinate in the external CRS to the equivalent Y-axis ordinate in the raster grid...
vector< double > m_VdSliceElev
Elevations for raster slice output.
bool m_bBeachProtectionSave
Save beach protection raster GIS files>
Definition simulation.h:145
bool m_bFineConsSedSave
Save fine consolidated sediment raster GIS files?
Definition simulation.h:205
bool m_bShadowDowndriftBoundarySave
Save wave shadow downdrift boundary vector GIS files?
Definition simulation.h:295
bool bIsWithinValidGrid(int const, int const) const
bool m_bDeepWaterWavePeriodSave
Save deep water wave period raster GIS files?
Definition simulation.h:256
double dGridXToExtCRSX(double const) const
Given a real-valued X-axis ordinate in the raster grid CRS (i.e. not the centroid of a cell),...
bool m_bCoarseConsSedSave
Save coarse consolidated sediment raster GIS files?
Definition simulation.h:211
CGeom2DPoint PtGridCentroidToExt(CGeom2DIPoint const *) const
Transforms a pointer to a CGeom2DIPoint in the raster grid CRS (assumed to be the centroid of a cell)...
Definition gis_utils.cpp:88
string m_strGDALRasterOutputDriverExtension
GDAL raster output driver file extension.
bool m_bBeachMaskSave
Save beach mask raster GIS files?
Definition simulation.h:244
bool m_bSlopeSave
Save slope raster grids?
Definition simulation.h:100
unsigned long m_ulIter
The number of the current iteration (time step)
Definition simulation.h:598
bool m_bAvgSuspSedSave
Save average suspended sediment raster GIS files?
Definition simulation.h:193
double dGridCentroidXToExtCRSX(int const) const
Definition gis_utils.cpp:68
double m_dCellSide
Length of a cell side (in external CRS units)
Definition simulation.h:658
bool bIsInterventionCell(int const, int const) const
Returns true if the cell is an intervention.
Definition utils.cpp:2954
bool m_bTotCliffCollapseDepositionSave
Save total cliff collapse deposition raster GIS files?
Definition simulation.h:232
double m_dUSaveTime[SAVEMAX]
Save time, in hours from the start of the simukation, if we are not saving regularly.
Definition simulation.h:688
bool m_bDoCliffCollapse
Simulate cliff collapse?
Definition simulation.h:364
bool m_bSetupSurgeRunupFloodMaskSave
Are we saving the setup surge runup flood mask? TODO 007.
Definition simulation.h:424
bool m_bWaveSetupSave
Are we saving the wave setup? TODO 007.
Definition simulation.h:412
bool m_bShadowZoneCodesSave
Save wave shadow zones raster GIS files?
Definition simulation.h:247
bool m_bPotentialPlatformErosionSave
Save potential shore platform erosion raster GIS files?
Definition simulation.h:148
static CGeom2DIPoint PtiPolygonCentroid(vector< CGeom2DIPoint > *)
GDALDataType m_GDALWriteFloatDataType
Thw data type used by GDAL for floating point operations, can be GDT_Byte, GDT_Int16,...
Definition simulation.h:589
bool m_bGDALCanWriteFloat
Is the selected GDAL output file format capable of writing floating-point values to files?
Definition simulation.h:373
char ** m_papszGDALRasterOptions
Options for GDAL when handling raster files.
Definition simulation.h:451
bool m_bCliffNotchSave
Save cliff notch incision depth vector GIS files?
Definition simulation.h:289
bool m_bVectorWaveFloodLineSave
Are we saving the vector wave flood line? TODO 007.
Definition simulation.h:430
bool m_bWaveAngleSave
Save wave angle raster GIS files?
Definition simulation.h:121
vector< CGeomCoastPolygon * > m_pVCoastPolygon
Pointers to coast polygon objects, in down-coast sequence TODO 044 Will need to use global polygon ID...
bool m_bLocalSlopeSave
Save local slope raster GIS files?
Definition simulation.h:181
This file contains global definitions for CoastalME.
int const INT_NODATA
Definition cme.h:476
int const RASTER_PLOT_POLYGON
Definition cme.h:635
string const RASTER_PLOT_POLYGON_UPDRIFT_OR_DOWNDRIFT_TITLE
Definition cme.h:1102
string const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_COARSE_TITLE
Definition cme.h:1082
string const VECTOR_PLOT_BREAKING_WAVE_HEIGHT_TITLE
Definition cme.h:1184
string const RASTER_PLOT_CLIFF_TITLE
Definition cme.h:1097
T tMin(T a, T b)
Definition cme.h:1265
string const VECTOR_PLOT_INVALID_NORMALS_TITLE
Definition cme.h:1191
double const TOLERANCE
Definition cme.h:823
string const VECTOR_PLOT_NORMALS_TITLE
Definition cme.h:1193
int const VECTOR_PLOT_STORM_SURGE
Definition cme.h:686
string const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_SAND_TITLE
Definition cme.h:1081
string const RASTER_PLOT_COAST_TITLE
Definition cme.h:1085
string const RASTER_PLOT_POLYGON_TITLE
Definition cme.h:1101
int const VECTOR_PLOT_BREAKING_WAVE_HEIGHT
Definition cme.h:670
int const VECTOR_PLOT_POLYGON_NODES
Definition cme.h:681
int const RASTER_PLOT_LOCAL_SLOPE_OF_CONSOLIDATED_SEDIMENT
Definition cme.h:632
int const RASTER_PLOT_TOTAL_ACTUAL_BEACH_EROSION
Definition cme.h:648
string const RASTER_PLOT_BEACH_DEPOSITION_TITLE
Definition cme.h:1075
int const RASTER_PLOT_CLIFF_COLLAPSE_DEPOSITION_SAND
Definition cme.h:618
int const RASTER_PLOT_BEACH_DEPOSITION
Definition cme.h:612
int const RASTER_PLOT_SUSPENDED_SEDIMENT
Definition cme.h:647
int const VECTOR_PLOT_NORMALS
Definition cme.h:679
string const RASTER_PLOT_DEEP_WATER_WAVE_ORIENTATION_TITLE
Definition cme.h:1087
string const VECTOR_PLOT_CLIFF_NOTCH_SIZE_TITLE
Definition cme.h:1185
string const RASTER_PLOT_FINE_CONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:1089
int const RASTER_PLOT_FINE_UNCONSOLIDATED_SEDIMENT
Definition cme.h:627
string const RASTER_PLOT_AVG_SEA_DEPTH_TITLE
Definition cme.h:1070
string const VECTOR_PLOT_DOWNDRIFT_BOUNDARY_TITLE
Definition cme.h:1190
string const ERR
Definition cme.h:902
string const RASTER_PLOT_BEACH_MASK_TITLE
Definition cme.h:1076
int const RASTER_PLOT_INUNDATION_MASK
Definition cme.h:630
string const RASTER_PLOT_AVG_WAVE_ORIENTATION_TITLE
Definition cme.h:1073
string const RASTER_PLOT_SETUP_SURGE_FLOOD_MASK_TITLE
Definition cme.h:1127
int const RASTER_PLOT_SEDIMENT_TOP_ELEVATION_ELEV
Definition cme.h:643
string const RASTER_PLOT_ACTUAL_BEACH_EROSION_TITLE
Definition cme.h:1068
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_FINE_TITLE
Definition cme.h:1118
int const RASTER_PLOT_ACTUAL_BEACH_EROSION
Definition cme.h:605
string const RASTER_PLOT_POLYGON_GAIN_OR_LOSS_TITLE
Definition cme.h:1100
string const VECTOR_PLOT_MEAN_WAVE_ENERGY_TITLE
Definition cme.h:1192
string const RASTER_PLOT_DEEP_WATER_WAVE_HEIGHT_TITLE
Definition cme.h:1086
string const RASTER_PLOT_WAVE_ORIENTATION_TITLE
Definition cme.h:1124
string const RASTER_PLOT_BASEMENT_ELEVATION_TITLE
Definition cme.h:1074
string const RASTER_PLOT_INTERVENTION_CLASS_TITLE
Definition cme.h:1091
string const RASTER_PLOT_COARSE_UNCONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:1084
string const VECTOR_PLOT_POLYGON_NODES_TITLE
Definition cme.h:1195
string const VECTOR_PLOT_RUN_UP_TITLE
Definition cme.h:1201
int const RASTER_PLOT_POTENTIAL_PLATFORM_EROSION_MASK
Definition cme.h:660
string const RASTER_PLOT_AVG_WAVE_HEIGHT_TITLE
Definition cme.h:1072
string const RASTER_PLOT_TOTAL_POTENTIAL_PLATFORM_EROSION_TITLE
Definition cme.h:1122
int const RASTER_PLOT_SAND_CONSOLIDATED_SEDIMENT
Definition cme.h:640
int const RASTER_PLOT_AVG_WAVE_HEIGHT
Definition cme.h:609
string const VECTOR_PLOT_CLIFF_EDGE_TITLE
Definition cme.h:1188
int const SOUTH_EAST
Definition cme.h:500
int const RASTER_PLOT_FINE_CONSOLIDATED_SEDIMENT
Definition cme.h:626
int const VECTOR_PLOT_DOWNDRIFT_BOUNDARY
Definition cme.h:676
int const RASTER_PLOT_ACTIVE_ZONE
Definition cme.h:604
int const VECTOR_PLOT_COAST_CURVATURE
Definition cme.h:673
string const RASTER_PLOT_CLIFF_COLLAPSE_DEPOSITION_COARSE_TITLE
Definition cme.h:1079
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_SAND_TITLE
Definition cme.h:1119
string const VECTOR_PLOT_WAVE_SETUP_TITLE
Definition cme.h:1199
string const RASTER_PLOT_LANDFORM_TITLE
Definition cme.h:1094
int const RASTER_PLOT_DEEP_WATER_WAVE_PERIOD
Definition cme.h:625
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_DEPOSITION_SAND
Definition cme.h:654
string const RASTER_PLOT_WAVE_HEIGHT_TITLE
Definition cme.h:1123
int const RASTER_PLOT_COAST
Definition cme.h:622
string const VECTOR_PLOT_AVG_WAVE_ANGLE_AND_HEIGHT_TITLE
Definition cme.h:1183
string const RASTER_PLOT_TOTAL_POTENTIAL_BEACH_EROSION_TITLE
Definition cme.h:1121
string const VECTOR_PLOT_COAST_CURVATURE_TITLE
Definition cme.h:1186
string const RASTER_PLOT_POTENTIAL_BEACH_EROSION_TITLE
Definition cme.h:1103
bool bFPIsEqual(const T d1, const T d2, const T dEpsilon)
Definition cme.h:1303
int const VECTOR_PLOT_RUN_UP
Definition cme.h:687
int const RASTER_PLOT_POLYGON_UPDRIFT_OR_DOWNDRIFT
Definition cme.h:637
int const VECTOR_PLOT_INVALID_NORMALS
Definition cme.h:677
string const RASTER_PLOT_SETUP_SURGE_RUNUP_FLOOD_MASK_TITLE
Definition cme.h:1128
int const RASTER_PLOT_POLYGON_GAIN_OR_LOSS
Definition cme.h:636
string const RASTER_PLOT_SAND_CONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:1105
int const RASTER_PLOT_DEEP_WATER_WAVE_ORIENTATION
Definition cme.h:624
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_COARSE
Definition cme.h:653
int const RASTER_PLOT_SLOPE
Definition cme.h:665
string const RASTER_PLOT_ACTUAL_PLATFORM_EROSION_TITLE
Definition cme.h:1069
int const RASTER_PLOT_COARSE_UNCONSOLIDATED_SEDIMENT
Definition cme.h:621
int const RASTER_PLOT_AVG_WAVE_ORIENTATION
Definition cme.h:610
string const RASTER_PLOT_TOTAL_BEACH_DEPOSITION_TITLE
Definition cme.h:1115
int const RASTER_PLOT_WAVE_ORIENTATION
Definition cme.h:659
int const SOUTH_WEST
Definition cme.h:502
string const RASTER_PLOT_SLOPE_TITLE
Definition cme.h:1096
int const RASTER_PLOT_BEACH_MASK
Definition cme.h:613
int const RASTER_PLOT_WAVE_FLOOD_LINE
Definition cme.h:664
T tMax(T a, T b)
Definition cme.h:1252
int const RASTER_PLOT_SEDIMENT_INPUT
Definition cme.h:661
int const RASTER_PLOT_POTENTIAL_BEACH_EROSION
Definition cme.h:638
int const NORTH_WEST
Definition cme.h:504
string const RASTER_PLOT_SEDIMENT_TOP_ELEVATION_ELEV_TITLE
Definition cme.h:1108
int const RASTER_PLOT_AVG_SUSPENDED_SEDIMENT
Definition cme.h:608
int const VECTOR_PLOT_COAST
Definition cme.h:672
int const VECTOR_PLOT_FLOOD_LINE
Definition cme.h:688
string const RASTER_PLOT_BEACH_PROTECTION_TITLE
Definition cme.h:1077
int const RASTER_PLOT_TOTAL_POTENTIAL_PLATFORM_EROSION
Definition cme.h:657
string const RASTER_PLOT_POTENTIAL_PLATFORM_EROSION_MASK_TITLE
Definition cme.h:1125
string const VECTOR_PLOT_COAST_TITLE
Definition cme.h:1187
int const VECTOR_PLOT_CLIFF_NOTCH_SIZE
Definition cme.h:671
string const PROGRAM_NAME
Definition cme.h:836
int const RASTER_PLOT_INTERVENTION_CLASS
Definition cme.h:628
int const RASTER_PLOT_CLIFF
Definition cme.h:666
string const VECTOR_PLOT_FLOOD_SWL_SETUP_LINE_TITLE
Definition cme.h:1203
int const VECTOR_PLOT_WAVE_ENERGY_SINCE_COLLAPSE
Definition cme.h:684
int const RASTER_PLOT_BEACH_PROTECTION
Definition cme.h:614
int const RASTER_PLOT_AVG_SEA_DEPTH
Definition cme.h:607
int const VECTOR_PLOT_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:683
int const RASTER_PLOT_OVERALL_TOP_ELEVATION
Definition cme.h:634
string const RASTER_PLOT_SHADOW_ZONE_TITLE
Definition cme.h:1110
int const RASTER_PLOT_TOTAL_BEACH_DEPOSITION
Definition cme.h:650
string const VECTOR_PLOT_SHADOW_BOUNDARY_TITLE
Definition cme.h:1196
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_FINE
Definition cme.h:651
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_SAND
Definition cme.h:652
int const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_FINE
Definition cme.h:615
int const SOUTH
Definition cme.h:501
int const NO_DIRECTION
Definition cme.h:496
int const VECTOR_PLOT_CLIFF_EDGE
Definition cme.h:674
string const RASTER_PLOT_AVG_SUSPENDED_SEDIMENT_TITLE
Definition cme.h:1071
int const RASTER_PLOT_ACTUAL_PLATFORM_EROSION
Definition cme.h:606
int const VECTOR_PLOT_POLYGON_BOUNDARY
Definition cme.h:680
string const RASTER_PLOT_INTERVENTION_HEIGHT_TITLE
Definition cme.h:1092
int const VECTOR_PLOT_MEAN_WAVE_ENERGY
Definition cme.h:678
int const EAST
Definition cme.h:499
string const VECTOR_PLOT_POLYGON_BOUNDARY_TITLE
Definition cme.h:1194
string const RASTER_PLOT_SEA_DEPTH_TITLE
Definition cme.h:1107
string const RASTER_PLOT_TOTAL_ACTUAL_PLATFORM_EROSION_TITLE
Definition cme.h:1114
string const RASTER_PLOT_SEDIMENT_INPUT_EVENT_TITLE
Definition cme.h:1126
int const RASTER_PLOT_INTERVENTION_HEIGHT
Definition cme.h:629
int const RASTER_PLOT_TOTAL_POTENTIAL_BEACH_EROSION
Definition cme.h:656
int const NORTH_EAST
Definition cme.h:498
int const RASTER_PLOT_SAND_UNCONSOLIDATED_SEDIMENT
Definition cme.h:641
string const RASTER_PLOT_FINE_UNCONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:1090
string const RASTER_PLOT_NORMAL_PROFILE_TITLE
Definition cme.h:1098
string const RASTER_PLOT_DEEP_WATER_WAVE_PERIOD_TITLE
Definition cme.h:1088
int const RASTER_PLOT_POTENTIAL_PLATFORM_EROSION
Definition cme.h:639
string const RASTER_PLOT_INUNDATION_MASK_TITLE
Definition cme.h:1093
string const RASTER_PLOT_POTENTIAL_PLATFORM_EROSION_TITLE
Definition cme.h:1104
int const RASTER_PLOT_NORMAL_PROFILE
Definition cme.h:633
double const DBL_NODATA
Definition cme.h:834
int const RASTER_PLOT_CLIFF_COLLAPSE_DEPOSITION_COARSE
Definition cme.h:619
int const RASTER_PLOT_WAVE_HEIGHT
Definition cme.h:658
int const RASTER_PLOT_SHADOW_ZONE
Definition cme.h:645
int const VECTOR_PLOT_AVG_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:669
int const RASTER_PLOT_DEEP_WATER_WAVE_HEIGHT
Definition cme.h:623
string const RASTER_PLOT_CLIFF_COLLAPSE_DEPOSITION_SAND_TITLE
Definition cme.h:1078
int const VECTOR_PLOT_DEEP_WATER_WAVE_ANGLE_AND_HEIGHT
Definition cme.h:675
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_EROSION_COARSE_TITLE
Definition cme.h:1120
string const RASTER_PLOT_SHADOW_DOWNDRIFT_ZONE_TITLE
Definition cme.h:1109
int const RASTER_PLOT_COARSE_CONSOLIDATED_SEDIMENT
Definition cme.h:620
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_DEPOSITION_SAND_TITLE
Definition cme.h:1116
int const RASTER_PLOT_TOTAL_ACTUAL_PLATFORM_EROSION
Definition cme.h:649
int const VECTOR_PLOT_WAVE_SETUP
Definition cme.h:685
int const RASTER_PLOT_SETUP_SURGE_RUNUP_FLOOD_MASK
Definition cme.h:663
int const RASTER_PLOT_BASEMENT_ELEVATION
Definition cme.h:611
string const VECTOR_PLOT_WAVE_ENERGY_SINCE_COLLAPSE_TITLE
Definition cme.h:1198
int const RASTER_PLOT_LANDFORM
Definition cme.h:631
string const RASTER_PLOT_SUSPENDED_SEDIMENT_TITLE
Definition cme.h:1112
int const RIGHT_HANDED
Definition cme.h:511
string const VECTOR_PLOT_STORM_SURGE_TITLE
Definition cme.h:1200
string const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_FINE_TITLE
Definition cme.h:1080
int const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_COARSE
Definition cme.h:617
string const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_DEPOSITION_COARSE_TITLE
Definition cme.h:1117
int const RASTER_PLOT_SHADOW_DOWNDRIFT_ZONE
Definition cme.h:644
string const RASTER_PLOT_SAND_UNCONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:1106
int const RASTER_PLOT_SLICE
Definition cme.h:646
string const RASTER_PLOT_OVERALL_TOP_ELEVATION_TITLE
Definition cme.h:1099
string const RASTER_PLOT_ACTIVE_ZONE_TITLE
Definition cme.h:1067
int const VECTOR_PLOT_SHADOW_BOUNDARY
Definition cme.h:682
string const RASTER_PLOT_LOCAL_SLOPE_OF_CONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:1095
string const VECTOR_PLOT_WAVE_ANGLE_AND_HEIGHT_TITLE
Definition cme.h:1197
int const RASTER_PLOT_TOTAL_CLIFF_COLLAPSE_DEPOSITION_COARSE
Definition cme.h:655
string const RASTER_PLOT_TOTAL_ACTUAL_BEACH_EROSION_TITLE
Definition cme.h:1113
int const RASTER_PLOT_CLIFF_COLLAPSE_EROSION_SAND
Definition cme.h:616
string const RASTER_PLOT_SLICE_TITLE
Definition cme.h:1111
int const RASTER_PLOT_SEA_DEPTH
Definition cme.h:642
int const NORTH
Definition cme.h:497
string const RASTER_PLOT_COARSE_CONSOLIDATED_SEDIMENT_TITLE
Definition cme.h:1083
string const VECTOR_PLOT_DEEP_WATER_WAVE_ANGLE_AND_HEIGHT_TITLE
Definition cme.h:1189
int const RASTER_PLOT_SETUP_SURGE_FLOOD_MASK
Definition cme.h:662
int const WEST
Definition cme.h:503
char const SPACE
Definition cme.h:453
Contains CRWCoast definitions.
Contains CGeomRasterGrid definitions.
int nRound(double const d)
Version of the above that returns an int.