[Git][debian-gis-team/saga][upstream] New upstream version 8.5.1+dfsg
Bas Couwenberg (@sebastic)
gitlab at salsa.debian.org
Tue Feb 7 15:42:58 GMT 2023
Bas Couwenberg pushed to branch upstream at Debian GIS Project / saga
Commits:
c6da6525 by Bas Couwenberg at 2023-02-07T15:11:34+01:00
New upstream version 8.5.1+dfsg
- - - - -
26 changed files:
- saga-gis/src/accessories/helper/doxygen_saga_api_chm
- saga-gis/src/accessories/helper/doxygen_saga_api_html
- saga-gis/src/accessories/helper/make_saga_release.bat
- saga-gis/src/saga_core/saga_api/saga_api.h
- saga-gis/src/saga_core/saga_api/shapes.h
- saga-gis/src/saga_core/saga_api/shapes_ogis.cpp
- saga-gis/src/saga_core/saga_cmd/man/saga_cmd.1
- saga-gis/src/saga_core/saga_cmd/tool.cpp
- saga-gis/src/saga_core/saga_gdi/3d_view_canvas.cpp
- saga-gis/src/saga_core/saga_gdi/3d_view_tools.h
- saga-gis/src/saga_core/saga_gui/man/saga_gui.1
- saga-gis/src/saga_core/saga_gui/view_map_control.cpp
- saga-gis/src/saga_core/saga_gui/view_map_control.h
- saga-gis/src/tools/grid/grid_gridding/CMakeLists.txt
- saga-gis/src/tools/grid/grid_gridding/Interpolation_NaturalNeighbour.cpp
- saga-gis/src/tools/grid/grid_gridding/MLB_Interface.cpp
- − saga-gis/src/tools/grid/grid_gridding/MLB_Interface.h
- saga-gis/src/tools/grid/grid_gridding/grid_cell_polygon_coverage.cpp
- saga-gis/src/tools/grid/grid_gridding/kernel_density.cpp
- saga-gis/src/tools/grid/grid_gridding/nn/config.h
- − saga-gis/src/tools/grid/grid_gridding/nn/delaunay.c
- + saga-gis/src/tools/grid/grid_gridding/nn/delaunay.cpp
- saga-gis/src/tools/terrain_analysis/ta_lighting/SolarRadiation.cpp
- saga-gis/version.cmake
- saga_setup_win32.iss
- saga_setup_x64.iss
Changes:
=====================================
saga-gis/src/accessories/helper/doxygen_saga_api_chm
=====================================
@@ -38,7 +38,7 @@ PROJECT_NAME = "SAGA API"
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = v8.5.0
+PROJECT_NUMBER = v8.5.1
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
@@ -58,7 +58,7 @@ PROJECT_LOGO = ../../../saga_core/saga_gui/res/saga_icon_64.png
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
-OUTPUT_DIRECTORY = saga-8.5.0_api_doc
+OUTPUT_DIRECTORY = saga-8.5.1_api_doc
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
@@ -1371,7 +1371,7 @@ GENERATE_HTMLHELP = YES
# written to the html output directory.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-CHM_FILE = ../../saga-8.5.0_api.chm
+CHM_FILE = ../../saga-8.5.1_api.chm
# The HHC_LOCATION tag can be used to specify the location (absolute path
# including file name) of the HTML help compiler (hhc.exe). If non-empty,
=====================================
saga-gis/src/accessories/helper/doxygen_saga_api_html
=====================================
@@ -38,7 +38,7 @@ PROJECT_NAME = "SAGA API"
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = v8.5.0
+PROJECT_NUMBER = v8.5.1
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
@@ -58,7 +58,7 @@ PROJECT_LOGO = ../../../saga_core/saga_gui/res/saga_icon_64.png
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
-OUTPUT_DIRECTORY = saga-8.5.0_api_doc
+OUTPUT_DIRECTORY = saga-8.5.1_api_doc
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
@@ -1371,7 +1371,7 @@ GENERATE_HTMLHELP = NO
# written to the html output directory.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-CHM_FILE = ../../saga-8.5.0_api.chm
+CHM_FILE = ../../saga-8.5.1_api.chm
# The HHC_LOCATION tag can be used to specify the location (absolute path
# including file name) of the HTML help compiler (hhc.exe). If non-empty,
=====================================
saga-gis/src/accessories/helper/make_saga_release.bat
=====================================
@@ -36,9 +36,9 @@ REM Version
REM For all bug-fix-releases!
REM Don't forget to activate the variable
REM - SWITCH_TO_BRANCH -
-REM SET SWITCH_TO_BRANCH=saga-8.4.0
-SET SAGA_VER_TEXT=8.5.0
-SET SAGA_VER_NEXT=8.6.0
+SET SWITCH_TO_BRANCH=saga-8.5
+SET SAGA_VER_TEXT=8.5.1
+SET SAGA_VER_NEXT=8.5.2
SET SAGA_VERSION=saga-%SAGA_VER_TEXT%
@@ -60,15 +60,8 @@ ECHO. - Translation Files
ECHO. - Tools Interface (Python)
ECHO.
ECHO Enter 'y' to continue!
-SET /P ANSWER0=
-IF /i NOT '%ANSWER0%' == 'y' EXIT
-
-ECHO __________________________________
-ECHO Create tag/branch %SAGA_VER_TEXT% [y/n]
-SET /P ANSWER1=
-IF /i '%ANSWER1%' == 'y' (
- SET GIT_BRANCH=true
-)
+SET /P ANSWER=
+IF /i NOT '%ANSWER%' == 'y' EXIT
REM ___________________________________
@@ -93,16 +86,6 @@ REM GIT Source Code Repository
PUSHD %SAGA_VERSION%
-IF /i "%GIT_BRANCH%" == "true" (
- REM Create a tag
- %GITEXE% tag v%SAGA_VER_TEXT%
- %GITEXE% push v%SAGA_VER_TEXT%
-
- REM Create a branch (better do manually?!)
- %GITEXE% branch saga-%SAGA_VER_TEXT%
- %GITEXE% push saga-%SAGA_VER_TEXT%
-)
-
IF /i NOT "%SWITCH_TO_BRANCH%" == "" (
ECHO switch to branch %SWITCH_TO_BRANCH%
%GITEXE% checkout %SWITCH_TO_BRANCH%
@@ -249,9 +232,13 @@ ECHO. including an up-to-date 'readme.txt'
ECHO.
ECHO - Upload API Documentation to saga-gis.org
ECHO.
-ECHO - Create new branch: saga-%SAGA_VER_TEXT%
-ECHO. and don't forget to activate the SWITCH_TO_BRANCH flag
-ECHO. for all bug-fix-releases!
+IF /i NOT "%SWITCH_TO_BRANCH%" == "" (
+ECHO - Create a new bug-fix-branch: saga-%SAGA_VER_TEXT%
+ECHO and don't forget to activate the SWITCH_TO_BRANCH flag
+ECHO for all bug-fix-releases!
+) ELSE (
+ECHO - Create a version tag: saga-%SAGA_VER_TEXT%
+)
ECHO.
ECHO - Update version numbers accordingly:
ECHO. ./saga_setup_x64.iss
=====================================
saga-gis/src/saga_core/saga_api/saga_api.h
=====================================
@@ -86,8 +86,8 @@
//---------------------------------------------------------
#define SAGA_MAJOR_VERSION 8
#define SAGA_MINOR_VERSION 5
-#define SAGA_RELEASE_NUMBER 0
-#define SAGA_VERSION SG_T("8.5.0")
+#define SAGA_RELEASE_NUMBER 1
+#define SAGA_VERSION SG_T("8.5.1")
///////////////////////////////////////////////////////////
=====================================
saga-gis/src/saga_core/saga_api/shapes.h
=====================================
@@ -1594,12 +1594,14 @@ private:
static bool _WKB_Read_Point (CSG_Bytes &Bytes, bool bSwapBytes, CSG_Shape *pShape, int iPart);
static bool _WKB_Read_Points (CSG_Bytes &Bytes, bool bSwapBytes, CSG_Shape *pShape);
static bool _WKB_Read_Parts (CSG_Bytes &Bytes, bool bSwapBytes, CSG_Shape *pShape);
+ static bool _WKB_Read_MultiPoint (CSG_Bytes &Bytes, bool bSwapBytes, CSG_Shape *pShape);
static bool _WKB_Read_MultiLine (CSG_Bytes &Bytes, bool bSwapBytes, CSG_Shape *pShape);
static bool _WKB_Read_MultiPolygon (CSG_Bytes &Bytes, bool bSwapBytes, CSG_Shape *pShape);
static bool _WKB_Write_Point (CSG_Bytes &Bytes, CSG_Shape *pShape, int iPoint, int iPart);
static bool _WKB_Write_Points (CSG_Bytes &Bytes, CSG_Shape *pShape, int iPart);
static bool _WKB_Write_Parts (CSG_Bytes &Bytes, CSG_Shape *pShape);
+ static bool _WKB_Write_MultiPoint (CSG_Bytes &Bytes, CSG_Shape *pShape);
static bool _WKB_Write_MultiLine (CSG_Bytes &Bytes, CSG_Shape *pShape);
static bool _WKB_Write_MultiPolygon (CSG_Bytes &Bytes, CSG_Shape *pShape);
=====================================
saga-gis/src/saga_core/saga_api/shapes_ogis.cpp
=====================================
@@ -1,6 +1,3 @@
-/**********************************************************
- * Version $Id$
- *********************************************************/
///////////////////////////////////////////////////////////
// //
@@ -50,15 +47,6 @@
// //
///////////////////////////////////////////////////////////
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-// //
-// //
-// //
-///////////////////////////////////////////////////////////
-
//---------------------------------------------------------
#include "shapes.h"
@@ -184,7 +172,7 @@ DWORD CSG_Shapes_OGIS_Converter::Type_asWKBinary(const CSG_String &Type)
//---------------------------------------------------------
inline bool CSG_Shapes_OGIS_Converter::_WKT_Read_Point(const CSG_String &Text, CSG_Shape *pShape, int iPart)
{
- double x, y, z, m;
+ double x, y, z, m;
switch( pShape->Get_Vertex_Type() )
{
@@ -225,8 +213,7 @@ inline bool CSG_Shapes_OGIS_Converter::_WKT_Read_Point(const CSG_String &Text, C
//---------------------------------------------------------
bool CSG_Shapes_OGIS_Converter::_WKT_Read_Points(const CSG_String &Text, CSG_Shape *pShape)
{
- int iPart = pShape->Get_Part_Count();
- CSG_String s(Text.AfterFirst('(').BeforeFirst(')'));
+ CSG_String s(Text.AfterFirst('(').BeforeFirst(')')); int iPart = pShape->Get_Part_Count();
while( s.Length() > 0 )
{
@@ -235,7 +222,7 @@ bool CSG_Shapes_OGIS_Converter::_WKT_Read_Points(const CSG_String &Text, CSG_Sha
return( false );
}
- s = s.AfterFirst(',');
+ s = s.AfterFirst(',');
}
return( pShape->Get_Point_Count(iPart) > 0 );
@@ -244,13 +231,13 @@ bool CSG_Shapes_OGIS_Converter::_WKT_Read_Points(const CSG_String &Text, CSG_Sha
//---------------------------------------------------------
bool CSG_Shapes_OGIS_Converter::_WKT_Read_Parts(const CSG_String &Text, CSG_Shape *pShape)
{
- CSG_String s = Text.AfterFirst('(').BeforeLast(')');
+ CSG_String s(Text.AfterFirst('(').BeforeLast(')'));
while( s.Length() > 0 )
{
_WKT_Read_Points(s, pShape);
- s = s.AfterFirst(',');
+ s = s.AfterFirst(',');
}
return( pShape->Get_Part_Count() > 0 );
@@ -259,7 +246,7 @@ bool CSG_Shapes_OGIS_Converter::_WKT_Read_Parts(const CSG_String &Text, CSG_Shap
//---------------------------------------------------------
bool CSG_Shapes_OGIS_Converter::_WKT_Read_Polygon(const CSG_String &Text, CSG_Shape *pShape)
{
- CSG_String Part;
+ CSG_String Part;
for(int i=0, Level=-2; i<(int)Text.Length(); i++)
{
@@ -271,7 +258,7 @@ bool CSG_Shapes_OGIS_Converter::_WKT_Read_Polygon(const CSG_String &Text, CSG_Sh
{
if( Level == 0 )
{
- Part += Text[i];
+ Part += Text[i];
_WKT_Read_Parts(Part, pShape);
Part.Clear();
}
@@ -281,7 +268,7 @@ bool CSG_Shapes_OGIS_Converter::_WKT_Read_Polygon(const CSG_String &Text, CSG_Sh
if( Level >= 0 )
{
- Part += Text[i];
+ Part += Text[i];
}
}
@@ -293,50 +280,42 @@ bool CSG_Shapes_OGIS_Converter::from_WKText(const CSG_String &Text, CSG_Shape *p
{
pShape->Del_Parts();
- CSG_String Type(Text.BeforeFirst('('));
-
- Type.Trim(true );
- Type.Trim(false);
+ CSG_String Type(Text.BeforeFirst('(')); Type.Trim_Both();
if( pShape->Get_Type() == to_ShapeType(Type) )
{
switch( Type_asWKBinary(Type) )
{
- case SG_OGIS_TYPE_Point:
- case SG_OGIS_TYPE_PointZ:
- case SG_OGIS_TYPE_PointM:
- case SG_OGIS_TYPE_PointZM:
- return( _WKT_Read_Point(Text.AfterFirst('(').BeforeFirst(')'), pShape, 0) );
-
- case SG_OGIS_TYPE_MultiPoint:
- case SG_OGIS_TYPE_MultiPointZ:
- case SG_OGIS_TYPE_MultiPointM:
- case SG_OGIS_TYPE_MultiPointZM:
- return( _WKT_Read_Parts (Text, pShape) );
-
- case SG_OGIS_TYPE_LineString:
- case SG_OGIS_TYPE_LineStringZ:
- case SG_OGIS_TYPE_LineStringM:
- case SG_OGIS_TYPE_LineStringZM:
- return( _WKT_Read_Points (Text, pShape) );
-
- case SG_OGIS_TYPE_MultiLineString:
- case SG_OGIS_TYPE_MultiLineStringZ:
- case SG_OGIS_TYPE_MultiLineStringM:
+ case SG_OGIS_TYPE_Point :
+ case SG_OGIS_TYPE_PointZ :
+ case SG_OGIS_TYPE_PointM :
+ case SG_OGIS_TYPE_PointZM : return( _WKT_Read_Point(Text.AfterFirst('(').BeforeFirst(')'), pShape, 0) );
+
+ case SG_OGIS_TYPE_MultiPoint :
+ case SG_OGIS_TYPE_MultiPointZ :
+ case SG_OGIS_TYPE_MultiPointM :
+ case SG_OGIS_TYPE_MultiPointZM : return( _WKT_Read_Points (Text, pShape) );
+
+ case SG_OGIS_TYPE_LineString :
+ case SG_OGIS_TYPE_LineStringZ :
+ case SG_OGIS_TYPE_LineStringM :
+ case SG_OGIS_TYPE_LineStringZM : return( _WKT_Read_Points (Text, pShape) );
+
+ case SG_OGIS_TYPE_MultiLineString :
+ case SG_OGIS_TYPE_MultiLineStringZ :
+ case SG_OGIS_TYPE_MultiLineStringM :
case SG_OGIS_TYPE_MultiLineStringZM:
return( _WKT_Read_Parts (Text, pShape) );
- case SG_OGIS_TYPE_Polygon:
- case SG_OGIS_TYPE_PolygonZ:
- case SG_OGIS_TYPE_PolygonM:
- case SG_OGIS_TYPE_PolygonZM:
- return( _WKT_Read_Parts (Text, pShape) );
+ case SG_OGIS_TYPE_Polygon :
+ case SG_OGIS_TYPE_PolygonZ :
+ case SG_OGIS_TYPE_PolygonM :
+ case SG_OGIS_TYPE_PolygonZM : return( _WKT_Read_Parts (Text, pShape) );
- case SG_OGIS_TYPE_MultiPolygon:
- case SG_OGIS_TYPE_MultiPolygonZ:
- case SG_OGIS_TYPE_MultiPolygonM:
- case SG_OGIS_TYPE_MultiPolygonZM:
- return( _WKT_Read_Polygon(Text, pShape) );
+ case SG_OGIS_TYPE_MultiPolygon :
+ case SG_OGIS_TYPE_MultiPolygonZ :
+ case SG_OGIS_TYPE_MultiPolygonM :
+ case SG_OGIS_TYPE_MultiPolygonZM : return( _WKT_Read_Polygon(Text, pShape) );
}
}
@@ -351,7 +330,7 @@ bool CSG_Shapes_OGIS_Converter::from_WKText(const CSG_String &Text, CSG_Shape *p
//---------------------------------------------------------
inline bool CSG_Shapes_OGIS_Converter::_WKT_Write_Point(CSG_String &Text, CSG_Shape *pShape, int iPoint, int iPart)
{
- TSG_Point Point = pShape->Get_Point(iPoint, iPart);
+ TSG_Point Point = pShape->Get_Point(iPoint, iPart);
switch( ((CSG_Shapes *)pShape->Get_Table())->Get_Vertex_Type() )
{
@@ -374,13 +353,13 @@ inline bool CSG_Shapes_OGIS_Converter::_WKT_Write_Point(CSG_String &Text, CSG_Sh
//---------------------------------------------------------
inline bool CSG_Shapes_OGIS_Converter::_WKT_Write_Points(CSG_String &Text, CSG_Shape *pShape, int iPart)
{
- Text += SG_T("(");
+ Text += "(";
for(int iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
{
if( iPoint > 0 )
{
- Text += SG_T(", ");
+ Text += ", ";
}
_WKT_Write_Point(Text, pShape, iPoint, iPart);
@@ -388,12 +367,12 @@ inline bool CSG_Shapes_OGIS_Converter::_WKT_Write_Points(CSG_String &Text, CSG_S
if( pShape->Get_Type() == SHAPE_TYPE_Polygon && CSG_Point(pShape->Get_Point(0, iPart)) != pShape->Get_Point(pShape->Get_Point_Count(iPart) -1, iPart) )
{
- Text += SG_T(", ");
+ Text += ", ";
_WKT_Write_Point(Text, pShape, 0, iPart);
}
- Text += SG_T(")");
+ Text += ")";
return( true );
}
@@ -401,19 +380,19 @@ inline bool CSG_Shapes_OGIS_Converter::_WKT_Write_Points(CSG_String &Text, CSG_S
//---------------------------------------------------------
inline bool CSG_Shapes_OGIS_Converter::_WKT_Write_Parts(CSG_String &Text, CSG_Shape *pShape)
{
- Text += SG_T("(");
+ Text += "(";
for(int iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
{
if( iPart > 0 )
{
- Text += SG_T(", ");
+ Text += ", ";
}
_WKT_Write_Points(Text, pShape, iPart);
}
- Text += SG_T(")");
+ Text += ")";
return( true );
}
@@ -421,7 +400,7 @@ inline bool CSG_Shapes_OGIS_Converter::_WKT_Write_Parts(CSG_String &Text, CSG_Sh
//---------------------------------------------------------
inline bool CSG_Shapes_OGIS_Converter::_WKT_Write_Polygon(CSG_String &Text, CSG_Shape *pShape)
{
- Text += SG_T("(");
+ Text += "(";
for(int iPart=0, nIslands=0; iPart<pShape->Get_Part_Count(); iPart++)
{
@@ -429,10 +408,10 @@ inline bool CSG_Shapes_OGIS_Converter::_WKT_Write_Polygon(CSG_String &Text, CSG_
{
if( nIslands++ > 0 )
{
- Text += SG_T(", ");
+ Text += ", ";
}
- Text += SG_T("(");
+ Text += "(";
_WKT_Write_Points(Text, pShape, iPart);
@@ -440,17 +419,17 @@ inline bool CSG_Shapes_OGIS_Converter::_WKT_Write_Polygon(CSG_String &Text, CSG_
{
if( ((CSG_Shape_Polygon *)pShape)->is_Lake(jPart) && ((CSG_Shape_Polygon *)pShape)->Contains(pShape->Get_Point(0, jPart), iPart) )
{
- Text += SG_T(", ");
+ Text += ", ";
_WKT_Write_Points(Text, pShape, jPart);
}
}
- Text += SG_T(")");
+ Text += ")";
}
}
- Text += SG_T(")");
+ Text += ")";
return( true );
}
@@ -460,24 +439,13 @@ bool CSG_Shapes_OGIS_Converter::to_WKText(CSG_Shape *pShape, CSG_String &Text)
{
switch( pShape->Get_Type() )
{
+ case SHAPE_TYPE_Point : _WKT_Write_Points (Text = from_ShapeType(pShape->Get_Type(), pShape->Get_Vertex_Type()), pShape, 0); break;
+ case SHAPE_TYPE_Points : _WKT_Write_Parts (Text = from_ShapeType(pShape->Get_Type(), pShape->Get_Vertex_Type()), pShape ); break;
+ case SHAPE_TYPE_Line : _WKT_Write_Parts (Text = from_ShapeType(pShape->Get_Type(), pShape->Get_Vertex_Type()), pShape ); break;
+ case SHAPE_TYPE_Polygon: _WKT_Write_Polygon(Text = from_ShapeType(pShape->Get_Type(), pShape->Get_Vertex_Type()), pShape ); break;
+
default:
return( false );
-
- case SHAPE_TYPE_Point:
- _WKT_Write_Points (Text = from_ShapeType(pShape->Get_Type(), pShape->Get_Vertex_Type()), pShape, 0);
- break;
-
- case SHAPE_TYPE_Points:
- _WKT_Write_Parts (Text = from_ShapeType(pShape->Get_Type(), pShape->Get_Vertex_Type()), pShape);
- break;
-
- case SHAPE_TYPE_Line:
- _WKT_Write_Parts (Text = from_ShapeType(pShape->Get_Type(), pShape->Get_Vertex_Type()), pShape);
- break;
-
- case SHAPE_TYPE_Polygon:
- _WKT_Write_Polygon(Text = from_ShapeType(pShape->Get_Type(), pShape->Get_Vertex_Type()), pShape);
- break;
}
return( true );
@@ -491,41 +459,38 @@ bool CSG_Shapes_OGIS_Converter::to_WKText(CSG_Shape *pShape, CSG_String &Text)
//---------------------------------------------------------
inline bool CSG_Shapes_OGIS_Converter::_WKB_Read_Point(CSG_Bytes &Bytes, bool bSwapBytes, CSG_Shape *pShape, int iPart)
{
- if( Bytes.is_EOF() )
+ if( !Bytes.is_EOF() )
{
- return( false );
- }
-
- double x, y;
+ double x = Bytes.Read_Double(bSwapBytes);
+ double y = Bytes.Read_Double(bSwapBytes);
- x = Bytes.Read_Double(bSwapBytes);
- y = Bytes.Read_Double(bSwapBytes);
+ pShape->Add_Point(x, y, iPart);
- pShape->Add_Point(x, y, iPart);
+ switch( ((CSG_Shapes *)pShape->Get_Table())->Get_Vertex_Type() )
+ {
+ default:
+ break;
- switch( ((CSG_Shapes *)pShape->Get_Table())->Get_Vertex_Type() )
- {
- case SG_VERTEX_TYPE_XY:
- break;
+ case SG_VERTEX_TYPE_XYZ:
+ pShape->Set_Z(Bytes.Read_Double(bSwapBytes), pShape->Get_Point_Count(iPart) - 1, iPart);
+ break;
- case SG_VERTEX_TYPE_XYZ:
- pShape->Set_Z(Bytes.Read_Double(bSwapBytes), pShape->Get_Point_Count(iPart) - 1, iPart);
- break;
+ case SG_VERTEX_TYPE_XYZM:
+ pShape->Set_Z(Bytes.Read_Double(bSwapBytes), pShape->Get_Point_Count(iPart) - 1, iPart);
+ pShape->Set_M(Bytes.Read_Double(bSwapBytes), pShape->Get_Point_Count(iPart) - 1, iPart);
+ break;
+ }
- case SG_VERTEX_TYPE_XYZM:
- pShape->Set_Z(Bytes.Read_Double(bSwapBytes), pShape->Get_Point_Count(iPart) - 1, iPart);
- pShape->Set_M(Bytes.Read_Double(bSwapBytes), pShape->Get_Point_Count(iPart) - 1, iPart);
- break;
+ return( true );
}
- return( true );
+ return( false );
}
//---------------------------------------------------------
bool CSG_Shapes_OGIS_Converter::_WKB_Read_Points(CSG_Bytes &Bytes, bool bSwapBytes, CSG_Shape *pShape)
{
- DWORD iPart = pShape->Get_Part_Count();
- DWORD nPoints = Bytes.Read_DWord(bSwapBytes);
+ DWORD nPoints = Bytes.Read_DWord(bSwapBytes), iPart = pShape->Get_Part_Count();
for(DWORD iPoint=0; iPoint<nPoints; iPoint++)
{
@@ -541,9 +506,9 @@ bool CSG_Shapes_OGIS_Converter::_WKB_Read_Points(CSG_Bytes &Bytes, bool bSwapByt
//---------------------------------------------------------
bool CSG_Shapes_OGIS_Converter::_WKB_Read_Parts(CSG_Bytes &Bytes, bool bSwapBytes, CSG_Shape *pShape)
{
- DWORD iPart, nParts = Bytes.Read_DWord(bSwapBytes);
+ DWORD nParts = Bytes.Read_DWord(bSwapBytes);
- for(iPart=0; iPart<nParts; iPart++)
+ for(int iPart=0; iPart<nParts; iPart++)
{
if( !_WKB_Read_Points(Bytes, bSwapBytes, pShape) )
{
@@ -554,14 +519,32 @@ bool CSG_Shapes_OGIS_Converter::_WKB_Read_Parts(CSG_Bytes &Bytes, bool bSwapByte
return( pShape->Get_Part_Count() > 0 );
}
+//---------------------------------------------------------
+bool CSG_Shapes_OGIS_Converter::_WKB_Read_MultiPoint(CSG_Bytes &Bytes, bool bSwapBytes, CSG_Shape *pShape)
+{
+ DWORD nPoints = Bytes.Read_DWord(bSwapBytes), iPart = pShape->Get_Part_Count();
+
+ for(DWORD iPoint=0; iPoint<nPoints; iPoint++)
+ {
+ bSwapBytes = Bytes.Read_Byte() != SG_OGIS_BYTEORDER_NDR;
+
+ if( Bytes.Read_DWord(bSwapBytes) != SG_OGIS_TYPE_Point || !_WKB_Read_Point(Bytes, bSwapBytes, pShape, iPart) )
+ {
+ return( false );
+ }
+ }
+
+ return( pShape->Get_Point_Count(iPart) > 0 );
+}
+
//---------------------------------------------------------
bool CSG_Shapes_OGIS_Converter::_WKB_Read_MultiLine(CSG_Bytes &Bytes, bool bSwapBytes, CSG_Shape *pShape)
{
- DWORD nLines = Bytes.Read_DWord(bSwapBytes);
+ DWORD nLines = Bytes.Read_DWord(bSwapBytes);
for(DWORD iLine=0; iLine<nLines; iLine++)
{
- bSwapBytes = Bytes.Read_Byte() != SG_OGIS_BYTEORDER_NDR;
+ bSwapBytes = Bytes.Read_Byte() != SG_OGIS_BYTEORDER_NDR;
if( Bytes.Read_DWord(bSwapBytes) != SG_OGIS_TYPE_LineString || !_WKB_Read_Points(Bytes, bSwapBytes, pShape) )
{
@@ -575,11 +558,11 @@ bool CSG_Shapes_OGIS_Converter::_WKB_Read_MultiLine(CSG_Bytes &Bytes, bool bSwap
//---------------------------------------------------------
bool CSG_Shapes_OGIS_Converter::_WKB_Read_MultiPolygon(CSG_Bytes &Bytes, bool bSwapBytes, CSG_Shape *pShape)
{
- DWORD nPolygons = Bytes.Read_DWord(bSwapBytes);
+ DWORD nPolygons = Bytes.Read_DWord(bSwapBytes);
for(DWORD iPolygon=0; iPolygon<nPolygons; iPolygon++)
{
- bSwapBytes = Bytes.Read_Byte() != SG_OGIS_BYTEORDER_NDR;
+ bSwapBytes = Bytes.Read_Byte() != SG_OGIS_BYTEORDER_NDR;
if( Bytes.Read_DWord(bSwapBytes) != SG_OGIS_TYPE_Polygon || !_WKB_Read_Parts(Bytes, bSwapBytes, pShape) )
{
@@ -595,53 +578,47 @@ bool CSG_Shapes_OGIS_Converter::from_WKBinary(CSG_Bytes &Bytes, CSG_Shape *pShap
{
pShape->Del_Parts();
- if( Bytes.Get_Count() > 3 )
+ if( Bytes.Get_Count() >= 4 )
{
Bytes.Rewind();
- bool bSwapBytes = Bytes.Read_Byte() != SG_OGIS_BYTEORDER_NDR;
+ bool bSwapBytes = Bytes.Read_Byte() != SG_OGIS_BYTEORDER_NDR;
- DWORD Type = Bytes.Read_DWord();
+ DWORD Type = Bytes.Read_DWord();
if( pShape->Get_Type() == to_ShapeType(Type) )
{
switch( Type )
{
- case SG_OGIS_TYPE_Point:
- case SG_OGIS_TYPE_PointZ:
- case SG_OGIS_TYPE_PointM:
- case SG_OGIS_TYPE_PointZM:
- return( _WKB_Read_Point (Bytes, bSwapBytes, pShape, 0) );
-
- case SG_OGIS_TYPE_MultiPoint:
- case SG_OGIS_TYPE_MultiPointZ:
- case SG_OGIS_TYPE_MultiPointM:
- case SG_OGIS_TYPE_MultiPointZM:
- return( _WKB_Read_Parts (Bytes, bSwapBytes, pShape) );
-
- case SG_OGIS_TYPE_LineString:
- case SG_OGIS_TYPE_LineStringZ:
- case SG_OGIS_TYPE_LineStringM:
- case SG_OGIS_TYPE_LineStringZM:
- return( _WKB_Read_Points (Bytes, bSwapBytes, pShape) );
-
- case SG_OGIS_TYPE_MultiLineString:
- case SG_OGIS_TYPE_MultiLineStringZ:
- case SG_OGIS_TYPE_MultiLineStringM:
- case SG_OGIS_TYPE_MultiLineStringZM:
- return( _WKB_Read_MultiLine (Bytes, bSwapBytes, pShape) );
-
- case SG_OGIS_TYPE_Polygon:
- case SG_OGIS_TYPE_PolygonZ:
- case SG_OGIS_TYPE_PolygonM:
- case SG_OGIS_TYPE_PolygonZM:
- return( _WKB_Read_Parts (Bytes, bSwapBytes, pShape) );
-
- case SG_OGIS_TYPE_MultiPolygon:
- case SG_OGIS_TYPE_MultiPolygonZ:
- case SG_OGIS_TYPE_MultiPolygonM:
- case SG_OGIS_TYPE_MultiPolygonZM:
- return( _WKB_Read_MultiPolygon(Bytes, bSwapBytes, pShape) );
+ case SG_OGIS_TYPE_Point :
+ case SG_OGIS_TYPE_PointZ :
+ case SG_OGIS_TYPE_PointM :
+ case SG_OGIS_TYPE_PointZM : return( _WKB_Read_Point (Bytes, bSwapBytes, pShape, 0) );
+
+ case SG_OGIS_TYPE_MultiPoint :
+ case SG_OGIS_TYPE_MultiPointZ :
+ case SG_OGIS_TYPE_MultiPointM :
+ case SG_OGIS_TYPE_MultiPointZM : return( _WKB_Read_MultiPoint (Bytes, bSwapBytes, pShape ) );
+
+ case SG_OGIS_TYPE_LineString :
+ case SG_OGIS_TYPE_LineStringZ :
+ case SG_OGIS_TYPE_LineStringM :
+ case SG_OGIS_TYPE_LineStringZM : return( _WKB_Read_Points (Bytes, bSwapBytes, pShape ) );
+
+ case SG_OGIS_TYPE_MultiLineString :
+ case SG_OGIS_TYPE_MultiLineStringZ :
+ case SG_OGIS_TYPE_MultiLineStringM :
+ case SG_OGIS_TYPE_MultiLineStringZM: return( _WKB_Read_MultiLine (Bytes, bSwapBytes, pShape ) );
+
+ case SG_OGIS_TYPE_Polygon :
+ case SG_OGIS_TYPE_PolygonZ :
+ case SG_OGIS_TYPE_PolygonM :
+ case SG_OGIS_TYPE_PolygonZM : return( _WKB_Read_Parts (Bytes, bSwapBytes, pShape ) );
+
+ case SG_OGIS_TYPE_MultiPolygon :
+ case SG_OGIS_TYPE_MultiPolygonZ :
+ case SG_OGIS_TYPE_MultiPolygonM :
+ case SG_OGIS_TYPE_MultiPolygonZM : return( _WKB_Read_MultiPolygon(Bytes, bSwapBytes, pShape) );
}
}
}
@@ -657,10 +634,10 @@ bool CSG_Shapes_OGIS_Converter::from_WKBinary(CSG_Bytes &Bytes, CSG_Shape *pShap
//---------------------------------------------------------
inline bool CSG_Shapes_OGIS_Converter::_WKB_Write_Point(CSG_Bytes &Bytes, CSG_Shape *pShape, int iPoint, int iPart)
{
- TSG_Point Point = pShape->Get_Point(iPoint, iPart);
+ TSG_Point Point = pShape->Get_Point(iPoint, iPart);
- Bytes += Point.x;
- Bytes += Point.y;
+ Bytes += Point.x;
+ Bytes += Point.y;
switch( pShape->Get_Vertex_Type() )
{
@@ -668,12 +645,12 @@ inline bool CSG_Shapes_OGIS_Converter::_WKB_Write_Point(CSG_Bytes &Bytes, CSG_Sh
break;
case SG_VERTEX_TYPE_XYZ:
- Bytes += pShape->Get_Z(iPoint, iPart);
+ Bytes += pShape->Get_Z(iPoint, iPart);
break;
case SG_VERTEX_TYPE_XYZM:
- Bytes += pShape->Get_Z(iPoint, iPart);
- Bytes += pShape->Get_M(iPoint, iPart);
+ Bytes += pShape->Get_Z(iPoint, iPart);
+ Bytes += pShape->Get_M(iPoint, iPart);
break;
}
@@ -683,9 +660,9 @@ inline bool CSG_Shapes_OGIS_Converter::_WKB_Write_Point(CSG_Bytes &Bytes, CSG_Sh
//---------------------------------------------------------
bool CSG_Shapes_OGIS_Converter::_WKB_Write_Points(CSG_Bytes &Bytes, CSG_Shape *pShape, int iPart)
{
- bool bFirstTwice = pShape->Get_Type() == SHAPE_TYPE_Polygon && CSG_Point(pShape->Get_Point(0, iPart)) != pShape->Get_Point(pShape->Get_Point_Count(iPart) -1, iPart);
+ bool bFirstTwice = pShape->Get_Type() == SHAPE_TYPE_Polygon && CSG_Point(pShape->Get_Point(0, iPart)) != pShape->Get_Point(pShape->Get_Point_Count(iPart) -1, iPart);
- Bytes += (DWORD)(pShape->Get_Point_Count(iPart) + (bFirstTwice ? 1 : 0));
+ Bytes += (DWORD)(pShape->Get_Point_Count(iPart) + (bFirstTwice ? 1 : 0));
for(int iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
{
@@ -703,7 +680,7 @@ bool CSG_Shapes_OGIS_Converter::_WKB_Write_Points(CSG_Bytes &Bytes, CSG_Shape *p
//---------------------------------------------------------
bool CSG_Shapes_OGIS_Converter::_WKB_Write_Parts(CSG_Bytes &Bytes, CSG_Shape *pShape)
{
- Bytes += (DWORD)pShape->Get_Part_Count();
+ Bytes += (DWORD)pShape->Get_Part_Count();
for(int iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
{
@@ -716,15 +693,37 @@ bool CSG_Shapes_OGIS_Converter::_WKB_Write_Parts(CSG_Bytes &Bytes, CSG_Shape *pS
return( true );
}
+//---------------------------------------------------------
+bool CSG_Shapes_OGIS_Converter::_WKB_Write_MultiPoint(CSG_Bytes &Bytes, CSG_Shape *pShape)
+{
+ Bytes += (DWORD)pShape->Get_Point_Count(); // total number of points
+
+ for(int iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
+ {
+ for(int iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
+ {
+ Bytes += (BYTE)SG_OGIS_BYTEORDER_NDR;
+ Bytes += (DWORD)SG_OGIS_TYPE_Point;
+
+ if( !_WKB_Write_Point(Bytes, pShape, iPoint, iPart) )
+ {
+ return( false );
+ }
+ }
+ }
+
+ return( true );
+}
+
//---------------------------------------------------------
bool CSG_Shapes_OGIS_Converter::_WKB_Write_MultiLine(CSG_Bytes &Bytes, CSG_Shape *pShape)
{
- Bytes += (DWORD)pShape->Get_Part_Count();
+ Bytes += (DWORD)pShape->Get_Part_Count();
for(int iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
{
- Bytes += (BYTE)SG_OGIS_BYTEORDER_NDR;
- Bytes += (DWORD)SG_OGIS_TYPE_LineString;
+ Bytes += (BYTE)SG_OGIS_BYTEORDER_NDR;
+ Bytes += (DWORD)SG_OGIS_TYPE_LineString;
if( !_WKB_Write_Points(Bytes, pShape, iPart) )
{
@@ -738,42 +737,40 @@ bool CSG_Shapes_OGIS_Converter::_WKB_Write_MultiLine(CSG_Bytes &Bytes, CSG_Shape
//---------------------------------------------------------
bool CSG_Shapes_OGIS_Converter::_WKB_Write_MultiPolygon(CSG_Bytes &Bytes, CSG_Shape *pShape)
{
- int iPart, nPolygons, *nRings, *iPolygon;
+ int nPolygons = 0;
+ int *nRings = new int[pShape->Get_Part_Count()];
+ int *iPolygon = new int[pShape->Get_Part_Count()];
- nPolygons = 0;
- nRings = new int[pShape->Get_Part_Count()];
- iPolygon = new int[pShape->Get_Part_Count()];
-
- for(iPart=0, nPolygons=0; iPart<pShape->Get_Part_Count(); iPart++)
+ for(int iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
{
- nRings [iPart] = 0;
+ nRings[iPart] = 0;
if( ((CSG_Shape_Polygon *)pShape)->is_Lake(iPart) == false )
{
- nPolygons ++;
- nRings [iPart] ++;
- iPolygon[iPart] = iPart;
+ nPolygons ++;
+ nRings [iPart] ++;
+ iPolygon[iPart] = iPart;
for(int jPart=0; jPart<pShape->Get_Part_Count(); jPart++)
{
if( ((CSG_Shape_Polygon *)pShape)->is_Lake(jPart) && ((CSG_Shape_Polygon *)pShape)->Contains(pShape->Get_Point(0, jPart), iPart) )
{
- nRings [iPart]++;
- iPolygon[jPart] = iPart;
+ nRings [iPart] ++;
+ iPolygon[jPart] = iPart;
}
}
}
}
- Bytes += (DWORD)nPolygons;
+ Bytes += (DWORD)nPolygons;
- for(iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
+ for(int iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
{
if( nRings[iPart] > 0 )
{
- Bytes += (BYTE)SG_OGIS_BYTEORDER_NDR;
- Bytes += (DWORD)SG_OGIS_TYPE_Polygon;
- Bytes += (DWORD)nRings[iPart];
+ Bytes += (BYTE)SG_OGIS_BYTEORDER_NDR;
+ Bytes += (DWORD)SG_OGIS_TYPE_Polygon;
+ Bytes += (DWORD)nRings[iPart];
for(int jPart=0; jPart<pShape->Get_Part_Count(); jPart++)
{
@@ -781,8 +778,8 @@ bool CSG_Shapes_OGIS_Converter::_WKB_Write_MultiPolygon(CSG_Bytes &Bytes, CSG_Sh
{
if( !_WKB_Write_Points(Bytes, pShape, jPart) )
{
- delete[](nRings);
- delete[](iPolygon);
+ delete[](nRings); delete[](iPolygon);
+
return( false );
}
}
@@ -790,8 +787,7 @@ bool CSG_Shapes_OGIS_Converter::_WKB_Write_MultiPolygon(CSG_Bytes &Bytes, CSG_Sh
}
}
- delete[](nRings);
- delete[](iPolygon);
+ delete[](nRings); delete[](iPolygon);
return( nPolygons > 0 );
}
@@ -799,23 +795,22 @@ bool CSG_Shapes_OGIS_Converter::_WKB_Write_MultiPolygon(CSG_Bytes &Bytes, CSG_Sh
//---------------------------------------------------------
bool CSG_Shapes_OGIS_Converter::to_WKBinary(CSG_Shape *pShape, CSG_Bytes &Bytes)
{
- DWORD Type;
+ DWORD Type;
if( from_ShapeType(Type, pShape->Get_Type(), pShape->Get_Vertex_Type()) )
{
Bytes.Destroy();
- Bytes += (BYTE)SG_OGIS_BYTEORDER_NDR;
- Bytes += Type;
+ Bytes += (BYTE)SG_OGIS_BYTEORDER_NDR;
+ Bytes += Type;
switch( pShape->Get_Type() )
{
- case SHAPE_TYPE_Point : return( _WKB_Write_Point (Bytes, pShape, 0, 0) );
- case SHAPE_TYPE_Points : return( _WKB_Write_Points (Bytes, pShape, 0 ) );
- case SHAPE_TYPE_Line : return( _WKB_Write_MultiLine (Bytes, pShape ) );
- case SHAPE_TYPE_Polygon: return( _WKB_Write_MultiPolygon(Bytes, pShape ) );
-
- default: break;
+ case SHAPE_TYPE_Point : return( _WKB_Write_Point (Bytes, pShape, 0, 0) );
+ case SHAPE_TYPE_Points : return( _WKB_Write_MultiPoint (Bytes, pShape ) );
+ case SHAPE_TYPE_Line : return( _WKB_Write_MultiLine (Bytes, pShape ) );
+ case SHAPE_TYPE_Polygon: return( _WKB_Write_MultiPolygon(Bytes, pShape ) );
+ default: break;
}
}
@@ -837,33 +832,33 @@ bool CSG_Shapes_OGIS_Converter::from_ShapeType(CSG_String &Type, TSG_Shape_Type
case SG_VERTEX_TYPE_XY:
switch( Shape )
{
- default: break;
- case SHAPE_TYPE_Point: Type = Type_asWKText(SG_OGIS_TYPE_Point ); return( true );
- case SHAPE_TYPE_Points: Type = Type_asWKText(SG_OGIS_TYPE_MultiPoint ); return( true );
- case SHAPE_TYPE_Line: Type = Type_asWKText(SG_OGIS_TYPE_MultiLineString ); return( true );
- case SHAPE_TYPE_Polygon: Type = Type_asWKText(SG_OGIS_TYPE_MultiPolygon ); return( true );
+ case SHAPE_TYPE_Point : Type = Type_asWKText(SG_OGIS_TYPE_Point ); return( true );
+ case SHAPE_TYPE_Points : Type = Type_asWKText(SG_OGIS_TYPE_MultiPoint ); return( true );
+ case SHAPE_TYPE_Line : Type = Type_asWKText(SG_OGIS_TYPE_MultiLineString ); return( true );
+ case SHAPE_TYPE_Polygon: Type = Type_asWKText(SG_OGIS_TYPE_MultiPolygon ); return( true );
+ default: break;
}
break;
case SG_VERTEX_TYPE_XYZ:
switch( Shape )
{
- default: break;
- case SHAPE_TYPE_Point: Type = Type_asWKText(SG_OGIS_TYPE_PointZ ); return( true );
- case SHAPE_TYPE_Points: Type = Type_asWKText(SG_OGIS_TYPE_MultiPointZ ); return( true );
- case SHAPE_TYPE_Line: Type = Type_asWKText(SG_OGIS_TYPE_MultiLineStringZ ); return( true );
- case SHAPE_TYPE_Polygon: Type = Type_asWKText(SG_OGIS_TYPE_MultiPolygonZ ); return( true );
+ case SHAPE_TYPE_Point : Type = Type_asWKText(SG_OGIS_TYPE_PointZ ); return( true );
+ case SHAPE_TYPE_Points : Type = Type_asWKText(SG_OGIS_TYPE_MultiPointZ ); return( true );
+ case SHAPE_TYPE_Line : Type = Type_asWKText(SG_OGIS_TYPE_MultiLineStringZ ); return( true );
+ case SHAPE_TYPE_Polygon: Type = Type_asWKText(SG_OGIS_TYPE_MultiPolygonZ ); return( true );
+ default: break;
}
break;
case SG_VERTEX_TYPE_XYZM:
switch( Shape )
{
- default: break;
- case SHAPE_TYPE_Point: Type = Type_asWKText(SG_OGIS_TYPE_PointZM ); return( true );
- case SHAPE_TYPE_Points: Type = Type_asWKText(SG_OGIS_TYPE_MultiPointZM ); return( true );
- case SHAPE_TYPE_Line: Type = Type_asWKText(SG_OGIS_TYPE_MultiLineStringZM); return( true );
- case SHAPE_TYPE_Polygon: Type = Type_asWKText(SG_OGIS_TYPE_MultiPolygonZM ); return( true );
+ case SHAPE_TYPE_Point : Type = Type_asWKText(SG_OGIS_TYPE_PointZM ); return( true );
+ case SHAPE_TYPE_Points : Type = Type_asWKText(SG_OGIS_TYPE_MultiPointZM ); return( true );
+ case SHAPE_TYPE_Line : Type = Type_asWKText(SG_OGIS_TYPE_MultiLineStringZM); return( true );
+ case SHAPE_TYPE_Polygon: Type = Type_asWKText(SG_OGIS_TYPE_MultiPolygonZM ); return( true );
+ default: break;
}
break;
}
@@ -879,33 +874,33 @@ bool CSG_Shapes_OGIS_Converter::from_ShapeType(DWORD &Type, TSG_Shape_Type Shape
case SG_VERTEX_TYPE_XY:
switch( Shape )
{
- default: break;
- case SHAPE_TYPE_Point: Type = SG_OGIS_TYPE_Point; return( true );
- case SHAPE_TYPE_Points: Type = SG_OGIS_TYPE_MultiPoint; return( true );
- case SHAPE_TYPE_Line: Type = SG_OGIS_TYPE_MultiLineString; return( true );
- case SHAPE_TYPE_Polygon: Type = SG_OGIS_TYPE_MultiPolygon; return( true );
+ case SHAPE_TYPE_Point : Type = SG_OGIS_TYPE_Point ; return( true );
+ case SHAPE_TYPE_Points : Type = SG_OGIS_TYPE_MultiPoint ; return( true );
+ case SHAPE_TYPE_Line : Type = SG_OGIS_TYPE_MultiLineString; return( true );
+ case SHAPE_TYPE_Polygon: Type = SG_OGIS_TYPE_MultiPolygon ; return( true );
+ default: break;
}
break;
case SG_VERTEX_TYPE_XYZ:
switch( Shape )
{
- default: break;
- case SHAPE_TYPE_Point: Type = SG_OGIS_TYPE_PointZ; return( true );
- case SHAPE_TYPE_Points: Type = SG_OGIS_TYPE_MultiPointZ; return( true );
- case SHAPE_TYPE_Line: Type = SG_OGIS_TYPE_MultiLineStringZ; return( true );
- case SHAPE_TYPE_Polygon: Type = SG_OGIS_TYPE_MultiPolygonZ; return( true );
+ case SHAPE_TYPE_Point : Type = SG_OGIS_TYPE_PointZ ; return( true );
+ case SHAPE_TYPE_Points : Type = SG_OGIS_TYPE_MultiPointZ ; return( true );
+ case SHAPE_TYPE_Line : Type = SG_OGIS_TYPE_MultiLineStringZ; return( true );
+ case SHAPE_TYPE_Polygon: Type = SG_OGIS_TYPE_MultiPolygonZ ; return( true );
+ default: break;
}
break;
case SG_VERTEX_TYPE_XYZM:
switch( Shape )
{
- default: break;
- case SHAPE_TYPE_Point: Type = SG_OGIS_TYPE_PointZM; return( true );
- case SHAPE_TYPE_Points: Type = SG_OGIS_TYPE_MultiPointZM; return( true );
- case SHAPE_TYPE_Line: Type = SG_OGIS_TYPE_MultiLineStringZM; return( true );
- case SHAPE_TYPE_Polygon: Type = SG_OGIS_TYPE_MultiPolygonZM; return( true );
+ case SHAPE_TYPE_Point : Type = SG_OGIS_TYPE_PointZM ; return( true );
+ case SHAPE_TYPE_Points : Type = SG_OGIS_TYPE_MultiPointZM ; return( true );
+ case SHAPE_TYPE_Line : Type = SG_OGIS_TYPE_MultiLineStringZM; return( true );
+ case SHAPE_TYPE_Polygon: Type = SG_OGIS_TYPE_MultiPolygonZM ; return( true );
+ default: break;
}
break;
}
@@ -916,7 +911,7 @@ bool CSG_Shapes_OGIS_Converter::from_ShapeType(DWORD &Type, TSG_Shape_Type Shape
//---------------------------------------------------------
CSG_String CSG_Shapes_OGIS_Converter::from_ShapeType(TSG_Shape_Type Shape, TSG_Vertex_Type Vertex)
{
- CSG_String Type;
+ CSG_String Type;
from_ShapeType(Type, Shape, Vertex);
@@ -928,36 +923,36 @@ bool CSG_Shapes_OGIS_Converter::to_ShapeType(const CSG_String &Type, TSG_Shape_T
{
switch( Type_asWKBinary(Type) )
{
- case SG_OGIS_TYPE_Point : Shape = SHAPE_TYPE_Point; Vertex = SG_VERTEX_TYPE_XY; return( true );
- case SG_OGIS_TYPE_MultiPoint : Shape = SHAPE_TYPE_Points; Vertex = SG_VERTEX_TYPE_XY; return( true );
- case SG_OGIS_TYPE_LineString : Shape = SHAPE_TYPE_Line; Vertex = SG_VERTEX_TYPE_XY; return( true );
- case SG_OGIS_TYPE_MultiLineString : Shape = SHAPE_TYPE_Line; Vertex = SG_VERTEX_TYPE_XY; return( true );
- case SG_OGIS_TYPE_Polygon : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XY; return( true );
- case SG_OGIS_TYPE_MultiPolygon : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XY; return( true );
-
- case SG_OGIS_TYPE_PointZ : Shape = SHAPE_TYPE_Point; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_MultiPointZ : Shape = SHAPE_TYPE_Points; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_LineStringZ : Shape = SHAPE_TYPE_Line; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_MultiLineStringZ : Shape = SHAPE_TYPE_Line; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_PolygonZ : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_MultiPolygonZ : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
-
- case SG_OGIS_TYPE_PointM : Shape = SHAPE_TYPE_Point; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_MultiPointM : Shape = SHAPE_TYPE_Points; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_LineStringM : Shape = SHAPE_TYPE_Line; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_MultiLineStringM : Shape = SHAPE_TYPE_Line; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_PolygonM : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_MultiPolygonM : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
-
- case SG_OGIS_TYPE_PointZM : Shape = SHAPE_TYPE_Point; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
- case SG_OGIS_TYPE_MultiPointZM : Shape = SHAPE_TYPE_Points; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
- case SG_OGIS_TYPE_LineStringZM : Shape = SHAPE_TYPE_Line; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
- case SG_OGIS_TYPE_MultiLineStringZM : Shape = SHAPE_TYPE_Line; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
- case SG_OGIS_TYPE_PolygonZM : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
- case SG_OGIS_TYPE_MultiPolygonZM : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
+ case SG_OGIS_TYPE_Point : Shape = SHAPE_TYPE_Point ; Vertex = SG_VERTEX_TYPE_XY ; return( true );
+ case SG_OGIS_TYPE_MultiPoint : Shape = SHAPE_TYPE_Points ; Vertex = SG_VERTEX_TYPE_XY ; return( true );
+ case SG_OGIS_TYPE_LineString : Shape = SHAPE_TYPE_Line ; Vertex = SG_VERTEX_TYPE_XY ; return( true );
+ case SG_OGIS_TYPE_MultiLineString : Shape = SHAPE_TYPE_Line ; Vertex = SG_VERTEX_TYPE_XY ; return( true );
+ case SG_OGIS_TYPE_Polygon : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XY ; return( true );
+ case SG_OGIS_TYPE_MultiPolygon : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XY ; return( true );
+
+ case SG_OGIS_TYPE_PointZ : Shape = SHAPE_TYPE_Point ; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_MultiPointZ : Shape = SHAPE_TYPE_Points ; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_LineStringZ : Shape = SHAPE_TYPE_Line ; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_MultiLineStringZ : Shape = SHAPE_TYPE_Line ; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_PolygonZ : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_MultiPolygonZ : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+
+ case SG_OGIS_TYPE_PointM : Shape = SHAPE_TYPE_Point ; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_MultiPointM : Shape = SHAPE_TYPE_Points ; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_LineStringM : Shape = SHAPE_TYPE_Line ; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_MultiLineStringM : Shape = SHAPE_TYPE_Line ; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_PolygonM : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_MultiPolygonM : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+
+ case SG_OGIS_TYPE_PointZM : Shape = SHAPE_TYPE_Point ; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
+ case SG_OGIS_TYPE_MultiPointZM : Shape = SHAPE_TYPE_Points ; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
+ case SG_OGIS_TYPE_LineStringZM : Shape = SHAPE_TYPE_Line ; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
+ case SG_OGIS_TYPE_MultiLineStringZM : Shape = SHAPE_TYPE_Line ; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
+ case SG_OGIS_TYPE_PolygonZM : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
+ case SG_OGIS_TYPE_MultiPolygonZM : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
}
- Shape = SHAPE_TYPE_Undefined;
+ Shape = SHAPE_TYPE_Undefined; Vertex = SG_VERTEX_TYPE_XY;
return( false );
}
@@ -967,36 +962,36 @@ bool CSG_Shapes_OGIS_Converter::to_ShapeType(DWORD Type, TSG_Shape_Type &Shape,
{
switch( Type )
{
- case SG_OGIS_TYPE_Point : Shape = SHAPE_TYPE_Point; Vertex = SG_VERTEX_TYPE_XY; return( true );
- case SG_OGIS_TYPE_MultiPoint : Shape = SHAPE_TYPE_Points; Vertex = SG_VERTEX_TYPE_XY; return( true );
- case SG_OGIS_TYPE_LineString : Shape = SHAPE_TYPE_Line; Vertex = SG_VERTEX_TYPE_XY; return( true );
- case SG_OGIS_TYPE_MultiLineString : Shape = SHAPE_TYPE_Line; Vertex = SG_VERTEX_TYPE_XY; return( true );
- case SG_OGIS_TYPE_Polygon : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XY; return( true );
- case SG_OGIS_TYPE_MultiPolygon : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XY; return( true );
-
- case SG_OGIS_TYPE_PointZ : Shape = SHAPE_TYPE_Point; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_MultiPointZ : Shape = SHAPE_TYPE_Points; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_LineStringZ : Shape = SHAPE_TYPE_Line; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_MultiLineStringZ : Shape = SHAPE_TYPE_Line; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_PolygonZ : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_MultiPolygonZ : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
-
- case SG_OGIS_TYPE_PointM : Shape = SHAPE_TYPE_Point; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_MultiPointM : Shape = SHAPE_TYPE_Points; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_LineStringM : Shape = SHAPE_TYPE_Line; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_MultiLineStringM : Shape = SHAPE_TYPE_Line; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_PolygonM : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
- case SG_OGIS_TYPE_MultiPolygonM : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZ; return( true );
-
- case SG_OGIS_TYPE_PointZM : Shape = SHAPE_TYPE_Point; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
- case SG_OGIS_TYPE_MultiPointZM : Shape = SHAPE_TYPE_Points; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
- case SG_OGIS_TYPE_LineStringZM : Shape = SHAPE_TYPE_Line; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
- case SG_OGIS_TYPE_MultiLineStringZM : Shape = SHAPE_TYPE_Line; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
- case SG_OGIS_TYPE_PolygonZM : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
- case SG_OGIS_TYPE_MultiPolygonZM : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
+ case SG_OGIS_TYPE_Point : Shape = SHAPE_TYPE_Point ; Vertex = SG_VERTEX_TYPE_XY ; return( true );
+ case SG_OGIS_TYPE_MultiPoint : Shape = SHAPE_TYPE_Points ; Vertex = SG_VERTEX_TYPE_XY ; return( true );
+ case SG_OGIS_TYPE_LineString : Shape = SHAPE_TYPE_Line ; Vertex = SG_VERTEX_TYPE_XY ; return( true );
+ case SG_OGIS_TYPE_MultiLineString : Shape = SHAPE_TYPE_Line ; Vertex = SG_VERTEX_TYPE_XY ; return( true );
+ case SG_OGIS_TYPE_Polygon : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XY ; return( true );
+ case SG_OGIS_TYPE_MultiPolygon : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XY ; return( true );
+
+ case SG_OGIS_TYPE_PointZ : Shape = SHAPE_TYPE_Point ; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_MultiPointZ : Shape = SHAPE_TYPE_Points ; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_LineStringZ : Shape = SHAPE_TYPE_Line ; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_MultiLineStringZ : Shape = SHAPE_TYPE_Line ; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_PolygonZ : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_MultiPolygonZ : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+
+ case SG_OGIS_TYPE_PointM : Shape = SHAPE_TYPE_Point ; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_MultiPointM : Shape = SHAPE_TYPE_Points ; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_LineStringM : Shape = SHAPE_TYPE_Line ; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_MultiLineStringM : Shape = SHAPE_TYPE_Line ; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_PolygonM : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+ case SG_OGIS_TYPE_MultiPolygonM : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZ ; return( true );
+
+ case SG_OGIS_TYPE_PointZM : Shape = SHAPE_TYPE_Point ; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
+ case SG_OGIS_TYPE_MultiPointZM : Shape = SHAPE_TYPE_Points ; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
+ case SG_OGIS_TYPE_LineStringZM : Shape = SHAPE_TYPE_Line ; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
+ case SG_OGIS_TYPE_MultiLineStringZM : Shape = SHAPE_TYPE_Line ; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
+ case SG_OGIS_TYPE_PolygonZM : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
+ case SG_OGIS_TYPE_MultiPolygonZM : Shape = SHAPE_TYPE_Polygon; Vertex = SG_VERTEX_TYPE_XYZM; return( true );
}
- Shape = SHAPE_TYPE_Undefined;
+ Shape = SHAPE_TYPE_Undefined; Vertex = SG_VERTEX_TYPE_XY;
return( false );
}
@@ -1004,8 +999,7 @@ bool CSG_Shapes_OGIS_Converter::to_ShapeType(DWORD Type, TSG_Shape_Type &Shape,
//---------------------------------------------------------
TSG_Shape_Type CSG_Shapes_OGIS_Converter::to_ShapeType(const CSG_String &Type)
{
- TSG_Shape_Type Shape;
- TSG_Vertex_Type Vertex;
+ TSG_Shape_Type Shape; TSG_Vertex_Type Vertex;
to_ShapeType(Type, Shape, Vertex);
@@ -1015,8 +1009,7 @@ TSG_Shape_Type CSG_Shapes_OGIS_Converter::to_ShapeType(const CSG_String &Type)
//---------------------------------------------------------
TSG_Shape_Type CSG_Shapes_OGIS_Converter::to_ShapeType(DWORD Type)
{
- TSG_Shape_Type Shape;
- TSG_Vertex_Type Vertex;
+ TSG_Shape_Type Shape; TSG_Vertex_Type Vertex;
to_ShapeType(Type, Shape, Vertex);
@@ -1097,45 +1090,43 @@ bool CSG_Grid_OGIS_Converter::from_WKBinary(CSG_Bytes &Bytes, class CSG_Grid *pG
//-----------------------------------------------------
// Raster System
- bool bSwap = Bytes.Read_Byte () == 0; // endiannes: 1=ndr/little endian, 0=xdr/big endian
- short version = Bytes.Read_Short (bSwap); // version
- short nBands = Bytes.Read_Short (bSwap); // number of bands
- double dx = Bytes.Read_Double(bSwap); // scaleX
- double dy = Bytes.Read_Double(bSwap); // scaleY
- double xMin = Bytes.Read_Double(bSwap); // ipX
- double yMax = Bytes.Read_Double(bSwap); // ipY
- double skewX = Bytes.Read_Double(bSwap); // skewX
- double skewY = Bytes.Read_Double(bSwap); // skewY
- int SRID = Bytes.Read_Int (bSwap); // srid
- short NX = Bytes.Read_Short (bSwap); // width
- short NY = Bytes.Read_Short (bSwap); // height
+ bool bSwap = Bytes.Read_Byte () == 0; // endiannes: 1=ndr/little endian, 0=xdr/big endian
+ short version = Bytes.Read_Short (bSwap); // version
+ short nBands = Bytes.Read_Short (bSwap); // number of bands
+ double dx = Bytes.Read_Double(bSwap); // scaleX
+ double dy = Bytes.Read_Double(bSwap); // scaleY
+ double xMin = Bytes.Read_Double(bSwap); // ipX
+ double yMax = Bytes.Read_Double(bSwap); // ipY
+ double skewX = Bytes.Read_Double(bSwap); // skewX
+ double skewY = Bytes.Read_Double(bSwap); // skewY
+ int SRID = Bytes.Read_Int (bSwap); // srid
+ short NX = Bytes.Read_Short (bSwap); // width
+ short NY = Bytes.Read_Short (bSwap); // height
//-----------------------------------------------------
// Band
- TSG_Data_Type Type;
-
- BYTE Flags = Bytes.Read_Byte();
+ TSG_Data_Type Type; BYTE Flags = Bytes.Read_Byte();
switch( Flags & 0x0F )
{
- case 0: Type = SG_DATATYPE_Bit ; break; // 0: 1-bit boolean
- case 1: Type = SG_DATATYPE_Char ; break; // 1: 2-bit unsigned integer
- case 2: Type = SG_DATATYPE_Char ; break; // 2: 4-bit unsigned integer
- case 3: Type = SG_DATATYPE_Char ; break; // 3: 8-bit signed integer
- case 4: Type = SG_DATATYPE_Byte ; break; // 4: 8-bit unsigned integer
- case 5: Type = SG_DATATYPE_Short ; break; // 5: 16-bit signed integer
- case 6: Type = SG_DATATYPE_Word ; break; // 6: 16-bit unsigned integer
- case 7: Type = SG_DATATYPE_Int ; break; // 7: 32-bit signed integer
- case 8: Type = SG_DATATYPE_DWord ; break; // 8: 32-bit unsigned integer
- case 10: Type = SG_DATATYPE_Float ; break; // 10: 32-bit float
- case 11: Type = SG_DATATYPE_Double; break; // 11: 64-bit float
+ case 0: Type = SG_DATATYPE_Bit ; break; // 0: 1-bit boolean
+ case 1: Type = SG_DATATYPE_Char ; break; // 1: 2-bit unsigned integer
+ case 2: Type = SG_DATATYPE_Char ; break; // 2: 4-bit unsigned integer
+ case 3: Type = SG_DATATYPE_Char ; break; // 3: 8-bit signed integer
+ case 4: Type = SG_DATATYPE_Byte ; break; // 4: 8-bit unsigned integer
+ case 5: Type = SG_DATATYPE_Short ; break; // 5: 16-bit signed integer
+ case 6: Type = SG_DATATYPE_Word ; break; // 6: 16-bit unsigned integer
+ case 7: Type = SG_DATATYPE_Int ; break; // 7: 32-bit signed integer
+ case 8: Type = SG_DATATYPE_DWord ; break; // 8: 32-bit unsigned integer
+ case 10: Type = SG_DATATYPE_Float ; break; // 10: 32-bit float
+ case 11: Type = SG_DATATYPE_Double; break; // 11: 64-bit float
}
-// Flags |= 0x80; // isOffline: no, never here!
- Flags |= 0x40; // hasNodataValue
-// Flags |= 0x20; // isNoDataValue: no, never here!
-// Flags |= 0x10; // reserved (unused)
+// Flags |= 0x80; // isOffline: no, never here!
+ Flags |= 0x40; // hasNodataValue
+// Flags |= 0x20; // isNoDataValue: no, never here!
+// Flags |= 0x10; // reserved (unused)
if( !pGrid->Create(Type, NX, NY, dx, xMin + 0.5 * dx, yMax - (NY - 0.5) * dx) )
{
@@ -1144,19 +1135,19 @@ bool CSG_Grid_OGIS_Converter::from_WKBinary(CSG_Bytes &Bytes, class CSG_Grid *pG
pGrid->Get_Projection().Create(SRID);
- double noData;
+ double noData;
switch( pGrid->Get_Type() )
{
- case SG_DATATYPE_Bit : noData = Bytes.Read_Byte ( ); break; // 0: 1-bit boolean
- case SG_DATATYPE_Char : noData = Bytes.Read_Char ( ); break; // 3: 8-bit signed integer
- case SG_DATATYPE_Byte : noData = Bytes.Read_Byte ( ); break; // 4: 8-bit unsigned integer
- case SG_DATATYPE_Short : noData = Bytes.Read_Short (bSwap); break; // 5: 16-bit signed integer
- case SG_DATATYPE_Word : noData = Bytes.Read_Word (bSwap); break; // 6: 16-bit unsigned integer
- case SG_DATATYPE_Int : noData = Bytes.Read_Int (bSwap); break; // 7: 32-bit signed integer
- case SG_DATATYPE_DWord : noData = Bytes.Read_DWord (bSwap); break; // 8: 32-bit unsigned integer
- case SG_DATATYPE_Float : noData = Bytes.Read_Float (bSwap); break; // 9: 32-bit float
- case SG_DATATYPE_Double: noData = Bytes.Read_Double(bSwap); break; // 10: 64-bit float
+ case SG_DATATYPE_Bit : noData = Bytes.Read_Byte ( ); break; // 0: 1-bit boolean
+ case SG_DATATYPE_Char : noData = Bytes.Read_Char ( ); break; // 3: 8-bit signed integer
+ case SG_DATATYPE_Byte : noData = Bytes.Read_Byte ( ); break; // 4: 8-bit unsigned integer
+ case SG_DATATYPE_Short : noData = Bytes.Read_Short (bSwap); break; // 5: 16-bit signed integer
+ case SG_DATATYPE_Word : noData = Bytes.Read_Word (bSwap); break; // 6: 16-bit unsigned integer
+ case SG_DATATYPE_Int : noData = Bytes.Read_Int (bSwap); break; // 7: 32-bit signed integer
+ case SG_DATATYPE_DWord : noData = Bytes.Read_DWord (bSwap); break; // 8: 32-bit unsigned integer
+ case SG_DATATYPE_Float : noData = Bytes.Read_Float (bSwap); break; // 9: 32-bit float
+ case SG_DATATYPE_Double: noData = Bytes.Read_Double(bSwap); break; // 10: 64-bit float
default:
break;
}
@@ -1169,15 +1160,15 @@ bool CSG_Grid_OGIS_Converter::from_WKBinary(CSG_Bytes &Bytes, class CSG_Grid *pG
{
switch( pGrid->Get_Type() )
{
- case SG_DATATYPE_Bit : pGrid->Set_Value(x, y, Bytes.Read_Byte ( )); break; // 0: 1-bit boolean
- case SG_DATATYPE_Char : pGrid->Set_Value(x, y, Bytes.Read_Char ( )); break; // 3: 8-bit signed integer
- case SG_DATATYPE_Byte : pGrid->Set_Value(x, y, Bytes.Read_Byte ( )); break; // 4: 8-bit unsigned integer
- case SG_DATATYPE_Short : pGrid->Set_Value(x, y, Bytes.Read_Short (bSwap)); break; // 5: 16-bit signed integer
- case SG_DATATYPE_Word : pGrid->Set_Value(x, y, Bytes.Read_Word (bSwap)); break; // 6: 16-bit unsigned integer
- case SG_DATATYPE_Int : pGrid->Set_Value(x, y, Bytes.Read_Int (bSwap)); break; // 7: 32-bit signed integer
- case SG_DATATYPE_DWord : pGrid->Set_Value(x, y, Bytes.Read_DWord (bSwap)); break; // 8: 32-bit unsigned integer
- case SG_DATATYPE_Float : pGrid->Set_Value(x, y, Bytes.Read_Float (bSwap)); break; // 9: 32-bit float
- case SG_DATATYPE_Double: pGrid->Set_Value(x, y, Bytes.Read_Double(bSwap)); break; // 10: 64-bit float
+ case SG_DATATYPE_Bit : pGrid->Set_Value(x, y, Bytes.Read_Byte ( )); break; // 0: 1-bit boolean
+ case SG_DATATYPE_Char : pGrid->Set_Value(x, y, Bytes.Read_Char ( )); break; // 3: 8-bit signed integer
+ case SG_DATATYPE_Byte : pGrid->Set_Value(x, y, Bytes.Read_Byte ( )); break; // 4: 8-bit unsigned integer
+ case SG_DATATYPE_Short : pGrid->Set_Value(x, y, Bytes.Read_Short (bSwap)); break; // 5: 16-bit signed integer
+ case SG_DATATYPE_Word : pGrid->Set_Value(x, y, Bytes.Read_Word (bSwap)); break; // 6: 16-bit unsigned integer
+ case SG_DATATYPE_Int : pGrid->Set_Value(x, y, Bytes.Read_Int (bSwap)); break; // 7: 32-bit signed integer
+ case SG_DATATYPE_DWord : pGrid->Set_Value(x, y, Bytes.Read_DWord (bSwap)); break; // 8: 32-bit unsigned integer
+ case SG_DATATYPE_Float : pGrid->Set_Value(x, y, Bytes.Read_Float (bSwap)); break; // 9: 32-bit float
+ case SG_DATATYPE_Double: pGrid->Set_Value(x, y, Bytes.Read_Double(bSwap)); break; // 10: 64-bit float
default:
break;
}
@@ -1197,21 +1188,21 @@ bool CSG_Grid_OGIS_Converter::to_WKBinary(CSG_Bytes &Bytes, class CSG_Grid *pGri
if( pGrid->Get_Projection().Get_EPSG() > 0 )
{
- SRID = pGrid->Get_Projection().Get_EPSG();
+ SRID = pGrid->Get_Projection().Get_EPSG();
}
- Bytes += (BYTE )1; // endiannes
- Bytes += (short )0; // version
- Bytes += (short )1; // number of bands
- Bytes += (double)pGrid->Get_Cellsize(); // scaleX
- Bytes += (double)pGrid->Get_Cellsize(); // scaleY
- Bytes += (double)pGrid->Get_XMin(true); // ipX
- Bytes += (double)pGrid->Get_YMax(true); // ipY
- Bytes += (double)0.0; // skewX
- Bytes += (double)0.0; // skewY
- Bytes += (int )SRID; // srid
- Bytes += (short )pGrid->Get_NX(); // width
- Bytes += (short )pGrid->Get_NY(); // height
+ Bytes += (BYTE )1 ; // endiannes
+ Bytes += (short )0 ; // version
+ Bytes += (short )1 ; // number of bands
+ Bytes += (double)pGrid->Get_Cellsize(); // scaleX
+ Bytes += (double)pGrid->Get_Cellsize(); // scaleY
+ Bytes += (double)pGrid->Get_XMin(true); // ipX
+ Bytes += (double)pGrid->Get_YMax(true); // ipY
+ Bytes += (double)0. ; // skewX
+ Bytes += (double)0. ; // skewY
+ Bytes += (int )SRID ; // srid
+ Bytes += (short )pGrid->Get_NX() ; // width
+ Bytes += (short )pGrid->Get_NY() ; // height
//-----------------------------------------------------
// Band
@@ -1220,56 +1211,56 @@ bool CSG_Grid_OGIS_Converter::to_WKBinary(CSG_Bytes &Bytes, class CSG_Grid *pGri
switch( pGrid->Get_Type() )
{
- case SG_DATATYPE_Bit : Flags = 0; break; // 0: 1-bit boolean
-// case SG_DATATYPE_ : Flags = 1; break; // 1: 2-bit unsigned integer
-// case SG_DATATYPE_ : Flags = 2; break; // 2: 4-bit unsigned integer
- case SG_DATATYPE_Char : Flags = 3; break; // 3: 8-bit signed integer
- case SG_DATATYPE_Byte : Flags = 4; break; // 4: 8-bit unsigned integer
- case SG_DATATYPE_Short : Flags = 5; break; // 5: 16-bit signed integer
- case SG_DATATYPE_Word : Flags = 6; break; // 6: 16-bit unsigned integer
- case SG_DATATYPE_Int : Flags = 7; break; // 7: 32-bit signed integer
- case SG_DATATYPE_DWord : Flags = 8; break; // 8: 32-bit unsigned integer
- default : Flags = 10; break; // 10: 32-bit float
- case SG_DATATYPE_Double: Flags = 11; break; // 11: 64-bit float
+ case SG_DATATYPE_Bit : Flags = 0; break; // 0: 1-bit boolean
+// case SG_DATATYPE_ : Flags = 1; break; // 1: 2-bit unsigned integer
+// case SG_DATATYPE_ : Flags = 2; break; // 2: 4-bit unsigned integer
+ case SG_DATATYPE_Char : Flags = 3; break; // 3: 8-bit signed integer
+ case SG_DATATYPE_Byte : Flags = 4; break; // 4: 8-bit unsigned integer
+ case SG_DATATYPE_Short : Flags = 5; break; // 5: 16-bit signed integer
+ case SG_DATATYPE_Word : Flags = 6; break; // 6: 16-bit unsigned integer
+ case SG_DATATYPE_Int : Flags = 7; break; // 7: 32-bit signed integer
+ case SG_DATATYPE_DWord : Flags = 8; break; // 8: 32-bit unsigned integer
+ default : Flags = 10; break; // 10: 32-bit float
+ case SG_DATATYPE_Double: Flags = 11; break; // 11: 64-bit float
}
-// Flags |= 0x80; // isOffline: no, never here!
- Flags |= 0x40; // hasNodataValue
-// Flags |= 0x20; // isNoDataValue: no, never here!
-// Flags |= 0x10; // reserved (unused)
+// Flags |= 0x80; // isOffline: no, never here!
+ Flags |= 0x40; // hasNodataValue
+// Flags |= 0x20; // isNoDataValue: no, never here!
+// Flags |= 0x10; // reserved (unused)
- Bytes += Flags;
+ Bytes += Flags;
switch( pGrid->Get_Type() )
{
- case SG_DATATYPE_Bit : Bytes += (BYTE )0 ; break; // 0: 1-bit boolean
- case SG_DATATYPE_Char : Bytes += (char )pGrid->Get_NoData_Value(); break; // 3: 8-bit signed integer
- case SG_DATATYPE_Byte : Bytes += (BYTE )pGrid->Get_NoData_Value(); break; // 4: 8-bit unsigned integer
- case SG_DATATYPE_Short : Bytes += (short )pGrid->Get_NoData_Value(); break; // 5: 16-bit signed integer
- case SG_DATATYPE_Word : Bytes += (WORD )pGrid->Get_NoData_Value(); break; // 6: 16-bit unsigned integer
- case SG_DATATYPE_Int : Bytes += (int )pGrid->Get_NoData_Value(); break; // 7: 32-bit signed integer
- case SG_DATATYPE_DWord : Bytes += (DWORD )pGrid->Get_NoData_Value(); break; // 8: 32-bit unsigned integer
- default : Bytes += (float )pGrid->Get_NoData_Value(); break; // 9: 32-bit float
- case SG_DATATYPE_Double: Bytes += (double)pGrid->Get_NoData_Value(); break; // 10: 64-bit float
+ case SG_DATATYPE_Bit : Bytes += (BYTE )0 ; break; // 0: 1-bit boolean
+ case SG_DATATYPE_Char : Bytes += (char )pGrid->Get_NoData_Value(); break; // 3: 8-bit signed integer
+ case SG_DATATYPE_Byte : Bytes += (BYTE )pGrid->Get_NoData_Value(); break; // 4: 8-bit unsigned integer
+ case SG_DATATYPE_Short : Bytes += (short )pGrid->Get_NoData_Value(); break; // 5: 16-bit signed integer
+ case SG_DATATYPE_Word : Bytes += (WORD )pGrid->Get_NoData_Value(); break; // 6: 16-bit unsigned integer
+ case SG_DATATYPE_Int : Bytes += (int )pGrid->Get_NoData_Value(); break; // 7: 32-bit signed integer
+ case SG_DATATYPE_DWord : Bytes += (DWORD )pGrid->Get_NoData_Value(); break; // 8: 32-bit unsigned integer
+ default : Bytes += (float )pGrid->Get_NoData_Value(); break; // 9: 32-bit float
+ case SG_DATATYPE_Double: Bytes += (double)pGrid->Get_NoData_Value(); break; // 10: 64-bit float
}
for(int y=0; y<pGrid->Get_NY() && SG_UI_Process_Set_Progress(y, pGrid->Get_NY()); y++)
{
for(int x=0; x<pGrid->Get_NX(); x++)
{
- double Value = pGrid->is_NoData(x, y) ? pGrid->Get_NoData_Value() : pGrid->asDouble(x, y);
+ double Value = pGrid->is_NoData(x, y) ? pGrid->Get_NoData_Value() : pGrid->asDouble(x, y);
switch( pGrid->Get_Type() )
{
- case SG_DATATYPE_Bit : Bytes += (BYTE )Value; break; // 0: 1-bit boolean
- case SG_DATATYPE_Char : Bytes += (char )Value; break; // 3: 8-bit signed integer
- case SG_DATATYPE_Byte : Bytes += (BYTE )Value; break; // 4: 8-bit unsigned integer
- case SG_DATATYPE_Short : Bytes += (short )Value; break; // 5: 16-bit signed integer
- case SG_DATATYPE_Word : Bytes += (WORD )Value; break; // 6: 16-bit unsigned integer
- case SG_DATATYPE_Int : Bytes += (int )Value; break; // 7: 32-bit signed integer
- case SG_DATATYPE_DWord : Bytes += (DWORD )Value; break; // 8: 32-bit unsigned integer
- default : Bytes += (float )Value; break; // 9: 32-bit float
- case SG_DATATYPE_Double: Bytes += (double)Value; break; // 10: 64-bit float
+ case SG_DATATYPE_Bit : Bytes += (BYTE )Value; break; // 0: 1-bit boolean
+ case SG_DATATYPE_Char : Bytes += (char )Value; break; // 3: 8-bit signed integer
+ case SG_DATATYPE_Byte : Bytes += (BYTE )Value; break; // 4: 8-bit unsigned integer
+ case SG_DATATYPE_Short : Bytes += (short )Value; break; // 5: 16-bit signed integer
+ case SG_DATATYPE_Word : Bytes += (WORD )Value; break; // 6: 16-bit unsigned integer
+ case SG_DATATYPE_Int : Bytes += (int )Value; break; // 7: 32-bit signed integer
+ case SG_DATATYPE_DWord : Bytes += (DWORD )Value; break; // 8: 32-bit unsigned integer
+ default : Bytes += (float )Value; break; // 9: 32-bit float
+ case SG_DATATYPE_Double: Bytes += (double)Value; break; // 10: 64-bit float
}
}
}
=====================================
saga-gis/src/saga_core/saga_cmd/man/saga_cmd.1
=====================================
@@ -133,7 +133,7 @@
.\" ========================================================================
.\"
.IX Title "SAGA_CMD 1"
-.TH SAGA_CMD 1 "2021-07-07" "8.5.0" " "
+.TH SAGA_CMD 1 "2021-07-07" "8.5.1" " "
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
=====================================
saga-gis/src/saga_core/saga_cmd/tool.cpp
=====================================
@@ -359,7 +359,7 @@ bool CCMD_Tool::_Found(const CSG_String &Name, CSG_DateTime &Value)
{
CSG_String Argument;
- return( _Found(Name, Argument) && Value.Parse_DateTime(Argument) );
+ return( _Found(Name, Argument) && Value.Parse_Date(Argument) );
}
=====================================
saga-gis/src/saga_core/saga_gdi/3d_view_canvas.cpp
=====================================
@@ -132,7 +132,7 @@ bool CSG_3DView_Canvas::Draw(void)
_Draw_Background();
- //-------------------------------------------------
+ //-----------------------------------------------------
if( m_Data_Min.x >= m_Data_Max.x
|| m_Data_Min.y >= m_Data_Max.y
|| m_Data_Min.z > m_Data_Max.z )
@@ -142,7 +142,7 @@ bool CSG_3DView_Canvas::Draw(void)
return( false );
}
- //-------------------------------------------------
+ //-----------------------------------------------------
if( !On_Before_Draw() )
{
bDrawing = false;
@@ -150,7 +150,7 @@ bool CSG_3DView_Canvas::Draw(void)
return( false );
}
- //-------------------------------------------------
+ //-----------------------------------------------------
m_Projector.Set_Center( // rotation center set to data's center
m_Data_Min.x + (m_Data_Max.x - m_Data_Min.x) / 2.,
m_Data_Min.y + (m_Data_Max.y - m_Data_Min.y) / 2.,
@@ -159,12 +159,14 @@ bool CSG_3DView_Canvas::Draw(void)
m_Projector.Set_Scale(SG_Get_Length(m_Data_Max.x - m_Data_Min.x, m_Data_Max.y - m_Data_Min.y));
- //-------------------------------------------------
+ int Front = _Draw_Get_Box_Front();
+
+ //-----------------------------------------------------
if( m_bStereo == false )
{
m_Color_Mode = COLOR_MODE_RGB;
- m_Image_zMax.Assign(999999.); On_Draw(); _Draw_Box(); _Draw_Labels();
+ m_Image_zMax.Assign(999999.); On_Draw(); _Draw_Box(); _Draw_Labels(Front);
}
//-----------------------------------------------------
@@ -180,7 +182,7 @@ bool CSG_3DView_Canvas::Draw(void)
m_Color_Mode = COLOR_MODE_RED;
- m_Image_zMax.Assign(999999.); On_Draw(); _Draw_Box(); _Draw_Labels();
+ m_Image_zMax.Assign(999999.); On_Draw(); _Draw_Box(); _Draw_Labels(Front);
//-------------------------------------------------
m_Projector.Set_yRotation(ry + dy);
@@ -188,7 +190,7 @@ bool CSG_3DView_Canvas::Draw(void)
m_Color_Mode = COLOR_MODE_CYAN;
- m_Image_zMax.Assign(999999.); On_Draw(); _Draw_Box(); _Draw_Labels();
+ m_Image_zMax.Assign(999999.); On_Draw(); _Draw_Box(); _Draw_Labels(Front);
//-------------------------------------------------
m_Projector.Set_yRotation(ry);
@@ -265,6 +267,22 @@ void CSG_3DView_Canvas::_Draw_Get_Box(TSG_Point_Z Box[8], bool bProjected)
}
}
+//---------------------------------------------------------
+int CSG_3DView_Canvas::_Draw_Get_Box_Front(void)
+{
+ int Front = 0; TSG_Point_Z b[8]; _Draw_Get_Box(b, true);
+
+ for(int i=1; i<4; i++)
+ {
+ if( b[i].z < b[Front].z )
+ {
+ Front = i;
+ }
+ }
+
+ return( Front );
+}
+
//---------------------------------------------------------
void CSG_3DView_Canvas::_Draw_Box(void)
{
@@ -300,7 +318,7 @@ void CSG_3DView_Canvas::_Draw_Box(void)
#define LABEL_SCALE 50.
//---------------------------------------------------------
-void CSG_3DView_Canvas::_Draw_Labels(void)
+void CSG_3DView_Canvas::_Draw_Labels(int Front)
{
if( m_Labels == 2 ) // none
{
@@ -309,8 +327,6 @@ void CSG_3DView_Canvas::_Draw_Labels(void)
TSG_Point_Z Box[8]; _Draw_Get_Box(Box, false);
- int Front = 0; { TSG_Point_Z b[8]; _Draw_Get_Box(b, true); for(int j=1; j<4; j++) { if( b[j].z < b[Front].z ) Front = j; } }
-
switch( m_Labels )
{
default:
@@ -320,24 +336,28 @@ void CSG_3DView_Canvas::_Draw_Labels(void)
_Draw_Labels(0, Box[0], Box[1], 0, 0, 0, LABEL_ALIGN_LEFT , m_Label_Res, m_Label_Scale);
_Draw_Labels(1, Box[3], Box[0], 270, 0, 0, LABEL_ALIGN_RIGHT, m_Label_Res, m_Label_Scale);
_Draw_Labels(2, Box[3], Box[7], 180, 90, 270, LABEL_ALIGN_RIGHT, m_Label_Res, m_Label_Scale);
+ _Draw_Labels(2, Box[1], Box[5], 180, 270, 180, LABEL_ALIGN_LEFT , m_Label_Res, m_Label_Scale);
break;
case 1:
_Draw_Labels(0, Box[0], Box[1], 0, 0, 0, LABEL_ALIGN_RIGHT, m_Label_Res, m_Label_Scale);
_Draw_Labels(1, Box[1], Box[2], 90, 0, 0, LABEL_ALIGN_LEFT , m_Label_Res, m_Label_Scale);
_Draw_Labels(2, Box[0], Box[4], 180, 90, 180, LABEL_ALIGN_RIGHT, m_Label_Res, m_Label_Scale);
+ _Draw_Labels(2, Box[2], Box[6], 180, 270, 270, LABEL_ALIGN_LEFT , m_Label_Res, m_Label_Scale);
break;
case 2:
_Draw_Labels(0, Box[2], Box[3], 180, 0, 0, LABEL_ALIGN_LEFT , m_Label_Res, m_Label_Scale);
_Draw_Labels(1, Box[1], Box[2], 90, 0, 0, LABEL_ALIGN_RIGHT, m_Label_Res, m_Label_Scale);
_Draw_Labels(2, Box[1], Box[5], 180, 90, 90, LABEL_ALIGN_RIGHT, m_Label_Res, m_Label_Scale);
+ _Draw_Labels(2, Box[3], Box[7], 180, 270, 0, LABEL_ALIGN_LEFT , m_Label_Res, m_Label_Scale);
break;
case 3:
_Draw_Labels(0, Box[2], Box[3], 180, 0, 0, LABEL_ALIGN_RIGHT, m_Label_Res, m_Label_Scale);
_Draw_Labels(1, Box[3], Box[0], 270, 0, 0, LABEL_ALIGN_LEFT , m_Label_Res, m_Label_Scale);
_Draw_Labels(2, Box[2], Box[6], 180, 90, 0, LABEL_ALIGN_RIGHT, m_Label_Res, m_Label_Scale);
+ _Draw_Labels(2, Box[0], Box[4], 180, 270, 90, LABEL_ALIGN_LEFT , m_Label_Res, m_Label_Scale);
break;
}
break;
=====================================
saga-gis/src/saga_core/saga_gdi/3d_view_tools.h
=====================================
@@ -218,9 +218,10 @@ private:
void _Draw_Background (void);
void _Draw_Get_Box (TSG_Point_Z Box[8], bool bProjected);
+ int _Draw_Get_Box_Front (void);
void _Draw_Box (void);
- void _Draw_Labels (void);
+ void _Draw_Labels (int Front);
void _Draw_Labels (double Min, double Max, const TSG_Point_Z &P, double Rx, double Ry, double Rz , int Resolution = 100, double Scale = 1.);
void _Draw_Labels (int Axis, const TSG_Point_Z &A, const TSG_Point_Z &B, double Rx, double Ry, double Rz, int Align = LABEL_ALIGN_TOP, int Resolution = 100, double Scale = 1.);
void _Draw_Label (const CSG_String &Text, const TSG_Point_Z &P, double Rx, double Ry, double Rz, int Align = LABEL_ALIGN_TOP, int Resolution = 100, double Scale = 1.);
=====================================
saga-gis/src/saga_core/saga_gui/man/saga_gui.1
=====================================
@@ -124,7 +124,7 @@
.\" ========================================================================
.\"
.IX Title "SAGA_GUI 1"
-.TH SAGA_GUI 1 "2021-07-07" "8.5.0" " "
+.TH SAGA_GUI 1 "2021-07-07" "8.5.1" " "
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
=====================================
saga-gis/src/saga_core/saga_gui/view_map_control.cpp
=====================================
@@ -507,7 +507,7 @@ void CVIEW_Map_Control::_Draw_Edit_Moves(wxDC &dc)
//---------------------------------------------------------
void CVIEW_Map_Control::On_Paint(wxPaintEvent &event)
{
- if( m_Bitmap.Ok() )
+ if( _Update_Bitmap_Size() )
{
wxPaintDC dc(this);
@@ -526,15 +526,28 @@ void CVIEW_Map_Control::On_Size(wxSizeEvent &event)
{
if( m_pParent->Do_Updates() )
{
- wxRect r(GetClientSize());
+ _Update_Bitmap_Size();
+ }
+}
+//---------------------------------------------------------
+bool CVIEW_Map_Control::_Update_Bitmap_Size(void)
+{
+ wxRect r(GetClientSize());
+
+ if( r.GetWidth() > 0 && r.GetHeight() > 0 )
+ {
if( !m_Bitmap.Ok() || m_Bitmap.GetWidth() != r.GetWidth() || m_Bitmap.GetHeight() != r.GetHeight() )
{
m_Bitmap.Create(r.GetWidth(), r.GetHeight());
Refresh_Map();
}
+
+ return( m_Bitmap.Ok() );
}
+
+ return( false );
}
//---------------------------------------------------------
=====================================
saga-gis/src/saga_core/saga_gui/view_map_control.h
=====================================
@@ -179,6 +179,8 @@ private:
int m_Mouse_Wheel_Accumulator = 0;
+ bool _Update_Bitmap_Size (void);
+
void _Set_StatusBar (const TSG_Point &Point);
wxPoint _Get_World2Client (const TSG_Point &Point);
=====================================
saga-gis/src/tools/grid/grid_gridding/CMakeLists.txt
=====================================
@@ -1,11 +1,9 @@
-option(WITH_TRIANGLE "Check to compile with triangle.c (only free for non-commercial usage), or use qhull instead (requires qhull)" ON)
-
if(WITH_TOOLS)
project(grid_gridding)
# add files in sudirectories
set(SAGA_TOOL_CUSTOM_SOURCE_LIST
- ./nn/delaunay.c
+ ./nn/delaunay.cpp
./nn/hash.c
./nn/istack.c
./nn/lpi.c
@@ -14,50 +12,50 @@ if(WITH_TOOLS)
./nn/nncommon-vulnerable.c
./nn/nnpi.c
)
- set(SAGA_TOOL_CUSTOM_HEADER_LIST
- grid_cell_polygon_coverage.h
- Interpolation.h
- Interpolation_AngularDistance.h
- Interpolation_InverseDistance.h
- Interpolation_NaturalNeighbour.h
- Interpolation_NearestNeighbour.h
- Interpolation_Shepard.h
- Interpolation_Triangulation.h
- )
- if(WITH_TRIANGLE) # use embedded triangle.c
- list(APPEND SAGA_TOOL_CUSTOM_SOURCE_LIST nn/triangle.c)
- list(APPEND SAGA_TOOL_CUSTOM_HEADER_LIST nn/triangle.h)
- message(STATUS "building with triangle")
- endif()
include(../../CMakePluginTemplate.cmake) # load common tool template
- if(NOT WITH_TRIANGLE)
- # link Qhull library
- # on Ubuntu 16.04 package libqhull-dev
- find_package(Qhull REQUIRED)
- find_file(LIBQHULL_R_HEADER NAMES libqhull_r/libqhull_r.h)
- message(STATUS "*** LIBQHULL_R_HEADER ${LIBQHULL_R_HEADER}")
-
- if(LIBQHULL_R_HEADER)
- target_compile_definitions(${PROJECT_NAME} PRIVATE -DUSE_QHULL -DHAVE_LIBQHULL_R_QHULL_RA_H)
- message(STATUS "LIBQHULL_R header found")
- else()
- find_file(LIBQHULL_HEADER NAMES libqhull/libqhull.h)
- message(STATUS "LIBQHULL_HEADER ${LIBQHULL_HEADER}")
- if(LIBQHULL_HEADER)
- target_compile_definitions(${PROJECT_NAME} PRIVATE -DUSE_QHULL -DHAVE_LIBQHULL_QHULL_A_H)
- message(STATUS "LIBQHULL header found")
- else()
- find_file(QHULL_HEADER NAMES qhull/qhull_a.h)
- message(STATUS "QHULL_HEADER ${QHULL_HEADER}")
- target_compile_definitions(${PROJECT_NAME} PRIVATE -DUSE_QHULL -DHAVE_QHULL_QHULL_A_H)
- message(STATUS "QHULL header found")
- endif()
- endif()
- message(STATUS "Qhull_INCLUDE_DIRS ${Qhull_INCLUDE_DIRS}")
-
- target_include_directories(${PROJECT_NAME} PRIVATE ${Qhull_INCLUDE_DIRS})
- target_link_libraries(${PROJECT_NAME} ${Qhull_LIBRARIES})
- endif()
+ # check for qhull
+# if(MSVC AND DEPS_FROM_ENVARS)
+# if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win32")
+# set(LIB4SAGA $ENV{QHULL_32})
+# else()
+# set(LIB4SAGA $ENV{QHULL})
+# endif()
+# find_path (Qhull_INCLUDE_DIRS NAMES libqhull_r/qhull_ra.h PATHS "${LIB4SAGA}")
+# find_library(Qhull_LIBRARIES NAMES qhullstatic_r.lib PATHS "${LIB4SAGA}")
+# if(Qhull_INCLUDE_DIRS AND Qhull_LIBRARIES)
+# mark_as_advanced(Qhull_INCLUDE_DIRS Qhull_LIBRARIES)
+# include(FindPackageHandleStandardArgs)
+# FIND_PACKAGE_HANDLE_STANDARD_ARGS(QHULL REQUIRED_VARS Qhull_LIBRARIES Qhull_INCLUDE_DIRS)
+# target_compile_definitions(${PROJECT_NAME} PRIVATE -DHAVE_LIBQHULL_R_QHULL_RA_H)
+# endif()
+# endif()
+#
+# if(NOT QHULL_FOUND)
+# find_package(Qhull QUIET) # ubuntu package libhpdf-dev
+# find_file(LIBQHULL_R_HEADER NAMES libqhull_r/libqhull_r.h)
+# if(LIBQHULL_R_HEADER)
+# target_compile_definitions(${PROJECT_NAME} PRIVATE -DHAVE_LIBQHULL_R_QHULL_RA_H)
+# message(STATUS "LIBQHULL_R header found")
+# else()
+# find_file(LIBQHULL_HEADER NAMES libqhull/libqhull.h)
+# if(LIBQHULL_HEADER)
+# target_compile_definitions(${PROJECT_NAME} PRIVATE -DHAVE_LIBQHULL_QHULL_A_H)
+# message(STATUS "LIBQHULL header found")
+# else()
+# find_file(QHULL_HEADER NAMES qhull/qhull_a.h)
+# if(LIBQHULL_HEADER)
+# target_compile_definitions(${PROJECT_NAME} PRIVATE -DHAVE_QHULL_QHULL_A_H)
+# message(STATUS "QHULL header found")
+# endif()
+# endif()
+# endif()
+# message(STATUS "Qhull_INCLUDE_DIRS ${Qhull_INCLUDE_DIRS}")
+# endif()
+#
+# if(QHULL_FOUND)
+# target_include_directories(${PROJECT_NAME} PRIVATE ${Qhull_INCLUDE_DIRS})
+# target_link_libraries (${PROJECT_NAME} ${Qhull_LIBRARIES})
+# endif()
endif()
=====================================
saga-gis/src/tools/grid/grid_gridding/Interpolation_NaturalNeighbour.cpp
=====================================
@@ -1,6 +1,3 @@
-/**********************************************************
- * Version $Id$
- *********************************************************/
///////////////////////////////////////////////////////////
// //
@@ -50,15 +47,6 @@
// //
///////////////////////////////////////////////////////////
-//---------------------------------------------------------
-
-
-///////////////////////////////////////////////////////////
-// //
-// //
-// //
-///////////////////////////////////////////////////////////
-
//---------------------------------------------------------
#include "Interpolation_NaturalNeighbour.h"
@@ -87,24 +75,26 @@ CInterpolation_NaturalNeighbour::CInterpolation_NaturalNeighbour(void)
"Natural Neighbour method for grid interpolation from irregular distributed points. "
"This tool makes use of the 'nn - Natural Neighbours interpolation library' created "
"and maintained by Pavel Sakov, CSIRO Marine Research. "
- "Find more information about this library at:\n"
- "<a href=\"http://github.com/sakov/nn-c\">github.com/sakov/nn-c</a>."
));
- Parameters.Add_Choice(NULL,
+ Add_Reference("https://github.com/sakov/nn-c",
+ SG_T("github.com/sakov/nn-c</a>")
+ );
+
+ Parameters.Add_Choice("",
"METHOD" , _TL("Method"),
_TL(""),
- CSG_String::Format("%s|%s|%s|",
+ CSG_String::Format("%s|%s|%s",
_TL("Linear"),
_TL("Sibson"),
_TL("Non-Sibsonian")
), 1
);
- Parameters.Add_Double(NULL,
+ Parameters.Add_Double("",
"WEIGHT" , _TL("Minimum Weight"),
_TL("restricts extrapolation by assigning minimal allowed weight for a vertex (normally \"-1\" or so; lower values correspond to lower reliability; \"0\" means no extrapolation)"),
- 0.0, 0.0, false, 0.0, true
+ 0., 0., false, 0., true
);
}
@@ -119,21 +109,19 @@ bool CInterpolation_NaturalNeighbour::Interpolate(void)
//-----------------------------------------------------
// initialize points
- CSG_Shapes *pPoints = Get_Points();
+ CSG_Shapes *pPoints = Get_Points();
- int nn_nPoints = 0;
- point *nn_pPoints = (point *)SG_Malloc(pPoints->Get_Count() * sizeof(point));
+ int nn_nPoints = 0; point *nn_pPoints = (point *)SG_Malloc(pPoints->Get_Count() * sizeof(point));
for(int iPoint=0; iPoint<pPoints->Get_Count() && Set_Progress(iPoint, pPoints->Get_Count()); iPoint++)
{
- CSG_Shape *pShape = pPoints->Get_Shape(iPoint);
+ CSG_Shape *pShape = pPoints->Get_Shape(iPoint);
if( !pShape->is_NoData(Get_Field()) )
{
- nn_pPoints[nn_nPoints].x = pShape->Get_Point(0).x;
- nn_pPoints[nn_nPoints].y = pShape->Get_Point(0).y;
- nn_pPoints[nn_nPoints].z = pShape->asDouble(Get_Field());
-
+ nn_pPoints[nn_nPoints].x = pShape->Get_Point(0).x;
+ nn_pPoints[nn_nPoints].y = pShape->Get_Point(0).y;
+ nn_pPoints[nn_nPoints].z = pShape->asDouble(Get_Field());
nn_nPoints++;
}
}
@@ -150,10 +138,9 @@ bool CInterpolation_NaturalNeighbour::Interpolate(void)
//-----------------------------------------------------
// initialize grid
- CSG_Grid *pGrid = Get_Grid();
+ CSG_Grid *pGrid = Get_Grid();
- int nn_nCells;
- point *nn_pCells = NULL;
+ int nn_nCells; point *nn_pCells = NULL;
points_generate(
pGrid->Get_XMin(), pGrid->Get_XMax(),
@@ -175,30 +162,20 @@ bool CInterpolation_NaturalNeighbour::Interpolate(void)
//-----------------------------------------------------
Process_Set_Text(_TL("interpolating"));
- double Weight = Parameters("WEIGHT")->asDouble();
+ double Weight = Parameters("WEIGHT")->asDouble();
switch( Parameters("METHOD")->asInt() )
{
- case 0:
- lpi_interpolate_points (nn_nPoints, nn_pPoints , nn_nCells, nn_pCells);
- break;
-
- default:
- nn_rule = SIBSON;
- nnpi_interpolate_points(nn_nPoints, nn_pPoints, Weight, nn_nCells, nn_pCells);
- break;
-
- case 2:
- nn_rule = NON_SIBSONIAN;
- nnpi_interpolate_points(nn_nPoints, nn_pPoints, Weight, nn_nCells, nn_pCells);
- break;
+ case 0: lpi_interpolate_points(nn_nPoints, nn_pPoints , nn_nCells, nn_pCells); break;
+ default: nn_rule = SIBSON ; nnpi_interpolate_points(nn_nPoints, nn_pPoints, Weight, nn_nCells, nn_pCells); break;
+ case 2: nn_rule = NON_SIBSONIAN; nnpi_interpolate_points(nn_nPoints, nn_pPoints, Weight, nn_nCells, nn_pCells); break;
}
//-----------------------------------------------------
#pragma omp parallel for
for(int iCell=0; iCell<pGrid->Get_NCells(); iCell++)
{
- double z = nn_pCells[iCell].z;
+ double z = nn_pCells[iCell].z;
if( SG_is_NaN(z) )
{
=====================================
saga-gis/src/tools/grid/grid_gridding/MLB_Interface.cpp
=====================================
@@ -76,7 +76,7 @@ CSG_String Get_Info(int i)
return( _TL("Grid") );
case TLB_INFO_Author:
- return( "O. Conrad (c) 2002-10" );
+ return( "O.Conrad (c) 2002-23" );
case TLB_INFO_Description:
return( _TL("Tools for the gridding of points and other vector data.") );
@@ -93,14 +93,15 @@ CSG_String Get_Info(int i)
//---------------------------------------------------------
// 3. Include the headers of your tools here...
+#include "Shapes2Grid.h"
#include "Interpolation_InverseDistance.h"
#include "Interpolation_AngularDistance.h"
#include "Interpolation_NearestNeighbour.h"
-#include "Interpolation_NaturalNeighbour.h"
#include "Interpolation_Shepard.h"
#include "Interpolation_Triangulation.h"
-#include "Shapes2Grid.h"
+#include "Interpolation_NaturalNeighbour.h"
#include "kernel_density.h"
+
#include "grid_cell_polygon_coverage.h"
@@ -111,24 +112,24 @@ CSG_Tool * Create_Tool(int i)
{
switch( i )
{
- case 0: return( new CShapes2Grid );
- case 9: return( new CPolygons2Grid );
- case 10: return( new CPolygonCategories2Grid );
+ case 0: return( new CShapes2Grid );
+ case 9: return( new CPolygons2Grid );
+ case 10: return( new CPolygonCategories2Grid );
- case 1: return( new CInterpolation_InverseDistance );
- case 7: return( new CInterpolation_AngularDistance );
- case 2: return( new CInterpolation_NearestNeighbour );
- case 3: return( new CInterpolation_NaturalNeighbour );
- case 4: return( new CInterpolation_Shepard );
- case 5: return( new CInterpolation_Triangulation );
+ case 1: return( new CInterpolation_InverseDistance );
+ case 7: return( new CInterpolation_AngularDistance );
+ case 2: return( new CInterpolation_NearestNeighbour );
+ case 4: return( new CInterpolation_Shepard );
+ case 5: return( new CInterpolation_Triangulation );
+ case 3: return( new CInterpolation_NaturalNeighbour );
- case 6: return( new CKernel_Density );
+ case 6: return( new CKernel_Density );
- case 8: return( new CGrid_Cell_Polygon_Coverage );
+ case 8: return( new CGrid_Cell_Polygon_Coverage );
//-----------------------------------------------------
- case 11: return( NULL );
- default: return( TLB_INTERFACE_SKIP_TOOL );
+ case 11: return( NULL );
+ default: return( TLB_INTERFACE_SKIP_TOOL );
}
}
=====================================
saga-gis/src/tools/grid/grid_gridding/MLB_Interface.h deleted
=====================================
@@ -1,72 +0,0 @@
-
-///////////////////////////////////////////////////////////
-// //
-// SAGA //
-// //
-// System for Automated Geoscientific Analyses //
-// //
-// Tool Library //
-// Grid_Gridding //
-// //
-//-------------------------------------------------------//
-// //
-// TLB_Interface.h //
-// //
-// Copyright (C) 2003 by //
-// Olaf Conrad //
-// //
-//-------------------------------------------------------//
-// //
-// This file is part of 'SAGA - System for Automated //
-// Geoscientific Analyses'. SAGA 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 2 of the //
-// License, or (at your option) any later version. //
-// //
-// SAGA 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. //
-// //
-// You should have received a copy of the GNU General //
-// Public License along with this program; if not, see //
-// <http://www.gnu.org/licenses/>. //
-// //
-//-------------------------------------------------------//
-// //
-// e-mail: oconrad at saga-gis.org //
-// //
-// contact: Olaf Conrad //
-// Institute of Geography //
-// University of Goettingen //
-// Goldschmidtstr. 5 //
-// 37077 Goettingen //
-// Germany //
-// //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#ifndef HEADER_INCLUDED__grid_gridding_H
-#define HEADER_INCLUDED__grid_gridding_H
-
-
-///////////////////////////////////////////////////////////
-// //
-// Include the SAGA-API here //
-// //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#include <saga_api/saga_api.h>
-
-
-///////////////////////////////////////////////////////////
-// //
-// //
-// //
-///////////////////////////////////////////////////////////
-
-//---------------------------------------------------------
-#endif // #ifndef HEADER_INCLUDED__grid_gridding_H
=====================================
saga-gis/src/tools/grid/grid_gridding/grid_cell_polygon_coverage.cpp
=====================================
@@ -142,7 +142,7 @@ int CGrid_Cell_Polygon_Coverage::On_Parameters_Enable(CSG_Parameters *pParameter
//---------------------------------------------------------
#define GET_NPOLYGONS (bSelection ? pPolygons->Get_Selection_Count() : pPolygons->Get_Count())
-#define GET_POLYGON(i) ((CSG_Shape_Polygon *)(bSelection ? pPolygons->Get_Selection(i) : pPolygons->Get_Shape(i)))
+#define GET_POLYGON(i) ((CSG_Shape_Polygon *)(bSelection ? pPolygons->Get_Selection((int)i) : pPolygons->Get_Shape(i)))
//---------------------------------------------------------
bool CGrid_Cell_Polygon_Coverage::On_Execute(void)
@@ -213,7 +213,7 @@ bool CGrid_Cell_Polygon_Coverage::On_Execute(void)
{
pArea->Assign(0.0);
- for(size_t i=0; i<GET_NPOLYGONS && Set_Progress(i, GET_NPOLYGONS); i++)
+ for(size_t i=0; i<GET_NPOLYGONS && Set_Progress((double)i, (double)GET_NPOLYGONS); i++)
{
Get_Area(GET_POLYGON(i), pArea);
}
=====================================
saga-gis/src/tools/grid/grid_gridding/kernel_density.cpp
=====================================
@@ -191,7 +191,7 @@ bool CKernel_Density::On_Execute(void)
//-----------------------------------------------------
if( pPoints->Get_Selection_Count() > 0 )
{
- for(int iPoint=0; iPoint<(int)pPoints->Get_Selection_Count() && Set_Progress(iPoint, pPoints->Get_Selection_Count()); iPoint++)
+ for(int iPoint=0; iPoint<(int)pPoints->Get_Selection_Count() && Set_Progress(iPoint, (int)pPoints->Get_Selection_Count()); iPoint++)
{
CSG_Shape *pPoint = pPoints->Get_Selection(iPoint);
=====================================
saga-gis/src/tools/grid/grid_gridding/nn/config.h
=====================================
@@ -1,6 +1,8 @@
/* config.h. Generated from config.h.in by configure. */
#if defined(_WIN32)
+#ifndef isnan
#define isnan _isnan
+#endif
#define copysign _copysign
#define rint (int)
#define M_PI 3.14159265358979323846
=====================================
saga-gis/src/tools/grid/grid_gridding/nn/delaunay.c deleted
=====================================
@@ -1,843 +0,0 @@
-/******************************************************************************
- *
- * File: delaunay.c
- *
- * Created: 04/08/2000
- *
- * Author: Pavel Sakov
- * CSIRO Marine Research
- *
- * Purpose: Delaunay triangulation - a wrapper to triangulate()
- *
- * Description: None
- *
- * Revisions: 10/06/2003 PS: delaunay_build(); delaunay_destroy();
- * struct delaunay: from now on, only shallow copy of the
- * input data is contained in struct delaunay. This saves
- * memory and is consistent with libcsa.
- * 30/10/2007 PS: added delaunay_addflag() and
- * delaunay_resetflags(); modified delaunay_circles_find()
- * to reset the flags to 0 on return. This is very important
- * for large datasets, many thanks to John Gerschwitz,
- * Petroleum Geo-Services, for identifying the problem..
- *
- *****************************************************************************/
-
-#define ANSI_DECLARATORS /* for triangle.h */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-#include <math.h>
-#include <string.h>
-#include <limits.h>
-#include <float.h>
-#include "istack.h"
-#include "nan.h"
-#include "delaunay.h"
-#include "nn.h"
-#include "nn_internal.h"
-
-/*
- * This parameter is used in search of tricircles containing a given point:
- * if there are no more triangles than N_SEARCH_TURNON
- * do linear search
- * else
- * do more complicated stuff
- */
-#define N_SEARCH_TURNON 20
-#define N_FLAGS_TURNON 1000
-#define N_FLAGS_INC 100
-
-static delaunay* delaunay_create()
-{
- delaunay* d = malloc(sizeof(delaunay));
-
- d->npoints = 0;
- d->points = NULL;
- d->xmin = DBL_MAX;
- d->xmax = -DBL_MAX;
- d->ymin = DBL_MAX;
- d->ymax = -DBL_MAX;
- d->ntriangles = 0;
- d->triangles = NULL;
- d->circles = NULL;
- d->neighbours = NULL;
- d->n_point_triangles = NULL;
- d->point_triangles = NULL;
- d->nedges = 0;
- d->edges = NULL;
- d->flags = NULL;
- d->first_id = -1;
- d->t_in = NULL;
- d->t_out = NULL;
- d->nflags = 0;
- d->nflagsallocated = 0;
- d->flagids = NULL;
-
- return d;
-}
-
-//---------------------------------------------------------
-#ifndef USE_QHULL
-
-#include "triangle.h"
-
-static void tio_init(struct triangulateio* tio)
-{
- tio->pointlist = NULL;
- tio->pointattributelist = NULL;
- tio->pointmarkerlist = NULL;
- tio->numberofpoints = 0;
- tio->numberofpointattributes = 0;
- tio->trianglelist = NULL;
- tio->triangleattributelist = NULL;
- tio->trianglearealist = NULL;
- tio->neighborlist = NULL;
- tio->numberoftriangles = 0;
- tio->numberofcorners = 0;
- tio->numberoftriangleattributes = 0;
- tio->segmentlist = 0;
- tio->segmentmarkerlist = NULL;
- tio->numberofsegments = 0;
- tio->holelist = NULL;
- tio->numberofholes = 0;
- tio->regionlist = NULL;
- tio->numberofregions = 0;
- tio->edgelist = NULL;
- tio->edgemarkerlist = NULL;
- tio->normlist = NULL;
- tio->numberofedges = 0;
-}
-
-static void tio_destroy(struct triangulateio* tio)
-{
- if (tio->pointlist != NULL)
- free(tio->pointlist);
- if (tio->pointattributelist != NULL)
- free(tio->pointattributelist);
- if (tio->pointmarkerlist != NULL)
- free(tio->pointmarkerlist);
- if (tio->trianglelist != NULL)
- free(tio->trianglelist);
- if (tio->triangleattributelist != NULL)
- free(tio->triangleattributelist);
- if (tio->trianglearealist != NULL)
- free(tio->trianglearealist);
- if (tio->neighborlist != NULL)
- free(tio->neighborlist);
- if (tio->segmentlist != NULL)
- free(tio->segmentlist);
- if (tio->segmentmarkerlist != NULL)
- free(tio->segmentmarkerlist);
- if (tio->holelist != NULL)
- free(tio->holelist);
- if (tio->regionlist != NULL)
- free(tio->regionlist);
- if (tio->edgelist != NULL)
- free(tio->edgelist);
- if (tio->edgemarkerlist != NULL)
- free(tio->edgemarkerlist);
- if (tio->normlist != NULL)
- free(tio->normlist);
-}
-
-static void tio2delaunay(struct triangulateio* tio_out, delaunay* d)
-{
- int i, j;
-
- /*
- * I assume that all input points appear in tio_out in the same order as
- * they were written to tio_in. I have seen no exceptions so far, even
- * if duplicate points were presented. Just in case, let us make a couple
- * of checks.
- */
- assert(tio_out->numberofpoints == d->npoints);
- assert(tio_out->pointlist[2 * d->npoints - 2] == d->points[d->npoints - 1].x && tio_out->pointlist[2 * d->npoints - 1] == d->points[d->npoints - 1].y);
-
- for (i = 0, j = 0; i < d->npoints; ++i) {
- point* p = &d->points[i];
-
- if (p->x < d->xmin)
- d->xmin = p->x;
- if (p->x > d->xmax)
- d->xmax = p->x;
- if (p->y < d->ymin)
- d->ymin = p->y;
- if (p->y > d->ymax)
- d->ymax = p->y;
- }
- if (nn_verbose) {
- fprintf(stderr, "input:\n");
- for (i = 0, j = 0; i < d->npoints; ++i) {
- point* p = &d->points[i];
-
- fprintf(stderr, " %d: %15.7g %15.7g %15.7g\n", i, p->x, p->y, p->z);
- }
- }
-
- d->ntriangles = tio_out->numberoftriangles;
- if (d->ntriangles > 0) {
- d->triangles = malloc(d->ntriangles * sizeof(triangle));
- d->neighbours = malloc(d->ntriangles * sizeof(triangle_neighbours));
- d->circles = malloc(d->ntriangles * sizeof(circle));
- d->n_point_triangles = calloc(d->npoints, sizeof(int));
- d->point_triangles = malloc(d->npoints * sizeof(int*));
- d->flags = calloc(d->ntriangles, sizeof(int));
- }
-
- if (nn_verbose)
- fprintf(stderr, "triangles:\n");
- for (i = 0; i < d->ntriangles; ++i) {
- int offset = i * 3;
- triangle* t = &d->triangles[i];
- triangle_neighbours* n = &d->neighbours[i];
- circle* c = &d->circles[i];
- int status;
-
- t->vids[0] = tio_out->trianglelist[offset];
- t->vids[1] = tio_out->trianglelist[offset + 1];
- t->vids[2] = tio_out->trianglelist[offset + 2];
-
- n->tids[0] = tio_out->neighborlist[offset];
- n->tids[1] = tio_out->neighborlist[offset + 1];
- n->tids[2] = tio_out->neighborlist[offset + 2];
-
- status = circle_build1(c, &d->points[t->vids[0]], &d->points[t->vids[1]], &d->points[t->vids[2]]);
- assert(status);
-
- if (nn_verbose)
- fprintf(stderr, " %d: (%d,%d,%d)\n", i, t->vids[0], t->vids[1], t->vids[2]);
- }
-
- for (i = 0; i < d->ntriangles; ++i) {
- triangle* t = &d->triangles[i];
-
- for (j = 0; j < 3; ++j)
- d->n_point_triangles[t->vids[j]]++;
- }
- if (d->ntriangles > 0) {
- for (i = 0; i < d->npoints; ++i) {
- if (d->n_point_triangles[i] > 0)
- d->point_triangles[i] = malloc(d->n_point_triangles[i] * sizeof(int));
- else
- d->point_triangles[i] = NULL;
- d->n_point_triangles[i] = 0;
- }
- }
- for (i = 0; i < d->ntriangles; ++i) {
- triangle* t = &d->triangles[i];
-
- for (j = 0; j < 3; ++j) {
- int vid = t->vids[j];
-
- d->point_triangles[vid][d->n_point_triangles[vid]] = i;
- d->n_point_triangles[vid]++;
- }
- }
-
- if (tio_out->edgelist != NULL) {
- d->nedges = tio_out->numberofedges;
- d->edges = malloc(d->nedges * 2 * sizeof(int));
- memcpy(d->edges, tio_out->edgelist, d->nedges * 2 * sizeof(int));
- }
-}
-
-/* Builds Delaunay triangulation of the given array of points.
- *
- * @param np Number of points
- * @param points Array of points [np] (input)
- * @param ns Number of forced segments
- * @param segments Array of (forced) segment endpoint indices [2*ns]
- * @param nh Number of holes
- * @param holes Array of hole (x,y) coordinates [2*nh]
- * @return Delaunay triangulation structure with triangulation results
- */
-delaunay* delaunay_build(int np, point points[], int ns, int segments[], int nh, double holes[])
-{
- delaunay* d = delaunay_create();
- struct triangulateio tio_in;
- struct triangulateio tio_out;
- char cmd[64] = "eznC";
- int i, j;
-
- assert(sizeof(REAL) == sizeof(double));
-
- tio_init(&tio_in);
-
- if (np == 0) {
- free(d);
- return NULL;
- }
-
- tio_in.pointlist = malloc(np * 2 * sizeof(double));
- tio_in.numberofpoints = np;
- for (i = 0, j = 0; i < np; ++i) {
- tio_in.pointlist[j++] = points[i].x;
- tio_in.pointlist[j++] = points[i].y;
- }
-
- if (ns > 0) {
- tio_in.segmentlist = malloc(ns * 2 * sizeof(int));
- tio_in.numberofsegments = ns;
- memcpy(tio_in.segmentlist, segments, ns * 2 * sizeof(int));
- }
-
- if (nh > 0) {
- tio_in.holelist = malloc(nh * 2 * sizeof(double));
- tio_in.numberofholes = nh;
- memcpy(tio_in.holelist, holes, nh * 2 * sizeof(double));
- }
-
- tio_init(&tio_out);
-
- if (!nn_verbose)
- strcat(cmd, "Q");
- else if (nn_verbose > 1)
- strcat(cmd, "VV");
- if (ns != 0)
- strcat(cmd, "p");
-
- if (nn_verbose)
- fflush(stderr);
-
- /*
- * climax
- */
- triangulate(cmd, &tio_in, &tio_out, NULL);
-
- if (nn_verbose)
- fflush(stderr);
-
- d->npoints = np;
- d->points = points;
-
- tio2delaunay(&tio_out, d);
-
- tio_destroy(&tio_in);
- tio_destroy(&tio_out);
-
- return d;
-}
-
-//---------------------------------------------------------
-#else /* USE_QHULL */
-
-#ifdef HAVE_LIBQHULL_R_QHULL_RA_H
- #include <libqhull_r/qhull_ra.h>
-#elif HAVE_LIBQHULL_QHULL_A_H
- #include <libqhull/qhull_a.h>
-#else
- #ifdef HAVE_QHULL_QHULL_A_H
- #include <qhull/qhull_a.h>
- #else
- #error Failed to include qhull_a.h. Is Qhull installed?
- #endif
-#endif
-
-/* returns 1 if a,b,c are clockwise ordered */
-static int cw(delaunay *d, triangle *t)
-{
- point* pa = &d->points[t->vids[0]];
- point* pb = &d->points[t->vids[1]];
- point* pc = &d->points[t->vids[2]];
-
- return ((pb->x - pa->x)*(pc->y - pa->y) < (pc->x - pa->x)*(pb->y - pa->y));
-}
-
-delaunay* delaunay_build(int np, point points[], int ns, int segments[], int nh, double holes[])
-{
- delaunay* d = delaunay_create();
-
- coordT *qpoints; /* array of coordinates for each point */
- boolT ismalloc = False; /* True if qhull should free points */
- char flags[64] = "qhull d Qbb Qt"; /* option flags for qhull */
- facetT *facet,*neighbor,**neighborp; /* variables to walk through facets */
- vertexT *vertex, **vertexp; /* variables to walk through vertex */
-
- int curlong, totlong; /* memory remaining after qh_memfreeshort */
- FILE *outfile = stdout;
- FILE *errfile = stderr; /* error messages from qhull code */
-
- int i, j;
- int exitcode;
- int dim, ntriangles;
- int numfacets, numsimplicial, numridges, totneighbors, numcoplanars, numtricoplanars;
-
- dim = 2;
-
- assert(sizeof(realT) == sizeof(double)); /* Qhull was compiled with doubles? */
-
- if (np == 0 || ns > 0 || nh > 0) {
- fprintf(stderr, "segments=%d holes=%d\n, aborting Qhull implementation, use 'triangle' instead.\n", ns, nh);
- free(d);
- return NULL;
- }
-
- qpoints = (coordT *) malloc(np * (dim+1) * sizeof(coordT));
-
- for (i=0; i<np; i++) {
- qpoints[i*dim] = points[i].x;
- qpoints[i*dim+1] = points[i].y;
- }
-
- if (!nn_verbose)
- outfile = NULL;
- if (nn_verbose)
- strcat(flags, " s");
- if (nn_verbose > 1)
- strcat(flags, " Ts");
-
- if (nn_verbose)
- fflush(stderr);
-
- /*
- * climax
- */
-
-#ifdef HAVE_LIBQHULL_R_QHULL_RA_H
- qhT qh_qh;
- qhT *qh= &qh_qh;
-
- QHULL_LIB_CHECK
-
- qh_zero(qh, errfile);
-
- exitcode = qh_new_qhull (qh, dim, np, qpoints, ismalloc,
- flags, outfile, errfile);
-#else
- exitcode = qh_new_qhull (dim, np, qpoints, ismalloc,
- flags, outfile, errfile);
-#endif
-
- if(!exitcode) {
-
- if (nn_verbose)
- fflush(stderr);
-
- d->xmin = DBL_MAX;
- d->xmax = -DBL_MAX;
- d->ymin = DBL_MAX;
- d->ymax = -DBL_MAX;
-
- d->npoints = np;
- d->points = malloc(np * sizeof(point));
- for (i = 0; i < np; ++i) {
- point* p = &d->points[i];
-
- p->x = points[i].x;
- p->y = points[i].y;
- p->z = points[i].z;
-
- if (p->x < d->xmin)
- d->xmin = p->x;
- if (p->x > d->xmax)
- d->xmax = p->x;
- if (p->y < d->ymin)
- d->ymin = p->y;
- if (p->y > d->ymax)
- d->ymax = p->y;
- }
-
- if (nn_verbose) {
- fprintf(stderr, "input:\n");
- for (i = 0; i < np; ++i) {
- point* p = &d->points[i];
-
- fprintf(stderr, " %d: %15.7g %15.7g %15.7g\n",
- i, p->x, p->y, p->z);
- }
- }
-
-#ifdef HAVE_LIBQHULL_R_QHULL_RA_H
- qh_findgood_all (qh, qh->facet_list);
- qh_countfacets (qh, qh->facet_list, NULL, !qh_ALL, &numfacets,
- &numsimplicial, &totneighbors, &numridges,
- &numcoplanars, &numtricoplanars);
-#else
- qh_findgood_all (qh facet_list);
- qh_countfacets (qh facet_list, NULL, !qh_ALL, &numfacets,
- &numsimplicial, &totneighbors, &numridges,
- &numcoplanars, &numtricoplanars);
-#endif
-
- ntriangles = 0;
- FORALLfacets {
- if (!facet->upperdelaunay && facet->simplicial)
- ntriangles++;
- }
-
- d->ntriangles = ntriangles;
- d->triangles = malloc(d->ntriangles * sizeof(triangle));
- d->neighbours = malloc(d->ntriangles * sizeof(triangle_neighbours));
- d->circles = malloc(d->ntriangles * sizeof(circle));
-
- if (nn_verbose)
- fprintf(stderr, "triangles:\tneighbors:\n");
-
- i = 0;
- FORALLfacets {
- if (!facet->upperdelaunay && facet->simplicial) {
- triangle* t = &d->triangles[i];
- triangle_neighbours* n = &d->neighbours[i];
- circle* c = &d->circles[i];
-
- j = 0;
- FOREACHvertex_(facet->vertices)
-
-#ifdef HAVE_LIBQHULL_R_QHULL_RA_H
- t->vids[j++] = qh_pointid(qh, vertex->point);
-#else
- t->vids[j++] = qh_pointid(vertex->point);
-#endif
-
- j = 0;
- FOREACHneighbor_(facet)
- n->tids[j++] = neighbor->visitid ? neighbor->visitid - 1 : - 1;
-
- /* Put triangle vertices in counterclockwise order, as
- * 'triangle' do.
- * The same needs to be done with the neighbors.
- *
- * The following works, i.e., it seems that Qhull maintains a
- * relationship between the vertices and the neighbors
- * triangles, but that is not said anywhere, so if this stop
- * working in a future Qhull release, you know what you have
- * to do, reorder the neighbors.
- */
-
- if(cw(d, t)) {
- int tmp = t->vids[1];
- t->vids[1] = t->vids[2];
- t->vids[2] = tmp;
-
- tmp = n->tids[1];
- n->tids[1] = n->tids[2];
- n->tids[2] = tmp;
- }
-
- circle_build1(c, &d->points[t->vids[0]], &d->points[t->vids[1]],
- &d->points[t->vids[2]]);
-
- if (nn_verbose)
- fprintf(stderr, " %d: (%d,%d,%d)\t(%d,%d,%d)\n",
- i, t->vids[0], t->vids[1], t->vids[2], n->tids[0],
- n->tids[1], n->tids[2]);
-
- i++;
- }
- }
-
- d->flags = calloc(d->ntriangles, sizeof(int));
-
- d->n_point_triangles = calloc(d->npoints, sizeof(int));
- for (i = 0; i < d->ntriangles; ++i) {
- triangle* t = &d->triangles[i];
-
- for (j = 0; j < 3; ++j)
- d->n_point_triangles[t->vids[j]]++;
- }
- d->point_triangles = malloc(d->npoints * sizeof(int*));
- for (i = 0; i < d->npoints; ++i) {
- if (d->n_point_triangles[i] > 0)
- d->point_triangles[i] = malloc(d->n_point_triangles[i] * sizeof(int));
- else
- d->point_triangles[i] = NULL;
- d->n_point_triangles[i] = 0;
- }
- for (i = 0; i < d->ntriangles; ++i) {
- triangle* t = &d->triangles[i];
-
- for (j = 0; j < 3; ++j) {
- int vid = t->vids[j];
-
- d->point_triangles[vid][d->n_point_triangles[vid]] = i;
- d->n_point_triangles[vid]++;
- }
- }
-
- d->nedges = 0;
- d->edges = NULL;
-
- d->t_in = NULL;
- d->t_out = NULL;
- d->first_id = -1;
-
- } else {
- free(d);
- d = NULL;
- }
-
- free(qpoints);
-
-#ifdef HAVE_LIBQHULL_R_QHULL_RA_H
- qh_freeqhull(qh, !qh_ALL); /* free long memory */
- qh_memfreeshort (qh, &curlong, &totlong); /* free short memory and memory allocator */
-#else
- qh_freeqhull(!qh_ALL); /* free long memory */
- qh_memfreeshort (&curlong, &totlong); /* free short memory and memory allocator */
-#endif
-
- if (curlong || totlong)
- fprintf (errfile,
- "qhull: did not free %d bytes of long memory (%d pieces)\n",
- totlong, curlong);
-
- return d;
-}
-#endif /* USE_QHULL */
-
-
-/* Destroys Delaunay triangulation.
- *
- * @param d Structure to be destroyed
- */
-void delaunay_destroy(delaunay* d)
-{
- if (d == NULL)
- return;
-
- if (d->point_triangles != NULL) {
- int i;
-
- for (i = 0; i < d->npoints; ++i)
- if (d->point_triangles[i] != NULL)
- free(d->point_triangles[i]);
- free(d->point_triangles);
- }
- if (d->nedges > 0)
- free(d->edges);
-#ifdef USE_QHULL
- /* This is a shallow copy if we're not using qhull so we don't
- * need to free it */
- if (d->points != NULL)
- free(d->points);
-#endif
- if (d->n_point_triangles != NULL)
- free(d->n_point_triangles);
- if (d->flags != NULL)
- free(d->flags);
- if (d->circles != NULL)
- free(d->circles);
- if (d->neighbours != NULL)
- free(d->neighbours);
- if (d->triangles != NULL)
- free(d->triangles);
- if (d->t_in != NULL)
- istack_destroy(d->t_in);
- if (d->t_out != NULL)
- istack_destroy(d->t_out);
- if (d->flagids != NULL)
- free(d->flagids);
- free(d);
-}
-
-/* Returns whether the point p is on the right side of the vector (p0, p1).
- */
-static int onrightside(point* p, point* p0, point* p1)
-{
- return (p1->x - p->x) * (p0->y - p->y) > (p0->x - p->x) * (p1->y - p->y);
-}
-
-/* Finds triangle specified point belongs to (if any).
- *
- * @param d Delaunay triangulation
- * @param p Point to be mapped
- * @param seed Triangle index to start with
- * @return Triangle id if successful, -1 otherwhile
- */
-int delaunay_xytoi(delaunay* d, point* p, int id)
-{
- triangle* t;
- int i;
-
- if (p->x < d->xmin || p->x > d->xmax || p->y < d->ymin || p->y > d->ymax)
- return -1;
-
- if (id < 0 || id > d->ntriangles)
- id = 0;
- t = &d->triangles[id];
- do {
- for (i = 0; i < 3; ++i) {
- int i1 = (i + 1) % 3;
-
- if (onrightside(p, &d->points[t->vids[i]], &d->points[t->vids[i1]])) {
- id = d->neighbours[id].tids[(i + 2) % 3];
- if (id < 0)
- return id;
- t = &d->triangles[id];
- break;
- }
- }
- } while (i < 3);
-
- return id;
-}
-
-static void delaunay_addflag(delaunay* d, int i)
-{
- if (d->nflags == d->nflagsallocated) {
- d->nflagsallocated += N_FLAGS_INC;
- d->flagids = realloc(d->flagids, d->nflagsallocated * sizeof(int));
- }
- d->flagids[d->nflags] = i;
- d->nflags++;
-}
-
-static void delaunay_resetflags(delaunay* d)
-{
- int i;
-
- for (i = 0; i < d->nflags; ++i)
- d->flags[d->flagids[i]] = 0;
- d->nflags = 0;
-}
-
-/* Finds all tricircles specified point belongs to.
- *
- * @param d Delaunay triangulation
- * @param p Point to be mapped
- * @param n Pointer to the number of tricircles within `d' containing `p'
- * (output)
- * @param out Pointer to an array of indices of the corresponding triangles
- * [n] (output)
- *
- * There is a standard search procedure involving search through triangle
- * neighbours (not through vertex neighbours). It must be a bit faster due to
- * the smaller number of triangle neighbours (3 per triangle) but may fail
- * for a point outside convex hall.
- *
- * We may wish to modify this procedure in future: first check if the point
- * is inside the convex hall, and depending on that use one of the two
- * search algorithms. It not 100% clear though whether this will lead to a
- * substantial speed gains because of the check on convex hall involved.
- */
-void delaunay_circles_find(delaunay* d, point* p, int* n, int** out)
-{
- /*
- * This flag was introduced as a hack to handle some degenerate cases. It
- * is set to 1 only if the triangle associated with the first circle is
- * already known to contain the point. In this case the circle is assumed
- * to contain the point without a check. In my practice this turned
- * useful in some cases when point p coincided with one of the vertices
- * of a thin triangle.
- */
- int contains = 0;
- int i;
-
- if (d->t_in == NULL) {
- d->t_in = istack_create();
- d->t_out = istack_create();
- }
-
- /*
- * if there are only a few data points, do linear search
- */
- if (d->ntriangles <= N_SEARCH_TURNON) {
- istack_reset(d->t_out);
-
- for (i = 0; i < d->ntriangles; ++i) {
- if (circle_contains(&d->circles[i], p)) {
- istack_push(d->t_out, i);
- }
- }
-
- *n = d->t_out->n;
- *out = d->t_out->v;
-
- return;
- }
- /*
- * otherwise, do a more complicated stuff
- */
-
- /*
- * It is important to have a reasonable seed here. If the last search
- * was successful -- start with the last found tricircle, otherwhile (i)
- * try to find a triangle containing p; if fails then (ii) check
- * tricircles from the last search; if fails then (iii) make linear
- * search through all tricircles
- */
- if (d->first_id < 0 || !circle_contains(&d->circles[d->first_id], p)) {
- /*
- * if any triangle contains p -- start with this triangle
- */
- d->first_id = delaunay_xytoi(d, p, d->first_id);
- contains = (d->first_id >= 0);
-
- /*
- * if no triangle contains p, there still is a chance that it is
- * inside some of circumcircles
- */
- if (d->first_id < 0) {
- int nn = d->t_out->n;
- int tid = -1;
-
- /*
- * first check results of the last search
- */
- for (i = 0; i < nn; ++i) {
- tid = d->t_out->v[i];
- if (circle_contains(&d->circles[tid], p))
- break;
- }
- /*
- * if unsuccessful, search through all circles
- */
- if (tid < 0 || i == nn) {
- double nt = d->ntriangles;
-
- for (tid = 0; tid < nt; ++tid) {
- if (circle_contains(&d->circles[tid], p))
- break;
- }
- if (tid == nt) {
- istack_reset(d->t_out);
- *n = 0;
- *out = NULL;
- return; /* failed */
- }
- }
- d->first_id = tid;
- }
- }
-
- istack_reset(d->t_in);
- istack_reset(d->t_out);
-
- istack_push(d->t_in, d->first_id);
- d->flags[d->first_id] = 1;
- delaunay_addflag(d, d->first_id);
-
- /*
- * main cycle
- */
- while (d->t_in->n > 0) {
- int tid = istack_pop(d->t_in);
- triangle* t = &d->triangles[tid];
-
- if (contains || circle_contains(&d->circles[tid], p)) {
- istack_push(d->t_out, tid);
- for (i = 0; i < 3; ++i) {
- int vid = t->vids[i];
- int nt = d->n_point_triangles[vid];
- int j;
-
- for (j = 0; j < nt; ++j) {
- int ntid = d->point_triangles[vid][j];
-
- if (d->flags[ntid] == 0) {
- istack_push(d->t_in, ntid);
- d->flags[ntid] = 1;
- delaunay_addflag(d, ntid);
- }
- }
- }
- }
- contains = 0;
- }
-
- *n = d->t_out->n;
- *out = d->t_out->v;
- delaunay_resetflags(d);
-}
=====================================
saga-gis/src/tools/grid/grid_gridding/nn/delaunay.cpp
=====================================
@@ -0,0 +1,726 @@
+/******************************************************************************
+*
+* File: delaunay.c
+*
+* Created: 04/08/2000
+*
+* Author: Pavel Sakov
+* CSIRO Marine Research
+*
+* Purpose: Delaunay triangulation - a wrapper to triangulate()
+*
+* Description: None
+*
+* Revisions: 10/06/2003 PS: delaunay_build(); delaunay_destroy();
+* struct delaunay: from now on, only shallow copy of the
+* input data is contained in struct delaunay. This saves
+* memory and is consistent with libcsa.
+* 30/10/2007 PS: added delaunay_addflag() and
+* delaunay_resetflags(); modified delaunay_circles_find()
+* to reset the flags to 0 on return. This is very important
+* for large datasets, many thanks to John Gerschwitz,
+* Petroleum Geo-Services, for identifying the problem.
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include <math.h>
+#include <string.h>
+#include <limits.h>
+#include <float.h>
+extern "C"
+{
+ #include "istack.h"
+ #include "nan.h"
+ #include "delaunay.h"
+ #include "nn.h"
+ #include "nn_internal.h"
+}
+
+/*
+* This parameter is used in search of tricircles containing a given point:
+* if there are no more triangles than N_SEARCH_TURNON
+* do linear search
+* else
+* do more complicated stuff
+*/
+#define N_SEARCH_TURNON 20
+#define N_FLAGS_TURNON 1000
+#define N_FLAGS_INC 100
+
+static delaunay* delaunay_create()
+{
+ delaunay *d = (delaunay*)malloc(sizeof(delaunay));
+
+ d->npoints = 0;
+ d->points = NULL;
+ d->xmin = DBL_MAX;
+ d->xmax = -DBL_MAX;
+ d->ymin = DBL_MAX;
+ d->ymax = -DBL_MAX;
+ d->ntriangles = 0;
+ d->triangles = NULL;
+ d->circles = NULL;
+ d->neighbours = NULL;
+ d->n_point_triangles = NULL;
+ d->point_triangles = NULL;
+ d->nedges = 0;
+ d->edges = NULL;
+ d->flags = NULL;
+ d->first_id = -1;
+ d->t_in = NULL;
+ d->t_out = NULL;
+ d->nflags = 0;
+ d->nflagsallocated = 0;
+ d->flagids = NULL;
+
+ return d;
+}
+
+//---------------------------------------------------------
+// returns 1 if triangle nodes a,b,c are clockwise ordered
+static int cw(delaunay *d, triangle *t)
+{
+ point *pa = &d->points[t->vids[0]];
+ point *pb = &d->points[t->vids[1]];
+ point *pc = &d->points[t->vids[2]];
+
+ return( (pb->x - pa->x)*(pc->y - pa->y) < (pc->x - pa->x)*(pb->y - pa->y) );
+}
+
+//---------------------------------------------------------
+#if !defined(HAVE_LIBQHULL_R_QHULL_RA_H) && !defined(HAVE_LIBQHULL_QHULL_A_H) && !defined(HAVE_QHULL_QHULL_A_H)
+
+//---------------------------------------------------------
+#include <saga_api/saga_api.h>
+
+//---------------------------------------------------------
+delaunay *delaunay_build(int np, point points[], int ns, int segments[], int nh, double holes[])
+{
+ CSG_TIN TIN; TIN.Add_Field("z", SG_DATATYPE_Double);
+
+ for(int i=0; i<np; i++)
+ {
+ TIN.Add_Node(CSG_Point(points[i].x, points[i].y), NULL, false)->Set_Value(0, points[i].z);
+ }
+
+ TIN.Update();
+
+ if( !TIN.is_Valid() )
+ {
+ return( NULL );
+ }
+
+ //-----------------------------------------------------
+ delaunay *d = delaunay_create(); // if( false ) { free(d); d = NULL; }
+
+ d->xmin = DBL_MAX; d->xmax = -DBL_MAX;
+ d->ymin = DBL_MAX; d->ymax = -DBL_MAX;
+
+ d->npoints = TIN.Get_Node_Count();
+ d->points = (point *)malloc(d->npoints * sizeof(point));
+
+ for(int i=0; i<d->npoints; ++i)
+ {
+ CSG_TIN_Node &Node = *TIN.Get_Node(i);
+
+ point *p = &d->points[i];
+
+ p->x = Node.Get_X(); p->y = Node.Get_Y(); p->z = Node.asDouble(0);
+
+ if( d->npoints < np ) // CSG_TIN might have removed duplicate points!!!
+ {
+ points[i].x = p->x; points[i].y = p->y; points[i].z = p->z;
+ }
+
+ if( p->x < d->xmin ) { d->xmin = p->x; } else if( p->x > d->xmax ) { d->xmax = p->x; }
+ if( p->y < d->ymin ) { d->ymin = p->y; } else if( p->y > d->ymax ) { d->ymax = p->y; }
+ }
+
+ d->ntriangles = TIN.Get_Triangle_Count();
+ d->triangles = (triangle *)malloc(d->ntriangles * sizeof(triangle ));
+ d->neighbours = (triangle_neighbours *)malloc(d->ntriangles * sizeof(triangle_neighbours));
+ d->circles = (circle *)malloc(d->ntriangles * sizeof(circle ));
+
+ for(int iTriangle=0; iTriangle<TIN.Get_Triangle_Count(); iTriangle++)
+ {
+ CSG_TIN_Triangle &Triangle = *TIN.Get_Triangle(iTriangle);
+
+ triangle *t = &d->triangles [iTriangle];
+ triangle_neighbours *n = &d->neighbours[iTriangle];
+ circle *c = &d->circles [iTriangle];
+
+ t->vids[0] = Triangle.Get_Node(0)->Get_Index();
+ t->vids[1] = Triangle.Get_Node(1)->Get_Index();
+ t->vids[2] = Triangle.Get_Node(2)->Get_Index();
+
+ n->tids[0] = -1;
+ n->tids[1] = -1;
+ n->tids[2] = -1;
+
+ if( cw(d, t) )
+ {
+ { int tmp = t->vids[1]; t->vids[1] = t->vids[2]; t->vids[2] = tmp; }
+ { int tmp = n->tids[1]; n->tids[1] = n->tids[2]; n->tids[2] = tmp; }
+ }
+
+ circle_build1(c, &d->points[t->vids[0]], &d->points[t->vids[1]], &d->points[t->vids[2]]);
+ }
+
+ d->flags = (int *)calloc(d->ntriangles, sizeof(int));
+
+ d->n_point_triangles = (int *)calloc(d->npoints, sizeof(int));
+ for(int i=0; i<d->ntriangles; ++i)
+ {
+ triangle *t = &d->triangles[i];
+
+ for(int j=0; j<3; ++j)
+ d->n_point_triangles[t->vids[j]]++;
+ }
+
+ d->point_triangles = (int **)malloc(d->npoints * sizeof(int *));
+ for(int i=0; i<d->npoints; ++i)
+ {
+ if (d->n_point_triangles[i] > 0)
+ d->point_triangles[i] = (int *)malloc(d->n_point_triangles[i] * sizeof(int));
+ else
+ d->point_triangles[i] = NULL;
+ d->n_point_triangles[i] = 0;
+ }
+
+ for(int i=0; i<d->ntriangles; ++i)
+ {
+ triangle *t = &d->triangles[i];
+
+ for(int j=0; j<3; ++j)
+ {
+ int vid = t->vids[j];
+
+ d->point_triangles[vid][d->n_point_triangles[vid]] = i;
+ d->n_point_triangles[vid]++;
+ }
+ }
+
+ d->nedges = 0;
+ d->edges = NULL;
+ d->t_in = NULL;
+ d->t_out = NULL;
+ d->first_id = -1;
+
+ return( d );
+}
+
+//---------------------------------------------------------
+#else // #if defined(HAVE_LIBQHULL_R_QHULL_RA_H) || defined(HAVE_LIBQHULL_QHULL_A_H) || defined(HAVE_QHULL_QHULL_A_H)
+
+//---------------------------------------------------------
+#ifdef HAVE_LIBQHULL_R_QHULL_RA_H
+#include <libqhull_r/qhull_ra.h>
+#elif HAVE_LIBQHULL_QHULL_A_H
+#include <libqhull/qhull_a.h>
+#else
+#ifdef HAVE_QHULL_QHULL_A_H
+#include <qhull/qhull_a.h>
+#else
+#error Failed to include qhull_a.h. Is Qhull installed?
+#endif
+#endif
+
+delaunay* delaunay_build(int np, point points[], int ns, int segments[], int nh, double holes[])
+{
+ delaunay* d = delaunay_create();
+
+ coordT *qpoints; /* array of coordinates for each point */
+ boolT ismalloc = False; /* True if qhull should free points */
+ char flags[64] = "qhull d Qbb Qt"; /* option flags for qhull */
+ facetT *facet,*neighbor,**neighborp; /* variables to walk through facets */
+ vertexT *vertex, **vertexp; /* variables to walk through vertex */
+
+ int curlong, totlong; /* memory remaining after qh_memfreeshort */
+ FILE *outfile = stdout;
+ FILE *errfile = stderr; /* error messages from qhull code */
+
+ int i, j;
+ int exitcode;
+ int dim, ntriangles;
+ int numfacets, numsimplicial, numridges, totneighbors, numcoplanars, numtricoplanars;
+
+ dim = 2;
+
+ assert(sizeof(realT) == sizeof(double)); /* Qhull was compiled with doubles? */
+
+ if (np == 0 || ns > 0 || nh > 0) {
+ fprintf(stderr, "segments=%d holes=%d\n, aborting Qhull implementation, use 'triangle' instead.\n", ns, nh);
+ free(d);
+ return NULL;
+ }
+
+ qpoints = (coordT *) malloc(np * (dim+1) * sizeof(coordT));
+
+ for (i=0; i<np; i++) {
+ qpoints[i*dim] = points[i].x;
+ qpoints[i*dim+1] = points[i].y;
+ }
+
+ if (!nn_verbose)
+ outfile = NULL;
+ if (nn_verbose)
+ strcat(flags, " s");
+ if (nn_verbose > 1)
+ strcat(flags, " Ts");
+
+ if (nn_verbose)
+ fflush(stderr);
+
+ /*
+ * climax
+ */
+
+ #ifdef HAVE_LIBQHULL_R_QHULL_RA_H
+ qhT qh_qh;
+ qhT *qh= &qh_qh;
+
+ QHULL_LIB_CHECK
+
+ qh_zero(qh, errfile);
+
+ exitcode = qh_new_qhull (qh, dim, np, qpoints, ismalloc,
+ flags, outfile, errfile);
+ #else
+ exitcode = qh_new_qhull (dim, np, qpoints, ismalloc,
+ flags, outfile, errfile);
+ #endif
+
+ if(!exitcode) {
+
+ if (nn_verbose)
+ fflush(stderr);
+
+ d->xmin = DBL_MAX;
+ d->xmax = -DBL_MAX;
+ d->ymin = DBL_MAX;
+ d->ymax = -DBL_MAX;
+
+ d->npoints = np;
+ d->points = (point *)malloc(np * sizeof(point));
+ for (i = 0; i < np; ++i) {
+ point* p = &d->points[i];
+
+ p->x = points[i].x;
+ p->y = points[i].y;
+ p->z = points[i].z;
+
+ if (p->x < d->xmin)
+ d->xmin = p->x;
+ if (p->x > d->xmax)
+ d->xmax = p->x;
+ if (p->y < d->ymin)
+ d->ymin = p->y;
+ if (p->y > d->ymax)
+ d->ymax = p->y;
+ }
+
+ if (nn_verbose) {
+ fprintf(stderr, "input:\n");
+ for (i = 0; i < np; ++i) {
+ point* p = &d->points[i];
+
+ fprintf(stderr, " %d: %15.7g %15.7g %15.7g\n",
+ i, p->x, p->y, p->z);
+ }
+ }
+
+ #ifdef HAVE_LIBQHULL_R_QHULL_RA_H
+ qh_findgood_all (qh, qh->facet_list);
+ qh_countfacets (qh, qh->facet_list, NULL, !qh_ALL, &numfacets,
+ &numsimplicial, &totneighbors, &numridges,
+ &numcoplanars, &numtricoplanars);
+ #else
+ qh_findgood_all (qh facet_list);
+ qh_countfacets (qh facet_list, NULL, !qh_ALL, &numfacets,
+ &numsimplicial, &totneighbors, &numridges,
+ &numcoplanars, &numtricoplanars);
+ #endif
+
+ ntriangles = 0;
+ FORALLfacets {
+ if (!facet->upperdelaunay && facet->simplicial)
+ ntriangles++;
+ }
+
+ d->ntriangles = ntriangles;
+ d->triangles = (triangle *)malloc(d->ntriangles * sizeof(triangle));
+ d->neighbours = (triangle_neighbours *)malloc(d->ntriangles * sizeof(triangle_neighbours));
+ d->circles = (circle *)malloc(d->ntriangles * sizeof(circle));
+
+ if (nn_verbose)
+ fprintf(stderr, "triangles:\tneighbors:\n");
+
+ i = 0;
+ FORALLfacets {
+ if (!facet->upperdelaunay && facet->simplicial) {
+ triangle* t = &d->triangles[i];
+ triangle_neighbours* n = &d->neighbours[i];
+ circle* c = &d->circles[i];
+
+ j = 0;
+ FOREACHvertex_(facet->vertices)
+
+ #ifdef HAVE_LIBQHULL_R_QHULL_RA_H
+ t->vids[j++] = qh_pointid(qh, vertex->point);
+ #else
+ t->vids[j++] = qh_pointid(vertex->point);
+ #endif
+
+ j = 0;
+ FOREACHneighbor_(facet)
+ n->tids[j++] = neighbor->visitid ? neighbor->visitid - 1 : - 1;
+
+ /* Put triangle vertices in counterclockwise order, as
+ * 'triangle' do.
+ * The same needs to be done with the neighbors.
+ *
+ * The following works, i.e., it seems that Qhull maintains a
+ * relationship between the vertices and the neighbors
+ * triangles, but that is not said anywhere, so if this stop
+ * working in a future Qhull release, you know what you have
+ * to do, reorder the neighbors.
+ */
+
+ if(cw(d, t)) {
+ int tmp = t->vids[1];
+ t->vids[1] = t->vids[2];
+ t->vids[2] = tmp;
+
+ tmp = n->tids[1];
+ n->tids[1] = n->tids[2];
+ n->tids[2] = tmp;
+ }
+
+ circle_build1(c, &d->points[t->vids[0]], &d->points[t->vids[1]],
+ &d->points[t->vids[2]]);
+
+ if (nn_verbose)
+ fprintf(stderr, " %d: (%d,%d,%d)\t(%d,%d,%d)\n",
+ i, t->vids[0], t->vids[1], t->vids[2], n->tids[0],
+ n->tids[1], n->tids[2]);
+
+ i++;
+ }
+ }
+
+ d->flags = (int *)calloc(d->ntriangles, sizeof(int));
+
+ d->n_point_triangles = (int *)calloc(d->npoints, sizeof(int));
+ for (i = 0; i < d->ntriangles; ++i) {
+ triangle* t = &d->triangles[i];
+
+ for (j = 0; j < 3; ++j)
+ d->n_point_triangles[t->vids[j]]++;
+ }
+ d->point_triangles = (int **)malloc(d->npoints * sizeof(int*));
+ for (i = 0; i < d->npoints; ++i) {
+ if (d->n_point_triangles[i] > 0)
+ d->point_triangles[i] = (int *)malloc(d->n_point_triangles[i] * sizeof(int));
+ else
+ d->point_triangles[i] = NULL;
+ d->n_point_triangles[i] = 0;
+ }
+ for (i = 0; i < d->ntriangles; ++i) {
+ triangle* t = &d->triangles[i];
+
+ for (j = 0; j < 3; ++j) {
+ int vid = t->vids[j];
+
+ d->point_triangles[vid][d->n_point_triangles[vid]] = i;
+ d->n_point_triangles[vid]++;
+ }
+ }
+
+ d->nedges = 0;
+ d->edges = NULL;
+
+ d->t_in = NULL;
+ d->t_out = NULL;
+ d->first_id = -1;
+
+ } else {
+ free(d);
+ d = NULL;
+ }
+
+ free(qpoints);
+
+ #ifdef HAVE_LIBQHULL_R_QHULL_RA_H
+ qh_freeqhull(qh, !qh_ALL); /* free long memory */
+ qh_memfreeshort (qh, &curlong, &totlong); /* free short memory and memory allocator */
+ #else
+ qh_freeqhull(!qh_ALL); /* free long memory */
+ qh_memfreeshort (&curlong, &totlong); /* free short memory and memory allocator */
+ #endif
+
+ if (curlong || totlong)
+ fprintf (errfile,
+ "qhull: did not free %d bytes of long memory (%d pieces)\n",
+ totlong, curlong);
+
+ return d;
+}
+#endif // #if defined(HAVE_LIBQHULL_R_QHULL_RA_H) || defined(HAVE_LIBQHULL_QHULL_A_H) || defined(HAVE_QHULL_QHULL_A_H)
+
+
+/* Destroys Delaunay triangulation.
+*
+* @param d Structure to be destroyed
+*/
+void delaunay_destroy(delaunay* d)
+{
+ if (d == NULL)
+ return;
+
+ if (d->point_triangles != NULL) {
+ int i;
+
+ for (i = 0; i < d->npoints; ++i)
+ if (d->point_triangles[i] != NULL)
+ free(d->point_triangles[i]);
+ free(d->point_triangles);
+ }
+ if (d->nedges > 0)
+ free(d->edges);
+ #if defined(HAVE_LIBQHULL_R_QHULL_RA_H) || defined(HAVE_LIBQHULL_QHULL_A_H) || defined(HAVE_QHULL_QHULL_A_H)
+ /* This is a shallow copy if we're not using qhull so we don't
+ * need to free it */
+ if (d->points != NULL)
+ free(d->points);
+ #endif
+ if (d->n_point_triangles != NULL)
+ free(d->n_point_triangles);
+ if (d->flags != NULL)
+ free(d->flags);
+ if (d->circles != NULL)
+ free(d->circles);
+ if (d->neighbours != NULL)
+ free(d->neighbours);
+ if (d->triangles != NULL)
+ free(d->triangles);
+ if (d->t_in != NULL)
+ istack_destroy(d->t_in);
+ if (d->t_out != NULL)
+ istack_destroy(d->t_out);
+ if (d->flagids != NULL)
+ free(d->flagids);
+ free(d);
+}
+
+/* Returns whether the point p is on the right side of the vector (p0, p1).
+*/
+static int onrightside(point* p, point* p0, point* p1)
+{
+ return (p1->x - p->x) * (p0->y - p->y) > (p0->x - p->x) * (p1->y - p->y);
+}
+
+/* Finds triangle specified point belongs to (if any).
+*
+* @param d Delaunay triangulation
+* @param p Point to be mapped
+* @param seed Triangle index to start with
+* @return Triangle id if successful, -1 otherwhile
+*/
+int delaunay_xytoi(delaunay* d, point* p, int id)
+{
+ triangle* t;
+ int i;
+
+ if (p->x < d->xmin || p->x > d->xmax || p->y < d->ymin || p->y > d->ymax)
+ return -1;
+
+ if (id < 0 || id > d->ntriangles)
+ id = 0;
+ t = &d->triangles[id];
+ do {
+ for (i = 0; i < 3; ++i) {
+ int i1 = (i + 1) % 3;
+
+ if (onrightside(p, &d->points[t->vids[i]], &d->points[t->vids[i1]])) {
+ id = d->neighbours[id].tids[(i + 2) % 3];
+ if (id < 0)
+ return id;
+ t = &d->triangles[id];
+ break;
+ }
+ }
+ } while (i < 3);
+
+ return id;
+}
+
+static void delaunay_addflag(delaunay* d, int i)
+{
+ if (d->nflags == d->nflagsallocated) {
+ d->nflagsallocated += N_FLAGS_INC;
+ d->flagids = (int *)realloc(d->flagids, d->nflagsallocated * sizeof(int));
+ }
+ d->flagids[d->nflags] = i;
+ d->nflags++;
+}
+
+static void delaunay_resetflags(delaunay* d)
+{
+ int i;
+
+ for (i = 0; i < d->nflags; ++i)
+ d->flags[d->flagids[i]] = 0;
+ d->nflags = 0;
+}
+
+/* Finds all tricircles specified point belongs to.
+*
+* @param d Delaunay triangulation
+* @param p Point to be mapped
+* @param n Pointer to the number of tricircles within `d' containing `p'
+* (output)
+* @param out Pointer to an array of indices of the corresponding triangles
+* [n] (output)
+*
+* There is a standard search procedure involving search through triangle
+* neighbours (not through vertex neighbours). It must be a bit faster due to
+* the smaller number of triangle neighbours (3 per triangle) but may fail
+* for a point outside convex hall.
+*
+* We may wish to modify this procedure in future: first check if the point
+* is inside the convex hall, and depending on that use one of the two
+* search algorithms. It not 100% clear though whether this will lead to a
+* substantial speed gains because of the check on convex hall involved.
+*/
+void delaunay_circles_find(delaunay* d, point* p, int* n, int** out)
+{
+ /*
+ * This flag was introduced as a hack to handle some degenerate cases. It
+ * is set to 1 only if the triangle associated with the first circle is
+ * already known to contain the point. In this case the circle is assumed
+ * to contain the point without a check. In my practice this turned
+ * useful in some cases when point p coincided with one of the vertices
+ * of a thin triangle.
+ */
+ int contains = 0;
+ int i;
+
+ if (d->t_in == NULL) {
+ d->t_in = istack_create();
+ d->t_out = istack_create();
+ }
+
+ /*
+ * if there are only a few data points, do linear search
+ */
+ if (d->ntriangles <= N_SEARCH_TURNON) {
+ istack_reset(d->t_out);
+
+ for (i = 0; i < d->ntriangles; ++i) {
+ if (circle_contains(&d->circles[i], p)) {
+ istack_push(d->t_out, i);
+ }
+ }
+
+ *n = d->t_out->n;
+ *out = d->t_out->v;
+
+ return;
+ }
+ /*
+ * otherwise, do a more complicated stuff
+ */
+
+ /*
+ * It is important to have a reasonable seed here. If the last search
+ * was successful -- start with the last found tricircle, otherwhile (i)
+ * try to find a triangle containing p; if fails then (ii) check
+ * tricircles from the last search; if fails then (iii) make linear
+ * search through all tricircles
+ */
+ if (d->first_id < 0 || !circle_contains(&d->circles[d->first_id], p)) {
+ /*
+ * if any triangle contains p -- start with this triangle
+ */
+ d->first_id = delaunay_xytoi(d, p, d->first_id);
+ contains = (d->first_id >= 0);
+
+ /*
+ * if no triangle contains p, there still is a chance that it is
+ * inside some of circumcircles
+ */
+ if (d->first_id < 0) {
+ int nn = d->t_out->n;
+ int tid = -1;
+
+ /*
+ * first check results of the last search
+ */
+ for (i = 0; i < nn; ++i) {
+ tid = d->t_out->v[i];
+ if (circle_contains(&d->circles[tid], p))
+ break;
+ }
+ /*
+ * if unsuccessful, search through all circles
+ */
+ if (tid < 0 || i == nn) {
+ double nt = d->ntriangles;
+
+ for (tid = 0; tid < nt; ++tid) {
+ if (circle_contains(&d->circles[tid], p))
+ break;
+ }
+ if (tid == nt) {
+ istack_reset(d->t_out);
+ *n = 0;
+ *out = NULL;
+ return; /* failed */
+ }
+ }
+ d->first_id = tid;
+ }
+ }
+
+ istack_reset(d->t_in);
+ istack_reset(d->t_out);
+
+ istack_push(d->t_in, d->first_id);
+ d->flags[d->first_id] = 1;
+ delaunay_addflag(d, d->first_id);
+
+ /*
+ * main cycle
+ */
+ while (d->t_in->n > 0) {
+ int tid = istack_pop(d->t_in);
+ triangle* t = &d->triangles[tid];
+
+ if (contains || circle_contains(&d->circles[tid], p)) {
+ istack_push(d->t_out, tid);
+ for (i = 0; i < 3; ++i) {
+ int vid = t->vids[i];
+ int nt = d->n_point_triangles[vid];
+ int j;
+
+ for (j = 0; j < nt; ++j) {
+ int ntid = d->point_triangles[vid][j];
+
+ if (d->flags[ntid] == 0) {
+ istack_push(d->t_in, ntid);
+ d->flags[ntid] = 1;
+ delaunay_addflag(d, ntid);
+ }
+ }
+ }
+ }
+ contains = 0;
+ }
+
+ *n = d->t_out->n;
+ *out = d->t_out->v;
+ delaunay_resetflags(d);
+}
=====================================
saga-gis/src/tools/terrain_analysis/ta_lighting/SolarRadiation.cpp
=====================================
@@ -100,9 +100,9 @@ CSolarRadiation::CSolarRadiation(void)
);
Add_Reference(
- "Hofierka, J., Suri, M.", "2002", "The solar radiation model for Open source GIS: implementation and applications",
- "International GRASS users conference in Trento, Italy, September 2002",
- SG_T("http://skagit.meas.ncsu.edu/~jaroslav/trento/Hofierka_Jaroslav.pdf")
+ "Hofierka, J., Šúri, M.", "2002", "The solar radiation model for Open source GIS: implementation and applications",
+ "International GRASS users conference in Trento, Italy, September 2002.",
+ SG_T("https://www.researchgate.net/publication/2539232_The_solar_radiation_model_for_Open_source_GIS_Implementation_and_applications"), SG_T("ResearchGate")
);
Add_Reference(
@@ -228,7 +228,7 @@ CSolarRadiation::CSolarRadiation(void)
_TL("Height of Atmosphere and Vapour Pressure"),
_TL("Air Pressure, Water and Dust Content"),
_TL("Lumped Atmospheric Transmittance"),
- _TL("Hofierka and Suri")
+ _TL("Hofierka and Šúri")
), 2
);
@@ -726,7 +726,7 @@ bool CSolarRadiation::Get_Insolation(CSG_DateTime Date, double Hour)
double JDN = floor(Date.Get_JDN()) - 0.5 + Hour / 24.0; // relate to UTC, avoid problems with daylight saving time
//-----------------------------------------------------
- m_Solar_Const = Parameters("SOLARCONST")->asDouble() / 1000.0; // >> [kW / m]
+ m_Solar_Const = Parameters("SOLARCONST")->asDouble() / 1000.0; // >> [kW / m²]
m_Solar_Const *= 1.0 + 0.03344 * cos(Date.Get_DayOfYear() * 2.0 * M_PI / 365.25 - 0.048869); // corrected for Earth's orbit eccentricity
@@ -885,7 +885,7 @@ inline bool CSolarRadiation::Get_Irradiance(int x, int y, double Sun_Height, dou
: cos(Slope) * cos(Sun_Height - M_PI_090) + sin(Slope) * sin(M_PI_090 - Sun_Height) * cos(Sun_Azimuth - Get_Aspect(x, y));
//-----------------------------------------------------
- if( m_Method == 3 ) // Hofierka & Suri 2002
+ if( m_Method == 3 ) // Hofierka & Šúri 2002
{
double h_0 = Sun_Height; // * M_RAD_TO_DEG; // ???!!
double sin_h_0 = sin(Sun_Height);
@@ -918,7 +918,7 @@ inline bool CSolarRadiation::Get_Irradiance(int x, int y, double Sun_Height, dou
{
Diffus = D_hc * F * 0.25227;
}
- else if( Sun_Height >= 0.1 ) // sunlit surface, height of Sun above 5.7
+ else if( Sun_Height >= 0.1 ) // sunlit surface, height of Sun above 5.7°
{
F *= 0.00263 - 0.712 * K_b - 0.6883 * K_b*K_b; // * N
=====================================
saga-gis/version.cmake
=====================================
@@ -1,7 +1,7 @@
# The version number.
set (SAGA_VERSION_MAJOR 8)
set (SAGA_VERSION_MINOR 5)
-set (SAGA_VERSION_PATCH 0)
+set (SAGA_VERSION_PATCH 1)
# get git commit hash (or dirty if git is not installed)
=====================================
saga_setup_win32.iss
=====================================
@@ -1,5 +1,5 @@
-; To build installer (for example, saga-8.5.0_setup.exe).
-; - Unzip the SAGA binary files in their own folder (for example, saga-8.5.0.zip).
+; To build installer (for example, saga-8.5.1_setup.exe).
+; - Unzip the SAGA binary files in their own folder (for example, saga-8.5.1.zip).
; - Place saga.iss and saga_readme.rtf in the SAGA folder (contains saga_gui.exe, etc.).
; - Open saga.iss in Inno Setup.
; - Choose Build | Compile.
@@ -7,7 +7,7 @@
[Setup]
AppName=SAGA - System for Automated Geoscientific Analyses
-AppVerName=SAGA 8.5.0
+AppVerName=SAGA 8.5.1
DefaultDirName={commonpf}\SAGA
DefaultGroupName=SAGA
@@ -19,9 +19,9 @@ Compression=lzma
SolidCompression=yes
OutputDir=.
-OutputBaseFilename=saga-8.5.0_win32_setup
+OutputBaseFilename=saga-8.5.1_win32_setup
-VersionInfoVersion=8.5.0.0
+VersionInfoVersion=8.5.1.0
VersionInfoCompany=SAGA User Group Association
VersionInfoCopyright=(c) 2005-2018 by O. Conrad
VersionInfoDescription=SAGA single-file installer
@@ -47,5 +47,5 @@ Name: "{commondesktop}\SAGA"; Filename: "{app}\saga_gui.exe"; WorkingDir: "{app}
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\saga_gui.exe"; ValueType: string; ValueName: ""; ValueData: "{app}\saga_gui.exe"; Flags: uninsdeletekey
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\saga_gui.exe"; ValueType: string; ValueName: "Path"; ValueData: "{app}"
-Root: HKLM; Subkey: "SOFTWARE\SAGA User Group Association\SAGA\8.5.0"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: uninsdeletekey
-Root: HKLM; Subkey: "SOFTWARE\SAGA User Group Association\SAGA\8.5.0"; ValueType: string; ValueName: "Version"; ValueData: "8.5.0.0"
+Root: HKLM; Subkey: "SOFTWARE\SAGA User Group Association\SAGA\8.5.1"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: uninsdeletekey
+Root: HKLM; Subkey: "SOFTWARE\SAGA User Group Association\SAGA\8.5.1"; ValueType: string; ValueName: "Version"; ValueData: "8.5.1.0"
=====================================
saga_setup_x64.iss
=====================================
@@ -1,5 +1,5 @@
-; To build installer (for example, saga-8.5.0_setup.exe).
-; - Unzip the SAGA binary files in their own folder (for example, saga-8.5.0.zip).
+; To build installer (for example, saga-8.5.1_setup.exe).
+; - Unzip the SAGA binary files in their own folder (for example, saga-8.5.1.zip).
; - Place saga.iss and saga_readme.rtf in the SAGA folder (contains saga_gui.exe, etc.).
; - Open saga.iss in Inno Setup.
; - Choose Build | Compile.
@@ -7,7 +7,7 @@
[Setup]
AppName=SAGA - System for Automated Geoscientific Analyses
-AppVerName=SAGA 8.5.0
+AppVerName=SAGA 8.5.1
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
@@ -22,9 +22,9 @@ Compression=lzma
SolidCompression=yes
OutputDir=.
-OutputBaseFilename=saga-8.5.0_x64_setup
+OutputBaseFilename=saga-8.5.1_x64_setup
-VersionInfoVersion=8.5.0.0
+VersionInfoVersion=8.5.1.0
VersionInfoCompany=SAGA User Group Association
VersionInfoCopyright=(c) 2005-2018 by O. Conrad
VersionInfoDescription=SAGA single-file installer
@@ -50,5 +50,5 @@ Name: "{commondesktop}\SAGA"; Filename: "{app}\saga_gui.exe"; WorkingDir: "{app}
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\saga_gui.exe"; ValueType: string; ValueName: ""; ValueData: "{app}\saga_gui.exe"; Flags: uninsdeletekey
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\saga_gui.exe"; ValueType: string; ValueName: "Path"; ValueData: "{app}"
-Root: HKLM; Subkey: "SOFTWARE\SAGA User Group Association\SAGA\8.5.0"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: uninsdeletekey
-Root: HKLM; Subkey: "SOFTWARE\SAGA User Group Association\SAGA\8.5.0"; ValueType: string; ValueName: "Version"; ValueData: "8.5.0.0"
+Root: HKLM; Subkey: "SOFTWARE\SAGA User Group Association\SAGA\8.5.1"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: uninsdeletekey
+Root: HKLM; Subkey: "SOFTWARE\SAGA User Group Association\SAGA\8.5.1"; ValueType: string; ValueName: "Version"; ValueData: "8.5.1.0"
View it on GitLab: https://salsa.debian.org/debian-gis-team/saga/-/commit/c6da65255efea73f49c27cd0149646f2ab304323
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/saga/-/commit/c6da65255efea73f49c27cd0149646f2ab304323
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20230207/6fb362db/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list