Ice Sheet System Model  4.18
Code documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Data Fields
KML_Point Class Reference

#include <KML_Point.h>

Inheritance diagram for KML_Point:
KML_Geometry KML_Object Object

Public Member Functions

 KML_Point ()
 
 ~KML_Point ()
 
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 ()
 
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

bool extrude
 
char altmode [KML_POINT_ALTMODE_LENGTH+1]
 
double coords [3]
 
- Data Fields inherited from KML_Object
DataSetattrib
 
DataSetcommnt
 
DataSetkmlobj
 

Detailed Description

Definition at line 16 of file KML_Point.h.

Constructor & Destructor Documentation

◆ KML_Point()

KML_Point::KML_Point ( )

Definition at line 19 of file KML_Point.cpp.

19  {/*{{{*/
20 
21  extrude =false;
22  memcpy(altmode,"clampToGround",(strlen("clampToGround")+1)*sizeof(char));
23 
24  coords[0] = 0.;
25  coords[1] = 0.;
26  coords[2] = 0.;
27 
28 }

◆ ~KML_Point()

KML_Point::~KML_Point ( )

Definition at line 30 of file KML_Point.cpp.

30  {/*{{{*/
31 
32  ;
33 
34 }

Member Function Documentation

◆ Echo()

void KML_Point::Echo ( void  )
virtual

Reimplemented from KML_Geometry.

Definition at line 38 of file KML_Point.cpp.

38  {/*{{{*/
39 
40  bool flag=true;
41 
42  if(flag) _printf0_("KML_Point:\n");
44 
45  if(flag) _printf0_(" extrude: " << (extrude ? "true" : "false") << "\n");
46  if(flag) _printf0_(" altmode: \"" << altmode << "\"\n");
47  if(flag) _printf0_(" coords: (" << coords[0] << "," << coords[1] << "," << coords[2] << ")\n");
48 
49  return;
50 }

◆ DeepEcho() [1/2]

void KML_Point::DeepEcho ( void  )
virtual

Reimplemented from KML_Geometry.

Definition at line 52 of file KML_Point.cpp.

52  {/*{{{*/
53 
54  char indent[81]="";
55 
56  KML_Point::DeepEcho(indent);
57 
58  return;
59 }

◆ DeepEcho() [2/2]

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

Reimplemented from KML_Geometry.

Definition at line 61 of file KML_Point.cpp.

61  {/*{{{*/
62 
63  bool flag=true;
64 
65  if(flag) _printf0_(indent << "KML_Point:\n");
66  KML_Geometry::DeepEcho(indent);
67 
68  if(flag) _printf0_(indent << " extrude: " << (extrude ? "true" : "false") << "\n");
69  if(flag) _printf0_(indent << " altmode: \"" << altmode << "\"\n");
70  if(flag) _printf0_(indent << " coords: (" << coords[0] << "," << coords[1] << "," << coords[2] << ")\n");
71 
72  return;
73 }

◆ Write()

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

Reimplemented from KML_Geometry.

Definition at line 75 of file KML_Point.cpp.

75  {/*{{{*/
76 
77  fprintf(filout,"%s<Point",indent);
78  WriteAttrib(filout," ");
79  fprintf(filout,">\n");
80  WriteCommnt(filout,indent);
81 
82  KML_Geometry::Write(filout,indent);
83 
84  fprintf(filout,"%s <extrude>%d</extrude>\n",indent,(extrude ? 1 : 0));
85  fprintf(filout,"%s <altitudeMode>%s</altitudeMode>\n",indent,altmode);
86  fprintf(filout,"%s <coordinates>%0.16g,%0.16g,%0.16g</coordinates>\n",
87  indent,coords[0],coords[1],coords[2]);
88 
89  fprintf(filout,"%s</Point>\n",indent);
90 
91  return;
92 }

◆ Read()

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

Reimplemented from KML_Geometry.

Definition at line 94 of file KML_Point.cpp.

94  {/*{{{*/
95 
96  double* pcoords=&coords[0];
97  char* kstri;
98  int ncom=0;
99  char** pcom=NULL;
100 
101 /* get object attributes and check for solo tag */
102 
103  if (KMLFileTagAttrib(this,
104  kstr))
105  return;
106 
107 /* loop over and process fields within opening and closing tags */
108 
109  while((kstri=KMLFileToken(fid, &ncom,&pcom))){
110  if (!strncmp(kstri,"</Point", 7)) {
111  xDelete<char>(kstri);
112  break;
113  }
114  else if (!strncmp(kstri,"</",2))
115  {_error_("KML_Point::Read -- Unexpected closing tag " << kstri << ".\n");}
116  else if (strncmp(kstri,"<",1))
117  {_error_("KML_Point::Read -- Unexpected field \"" << kstri << "\".\n");}
118 
119  else if (!strcmp(kstri,"<extrude>"))
120  KMLFileTokenParse(&extrude , kstri, fid);
121  else if (!strcmp(kstri,"<altitudeMode>"))
123  else if (!strcmp(kstri,"<coordinates>"))
124  KMLFileTokenParse(&pcoords ,NULL,3, kstri, fid);
125 
126  else if (!strncmp(kstri,"<",1))
127  KML_Geometry::Read(fid,kstri);
128 
129  xDelete<char>(kstri);
130  }
131 
132  this->AddCommnt(ncom,pcom);
133 
134  for(ncom=ncom; ncom>0; ncom--)
135  xDelete<char>(pcom[ncom-1]);
136  xDelete<char*>(pcom);
137 
138  return;
139 }

