SAGA API  v9.2
shapes.cpp
Go to the documentation of this file.
1 
3 // //
4 // SAGA //
5 // //
6 // System for Automated Geoscientific Analyses //
7 // //
8 // Application Programming Interface //
9 // //
10 // Library: SAGA_API //
11 // //
12 //-------------------------------------------------------//
13 // //
14 // shapes.cpp //
15 // //
16 // Copyright (C) 2005 by Olaf Conrad //
17 // //
18 //-------------------------------------------------------//
19 // //
20 // This file is part of 'SAGA - System for Automated //
21 // Geoscientific Analyses'. //
22 // //
23 // This library is free software; you can redistribute //
24 // it and/or modify it under the terms of the GNU Lesser //
25 // General Public License as published by the Free //
26 // Software Foundation, either version 2.1 of the //
27 // License, or (at your option) any later version. //
28 // //
29 // This library is distributed in the hope that it will //
30 // be useful, but WITHOUT ANY WARRANTY; without even the //
31 // implied warranty of MERCHANTABILITY or FITNESS FOR A //
32 // PARTICULAR PURPOSE. See the GNU Lesser General Public //
33 // License for more details. //
34 // //
35 // You should have received a copy of the GNU Lesser //
36 // General Public License along with this program; if //
37 // not, see <http://www.gnu.org/licenses/>. //
38 // //
39 //-------------------------------------------------------//
40 // //
41 // contact: Olaf Conrad //
42 // Institute of Geography //
43 // University of Goettingen //
44 // Goldschmidtstr. 5 //
45 // 37077 Goettingen //
46 // Germany //
47 // //
48 // e-mail: oconrad@saga-gis.org //
49 // //
51 
52 //---------------------------------------------------------
53 #include "shapes.h"
54 #include "pointcloud.h"
55 #include "tool_library.h"
56 
57 
59 // //
60 // //
61 // //
63 
64 //---------------------------------------------------------
66 {
67  switch( Type )
68  {
69  case SHAPE_TYPE_Point : return( _TL("Point" ) );
70  case SHAPE_TYPE_Points : return( _TL("Points" ) );
71  case SHAPE_TYPE_Line : return( _TL("Line" ) );
72  case SHAPE_TYPE_Polygon: return( _TL("Polygon" ) );
73  default : return( _TL("Undefined") );
74  }
75 }
76 
77 
79 // //
80 // //
81 // //
83 
84 //---------------------------------------------------------
86 {
87  return( new CSG_Shapes );
88 }
89 
90 //---------------------------------------------------------
92 {
93  switch( Shapes.Get_ObjectType() )
94  {
96  return( new CSG_Shapes(Shapes) );
97 
99  return( SG_Create_PointCloud(*((CSG_PointCloud *)&Shapes)) );
100 
101  default:
102  return( NULL );
103  }
104 }
105 
106 //---------------------------------------------------------
107 CSG_Shapes * SG_Create_Shapes(const char *File) { return( SG_Create_Shapes(CSG_String(File)) ); }
108 CSG_Shapes * SG_Create_Shapes(const wchar_t *File) { return( SG_Create_Shapes(CSG_String(File)) ); }
110 {
111  CSG_Shapes *pShapes = new CSG_Shapes(File);
112 
113  if( !pShapes->is_Valid() ) { delete(pShapes); return( NULL ); } return( pShapes );
114 }
115 
116 //---------------------------------------------------------
117 CSG_Shapes * SG_Create_Shapes(TSG_Shape_Type Type, const SG_Char *Name, CSG_Table *pTemplate, TSG_Vertex_Type Vertex_Type)
118 {
119  return( new CSG_Shapes(Type, Name, pTemplate, Vertex_Type) );
120 }
121 
122 //---------------------------------------------------------
124 {
125  if( pTemplate )
126  {
127  switch( pTemplate->Get_ObjectType() )
128  {
130  return( new CSG_Shapes(pTemplate->Get_Type(), pTemplate->Get_Name(), pTemplate, pTemplate->Get_Vertex_Type()) );
131 
133  return( SG_Create_PointCloud((CSG_PointCloud *)pTemplate) );
134 
135  default:
136  break;
137  }
138  }
139 
140  return( new CSG_Shapes() );
141 }
142 
143 
145 // //
146 // //
147 // //
149 
150 //---------------------------------------------------------
152  : CSG_Table()
153 {
155 }
156 
157 //---------------------------------------------------------
159  : CSG_Table()
160 {
161  _On_Construction(); Create(Shapes);
162 }
163 
164 //---------------------------------------------------------
165 CSG_Shapes::CSG_Shapes(const char *File) : CSG_Shapes(CSG_String(File)) {}
166 CSG_Shapes::CSG_Shapes(const wchar_t *File) : CSG_Shapes(CSG_String(File)) {}
168  : CSG_Table()
169 {
170  _On_Construction(); Create(File);
171 }
172 
173 //---------------------------------------------------------
174 CSG_Shapes::CSG_Shapes(TSG_Shape_Type Type, const SG_Char *Name, CSG_Table *pTemplate, TSG_Vertex_Type Vertex_Type)
175  : CSG_Table()
176 {
177  _On_Construction(); Create(Type, Name, pTemplate, Vertex_Type);
178 }
179 
180 
182 // //
183 // //
184 // //
186 
187 //---------------------------------------------------------
189 {
191 
194 
196 }
197 
198 
200 // //
202 
203 //---------------------------------------------------------
204 bool CSG_Shapes::Create(const CSG_Shapes &Shapes)
205 {
206  return( Assign((CSG_Data_Object *)&Shapes) );
207 }
208 
209 //---------------------------------------------------------
210 bool CSG_Shapes::Create(const char *File) { return( Create(CSG_String(File)) ); }
211 bool CSG_Shapes::Create(const wchar_t *File) { return( Create(CSG_String(File)) ); }
213 {
214  Destroy();
215 
216  SG_UI_Msg_Add(CSG_String::Format("%s %s: %s...", _TL("Loading"), _TL("shapes"), File.c_str()), true);
217 
218  bool bResult = false;
219 
220  //-----------------------------------------------------
221  if( File.BeforeFirst(':').Cmp("PGSQL") == 0 ) // database source
222  {
223  CSG_String s(File);
224 
225  s = s.AfterFirst(':'); CSG_String Host (s.BeforeFirst(':'));
226  s = s.AfterFirst(':'); CSG_String Port (s.BeforeFirst(':'));
227  s = s.AfterFirst(':'); CSG_String DBName(s.BeforeFirst(':'));
228  s = s.AfterFirst(':'); CSG_String Table (s.BeforeFirst(':'));
229 
230  CSG_Tool *pTool = SG_Get_Tool_Library_Manager().Create_Tool("db_pgsql", 0, true); // CGet_Connections
231 
232  if( pTool != NULL )
233  {
235 
236  //---------------------------------------------
237  CSG_Table Connections; CSG_String Connection(DBName + " [" + Host + ":" + Port + "]");
238 
239  pTool->Set_Manager(NULL); pTool->On_Before_Execution();
240 
241  if( SG_TOOL_PARAMETER_SET("CONNECTIONS", &Connections) && pTool->Execute() ) // CGet_Connections
242  {
243  for(int i=0; !bResult && i<Connections.Get_Count(); i++)
244  {
245  if( !Connection.Cmp(Connections[i].asString(0)) )
246  {
247  bResult = true;
248  }
249  }
250  }
251 
253 
254  //---------------------------------------------
255  if( bResult && (bResult = (pTool = SG_Get_Tool_Library_Manager().Create_Tool("db_pgsql", 20, true)) != NULL) == true ) // CPGIS_Shapes_Load
256  {
257  pTool->Set_Manager(NULL); pTool->On_Before_Execution();
258 
259  bResult = SG_TOOL_PARAMETER_SET("CONNECTION", Connection)
260  && SG_TOOL_PARAMETER_SET("DB_TABLE" , Table )
261  && SG_TOOL_PARAMETER_SET("SHAPES" , this )
262  && pTool->Execute();
263 
265  }
266 
268  }
269  }
270  else
271  {
272  if( SG_File_Cmp_Extension(File, "shp") )
273  {
274  bResult = _Load_ESRI(File);
275  }
276 
277  if( !bResult )
278  {
279  bResult = _Load_GDAL(File);
280  }
281  }
282 
283  //-----------------------------------------------------
284  if( bResult )
285  {
286  Set_Modified(false);
287  Set_Update_Flag();
288 
290  SG_UI_Msg_Add(_TL("okay"), false, SG_UI_MSG_STYLE_SUCCESS);
291 
292  return( true );
293  }
294 
295  //-----------------------------------------------------
296  for(sLong iShape=Get_Count()-1; iShape>=0; iShape--) // be kind, keep at least those shapes that have been loaded successfully
297  {
298  if( !Get_Shape(iShape)->is_Valid() )
299  {
300  Del_Shape(iShape);
301  }
302  }
303 
304  if( Get_Count() <= 0 )
305  {
306  Destroy();
307  }
308 
309  //-----------------------------------------------------
311  SG_UI_Msg_Add(_TL("failed"), false, SG_UI_MSG_STYLE_FAILURE);
312 
313  return( false );
314 }
315 
316 //---------------------------------------------------------
317 bool CSG_Shapes::Create(TSG_Shape_Type Type, const SG_Char *Name, CSG_Table *pTemplate, TSG_Vertex_Type Vertex_Type)
318 {
319  Destroy();
320 
321  CSG_Table::Create(pTemplate);
322 
323  if( Name )
324  {
325  Set_Name(CSG_String(Name));
326  }
327 
328  m_Type = Type; m_Vertex_Type = Vertex_Type;
329 
330  return( true );
331 }
332 
333 
335 // //
336 // //
337 // //
339 
340 //---------------------------------------------------------
342 {
343  Destroy();
344 }
345 
346 //---------------------------------------------------------
348 {
349  return( CSG_Table::Destroy() );
350 }
351 
352 
354 // //
355 // //
356 // //
358 
359 //---------------------------------------------------------
361 {
362  if( pObject && pObject->is_Valid() && (pObject->Get_ObjectType() == SG_DATAOBJECT_TYPE_Shapes || pObject->Get_ObjectType() == SG_DATAOBJECT_TYPE_PointCloud) )
363  {
364  CSG_Shapes *pShapes = (CSG_Shapes *)pObject;
365 
366  Create(pShapes->Get_Type(), pShapes->Get_Name(), pShapes, pShapes->Get_Vertex_Type());
367 
368  Get_History() = pShapes->Get_History();
369 
370  Get_Projection().Create(pShapes->Get_Projection());
371 
372  for(sLong iShape=0; iShape<pShapes->Get_Count() && SG_UI_Process_Get_Okay(); iShape++)
373  {
374  Add_Shape(pShapes->Get_Shape(iShape));
375  }
376 
377  return( true );
378  }
379 
380  return( false );
381 }
382 
383 
385 // //
386 // //
387 // //
389 
390 //---------------------------------------------------------
392 
393 //---------------------------------------------------------
395 {
396  switch( Format )
397  {
402  return( true );
403  }
404 
405  return( false );
406 }
407 
408 //---------------------------------------------------------
410 {
412 }
413 
414 //---------------------------------------------------------
416 {
418  {
419  default:
420  case SHAPE_FILE_FORMAT_ESRI : return( "shp" );
421  case SHAPE_FILE_FORMAT_GeoPackage: return( "gpkg" );
422  case SHAPE_FILE_FORMAT_GeoJSON : return( "geojson" );
423  }
424 }
425 
426 
428 // //
430 
431 //---------------------------------------------------------
432 bool CSG_Shapes::Save(const CSG_String &File, int Format)
433 {
434  SG_UI_Msg_Add(CSG_String::Format("%s %s: %s...", _TL("Saving"), _TL("shapes"), File.c_str()), true);
435 
436  //-----------------------------------------------------
437  if( Format == SHAPE_FILE_FORMAT_Undefined )
438  {
440 
441  if( SG_File_Cmp_Extension(File, "shp" ) ) Format = SHAPE_FILE_FORMAT_ESRI ;
442  if( SG_File_Cmp_Extension(File, "gpkg" ) ) Format = SHAPE_FILE_FORMAT_GeoPackage;
443  if( SG_File_Cmp_Extension(File, "geojson") ) Format = SHAPE_FILE_FORMAT_GeoJSON ;
444  }
445 
446  //-----------------------------------------------------
447  bool bResult = false;
448 
449  switch( Format )
450  {
451  case SHAPE_FILE_FORMAT_ESRI : bResult = _Save_ESRI(File ); break;
452  case SHAPE_FILE_FORMAT_GeoPackage: bResult = _Save_GDAL(File, "GPKG" ); break;
453  case SHAPE_FILE_FORMAT_GeoJSON : bResult = _Save_GDAL(File, "GeoJSON"); break;
454  }
455 
456  //-----------------------------------------------------
457  if( bResult )
458  {
459  Set_Modified(false);
460 
461  Set_File_Name(File, true);
462 
464  SG_UI_Msg_Add(_TL("okay"), false, SG_UI_MSG_STYLE_SUCCESS);
465 
466  return( true );
467  }
468 
470  SG_UI_Msg_Add(_TL("failed"), false, SG_UI_MSG_STYLE_FAILURE);
471 
472  return( false );
473 }
474 
475 
477 // //
478 // //
479 // //
481 
482 //---------------------------------------------------------
484 {
485  switch( m_Type )
486  {
487  case SHAPE_TYPE_Polygon : return( new CSG_Shape_Polygon (this, Index) );
488  case SHAPE_TYPE_Line : return( new CSG_Shape_Line (this, Index) );
489  case SHAPE_TYPE_Points : return( new CSG_Shape_Points (this, Index) );
490  case SHAPE_TYPE_Point :
491  switch( m_Vertex_Type )
492  {
493  case SG_VERTEX_TYPE_XY : return( new CSG_Shape_Point (this, Index) );
494  case SG_VERTEX_TYPE_XYZ : return( new CSG_Shape_Point_Z (this, Index) );
495  case SG_VERTEX_TYPE_XYZM: return( new CSG_Shape_Point_ZM(this, Index) );
496  default:
497  return( NULL );
498  }
499  default:
500  return( NULL );
501  }
502 }
503 
504 //---------------------------------------------------------
506 {
507  CSG_Shape *pShape = (CSG_Shape *)Add_Record();
508 
509  if( pShape && pCopy && mCopy != SHAPE_NO_COPY )
510  {
511  pShape->Assign(pCopy, mCopy);
512  }
513 
514  return( pShape );
515 }
516 
517 //---------------------------------------------------------
519 {
520  return( Del_Record(pShape->Get_Index()) );
521 }
522 
524 {
525  return( Del_Record(Index) );
526 }
527 
528 
530 // //
531 // //
532 // //
534 
535 //---------------------------------------------------------
537 {
538  if( Get_Count() > 0 )
539  {
540  CSG_Shape *pShape = Get_Shape(0);
541 
542  m_Extent = pShape->Get_Extent();
543  m_ZMin = pShape->Get_ZMin();
544  m_ZMax = pShape->Get_ZMax();
545  m_MMin = pShape->Get_MMin();
546  m_MMax = pShape->Get_MMax();
547 
548  for(sLong i=1; i<Get_Count(); i++)
549  {
550  pShape = Get_Shape(i);
551 
552  m_Extent.Union(pShape->Get_Extent());
553 
554  switch( m_Vertex_Type )
555  {
556  case SG_VERTEX_TYPE_XYZM:
557  if( m_MMin > pShape->Get_MMin() ) m_MMin = pShape->Get_MMin();
558  if( m_MMax < pShape->Get_MMax() ) m_MMax = pShape->Get_MMax();
559 
560  case SG_VERTEX_TYPE_XYZ:
561  if( m_ZMin > pShape->Get_ZMin() ) m_ZMin = pShape->Get_ZMin();
562  if( m_ZMax < pShape->Get_ZMax() ) m_ZMax = pShape->Get_ZMax();
563  break;
564 
565  default:
566  break;
567  }
568  }
569  }
570  else
571  {
572  m_Extent.Assign(0.0, 0.0, 0.0, 0.0);
573  }
574 
575  return( CSG_Table::On_Update() );
576 }
577 
578 
580 // //
581 // //
582 // //
584 
585 //---------------------------------------------------------
586 CSG_Shape * CSG_Shapes::Get_Shape(const CSG_Point &Point, double Epsilon)
587 {
588  CSG_Rect r(Point.x - Epsilon, Point.y - Epsilon, Point.x + Epsilon, Point.y + Epsilon);
589 
590  CSG_Shape *pNearest = NULL;
591 
593  {
594  double dNearest = -1.;
595 
596  for(sLong iShape=0; iShape<Get_Count(); iShape++)
597  {
598  CSG_Shape *pShape = Get_Shape(iShape);
599 
600  if( pShape->Intersects(r) )
601  {
602  double d = pShape->Get_Distance(Point);
603 
604  if( d == 0. )
605  {
606  return( pShape );
607  }
608  else if( d > 0. && d <= Epsilon && (pNearest == NULL || d < dNearest) )
609  {
610  dNearest = d;
611  pNearest = pShape;
612  }
613  }
614  }
615  }
616 
617  return( pNearest );
618 }
619 
620 
622 // //
623 // //
624 // //
626 
627 //---------------------------------------------------------
629 {
630  if( m_Type != SHAPE_TYPE_Polygon )
631  {
632  return( true );
633  }
634 
635  for(sLong iShape=0; iShape<Get_Count() && SG_UI_Process_Set_Progress(iShape, Get_Count()); iShape++)
636  {
637  CSG_Shape_Polygon *pPolygon = (CSG_Shape_Polygon *)Get_Shape(iShape);
638 
639  for(int iPart=0; iPart<pPolygon->Get_Part_Count(); iPart++)
640  {
641  // currently we have to disable this check for 3D shapefiles since the
642  // _Update_Area() method can not handle polygons with no horizontal extent
644  {
645  if( pPolygon->is_Lake(iPart) == pPolygon->is_Clockwise(iPart) )
646  {// ring direction: outer rings > clockwise, inner rings (lakes) > counterclockwise !
647  pPolygon->Revert_Points(iPart);
648  }
649  }
650 
651  //---------------------------------------------
652  if( !CSG_Point(pPolygon->Get_Point(0, iPart)).is_Equal(pPolygon->Get_Point(pPolygon->Get_Point_Count(iPart) - 1, iPart)) )
653  { // last point == first point !
654  ((CSG_Shape *)pPolygon)->Add_Point(pPolygon->Get_Point(0, iPart), iPart);
655 
657  {
658  pPolygon->Set_Z(pPolygon->Get_Z(0, iPart), pPolygon->Get_Point_Count(iPart) - 1, iPart);
659 
661  {
662  pPolygon->Set_M(pPolygon->Get_M(0, iPart), pPolygon->Get_Point_Count(iPart) - 1, iPart);
663  }
664  }
665  }
666 
667  //--------------------------------------------
668  // to do: ensure there is no self intersection !
669  }
670  }
671 
672  return( true );
673 }
674 
675 
677 // //
678 // //
679 // //
681 
682 //---------------------------------------------------------
CSG_String::BeforeFirst
CSG_String BeforeFirst(char Character) const
Definition: api_string.cpp:666
CSG_Rect
Definition: geo_tools.h:471
CSG_Shapes::Assign
virtual bool Assign(CSG_Data_Object *pObject)
Definition: shapes.cpp:360
gSG_Shape_File_Format_Default
static TSG_Shape_File_Format gSG_Shape_File_Format_Default
Definition: shapes.cpp:391
CSG_Shape_Point_ZM
Definition: shapes.h:344
CSG_Shapes::m_ZMin
double m_ZMin
Definition: shapes.h:843
CSG_Shapes::Del_Shape
virtual bool Del_Shape(sLong Index)
Definition: shapes.cpp:523
CSG_Shapes::m_MMax
double m_MMax
Definition: shapes.h:843
_TL
#define _TL(s)
Definition: api_core.h:1480
SG_Shapes_Get_File_Extension_Default
CSG_String SG_Shapes_Get_File_Extension_Default(void)
Definition: shapes.cpp:415
CSG_Data_Object::Set_File_Name
void Set_File_Name(const CSG_String &FileName)
Definition: dataobject.cpp:307
CSG_Data_Object::Get_History
CSG_MetaData & Get_History(void)
Definition: dataobject.h:227
CSG_Shape_Points::Revert_Points
virtual bool Revert_Points(int iPart)
Definition: shapes.h:550
CSG_Shapes::_Get_New_Record
virtual CSG_Table_Record * _Get_New_Record(sLong Index)
Definition: shapes.cpp:483
CSG_Shapes::Get_Shape
virtual CSG_Shape * Get_Shape(const CSG_Point &Point, double Epsilon=0.)
Definition: shapes.cpp:586
CSG_Shape_Polygon::is_Clockwise
bool is_Clockwise(int iPart)
Definition: shape_polygon.cpp:871
CSG_Table_Record
Definition: table.h:130
CSG_Shape_Points::Set_Z
virtual void Set_Z(double z, int iPoint=0, int iPart=0)
Definition: shapes.h:531
CSG_Shape_Points::Get_Z
virtual double Get_Z(int iPoint=0, int iPart=0, bool bAscending=true) const
Definition: shapes.h:532
CSG_Shape_Point
Definition: shapes.h:265
TSG_ADD_Shape_Copy_Mode
TSG_ADD_Shape_Copy_Mode
Definition: shapes.h:124
TSG_Shape_Type
TSG_Shape_Type
Definition: shapes.h:100
SG_Create_PointCloud
CSG_PointCloud * SG_Create_PointCloud(void)
Definition: pointcloud.cpp:76
SG_UI_MSG_STYLE_SUCCESS
@ SG_UI_MSG_STYLE_SUCCESS
Definition: api_core.h:1496
SG_File_Cmp_Extension
SAGA_API_DLL_EXPORT bool SG_File_Cmp_Extension(const CSG_String &FileName, const CSG_String &Extension)
Definition: api_file.cpp:928
CSG_Shapes::Create
bool Create(const CSG_Shapes &Shapes)
Definition: shapes.cpp:204
CSG_Shapes::Get_MMax
double Get_MMax(void)
Definition: shapes.h:816
SG_UI_Process_Get_Okay
bool SG_UI_Process_Get_Okay(bool bBlink)
Definition: api_callback.cpp:201
SHAPE_TYPE_Polygon
@ SHAPE_TYPE_Polygon
Definition: shapes.h:105
CSG_Rect::Intersects
TSG_Intersection Intersects(const CSG_Rect &Rect) const
Definition: geo_classes.cpp:882
CSG_Shape_Points
Definition: shapes.h:484
CSG_Tool
Definition: tool.h:149
CSG_Table::Destroy
virtual bool Destroy(void)
Definition: table.cpp:327
CSG_Shapes::~CSG_Shapes
virtual ~CSG_Shapes(void)
Definition: shapes.cpp:341
CSG_Data_Object::Get_Name
const SG_Char * Get_Name(void) const
Definition: dataobject.cpp:290
CSG_Shapes::m_ZMax
double m_ZMax
Definition: shapes.h:843
CSG_Tool::Execute
bool Execute(bool bAddHistory=false)
Definition: tool.cpp:246
CSG_Shapes::_On_Construction
virtual void _On_Construction(void)
Definition: shapes.cpp:188
CSG_Shapes::m_Type
TSG_Shape_Type m_Type
Definition: shapes.h:845
CSG_Data_Object::Get_ObjectType
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.
CSG_Table::m_Extent
CSG_Rect m_Extent
Definition: table.h:454
CSG_Shape::Intersects
TSG_Intersection Intersects(CSG_Shape *pShape)
Definition: shape.cpp:118
CSG_Shapes::is_Valid
virtual bool is_Valid(void) const
Definition: shapes.h:805
CSG_Shapes::CSG_Shapes
CSG_Shapes(void)
Definition: shapes.cpp:151
CSG_Tool_Library_Manager::Delete_Tool
bool Delete_Tool(CSG_Tool *pTool) const
Definition: tool_library.cpp:726
CSG_Shape::Get_Distance
virtual double Get_Distance(TSG_Point Point) const =0
CSG_Data_Object::Set_Update_Flag
void Set_Update_Flag(bool bOn=true)
Definition: dataobject.h:273
CSG_Table::Set_Modified
virtual void Set_Modified(bool bModified=true)
Definition: table.cpp:1117
CSG_String::Cmp
int Cmp(const CSG_String &String) const
Definition: api_string.cpp:515
CSG_Shape_Points::Get_Point
virtual TSG_Point Get_Point(int iPoint=0) const
Definition: shape_points.cpp:294
CSG_Shapes::Add_Shape
virtual CSG_Shape * Add_Shape(CSG_Table_Record *pCopy=NULL, TSG_ADD_Shape_Copy_Mode mCopy=SHAPE_COPY)
Definition: shapes.cpp:505
SG_VERTEX_TYPE_XY
@ SG_VERTEX_TYPE_XY
Definition: shapes.h:92
SG_UI_MSG_STYLE_FAILURE
@ SG_UI_MSG_STYLE_FAILURE
Definition: api_core.h:1497
CSG_Shape_Points::Set_M
virtual void Set_M(double m, int iPoint=0, int iPart=0)
Definition: shapes.h:536
SG_TOOL_PARAMETER_SET
#define SG_TOOL_PARAMETER_SET(IDENTIFIER, VALUE)
Definition: tool_library.h:351
CSG_Shapes::Get_Vertex_Type
TSG_Vertex_Type Get_Vertex_Type(void) const
Definition: shapes.h:809
CSG_Data_Object
Definition: dataobject.h:180
CSG_Point
Definition: geo_tools.h:135
CSG_Shapes::m_MMin
double m_MMin
Definition: shapes.h:843
SG_VERTEX_TYPE_XYZM
@ SG_VERTEX_TYPE_XYZM
Definition: shapes.h:94
CSG_Shape_Line
Definition: shapes.h:601
CSG_Shapes::Save
virtual bool Save(const CSG_String &File, int Format=0)
Definition: shapes.cpp:432
INTERSECTION_None
@ INTERSECTION_None
Definition: geo_tools.h:102
CSG_Tool_Library_Manager::Create_Tool
CSG_Tool * Create_Tool(const CSG_String &Library, int Index, bool bWithGUI=false) const
Definition: tool_library.cpp:697
CSG_Rect::Assign
void Assign(double xMin, double yMin, double xMax, double yMax)
Definition: geo_classes.cpp:721
CSG_Shape_Points::Get_M
virtual double Get_M(int iPoint=0, int iPart=0, bool bAscending=true) const
Definition: shapes.h:537
sLong
signed long long sLong
Definition: api_core.h:158
SG_Get_Tool_Library_Manager
CSG_Tool_Library_Manager & SG_Get_Tool_Library_Manager(void)
Definition: tool_library.cpp:286
CSG_Shape::Get_ZMax
virtual double Get_ZMax(void)
Definition: shapes.h:197
SG_Shapes_Set_File_Format_Default
bool SG_Shapes_Set_File_Format_Default(int Format)
Definition: shapes.cpp:394
SHAPE_FILE_FORMAT_GeoPackage
@ SHAPE_FILE_FORMAT_GeoPackage
Definition: shapes.h:117
CSG_Shape::Get_ZMin
virtual double Get_ZMin(void)
Definition: shapes.h:196
CSG_Table::Get_Count
sLong Get_Count(void) const
Definition: table.h:385
CSG_Table::On_Update
virtual bool On_Update(void)
Definition: table.cpp:1292
CSG_Rect::Union
void Union(double x, double y)
Definition: geo_classes.cpp:832
pointcloud.h
SHAPE_FILE_FORMAT_Undefined
@ SHAPE_FILE_FORMAT_Undefined
Definition: shapes.h:115
CSG_Shape::Get_MMin
virtual double Get_MMin(void)
Definition: shapes.h:212
CSG_Shape::Assign
virtual bool Assign(CSG_Table_Record *pRecord)
Definition: shape.cpp:195
CSG_Shapes::Get_Extent
virtual const CSG_Rect & Get_Extent(void)
Definition: shapes.h:811
SG_Get_ShapeType_Name
CSG_String SG_Get_ShapeType_Name(TSG_Shape_Type Type)
Definition: shapes.cpp:65
CSG_Shapes::m_Vertex_Type
TSG_Vertex_Type m_Vertex_Type
Definition: shapes.h:847
CSG_Data_Object::Set_Name
void Set_Name(const CSG_String &Name)
Definition: dataobject.cpp:235
CSG_Table::m_Encoding
int m_Encoding
Definition: table.h:442
CSG_String::Format
static CSG_String Format(const char *Format,...)
Definition: api_string.cpp:270
SHAPE_TYPE_Line
@ SHAPE_TYPE_Line
Definition: shapes.h:104
CSG_Table
Definition: table.h:283
TSG_Shape_File_Format
TSG_Shape_File_Format
Definition: shapes.h:114
SG_DATAOBJECT_TYPE_Shapes
@ SG_DATAOBJECT_TYPE_Shapes
Definition: dataobject.h:121
CSG_String::AfterFirst
CSG_String AfterFirst(char Character) const
Definition: api_string.cpp:644
CSG_Shapes::Get_ObjectType
virtual TSG_Data_Object_Type Get_ObjectType(void) const
Returns the object type as defined by TSG_Data_Object_Type. Used for run time type checking.
Definition: shapes.h:797
SHAPE_NO_COPY
@ SHAPE_NO_COPY
Definition: shapes.h:125
SHAPE_FILE_FORMAT_GeoJSON
@ SHAPE_FILE_FORMAT_GeoJSON
Definition: shapes.h:118
CSG_Table::Del_Record
virtual bool Del_Record(sLong Index)
Definition: table.cpp:873
SG_Char
#define SG_Char
Definition: api_core.h:530
CSG_Table::Create
bool Create(const CSG_Table &Table)
Definition: table.cpp:146
TSG_Vertex_Type
TSG_Vertex_Type
Definition: shapes.h:91
shapes.h
CSG_String
Definition: api_core.h:557
CSG_Tool::Set_Manager
bool Set_Manager(class CSG_Data_Manager *pManager)
Definition: tool.cpp:549
SHAPE_TYPE_Point
@ SHAPE_TYPE_Point
Definition: shapes.h:102
CSG_Shapes::Destroy
virtual bool Destroy(void)
Definition: shapes.cpp:347
CSG_Shape::Get_MMax
virtual double Get_MMax(void)
Definition: shapes.h:213
SG_UI_Process_Set_Progress
bool SG_UI_Process_Set_Progress(int Position, int Range)
Definition: api_callback.cpp:249
SSG_Point::x
double x
Definition: geo_tools.h:129
CSG_Shape_Point_Z
Definition: shapes.h:323
SHAPE_FILE_FORMAT_ESRI
@ SHAPE_FILE_FORMAT_ESRI
Definition: shapes.h:116
SSG_Point::y
double y
Definition: geo_tools.h:129
SG_Shapes_Get_File_Format_Default
TSG_Shape_File_Format SG_Shapes_Get_File_Format_Default(void)
Definition: shapes.cpp:409
CSG_Shapes::Make_Clean
bool Make_Clean(void)
Definition: shapes.cpp:628
CSG_Table_Record::Get_Index
sLong Get_Index(void) const
Definition: table.h:136
CSG_Shape_Polygon::is_Lake
bool is_Lake(int iPart)
Definition: shape_polygon.cpp:811
CSG_Shape::Get_Extent
virtual const CSG_Rect & Get_Extent(void)=0
CSG_Shape_Points::Get_Point_Count
virtual int Get_Point_Count(void) const
Definition: shapes.h:494
CSG_Tool::On_Before_Execution
virtual bool On_Before_Execution(void)
Definition: tool.h:239
CSG_Shapes
Definition: shapes.h:773
SG_UI_ProgressAndMsg_Lock
void SG_UI_ProgressAndMsg_Lock(bool bOn)
Definition: api_callback.cpp:577
CSG_String::c_str
const SG_Char * c_str(void) const
Definition: api_string.cpp:236
tool_library.h
SHAPE_TYPE_Points
@ SHAPE_TYPE_Points
Definition: shapes.h:103
CSG_PointCloud
Definition: pointcloud.h:105
SG_UI_Process_Set_Ready
bool SG_UI_Process_Set_Ready(void)
Definition: api_callback.cpp:299
CSG_Shapes::Get_Type
virtual TSG_Shape_Type Get_Type(void) const
Definition: shapes.h:807
CSG_Shape_Points::Get_Part_Count
virtual int Get_Part_Count(void) const
Definition: shapes.h:496
CSG_Shapes::On_Update
virtual bool On_Update(void)
Definition: shapes.cpp:536
CSG_Table::Add_Record
virtual CSG_Table_Record * Add_Record(CSG_Table_Record *pCopy=NULL)
Definition: table.cpp:799
CSG_Shape_Polygon
Definition: shapes.h:699
CSG_Projection::Create
bool Create(const CSG_Projection &Projection)
Definition: projections.cpp:252
SG_FILE_ENCODING_UTF8
@ SG_FILE_ENCODING_UTF8
Definition: api_core.h:546
CSG_Shape
Definition: shapes.h:141
CSG_Data_Object::Get_Projection
CSG_Projection & Get_Projection(void)
Definition: dataobject.cpp:578
SG_VERTEX_TYPE_XYZ
@ SG_VERTEX_TYPE_XYZ
Definition: shapes.h:93
CSG_Shapes::Get_ZMax
double Get_ZMax(void)
Definition: shapes.h:814
SG_DATAOBJECT_TYPE_PointCloud
@ SG_DATAOBJECT_TYPE_PointCloud
Definition: dataobject.h:123
SHAPE_TYPE_Undefined
@ SHAPE_TYPE_Undefined
Definition: shapes.h:101
CSG_Data_Object::is_Valid
virtual bool is_Valid(void) const =0
SG_UI_Msg_Add
void SG_UI_Msg_Add(const char *Message, bool bNewLine, TSG_UI_MSG_STYLE Style)
Definition: api_callback.cpp:490
CSG_Table::_On_Construction
virtual void _On_Construction(void)
Definition: table.cpp:297
SG_Create_Shapes
CSG_Shapes * SG_Create_Shapes(void)
Definition: shapes.cpp:85