Ice Sheet System Model  4.18
Code documentation
Public Member Functions | Data Fields
KML_MultiGeometry Class Reference

#include <KML_MultiGeometry.h>

Inheritance diagram for KML_MultiGeometry:
KML_Geometry KML_Object Object

Public Member Functions

 KML_MultiGeometry ()
 
 ~KML_MultiGeometry ()
 
void Echo ()
 
void DeepEcho ()
 
void DeepEcho (const char *indent)
 
void Write (FILE *fid, const char *indent)
 
void Read (FILE *fid, char *kstr)
 
void WriteExp (FILE *fid, const char *nstr, int sgn, double cm, double sp)
 
int Id ()
 
int ObjectEnum ()
 
Objectcopy ()
 
void Marshall (char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
 
- Public Member Functions inherited from KML_Geometry
 KML_Geometry ()
 
 ~KML_Geometry ()
 
- Public Member Functions inherited from KML_Object
 KML_Object ()
 
 ~KML_Object ()
 
int Id ()
 
int ObjectEnum ()
 
Objectcopy ()
 
void Marshall (char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
 
virtual void AddAttrib (const char *name, const char *value)
 
virtual void WriteAttrib (FILE *fid, const char *indent)
 
virtual void AddCommnt (int ncom, char **pcom)
 
virtual void AddCommnt (char *value)
 
virtual void WriteCommnt (FILE *fid, const char *indent)
 
- Public Member Functions inherited from Object
virtual ~Object ()
 

Data Fields

DataSetgeometry
 
- Data Fields inherited from KML_Object
DataSetattrib
 
DataSetcommnt
 
DataSetkmlobj
 

Detailed Description

Definition at line 16 of file KML_MultiGeometry.h.

Constructor & Destructor Documentation

◆ KML_MultiGeometry()

KML_MultiGeometry::KML_MultiGeometry ( )

Definition at line 24 of file KML_MultiGeometry.cpp.

24  {/*{{{*/
25 
26  geometry =new DataSet;
27 
28 }

◆ ~KML_MultiGeometry()

KML_MultiGeometry::~KML_MultiGeometry ( )

Definition at line 30 of file KML_MultiGeometry.cpp.

30  {/*{{{*/
31 
32  if (geometry) {
33  delete geometry;
34  geometry =NULL;
35  }
36 
37 }

Member Function Documentation

◆ Echo()

void KML_MultiGeometry::Echo ( void  )
virtual

Reimplemented from KML_Geometry.

Definition at line 41 of file KML_MultiGeometry.cpp.

41  {/*{{{*/
42 
43  bool flag=true;
44 
45  if(flag) _printf0_("KML_Multigeometry:\n");
47 
48  if(flag) _printf0_(" geometry: (size=" << geometry->Size() << ")\n");
49 
50  return;
51 }

◆ DeepEcho() [1/2]

void KML_MultiGeometry::DeepEcho ( void  )
virtual

Reimplemented from KML_Geometry.

Definition at line 53 of file KML_MultiGeometry.cpp.

53  {/*{{{*/
54 
55  char indent[81]="";
56 
58 
59  return;
60 }

◆ DeepEcho() [2/2]

void KML_MultiGeometry::DeepEcho ( const char *  indent)
virtual

Reimplemented from KML_Geometry.

Definition at line 62 of file KML_MultiGeometry.cpp.

62  {/*{{{*/
63 
64  int i;
65  char indent2[81];
66  bool flag=true;
67 
68  if(flag) _printf0_(indent << "KML_Multigeometry:\n");
69  KML_Geometry::DeepEcho(indent);
70 
71 /* loop over the geometry elements for the multigeometry */
72 
73  memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char));
74  strcat(indent2," ");
75 
76  if (geometry->Size())
77  for (i=0; i<geometry->Size(); i++) {
78  if(flag) _printf0_(indent << " geometry: -------- begin [" << i << "] --------\n");
80  if(flag) _printf0_(indent << " geometry: -------- end [" << i << "] --------\n");
81  }
82  else
83  if(flag) _printf0_(indent << " geometry: [empty]\n");
84 
85  return;
86 }

