Ice Sheet System Model  4.18
Code documentation
KML_Overlay.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 "./KMLFileReadUtils.h"
14 #include "./KML_Overlay.h"
15 #include "./KML_Icon.h"
16 #include "../shared/shared.h"
17 /*}}}*/
18 
19 /*Constructors/destructor/copy*/
21 
22  strcpy(color ,"ffffffff");
23  memcpy(color,"ffffffff",(strlen("ffffffff")+1)*sizeof(char));
24 
25  draword = 0;
26  icon =NULL;
27 
28 }
29 /*}}}*/
31 
32  if (icon) {
33  delete icon;
34  icon =NULL;
35  }
36 
37 }
38 /*}}}*/
39 
40 /*Other*/
41 void KML_Overlay::Echo(){/*{{{*/
42 
44  _printf0_(" color: \"" << color << "\"\n");
45  _printf0_(" draword: " << draword << "\n");
46  _printf0_(" icon: " << icon << "\n");
47 }
48 /*}}}*/
49 void KML_Overlay::DeepEcho(){/*{{{*/
50 
51  char indent[81]="";
52 
53  KML_Overlay::DeepEcho(indent);
54 
55  return;
56 }
57 /*}}}*/
58 void KML_Overlay::DeepEcho(const char* indent){/*{{{*/
59 
60  char indent2[81];
61  KML_Feature::DeepEcho(indent);
62 
63  memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char));
64  strcat(indent2," ");
65 
66  _printf0_(indent << " color: " << color << "\n");
67  _printf0_(indent << " draword: " << draword << "\n");
68  if (icon)
69  icon->DeepEcho(indent2);
70  else
71  _printf0_(indent << " icon: " << icon << "\n");
72 }
73 /*}}}*/
74 void KML_Overlay::Write(FILE* filout,const char* indent){/*{{{*/
75 
76  char indent2[81];
77 
78  KML_Feature::Write(filout,indent);
79 
80  memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char));
81 
82  strcat(indent2," ");
83 
84  if (color && strlen(color))
85  fprintf(filout,"%s <color>%s</color>\n",indent,color);
86  fprintf(filout,"%s <drawOrder>%d</drawOrder>\n",indent,draword);
87  if (icon)
88  icon->Write(filout,indent2);
89 
90  return;
91 }
92 /*}}}*/
93 void KML_Overlay::Read(FILE* fid,char* kstr){/*{{{*/
94 
95 /* process field within opening and closing tags */
96 
97  if (!strncmp(kstr,"</Overlay", 9)) {
98  xDelete<char>(kstr);
99  return;
100  }
101  else if (!strncmp(kstr,"</",2))
102  {_error_("KML_Overlay::Read -- Unexpected closing tag " << kstr << ".\n");}
103  else if (strncmp(kstr,"<",1))
104  {_error_("KML_Overlay::Read -- Unexpected field \"" << kstr << "\".\n");}
105 
106  else if (!strcmp(kstr,"<color>"))
108  kstr,
109  fid);
110  else if (!strcmp(kstr,"<drawOrder>"))
112  kstr,
113  fid);
114 
115  else if (!strncmp(kstr,"<Icon", 5)) {
116  icon =new KML_Icon();
117  icon ->Read(fid,kstr);
118  }
119 
120  else if (!strncmp(kstr,"<",1))
121  KML_Feature::Read(fid,kstr);
122 
123  return;
124 }
125 /*}}}*/
KML_Overlay::color
char color[KML_OVERLAY_COLOR_LENGTH+1]
Definition: KML_Overlay.h:21
_printf0_
#define _printf0_(StreamArgs)
Definition: Print.h:29
KML_OVERLAY_COLOR_LENGTH
#define KML_OVERLAY_COLOR_LENGTH
Definition: KML_Overlay.h:8
KML_Overlay::Write
void Write(FILE *fid, const char *indent)
Definition: KML_Overlay.cpp:74
KMLFileReadUtils.h
: header file for kml file reading utilities.
KML_Overlay.h
: header file for kml_overlay abstract object
KML_Icon.h
: header file for kml_icon object
KML_Overlay::KML_Overlay
KML_Overlay()
Definition: KML_Overlay.cpp:20
KML_Icon::Read
void Read(FILE *fid, char *kstr)
Definition: KML_Icon.cpp:115
KML_Overlay::Read
void Read(FILE *fid, char *kstr)
Definition: KML_Overlay.cpp:93
KML_Feature::DeepEcho
void DeepEcho()
Definition: KML_Feature.cpp:70
KMLFileTokenParse
int KMLFileTokenParse(int *pival, char *ktag, FILE *fid)
Definition: KMLFileReadUtils.cpp:335
KML_Overlay::DeepEcho
void DeepEcho()
Definition: KML_Overlay.cpp:49
KML_Overlay::Echo
void Echo()
Definition: KML_Overlay.cpp:41
KML_Feature::Write
void Write(FILE *fid, const char *indent)
Definition: KML_Feature.cpp:111
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
KML_Icon
Definition: KML_Icon.h:20
KML_Overlay::~KML_Overlay
~KML_Overlay()
Definition: KML_Overlay.cpp:30
KML_Icon::Write
void Write(FILE *fid, const char *indent)
Definition: KML_Icon.cpp:87
KML_Feature::Echo
void Echo()
Definition: KML_Feature.cpp:53
KML_Icon::DeepEcho
void DeepEcho()
Definition: KML_Icon.cpp:59
KML_Overlay::draword
int draword
Definition: KML_Overlay.h:22
KML_Feature::Read
void Read(FILE *fid, char *kstr)
Definition: KML_Feature.cpp:141
KML_Overlay::icon
KML_Icon * icon
Definition: KML_Overlay.h:23