77 delete(pGrids); pGrids = NULL;
90 delete(pGrids); pGrids = NULL;
103 if( !pGrids->
Create(File, bLoadData) )
105 delete(pGrids); pGrids = NULL;
118 delete(pGrids); pGrids = NULL;
127 CSG_Grids *pGrids =
new CSG_Grids(System, Attributes, zAttribute, Type, bCreateGrids);
129 if( bCreateGrids && !pGrids->
is_Valid() )
131 delete(pGrids); pGrids = NULL;
144 delete(pGrids); pGrids = NULL;
153 return(
new CSG_Grids(Attributes, zAttribute) );
208 Create(pGrids, bCopyData);
229 Create(System, NZ, zMin, Type);
241 Create(System, Attributes, zAttribute, Type, bCreateGrids);
253 Create(NX, NY, NZ, Cellsize, xMin, yMin, zMin, Type);
265 Create(Attributes, zAttribute);
274void CSG_Grids::_On_Construction(
void)
295 for(
size_t i=1; i<m_Grids.Get_uSize(); i++)
300 m_pGrids = (
CSG_Grid **)m_Grids.Get_Array(1);
302 m_pGrids[0]->Destroy();
306 m_Attributes.Destroy();
308 m_Z_Attribute = m_Z_Name = 0;
331 m_Attributes.Create(&pGrids->m_Attributes);
337 for(
int i=0; i<pGrids->
Get_NZ(); i++)
364 if( m_pGrids[0]->
Create(System, Type) )
387 if( m_Attributes.Create(&Attributes) && m_pGrids[0]->Create(System, Type) )
393 for(
int i=0; i<Attributes.
Get_Count(); i++)
419 if( m_Attributes.Create(&Attributes) )
439 m_pGrids[0]->Set_Unit(Unit);
445 m_pGrids[0]->Set_Scaling(Scale, Offset);
449 m_pGrids[i]->Set_Scaling(Scale, Offset);
460 m_pGrids[0]->Set_NoData_Value_Range(loValue, hiValue);
464 m_pGrids[i]->Set_NoData_Value_Range(loValue, hiValue);
474void CSG_Grids::_Synchronize(
CSG_Grid *pGrid)
483 if( pGrid == m_pGrids[0] )
539 if( i >= 0 && i < m_Attributes.Get_Field_Count() )
557 if( i >= 0 && i < m_Attributes.Get_Field_Count() )
569 return( m_Z_Name >= 0 && m_Z_Name < m_Attributes.Get_Field_Count() ? m_Z_Name : m_Z_Attribute );
577 return( m_Attributes.Add_Field(Name, Type, Insert) );
583 if( i != m_Z_Attribute && m_Attributes.Get_Field_Count() > 0 && m_Attributes.Del_Field(i) )
585 if( m_Z_Attribute > i )
594 else if( m_Z_Name == i )
611 return( i >= 0 && i < (
int)m_Attributes.Get_Count() && m_Attributes[i].Set_Value(Field, Value) );
620 return( i >= 0 && i < (
int)m_Attributes.Get_Count() && m_Attributes[i].Set_Value(Field, Value) );
626 return( i >= 0 && i <
Get_NZ() && m_Attributes[i].
Set_Value(m_Z_Attribute, Value) );
632 bool bChanged =
false;
642 int Index = (int)Attributes[i].Get_Index();
648 m_pGrids[i] = pGrids[Index];
650 m_Attributes[i].
Assign(&Attributes[i]);
693 for(
int i=Count; i<
Get_NZ(); i++)
698 m_pGrids = (
CSG_Grid **)m_Grids.Get_Array(Count);
700 m_Attributes.Set_Count(Count);
704 else if( Count >
Get_NZ() )
732 Attributes[0].
Set_Value(m_Z_Attribute, Z);
744 Attributes[0].
Set_Value(m_Z_Attribute, Z);
746 return(
Add_Grid(Attributes[0], pGrid, bAttach) );
762 _Synchronize(m_pGrids[0]);
780 m_Attributes.Add_Record(&Attributes);
821 else if( m_pGrids[0]->
Create(*pGrid) )
833 m_Attributes.Add_Record(&Attributes);
855 if( m_Attributes.Del_Record(i) )
863 m_pGrids[i]->Set_Owner(NULL);
872 m_pGrids[i] = m_pGrids[i + 1];
879 m_pGrids[0]->Set_Owner(NULL);
881 m_pGrids[0]->Set_Owner(
this);
897 for(
size_t i=0; i<m_Grids.Get_uSize(); i++)
901 m_pGrids[i]->Set_Owner(NULL);
906 m_pGrids[0]->Set_Owner(
this);
910 for(
size_t i=1; i<m_Grids.Get_uSize(); i++)
916 m_pGrids = (
CSG_Grid **)m_Grids.Get_Array(1);
918 m_Attributes.Del_Records();
982 m_pGrids[i]->Assign_NoData();
991 m_pGrids[i]->Assign(Value);
1007 if( !m_pGrids[i]->
Assign(pObject->
asGrid(), bProgress) )
1031 bool bResult =
true;
1035 if( !m_pGrids[i]->
Assign(pGrids->m_pGrids[i], Interpolation, bProgress) )
1055 Create(Grids);
return( *
this );
1060 Assign(Value);
return( *
this );
1066 return(
Add(Value) );
1073 m_pGrids[i]->Add(Value);
1089 m_pGrids[i]->Subtract(Value);
1105 m_pGrids[i]->Multiply(Value);
1121 m_pGrids[i]->Divide(Value);
1147 return(
Get_Value(p.
x, p.
y, p.
z, Value, Resampling, ZResampling) );
1160 if( !_Get_Z(z, iz, dz) )
1167 return( m_pGrids[iz]->
Get_Value(x, y, Value, Resampling) );
1172 ZResampling = Resampling;
1176 && (iz < 1 || iz >= m_Attributes.Get_Count() - 2) )
1181 switch( ZResampling )
1184 return( m_pGrids[dz < 0.5 ? iz : iz + 1]->
Get_Value(x, y, Value, Resampling) );
1190 if( m_pGrids[iz ]->
Get_Value(x, y, v[0], Resampling)
1191 && m_pGrids[iz + 1]->
Get_Value(x, y, v[1], Resampling) )
1193 Value = v[0] + dz * (v[1] - v[0]);
1206 #define ADD_TO_SPLINE(i) if( i < 0 || i >= Get_NZ() || !m_pGrids[i]->Get_Value(x, y, Value, Resampling) ) { return( false ); } s.Add(Get_Z(i), Value);
1222bool CSG_Grids::_Get_Z(
double z,
int &iz,
double &dz)
const
1224 if( z < m_Attributes[0 ].
asDouble(m_Z_Attribute)
1225 || z > m_Attributes[m_Attributes.
Get_Count() - 1].asDouble(m_Z_Attribute) )
1230 double z0, z1 = m_Attributes[0].
asDouble(m_Z_Attribute);
1232 for(iz=0; iz<m_Attributes.Get_Count()-1; iz++)
1234 z0 = z1; z1 = m_Attributes[((
sLong)iz) + 1].
asDouble(m_Z_Attribute);
1238 dz = z0 < z1 ? (z - z0) / (z1 - z0) : 0.;
1244 return( (dz = z - z1) == 0. );
1255#define SORT_SWAP(a,b) {itemp=(a);(a)=(b);(b)=itemp;}
1257bool CSG_Grids::_Set_Index(
void)
1270 sLong i, j, k, l, ir, n, *istack, jstack, nstack, indxt, itemp, nData;
1280 m_Index[--nData] = i;
1312 for(j=l+1; j<=ir; j++)
1317 for(i=j-1; i>=0; i--)
1324 m_Index[i + 1] = m_Index[i];
1327 m_Index[i + 1] = indxt;
1335 ir = istack[jstack--];
1336 l = istack[jstack--];
1362 do i++;
while(
asDouble(m_Index[i]) < a);
1363 do j--;
while(
asDouble(m_Index[j]) > a);
1373 m_Index[l] = m_Index[j];
1377 if( jstack >= nstack )
1383 if( ir - i + 1 >= j - l )
1385 istack[jstack] = ir;
1386 istack[jstack - 1] = i;
1391 istack[jstack] = j - 1;
1392 istack[jstack - 1] = l;
1421 m_Statistics.Invalidate();
1422 m_Histogram.Destroy();
1430 for(
double i=0; i<(double)
Get_NCells(); i+=d)
1436 m_Statistics += Scaling ? Offset + Scaling * Value : Value;
1452 m_Statistics += Scaling ? Offset + Scaling * Value : Value;
1464 Update();
return( m_Statistics.Get_Mean() );
1469 Update();
return( m_Statistics.Get_Minimum() );
1474 Update();
return( m_Statistics.Get_Maximum() );
1479 Update();
return( m_Statistics.Get_Range() );
1484 Update();
return( m_Statistics.Get_StdDev() );
1489 Update();
return( m_Statistics.Get_Variance() );
1495 Update();
return( m_Statistics.Get_Count() );
1506 if( Quantile <= 0. ) {
return(
Get_Min() ); }
1507 if( Quantile >= 1. ) {
return(
Get_Max() ); }
1509 if( bFromHistogram )
1529 return(
Get_Quantile(0.01 * Percentile, bFromHistogram) );
1546 Update();
return( m_Statistics );
1563 if( xMin > xMax || yMin > yMax )
1568 Statistics.
Create(bHoldValues);
1570 int nx = 1 + (xMax - xMin);
1571 int ny = 1 + (yMax - yMin);
1580 for(
double i=0; i<(double)nCells; i+=d)
1582 int y = yMin + (int)i / nx;
1583 int x = xMin + (int)i % nx;
1585 for(
int z=0; z<
Get_NZ(); z++)
1587 double Value =
asDouble(x, y, z,
false);
1591 Statistics += Scaling ? Offset + Scaling * Value : Value;
1598 for(
int x=xMin; x<=xMax; x++)
1600 for(
int y=yMin; y<=yMax; y++)
1602 for(
int z=0; z<
Get_NZ(); z++)
1604 double Value =
asDouble(x, y, z,
false);
1608 Statistics += Scaling ? Offset + Scaling * Value : Value;
1637#define SG_GRID_HISTOGRAM_CLASSES_DEFAULT 255
1648 if( nClasses > 1 && nClasses != m_Histogram.Get_Class_Count() )
1650 m_Histogram.Destroy();
1653 if( m_Histogram.Get_Statistics().Get_Count() < 1 )
1658 return( m_Histogram );
1676 if( xMin > xMax || yMin > yMax )
1683 int nx = 1 + (xMax - xMin);
1684 int ny = 1 + (yMax - yMin);
1693 for(
double i=0; i<(double)nCells; i+=d)
1695 int y = yMin + (int)i / nx;
1696 int x = xMin + (int)i % nx;
1698 for(
int z=0; z<
Get_NZ(); z++)
1700 double Value =
asDouble(x, y, z,
false);
1704 Histogram += Scaling ? Offset + Scaling * Value : Value;
1711 for(
int x=xMin; x<=xMax; x++)
for(
int y=yMin; y<=yMax; y++)
for(
int z=0; z<
Get_NZ(); z++)
1713 double Value =
asDouble(x, y, z,
false);
1717 Histogram += Scaling ? Offset + Scaling * Value : Value;
1722 return( Histogram.
Update() );
1771 if( _Load_PGSQL (File)
1772 || _Load_Normal (File)
1773 || _Load_Compressed(File)
1774 || _Load_External (File) )
1809 bool bResult =
false;
1814 bResult = _Save_Normal (File);
1818 bResult = _Save_Compressed(File);
1854bool CSG_Grids::_Load_External(
const CSG_String &File)
1870 m_Attributes.
Create(&pGrids->m_Attributes);
1897bool CSG_Grids::_Load_PGSQL(
const CSG_String &File)
1899 bool bResult =
false;
1905 s = s.AfterFirst(
':'); CSG_String Host (s.BeforeFirst(
':'));
1906 s = s.AfterFirst(
':'); CSG_String Port (s.BeforeFirst(
':'));
1907 s = s.AfterFirst(
':'); CSG_String DBase(s.BeforeFirst(
':'));
1908 s = s.AfterFirst(
':'); CSG_String Table(s.BeforeFirst(
':'));
1909 s = s.AfterFirst(
':'); CSG_String rid (s.BeforeFirst(
':').AfterFirst(
'='));
1914 for(
int i=0; i<rids.Get_Count(); i++)
1916 if( !rid.is_Empty() )
1921 rid +=
"rid=\'" + rids[i] +
"\'";
1931 CSG_String Connection(DBase +
" [" + Host +
":" + Port +
"]"); CSG_Data_Manager Manager;
1976bool CSG_Grids::_Load_Normal(
const CSG_String &_File)
1985 CSG_String File(_File); CSG_File Stream;
1988 if( !Stream.
Open(File,
SG_FILE_R,
false) || !_Load_Header(Stream) )
1995 if( m_Attributes.Get_Count() <= 0 )
1996 if( !Stream.
Open(File,
SG_FILE_R,
false) || !_Load_Attributes(Stream) )
2006 if( !Stream.
Open(File,
SG_FILE_R,
true) || !_Load_Data(Stream, m_pGrids[i]) )
2021bool CSG_Grids::_Save_Normal(
const CSG_String &_File)
2023 CSG_String File(_File); CSG_File Stream;
2028 if( !Stream.
Open(File,
SG_FILE_W,
false) || !_Save_Header(Stream) )
2035 if( !Stream.
Open(File,
SG_FILE_W,
false) || !_Save_Attributes(Stream) )
2045 if( !Stream.
Open(File,
SG_FILE_W,
true) || !_Save_Data(Stream, m_pGrids[i]) )
2065bool CSG_Grids::_Load_Compressed(
const CSG_String &_File)
2079 if( !Stream.Get_File(File +
"sg-gds") )
2083 for(
size_t i=0; File.
is_Empty() && i<Stream.Get_File_Count(); i++)
2093 if( !Stream.Get_File(File +
"sg-gds") || !_Load_Header(Stream) )
2098 if( m_Attributes.Get_Count() <= 0 )
2099 if( !Stream.Get_File(File +
"sg-att") || !_Load_Attributes(Stream) )
2107 if( !Stream.Get_File(File +
CSG_String::Format(
"sg-%03d", i + 1)) || !_Load_Data(Stream, m_pGrids[i]) )
2114 if( Stream.Get_File(File +
"sg-info") )
2119 if( Stream.Get_File(File +
"sg-prj") )
2128bool CSG_Grids::_Save_Compressed(
const CSG_String &_File)
2135 if( !Stream.Add_File(File +
"sg-gds") || !_Save_Header(Stream) )
2140 if( !Stream.Add_File(File +
"sg-att") || !_Save_Attributes(Stream) )
2148 if( !Stream.Add_File(File +
CSG_String::Format(
"sg-%03d", i + 1)) || !_Save_Data(Stream, m_pGrids[i]) )
2155 if( Stream.Add_File(File +
"sg-info") )
2160 if( Stream.Add_File(File +
"sg-prj") )
2174bool CSG_Grids::_Load_Header(
CSG_File &Stream)
2176 CSG_MetaData Header;
2178 if( !Header.
Load(Stream) )
2184 if( !Header(
"NX") || !Header(
"NY") || !Header(
"XMIN") || !Header(
"YMIN") || !Header(
"CELLSIZE") || !Header(
"TYPE") )
2189 CSG_Grid_System System(Header[
"CELLSIZE"].Get_Content().
asDouble(),
2190 Header[
"XMIN"].Get_Content().
asDouble(), Header[
"YMIN"].Get_Content().
asDouble(),
2191 Header[
"NX" ].Get_Content().
asInt (), Header[
"NY" ].Get_Content().
asInt ()
2203 if( Header(
"DESCRIPTION") ) {
Set_Description(Header[
"DESCRIPTION"].Get_Content()); }
2204 if( Header(
"UNIT" ) ) {
Set_Unit (Header[
"UNIT" ].Get_Content()); }
2207 Header(
"SCALE" ) ? Header[
"SCALE" ].Get_Content().
asDouble() : 1.,
2208 Header(
"OFFSET") ? Header[
"OFFSET"].Get_Content().
asDouble() : 0.
2211 if( Header(
"NODATA_MIN") )
2213 if( Header(
"NODATA_MAX") )
2216 Header[
"NODATA_MIN"].Get_Content().
asDouble(),
2217 Header[
"NODATA_MAX"].Get_Content().
asDouble()
2223 Header[
"NODATA_MIN"].Get_Content().
asDouble()
2229 m_Attributes.Destroy();
2231 if( Header(
"ATTRIBUTES") && Header[
"ATTRIBUTES"](
"FIELDS") == NULL )
2233 const CSG_MetaData &Fields = Header[
"ATTRIBUTES"];
2237 if( Fields[iField].Cmp_Name(
"FIELD") && Fields[iField].Get_Property(
"TYPE") )
2239 m_Attributes.Add_Field(Fields[iField].Get_Content(),
SG_Data_Type_Get_Type(Fields[iField].Get_Property(
"TYPE")));
2243 if( !Fields.
Get_Property(
"Z_FIELD", m_Z_Attribute) || m_Z_Attribute >= m_Attributes.Get_Field_Count() )
2248 if( !Fields.
Get_Property(
"Z_NAME", m_Z_Name ) || m_Z_Name >= m_Attributes.Get_Field_Count() )
2256 if( Header(
"ATTRIBUTES") && Header[
"ATTRIBUTES"](
"FIELDS") != NULL )
2258 if( !Header[
"ATTRIBUTES"].Get_Property(
"ZATTRIBUTE", m_Z_Attribute) )
2263 const CSG_MetaData &Fields = Header[
"ATTRIBUTES"][
"FIELDS"];
2267 if( Fields[iField].Cmp_Name(
"FIELD") && Fields[iField].Get_Property(
"TYPE") )
2269 m_Attributes.Add_Field(Fields[iField].Get_Content(),
SG_Data_Type_Get_Type(Fields[iField].Get_Property(
"TYPE")));
2273 if( m_Attributes.Get_Field_Count() > 0 && Header[
"ATTRIBUTES"](
"RECORDS") )
2275 CSG_Table Attributes(m_Attributes);
2277 const CSG_MetaData &Records = Header[
"ATTRIBUTES"][
"RECORDS"];
2281 if( Records[iRecord].Cmp_Name(
"RECORD") )
2283 CSG_String_Tokenizer Values(Records[iRecord].Get_Content(),
";");
2285 if( Values.Get_Tokens_Count() == (
size_t)Attributes.Get_Field_Count() )
2287 CSG_Table_Record *pRecord = Attributes.Add_Record();
2289 for(
int iField=0; iField<m_Attributes.Get_Field_Count(); iField++)
2291 pRecord->
Set_Value(iField, Values.Get_Next_Token());
2303 else if( Header(
"NZ") && Header[
"NZ"].Get_Content().
asInt() > 0 )
2307 for(
int i=0, n=Header[
"NZ"].Get_Content().
asInt(); i<n; i++)
2318 return( m_Attributes.Get_Field_Count() > 0 );
2322bool CSG_Grids::_Save_Header(
CSG_File &Stream)
2324 CSG_MetaData Header;
2357 CSG_MetaData &Attributes = *Header.
Add_Child(
"ATTRIBUTES");
2362 for(
int iField=0; iField<m_Attributes.Get_Field_Count(); iField++)
2370 return( Header.
Save(Stream) );
2379bool CSG_Grids::_Load_Attributes(
CSG_File &Stream)
2381 CSG_Table Attributes(m_Attributes);
2389 if( Values.Get_Tokens_Count() == (
size_t)Attributes.Get_Field_Count() )
2391 CSG_Table_Record *pRecord = Attributes.Add_Record();
2393 for(
int iField=0; iField<m_Attributes.Get_Field_Count(); iField++)
2395 pRecord->
Set_Value(iField, Values.Get_Next_Token());
2409bool CSG_Grids::_Save_Attributes(
CSG_File &Stream)
2411 for(
int iRecord=0; iRecord<m_Attributes.Get_Count(); iRecord++)
2413 for(
int iField=0; iField<m_Attributes.Get_Field_Count(); iField++)
2415 Stream.
Write(m_Attributes[iRecord].asString(iField));
2416 Stream.
Write(iField < m_Attributes.Get_Field_Count() - 1 ?
"\t" :
"\n");
2440 for(
int y=0; y<
Get_NY(); y++)
2447 char *pValue = (
char *)Line.Get_Array();
2476 for(
int y=0; y<
Get_NY(); y++)
2478 char *pValue = (
char *)Line.Get_Array();
2512bool CSG_Grids::_Assign_MeanValue (
CSG_Grids *pSource,
bool bVolumeProportional ) {
return(
false ); }
2513bool CSG_Grids::_Assign_ExtremeValue (
CSG_Grids *pSource,
bool bMaximum ) {
return(
false ); }
2514bool CSG_Grids::_Assign_Majority (
CSG_Grids *pSource ) {
return(
false ); }
void SG_UI_Msg_Add_Error(const char *Message)
bool SG_UI_Process_Get_Okay(bool bBlink)
void SG_UI_Msg_Add(const char *Message, bool bNewLine, TSG_UI_MSG_STYLE Style)
void SG_UI_Process_Set_Text(const CSG_String &Text)
bool SG_UI_Process_Set_Ready(void)
bool SG_UI_Process_Set_Progress(int Position, int Range)
int SG_UI_Msg_Lock(bool bOn)
void SG_UI_ProgressAndMsg_Lock(bool bOn)
TSG_Data_Type SG_Data_Type_Get_Type(const CSG_String &Identifier)
CSG_String SG_Data_Type_Get_Identifier(TSG_Data_Type Type)
@ SG_UI_MSG_STYLE_FAILURE
@ SG_UI_MSG_STYLE_SUCCESS
SAGA_API_DLL_EXPORT bool SG_File_Cmp_Extension(const CSG_String &File, const CSG_String &Extension)
SAGA_API_DLL_EXPORT void * SG_Malloc(size_t size)
SAGA_API_DLL_EXPORT void SG_Free(void *memblock)
SAGA_API_DLL_EXPORT CSG_String SG_File_Make_Path(const CSG_String &Directory, const CSG_String &Name)
SAGA_API_DLL_EXPORT bool SG_File_Delete(const CSG_String &FileName)
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Name(const CSG_String &full_Path, bool bExtension)
SAGA_API_DLL_EXPORT void * SG_Realloc(void *memblock, size_t size)
SAGA_API_DLL_EXPORT CSG_Strings SG_String_Tokenize(const CSG_String &String, const CSG_String &Delimiters=SG_DEFAULT_DELIMITERS, TSG_String_Tokenizer_Mode Mode=SG_TOKEN_DEFAULT)
#define SG_FREE_SAFE(PTR)
SAGA_API_DLL_EXPORT bool SG_File_Set_Extension(CSG_String &File, const CSG_String &Extension)
SAGA_API_DLL_EXPORT CSG_String SG_Get_String(double Value, int Precision=-99)
void ** Create(const CSG_Array_Pointer &Array)
CSG_Data_Collection & Grids(void) const
const SG_Char * Get_Name(void) const
void Set_Name(const CSG_String &Name)
bool is_NoData_Value(double Value) const
void Set_Update_Flag(bool bOn=true)
virtual bool Set_Max_Samples(sLong Max_Samples)
bool Save_MetaData(const CSG_String &FileName)
double Get_NoData_Value(bool bUpper=false) const
virtual bool Set_NoData_Value_Range(double Lower, double Upper)
const SG_Char * Get_File_Name(bool bNative=true) const
bool Load_MetaData(const CSG_String &FileName)
bool Update(bool bForce=false)
virtual bool Destroy(void)
void Set_Description(const CSG_String &Description)
virtual bool Set_NoData_Value(double Value)
CSG_Data_Object * Get_Owner(void) const
void Set_Owner(CSG_Data_Object *pOwner)
const SG_Char * Get_Description(void) const
sLong Get_Max_Samples(void) const
CSG_Projection & Get_Projection(void)
class CSG_Grids * asGrids(bool bPolymorph=false) const
virtual TSG_Data_Object_Type Get_ObjectType(void) const =0
Returns the object type as defined by TSG_Data_Object_Type. Used for run time type checking.
class CSG_Grid * asGrid(bool bPolymorph=false) const
CSG_MetaData & Get_MetaData_DB(void) const
void Set_File_Name(const CSG_String &FileName)
virtual bool Open(const SG_Char *FileName, int Mode=SG_FILE_R, bool bBinary=true, int Encoding=SG_FILE_ENCODING_ANSI)
virtual const CSG_String & Get_File_Name(void) const
bool Read_Line(CSG_String &Line) const
size_t Write(void *Buffer, size_t Size, size_t Count=1) const
size_t Read(void *Buffer, size_t Size, size_t Count=1) const
int Get_xWorld_to_Grid(double xWorld) const
double Get_Cellsize(void) const
int Get_yWorld_to_Grid(double yWorld) const
double Get_Offset(void) const
virtual int asInt(int x, int y, bool bScaled=true) const
virtual char asChar(int x, int y, bool bScaled=true) const
double Get_Scaling(void) const
virtual short asShort(int x, int y, bool bScaled=true) const
virtual bool is_Valid(void) const
virtual double asDouble(sLong i, bool bScaled=true) const
virtual BYTE asByte(int x, int y, bool bScaled=true) const
virtual bool Assign(double Value=0.)
virtual float asFloat(int x, int y, bool bScaled=true) const
void Set_Scaling(double Scale=1., double Offset=0.)
const CSG_Grid_System & Get_System(void) const
virtual void Set_Value(sLong i, double Value, bool bScaled=true)
TSG_Data_Type Get_Type(void) const
TSG_Data_Type Get_Type(void) const
virtual bool On_Update(void)
bool Del_Grids(bool bDetach=false)
CSG_String Get_Grid_Name(int i, int Style=0) const
bool Set_Grid_Count(int Count)
const CSG_Grid_System & Get_System(void) const
virtual const CSG_Rect & Get_Extent(void)
const CSG_Simple_Statistics & Get_Statistics(void)
bool Set_Z_Name_Field(int Field)
virtual bool is_NoData(int x, int y, int z) const
virtual void Set_Modified(bool bModified=true)
virtual CSG_Grids & Multiply(double Value)
bool Set_Z_Attribute(int Field, bool bSetNameField=false)
virtual bool On_Delete(void)
virtual bool Set_NoData_Value_Range(double loValue, double hiValue)
virtual bool is_Valid(void) const
sLong Get_NCells(void) const
double Get_Cellsize(void) const
bool is_Compatible(CSG_Grid *pGrid) const
double Get_Variance(void)
virtual bool Create(const CSG_Grids &Grids)
virtual CSG_Grids & operator+=(double Value)
virtual bool Assign(double Value=0.)
virtual void Set_Value(sLong i, double Value, bool bScaled=true)
int Get_Z_Name_Field(void) const
sLong Get_Sorted(sLong Position, bool bDown=true, bool bCheckNoData=true)
bool Update_Z_Order(void)
virtual CSG_Grids & Add(double Value)
const SG_Char * Get_Unit(void) const
bool Add_Attribute(const char *Name, TSG_Data_Type Type, int Insert=-1)
double Get_XMin(bool bCells=false) const
virtual CSG_Grids & Divide(double Value)
double Get_ZMax(bool bCells=false) const
double Get_Offset(void) const
double Get_Value(double x, double y, double z, CSG_Grid_Resampling Resampling=CSG_Grid_Resampling::Bicubic_2, CSG_Grid_Resampling ZResampling=CSG_Grid_Resampling::Undefined) const
double Get_Scaling(void) const
double Get_Z(int i) const
int Get_Grid_Count(void) const
virtual CSG_Grids & operator*=(double Value)
int Get_Z_Attribute(void) const
CSG_Grid * Get_Grid_Ptr(int i) const
sLong Get_Data_Count(void)
bool Set_Attribute(int i, int Field, const CSG_String &Value)
double Get_YMin(bool bCells=false) const
virtual int asInt(int x, int y, int z, bool bScaled=true) const
bool Del_Attribute(int Field)
virtual bool On_Reload(void)
virtual bool Load(const CSG_String &File, bool bLoadData=true)
virtual CSG_Grids & operator/=(double Value)
const CSG_Table & Get_Attributes(void) const
virtual double asDouble(sLong i, bool bScaled=true) const
void Set_Unit(const CSG_String &Unit)
sLong Get_NoData_Count(void)
virtual bool Set_Max_Samples(sLong Max_Samples)
const CSG_Histogram & Get_Histogram(size_t nClasses=0)
virtual CSG_Grids & operator=(const CSG_Grids &Grids)
double Get_Percentile(double Percentile, bool bFromHistogram=true)
int Get_nValueBytes(void) const
virtual CSG_Grids & Subtract(double Value)
bool is_Scaled(void) const
virtual CSG_Grids & operator-=(double Value)
void Set_Scaling(double Scale=1., double Offset=0.)
virtual bool Save(const CSG_String &File, int Format=0)
double Get_Quantile(double Quantile, bool bFromHistogram=true)
bool Del_Grid(int i, bool bDetach=false)
int Get_nLineBytes(void) const
virtual bool Destroy(void)
bool Set_Z(int i, double Value)
bool Create(const CSG_Histogram &Histogram)
bool Save(const CSG_String &File, ESG_CRS_Format Format=ESG_CRS_Format::WKT) const
bool Create(const CSG_Projection &Projection)
bool Load(const CSG_String &File)
double Get_XMax(void) const
double Get_XMin(void) const
double Get_YMin(void) const
double Get_YMax(void) const
bool Create(bool bHoldValues=false)
sLong Get_Count(void) const
bool Get_Value(double x, double &y)
int Cmp(const CSG_String &String) const
CSG_String BeforeFirst(char Character) const
static CSG_String Format(const char *Format,...)
const SG_Char * c_str(void) const
int Printf(const char *Format,...)
bool is_Empty(void) const
bool Set_Value(int Field, const CSG_String &Value)
sLong Get_Count(void) const
virtual CSG_Table_Record * Add_Record(CSG_Table_Record *pCopy=NULL)
bool Set_Index(CSG_Index &Index, int Field, bool bAscending=true) const
virtual bool Set_Value(sLong Index, int Field, const SG_Char *Value)
@ SG_DATAOBJECT_TYPE_Grids
@ SG_DATAOBJECT_TYPE_Grid
#define SG_GRID_HISTOGRAM_CLASSES_DEFAULT
CSG_Grid * SG_Create_Grid(void)
CSG_Grids * SG_Create_Grids(void)
@ GRIDS_FILE_FORMAT_GeoTIFF
@ GRIDS_FILE_FORMAT_Normal
@ GRIDS_FILE_FORMAT_Compressed
@ GRIDS_FILE_FORMAT_Undefined
#define SG_GRIDS_NAME_INDEX
#define SG_GRIDS_NAME_VALUE
#define SG_GRIDS_NAME_GRID
#define SG_GRIDS_NAME_OWNER