Ice Sheet System Model  4.18
Code documentation
KML_LineStyle.cpp
Go to the documentation of this file.
1 
5 /*Headers:*/
6 /*{{{*/
7 #ifdef HAVE_CONFIG_H
8  #include <config.h>
9 #else
10 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
11 #endif
12 
13 #include "./KML_LineStyle.h"
14 #include "./KMLFileReadUtils.h"
15 #include "../shared/shared.h"
16 /*}}}*/
17 
18 /*Constructors/destructor/copy*/
20 
21  width =1.;
22 
23 }
24 /*}}}*/
26 
27  ;
28 
29 }
30 /*}}}*/
31 
32 /*Other*/
33 void KML_LineStyle::Echo(){/*{{{*/
34 
35  bool flag=true;
36 
37  if(flag) _printf0_("KML_LineStyle:\n");
39 
40  if(flag) _printf0_(" width: " << width << "\n");
41 
42  return;
43 }
44 /*}}}*/
46 
47  char indent[81]="";
48 
50 
51  return;
52 }
53 /*}}}*/
54 void KML_LineStyle::DeepEcho(const char* indent){/*{{{*/
55 
56  bool flag=true;
57 
58  if(flag) _printf0_(indent << "KML_LineStyle:\n");
60 
61  if(flag) _printf0_(indent << " width: " << width << "\n");
62 
63  return;
64 }
65 /*}}}*/
66 void KML_LineStyle::Write(FILE* filout,const char* indent){/*{{{*/
67 
68  fprintf(filout,"%s<LineStyle",indent);
69  WriteAttrib(filout," ");
70  fprintf(filout,">\n");
71  WriteCommnt(filout,indent);
72 
73  KML_ColorStyle::Write(filout,indent);
74 
75  fprintf(filout,"%s <width>%g</width>\n",indent,width);
76 
77  fprintf(filout,"%s</LineStyle>\n",indent);
78 
79  return;
80 }
81 /*}}}*/
82 void KML_LineStyle::Read(FILE* fid,char* kstr){/*{{{*/
83 
84  char* kstri;
85  int ncom=0;
86  char** pcom=NULL;
87 
88 /* get object attributes and check for solo tag */
89 
90  if (KMLFileTagAttrib(this,
91  kstr))
92  return;
93 
94 /* loop over and process fields within opening and closing tags */
95 
96  while((kstri=KMLFileToken(fid, &ncom,&pcom))){
97  if (!strncmp(kstri,"</LineStyle",11)) {
98  xDelete<char>(kstri);
99  break;
100  }
101  else if (!strncmp(kstri,"</",2))
102  {_error_("KML_LineStyle::Read -- Unexpected closing tag " << kstri << ".\n");}
103  else if (strncmp(kstri,"<",1))
104  {_error_("KML_LineStyle::Read -- Unexpected field \"" << kstri << "\".\n");}
105 
106  else if (!strcmp(kstri,"<width>"))
108  kstri,
109  fid);
110 
111  else if (!strncmp(kstri,"<",1))
112  KML_ColorStyle::Read(fid,kstri);
113 
114  xDelete<char>(kstri);
115  }
116 
117  this->AddCommnt(ncom,pcom);
118 
119  for(ncom=ncom; ncom>0; ncom--)
120  xDelete<char>(pcom[ncom-1]);
121  xDelete<char*>(pcom);
122 
123  return;
124 }
125 /*}}}*/
KML_ColorStyle::Echo
void Echo()
Definition: KML_ColorStyle.cpp:35
_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_LineStyle::KML_LineStyle
KML_LineStyle()
Definition: KML_LineStyle.cpp:19
KML_LineStyle::width
float width
Definition: KML_LineStyle.h:18
KML_ColorStyle::Write
void Write(FILE *fid, const char *indent)
Definition: KML_ColorStyle.cpp:66
KMLFileReadUtils.h
: header file for kml file reading utilities.
KMLFileTagAttrib
int KMLFileTagAttrib(KML_Object *kobj, char *ktag)
Definition: KMLFileReadUtils.cpp:287
KML_ColorStyle::Read
void Read(FILE *fid, char *kstr)
Definition: KML_ColorStyle.cpp:78
KML_LineStyle::~KML_LineStyle
~KML_LineStyle()
Definition: KML_LineStyle.cpp:25
KMLFileToken
char * KMLFileToken(FILE *fid, int *pncom=NULL, char ***ppcom=NULL)
Definition: KMLFileReadUtils.cpp:18
KML_LineStyle::Echo
void Echo()
Definition: KML_LineStyle.cpp:33
KML_LineStyle.h
: header file for kml_linestyle object
KMLFileTokenParse
int KMLFileTokenParse(int *pival, char *ktag, FILE *fid)
Definition: KMLFileReadUtils.cpp:335
KML_LineStyle::DeepEcho
void DeepEcho()
Definition: KML_LineStyle.cpp:45
KML_LineStyle::Read
void Read(FILE *fid, char *kstr)
Definition: KML_LineStyle.cpp:82
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
KML_ColorStyle::DeepEcho
void DeepEcho()
Definition: KML_ColorStyle.cpp:47
KML_LineStyle::Write
void Write(FILE *fid, const char *indent)
Definition: KML_LineStyle.cpp:66
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