◆ Write()

void KML_MultiGeometry::Write ( FILE *  fid,
const char *  indent 
)
virtual

Reimplemented from KML_Geometry.

Definition at line 88 of file KML_MultiGeometry.cpp.

88  {/*{{{*/
89 
90  int i;
91  char indent2[81];
92 
93  fprintf(filout,"%s<MultiGeometry",indent);
94  WriteAttrib(filout," ");
95  fprintf(filout,">\n");
96  WriteCommnt(filout,indent);
97 
98  KML_Geometry::Write(filout,indent);
99 
100 /* loop over the geometry elements for the multigeometry */
101 
102  memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char));
103 
104  strcat(indent2," ");
105 
106  for (i=0; i<geometry->Size(); i++)
107  ((KML_Geometry *)geometry->GetObjectByOffset(i))->Write(filout,indent2);
108 
109  fprintf(filout,"%s</MultiGeometry>\n",indent);
110 
111  return;
112 }

◆ Read()

void KML_MultiGeometry::Read ( FILE *  fid,
char *  kstr 
)
virtual

Reimplemented from KML_Geometry.

Definition at line 114 of file KML_MultiGeometry.cpp.

114  {/*{{{*/
115 
116  char* kstri;
117  int ncom=0;
118  char** pcom=NULL;
119  KML_Object* kobj;
120 
121 /* get object attributes and check for solo tag */
122 
123  if (KMLFileTagAttrib(this,
124  kstr))
125  return;
126 
127 /* loop over and process fields within opening and closing tags */
128 
129  while((kstri=KMLFileToken(fid, &ncom,&pcom))){
130  if (!strncmp(kstri,"</MultiGeometry",15)) {
131  xDelete<char>(kstri);
132  break;
133  }
134  else if (!strncmp(kstri,"</",2))
135  {_error_("KML_MultiGeometry::Read -- Unexpected closing tag " << kstri << ".\n");}
136  else if (strncmp(kstri,"<",1))
137  {_error_("KML_MultiGeometry::Read -- Unexpected field \"" << kstri << "\".\n");}
138 
139  else if (!strncmp(kstri,"<Point", 6)) {
140  kobj=(KML_Object*)new KML_Point();
141  kobj->Read(fid,kstri);
142  geometry ->AddObject((Object*)kobj);
143  }
144 
145  else if (!strncmp(kstri,"<LineString",11)) {
146  kobj=(KML_Object*)new KML_LineString();
147  kobj->Read(fid,kstri);
148  geometry ->AddObject((Object*)kobj);
149  }
150 
151  else if (!strncmp(kstri,"<LinearRing",11)) {
152  kobj=(KML_Object*)new KML_LinearRing();
153  kobj->Read(fid,kstri);
154  geometry ->AddObject((Object*)kobj);
155  }
156 
157  else if (!strncmp(kstri,"<Polygon", 8)) {
158  kobj=(KML_Object*)new KML_Polygon();
159  kobj->Read(fid,kstri);
160  geometry ->AddObject((Object*)kobj);
161  }
162 
163  else if (!strncmp(kstri,"<MultiGeometry",14)) {
164  kobj=(KML_Object*)new KML_MultiGeometry();
165  kobj->Read(fid,kstri);
166  geometry ->AddObject((Object*)kobj);
167  }
168 
169  else if (!strncmp(kstri,"<",1))
170  KML_Geometry::Read(fid,kstri);
171 
172  xDelete<char>(kstri);
173  }
174 
175  this->AddCommnt(ncom,pcom);
176 
177  for(ncom=ncom; ncom>0; ncom--)
178  xDelete<char>(pcom[ncom-1]);
179  xDelete<char*>(pcom);
180 
181  return;
182 }

◆ WriteExp()

void KML_MultiGeometry::WriteExp ( FILE *  fid,
const char *  nstr,
int  sgn,
double  cm,
double  sp 
)
virtual

Reimplemented from KML_Object.

Definition at line 184 of file KML_MultiGeometry.cpp.