◆ WriteExp()

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

Reimplemented from KML_Object.

Definition at line 141 of file KML_Point.cpp.

141  {/*{{{*/
142 
143  int i;
144  double lat,lon,x,y;
145  char nstr2[81];
146 
147 /* extract latitude and longitude */
148 
149  lon=coords[0];
150  lat=coords[1];
151 
152 /* convert latitude and longitude to x and y */
153 
154  if (sgn) {
155  Ll2xyx(&x,&y,&lat,&lon,1,sgn,cm,sp);
156  }
157  else {
158  memcpy(&x,&lon,1*sizeof(IssmDouble));
159  memcpy(&y,&lat,1*sizeof(IssmDouble));
160  }
161 
162 /* write header */
163 
164  memcpy(nstr2,nstr,(strlen(nstr)+1)*sizeof(char));
165 
166  for (i=0; i<strlen(nstr2); i++)
167  if ((nstr2[i] == ' ') || (nstr2[i] == '\t'))
168  nstr2[i]='_';
169  fprintf(fid,"## Name:%s\n",nstr2);
170  fprintf(fid,"## Icon:0\n");
171  fprintf(fid,"# Points Count Value\n");
172  fprintf(fid,"%u %s\n",1,"1.");
173  fprintf(fid,"# X pos Y pos\n");
174 
175 /* write vertex */
176 
177  fprintf(fid,"%lf\t%lf\n",x,y);
178 
179 /* write blank line */
180 
181  fprintf(fid,"\n");
182 
183  return;
184 }

◆ Id()

int KML_Point::Id ( void  )
inlinevirtual

Reimplemented from KML_Geometry.

Definition at line 35 of file KML_Point.h.

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

◆ ObjectEnum()

int KML_Point::ObjectEnum ( void  )
inlinevirtual

Reimplemented from KML_Geometry.

Definition at line 36 of file KML_Point.h.

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

◆ copy()

Object* KML_Point::copy ( void  )
inlinevirtual

Reimplemented from KML_Geometry.

Definition at line 37 of file KML_Point.h.

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

◆ Marshall()

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

Reimplemented from KML_Geometry.

Definition at line 38 of file KML_Point.h.

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

Field Documentation

◆ extrude

bool KML_Point::extrude

Definition at line 20 of file KML_Point.h.

◆ altmode

char KML_Point::altmode[KML_POINT_ALTMODE_LENGTH+1]

Definition at line 21 of file KML_Point.h.

◆ coords

double KML_Point::coords[3]

Definition at line 22 of file KML_Point.h.


The documentation for this class was generated from the following files:
Ll2xyx
int Ll2xyx(double *x, double *y, double *lat, double *lon, int ncoord, int sgn)
Definition: Ll2xyx.cpp:8
IssmDouble
double IssmDouble
Definition: types.h:37
_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
KML_Point::extrude
bool extrude
Definition: KML_Point.h:20
KMLFileTagAttrib
int KMLFileTagAttrib(KML_Object *kobj, char *ktag)
Definition: KMLFileReadUtils.cpp:287
KML_Point::coords
double coords[3]
Definition: KML_Point.h:22
KML_POINT_ALTMODE_LENGTH
#define KML_POINT_ALTMODE_LENGTH
Definition: KML_Point.h:8
KML_Point::DeepEcho
void DeepEcho()
Definition: KML_Point.cpp:52
KML_Point::altmode
char altmode[KML_POINT_ALTMODE_LENGTH+1]
Definition: KML_Point.h:21
KMLFileToken
char * KMLFileToken(FILE *fid, int *pncom=NULL, char ***ppcom=NULL)
Definition: KMLFileReadUtils.cpp:18
KML_Geometry::DeepEcho
void DeepEcho()
Definition: KML_Geometry.cpp:40
KMLFileTokenParse
int KMLFileTokenParse(int *pival, char *ktag, FILE *fid)
Definition: KMLFileReadUtils.cpp:335
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
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