40 for (
int nCoast = 0; nCoast < static_cast<int>(
m_VCoast.size()); nCoast++)
43 for (
int n = 0; n <
m_VCoast[nCoast].nGetNumProfiles(); n++)
54 int nX = pCell->
nGetX();
55 int nY = pCell->
nGetY();
58 int nHitProfileCoast =
m_pRasterGrid->m_Cell[nX][nY].nGetProfileCoastID();
59 if ((nHitProfileCoast !=
INT_NODATA) && (nHitProfileCoast != nCoast))
62 int nHitProfile =
m_pRasterGrid->m_Cell[nX][nY].nGetProfileID();
72 nHitProfileCoast =
m_pRasterGrid->m_Cell[nX][nY+1].nGetProfileCoastID();
73 if ((nHitProfileCoast !=
INT_NODATA) && (nHitProfileCoast != nCoast))
76 int nHitProfile =
m_pRasterGrid->m_Cell[nX][nY+1].nGetProfileID();
89 int nHitCoast =
m_pRasterGrid->m_Cell[nX][nY].nGetCoastline();
90 if (nHitCoast != nCoast)
104 int nHitCoast =
m_pRasterGrid->m_Cell[nX][nY+1].nGetCoastline();
105 if (nHitCoast != nCoast)
138 int nProfileLen =
static_cast<int>(pVProfileCells->size());
141 bool bProfileGridEdge =
false;
142 bool bHitProfileGridEdge =
false;
144 bProfileGridEdge =
true;
146 bHitProfileGridEdge =
true;
149 if (bProfileGridEdge && bHitProfileGridEdge)
160 nCell =
tMax(nCell, 0);
163 nX = pVProfileCells->at(nCell).nGetX();
164 nY = pVProfileCells->at(nCell).nGetY();
171 for (
int nn = nProfileNewLen-1; nn < nProfileLen; nn++)
173 int nXThis = pVProfileCells->at(nn).nGetX();
174 int nYThis = pVProfileCells->at(nn).nGetY();
176 if ((
m_pRasterGrid->m_Cell[nXThis][nYThis].nGetProfileID() == nProfile) && (
m_pRasterGrid->m_Cell[nXThis][nYThis].nGetProfileCoastID() == nCoast))
181 pVProfileCells->resize(nProfileNewLen);
199 if (bStartCoastEdgeProfile || bEndCoastEdgeProfile)
201 strTmp +=
" grid-edge ";
203 if (bStartCoastEdgeProfile)
206 if (bEndCoastEdgeProfile)
210 LogStream <<
m_ulIter <<
": coast " << nCoast << strTmp <<
" profile " << nProfile <<
" hit profile belonging to another coast at [" << nX <<
"][" << nY <<
"] = {" <<
dGridCentroidXToExtCRSX(nX) <<
", " <<
dGridCentroidYToExtCRSY(nY) <<
"}. Profile truncated, length of profile " << nProfile <<
" was " << nProfileLen <<
" cells, is now " << nProfileNewLen <<
" cells." << endl;
215 int nHitProfileLen =
static_cast<int>(pVHitProfileCells->size());
225 for (
int nn = nHitProfileNewLen-1; nn < nHitProfileLen; nn++)
227 int nXThis = pVHitProfileCells->at(nn).nGetX();
228 int nYThis = pVHitProfileCells->at(nn).nGetY();
230 if ((
m_pRasterGrid->m_Cell[nXThis][nYThis].nGetProfileID() == nHitProfile) && (
m_pRasterGrid->m_Cell[nXThis][nYThis].nGetProfileCoastID() == nHitProfileCoast))
235 pVHitProfileCells->resize(nHitProfileNewLen);
239 PtiLast = pVHitProfileCells->back();
253 if (bStartCoastEdgeProfile || bEndCoastEdgeProfile)
255 strTmp +=
" grid-edge ";
257 if (bStartCoastEdgeProfile)
260 if (bEndCoastEdgeProfile)
264 LogStream <<
m_ulIter <<
": coast " << nHitProfileCoast << strTmp <<
" profile " << nHitProfile <<
" also truncated, length of profile " << nHitProfile <<
" was " << nHitProfileLen <<
" cells, is now " << nHitProfileNewLen <<
" cells." << endl;
294 int nProfileLen =
static_cast<int>(pVProfileCells->size());
304 if (pUpCoastProfile != NULL)
306 if (pDownCoastProfile != NULL)
310 int nAvgAdjacentProfileLen;
311 if (pUpCoastProfile == NULL)
312 nAvgAdjacentProfileLen = nDownCoastProfileLen;
313 else if (pDownCoastProfile == NULL)
314 nAvgAdjacentProfileLen = nUpCoastProfileLen;
316 nAvgAdjacentProfileLen = (nUpCoastProfileLen + nDownCoastProfileLen) / 2;
319 nProfileNewLen =
tMin(nProfileNewLen, nAvgAdjacentProfileLen);
322 for (
int nn = nProfileNewLen-1; nn < nProfileLen; nn++)
324 int nXThis = pVProfileCells->at(nn).nGetX();
325 int nYThis = pVProfileCells->at(nn).nGetY();
327 if ((
m_pRasterGrid->m_Cell[nXThis][nYThis].nGetProfileID() == nProfile) && (
m_pRasterGrid->m_Cell[nXThis][nYThis].nGetProfileCoastID() == nCoast))
332 pVProfileCells->resize(nProfileNewLen);
350 if (bStartCoastEdgeProfile || bEndCoastEdgeProfile)
352 strTmp +=
" grid-edge ";
354 if (bStartCoastEdgeProfile)
357 if (bEndCoastEdgeProfile)
361 LogStream <<
m_ulIter <<
": coast " << nCoast << strTmp <<
" profile " << nProfile <<
" hit another coast at [" << nX <<
"][" << nY <<
"] = {" <<
dGridCentroidXToExtCRSX(nX) <<
", " <<
dGridCentroidYToExtCRSY(nY) <<
"}. Profile truncated, length of profile " << nProfile <<
" was " << nProfileLen <<
" cells, is now " << nProfileNewLen <<
" cells." << endl;
390 int const nProfileLineSegments = pProfile->CGeomMultiLine::nGetNumLineSegments();
391 for (
int nSeg = 0; nSeg < nProfileLineSegments; nSeg++)
394 int nNumCoinc = pProfile->CGeomMultiLine::nGetNumCoincidentProfilesInLineSegment(nSeg);
395 for (
int nCoinc = 0; nCoinc < nNumCoinc; nCoinc++)
397 vector<CGeom2DPoint>& pVPt = pProfile->CGeomMultiLine::pGetPoints();
399 for (
int nLin = 0; nLin < static_cast<int>(pVPt.size())-1; nLin++)
401 double dX1 = pVPt[nLin].dGetX();
402 double dY1 = pVPt[nLin].dGetY();
403 double dX2 = pVPt[nLin+1].dGetX();
404 double dY2 = pVPt[nLin+1].dGetY();
406 double dXMin =
tMin(dX1, dX2);
407 double dXMax =
tMax(dX1, dX2);
408 double dYMin =
tMin(dY1, dY2);
409 double dYMax =
tMax(dY1, dY2);
414 if ((dX >= dXMin) && (dX <= dXMax) && (dY >= dYMin) && (dY <= dYMax))
420 pProfile->CGeomMultiLine::SetPoints(pVPt);
Geometry class used to represent 2D point objects with integer coordinates.
int nGetY(void) const
Returns the CGeom2DIPoint object's integer Y coordinate.
int nGetX(void) const
Returns the CGeom2DIPoint object's integer X coordinate.
Geometry class used to represent 2D point objects with floating-point coordinates.
Geometry class used to represent coast profile objects.
void TruncateProfile(int const)
Truncates the profile's CGeomLine (external CRS points)
int nGetProfileID(void) const
Returns the profile's this-coast ID.
CGeomProfile * pGetUpCoastAdjacentProfile(void) const
Returns the up-coast adjacent profile, returns NULL if there is no up-coast adjacent profile.
CGeomProfile * pGetDownCoastAdjacentProfile(void) const
Returns the down-coast adjacent profile, returns NULL if there is no down-coast adjacent profile.
CGeom2DIPoint * pPtiGetCellInProfile(int const)
Returns a single cell (grid CRS) in the profile.
int nGetNumCellsInProfile(void) const
Returns the number of cells in the profile.
CGeom2DIPoint * pPtiGetStartPoint(void)
Returns a pointer to the location of the cell (grid CRS) on which the profile starts.
bool bStartOfCoast(void) const
Returns the switch to indicate whether this is a start-of-coast profile.
void SetEndPoint(CGeom2DIPoint const *)
Sets the the location of the cell (grid CRS) on which the profile ends.
vector< CGeom2DIPoint > * pPtiVGetCellsInProfile(void)
Returns all cells (grid CRS) in the profile.
void SetCellsInProfile(vector< CGeom2DIPoint > *)
Sets the profile's vector of cells (grid CRS)
void SetTruncatedDifferentCoast(bool const)
Sets a switch which indicates whether this profile is truncated, due to hitting another profile from ...
int nGetIndexOfCellInProfile(int const, int const)
Returns the index of a given cell in the vector of profile cells; returns INT_NODATA if not found.
bool bEndOfCoast(void) const
Returns the switch to indicate whether this is an end-of-coast profile.
Real-world class used to represent coastline objects.
int m_nLogFileDetail
The level of detail in the log file output. Can be LOG_FILE_LOW_DETAIL, LOG_FILE_MIDDLE_DETAIL,...
bool bWriteRasterGISFile(int const, string const *, int const =0, double const =0)
Writes GIS raster files using GDAL, using data from the RasterGrid array.
CGeomRasterGrid * m_pRasterGrid
Pointer to the raster grid object.
vector< CRWCoast > m_VCoast
The coastline objects.
int nTruncateProfilesDifferentCoasts(int const, int const, int, int const, int const, int, int, bool const, bool const)
Truncates two intersecting coast-normal profile belonging to different coasts.
int nDoMultipleCoastlines(void)
Checks all profiles on all coasts for intersections between profiles belonging to different coasts.
bool bWriteVectorGISFile(int const, string const *)
Writes vector GIS files using GDAL/OGR.
static double dGetDistanceBetween(CGeom2DPoint const *, CGeom2DPoint const *)
Returns the distance (in external CRS) between two points.
int nTruncateProfileMultiLineDifferentCoasts(CGeomProfile *, int const, int const)
Truncates the CGeomMultiLine (external CRS) of a profile which has hit a different coast,...
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...
double dGridYToExtCRSY(double const) const
int m_nGISSave
The save number for GIS files (can be sequential, or the iteration number)
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),...
unsigned long m_ulIter
The number of the current iteration (time step)
double dGridCentroidXToExtCRSX(int const) const
int nTruncateProfileHitDifferentCoast(int const, int const, int const, int const, int const, bool const, bool const)
Truncates a profile which has hit a different coast.
int const RASTER_PLOT_POLYGON
int const RTN_ERR_POINT_NOT_FOUND_IN_MULTILINE_DIFFERENT_COASTS
string const VECTOR_PLOT_INVALID_NORMALS_TITLE
string const VECTOR_PLOT_NORMALS_TITLE
string const RASTER_PLOT_POLYGON_TITLE
int const GAP_BETWEEN_DIFFERENT_COAST_PROFILES
int const VECTOR_PLOT_NORMALS
int const VECTOR_PLOT_INVALID_NORMALS
int const VECTOR_PLOT_COAST
string const VECTOR_PLOT_COAST_TITLE
int const RTN_ERR_CELL_MARKED_PROFILE_COAST_BUT_NOT_PROFILE
string const RASTER_PLOT_NORMAL_PROFILE_TITLE
int const MIN_PROFILE_SIZE
int const RASTER_PLOT_NORMAL_PROFILE
int const RTN_ERR_CELL_NOT_FOUND_IN_HIT_PROFILE_DIFFERENT_COASTS
Contains CRWCoast definitions.
Contains CSimulation definitions.