184  {/*{{{*/
185 
186  int i;
187 
188 /* loop over the geometry elements for the multigeometry */
189 
190  for (i=0; i<geometry->Size(); i++)
191  ((KML_Object *)geometry->GetObjectByOffset(i))->WriteExp(fid,nstr,sgn,cm,sp);
192 
193  return;
194 }

◆ Id()

int KML_MultiGeometry::Id ( void  )
inlinevirtual

Reimplemented from KML_Geometry.

Definition at line 33 of file KML_MultiGeometry.h.

33 {_error_("Not implemented yet.");};

◆ ObjectEnum()

int KML_MultiGeometry::ObjectEnum ( void  )
inlinevirtual

Reimplemented from KML_Geometry.

Definition at line 34 of file KML_MultiGeometry.h.

34 {_error_("Not implemented yet.");};

◆ copy()

Object* KML_MultiGeometry::copy ( void  )
inlinevirtual

Reimplemented from KML_Geometry.

Definition at line 35 of file KML_MultiGeometry.h.

35 {_error_("Not implemented yet.");};

◆ Marshall()

void KML_MultiGeometry::Marshall ( char **  pmarshalled_data,
int *  pmarshalled_data_size,
int  marshall_direction 
)
inlinevirtual

Reimplemented from KML_Geometry.

Definition at line 36 of file KML_MultiGeometry.h.

36 { _error_("not implemented yet!");};

Field Documentation

◆ geometry

DataSet* KML_MultiGeometry::geometry

Definition at line 20 of file KML_MultiGeometry.h.


The documentation for this class was generated from the following files:
DataSet::Size
int Size()
Definition: DataSet.cpp:399
KML_Object
Definition: KML_Object.h:13
_printf0_
#define _printf0_(StreamArgs)
Definition: Print.h:29
KML_Object::WriteAttrib
virtual void WriteAttrib(FILE *fid, const char *indent)
Definition: KML_Object.cpp:288
KML_Geometry::Write
void Write(FILE *fid, const char *indent)
Definition: KML_Geometry.cpp:56
DataSet::AddObject
int AddObject(Object *object)
Definition: DataSet.cpp:252
KMLFileTagAttrib
int KMLFileTagAttrib(KML_Object *kobj, char *ktag)
Definition: KMLFileReadUtils.cpp:287
KML_Object::Read
virtual void Read(FILE *fid, char *kstr)=0
Definition: KML_Object.cpp:143
Object
Definition: Object.h:13
KMLFileToken
char * KMLFileToken(FILE *fid, int *pncom=NULL, char ***ppcom=NULL)
Definition: KMLFileReadUtils.cpp:18
KML_Polygon
Definition: KML_Polygon.h:18
KML_MultiGeometry::KML_MultiGeometry
KML_MultiGeometry()
Definition: KML_MultiGeometry.cpp:24
KML_MultiGeometry::geometry
DataSet * geometry
Definition: KML_MultiGeometry.h:20
KML_Geometry
Definition: KML_Geometry.h:14
KML_Geometry::DeepEcho
void DeepEcho()
Definition: KML_Geometry.cpp:40
KML_Point
Definition: KML_Point.h:16
KML_LinearRing
Definition: KML_LinearRing.h:16
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
DataSet::GetObjectByOffset
Object * GetObjectByOffset(int offset)
Definition: DataSet.cpp:334
KML_MultiGeometry::DeepEcho
void DeepEcho()
Definition: KML_MultiGeometry.cpp:53
KML_LineString
Definition: KML_LineString.h:16
DataSet
Declaration of DataSet class.
Definition: DataSet.h:14
KML_Object::AddCommnt
virtual void AddCommnt(int ncom, char **pcom)
Definition: KML_Object.cpp:301
KML_Object::WriteCommnt
virtual void WriteCommnt(FILE *fid, const char *indent)
Definition: KML_Object.cpp:326
KML_Geometry::Echo
void Echo()
Definition: KML_Geometry.cpp:33
KML_Geometry::Read
void Read(FILE *fid, char *kstr)
Definition: KML_Geometry.cpp:63