source: issm/trunk-jpl/src/c/classes/objects/KML/KML_Icon.cpp@ 14996

Last change on this file since 14996 was 14996, checked in by Eric.Larour, 12 years ago

CHG: integrated Container/ directory into src/c/classes/objects directory. No reason to have the containers
and the objects that they contain defined in different places.

File size: 5.0 KB
Line 
1/*!\file KML_Icon.cpp
2 * \brief: implementation of the kml_feature abstract object
3 */
4
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 <stdio.h>
14#include <string.h>
15#include "../objects.h"
16#include "../../../shared/shared.h"
17#include "../../../shared/io/io.h"
18/*}}}*/
19
20/*Constructors/destructor/copy*/
21/*FUNCTION KML_Icon::KML_Icon(){{{*/
22KML_Icon::KML_Icon(){
23
24 strcpy(href ,"");
25 strcpy(refmode ,"onChange");
26 refint = 4.;
27 strcpy(vrefmode ,"never");
28 vreftime = 4.;
29 vboundsc = 1.;
30 strcpy(vformat ,"");
31 strcpy(hquery ,"");
32
33}
34/*}}}*/
35/*FUNCTION KML_Icon::~KML_Icon(){{{*/
36KML_Icon::~KML_Icon(){
37
38 ;
39
40}
41/*}}}*/
42
43/*Other*/
44/*FUNCTION KML_Icon::Echo {{{*/
45void KML_Icon::Echo(){
46
47 bool flag=true;
48
49 if(flag) _pprintLine_("KML_Icon:");
50 KML_Object::Echo();
51
52 if(flag) _pprintLine_(" href: \"" << href << "\"");
53 if(flag) _pprintLine_(" refmode: \"" << refmode << "\"");
54 if(flag) _pprintLine_(" refint: " << refint);
55 if(flag) _pprintLine_(" vrefmode: \"" << vrefmode << "\"");
56 if(flag) _pprintLine_(" vreftime: " << vreftime);
57 if(flag) _pprintLine_(" vboundsc: " << vboundsc);
58 if(flag) _pprintLine_(" vformat: \"" << vformat << "\"");
59 if(flag) _pprintLine_(" hquery: \"" << hquery << "\"");
60
61 return;
62}
63/*}}}*/
64/*FUNCTION KML_Icon::DeepEcho {{{*/
65void KML_Icon::DeepEcho(){
66
67 char indent[81]="";
68
69 KML_Icon::DeepEcho(indent);
70
71 return;
72}
73/*}}}*/
74/*FUNCTION KML_Icon::DeepEcho {{{*/
75void KML_Icon::DeepEcho(const char* indent){
76
77 bool flag=true;
78
79 if(flag) _pprintLine_(indent << "KML_Icon:");
80 KML_Object::DeepEcho(indent);
81
82 if(flag) _pprintLine_(indent << " href: \"" << href << "\"");
83 if(flag) _pprintLine_(indent << " refmode: \"" << refmode << "\"");
84 if(flag) _pprintLine_(indent << " refint: " << refint);
85 if(flag) _pprintLine_(indent << " vrefmode: \"" << vrefmode << "\"");
86 if(flag) _pprintLine_(indent << " vreftime: " << vreftime);
87 if(flag) _pprintLine_(indent << " vboundsc: " << vboundsc);
88 if(flag) _pprintLine_(indent << " vformat: \"" << vformat << "\"");
89 if(flag) _pprintLine_(indent << " hquery: \"" << hquery << "\"");
90
91 return;
92}
93/*}}}*/
94/*FUNCTION KML_Icon::Write {{{*/
95void KML_Icon::Write(FILE* filout,const char* indent){
96
97 fprintf(filout,"%s<Icon",indent);
98 WriteAttrib(filout," ");
99 fprintf(filout,">\n");
100 WriteCommnt(filout,indent);
101
102 KML_Object::Write(filout,indent);
103
104 if (href && strlen(href))
105 fprintf(filout,"%s <href>%s</href>\n",indent,href);
106 if (refmode && strlen(refmode))
107 fprintf(filout,"%s <refreshMode>%s</refreshMode>\n",indent,refmode);
108 fprintf(filout,"%s <refreshInterval>%g</refreshInterval>\n",indent,refint);
109 if (vrefmode && strlen(vrefmode))
110 fprintf(filout,"%s <viewRefreshMode>%s</viewRefreshMode>\n",indent,vrefmode);
111 fprintf(filout,"%s <viewRefreshTime>%g</viewRefreshTime>\n",indent,vreftime);
112 fprintf(filout,"%s <viewBoundScale>%g</viewBoundScale>\n",indent,vboundsc);
113 if (vformat && strlen(vformat))
114 fprintf(filout,"%s <viewFormat>%s</viewFormat>\n",indent,vformat);
115 if (hquery && strlen(hquery))
116 fprintf(filout,"%s <httpQuery>%s</httpQuery>\n",indent,hquery);
117
118 fprintf(filout,"%s</Icon>\n",indent);
119
120 return;
121}
122/*}}}*/
123/*FUNCTION KML_Icon::Read {{{*/
124void KML_Icon::Read(FILE* fid,char* kstr){
125
126 char* kstri;
127 int ncom=0;
128 char** pcom=NULL;
129
130/* get object attributes and check for solo tag */
131
132 if (KMLFileTagAttrib(this,
133 kstr))
134 return;
135
136/* loop over and process fields within opening and closing tags */
137
138 while (kstri=KMLFileToken(fid,
139 &ncom,&pcom)) {
140 if (!strncmp(kstri,"</Icon", 6)) {
141 xDelete<char>(kstri);
142 break;
143 }
144 else if (!strncmp(kstri,"</",2))
145 {_error_("KML_Icon::Read -- Unexpected closing tag " << kstri << ".\n");}
146 else if (strncmp(kstri,"<",1))
147 {_error_("KML_Icon::Read -- Unexpected field \"" << kstri << "\".\n");}
148
149 else if (!strcmp(kstri,"<href>"))
150 KMLFileTokenParse( href ,NULL,KML_ICON_HREF_LENGTH, kstri, fid);
151 else if (!strcmp(kstri,"<refreshMode>"))
152 KMLFileTokenParse( refmode ,NULL,KML_ICON_REFMODE_LENGTH, kstri, fid);
153 else if (!strcmp(kstri,"<refreshInterval>"))
154 KMLFileTokenParse(&refint , kstri, fid);
155 else if (!strcmp(kstri,"<viewRefreshMode>"))
156 KMLFileTokenParse( vrefmode ,NULL,KML_ICON_VREFMODE_LENGTH, kstri, fid);
157 else if (!strcmp(kstri,"<viewRefreshTime>"))
158 KMLFileTokenParse(&vreftime , kstri, fid);
159 else if (!strcmp(kstri,"<viewBoundScale>"))
160 KMLFileTokenParse(&vboundsc , kstri, fid);
161 else if (!strcmp(kstri,"<viewFormat>"))
162 KMLFileTokenParse( vformat ,NULL,KML_ICON_VFORMAT_LENGTH, kstri, fid);
163 else if (!strcmp(kstri,"<httpQuery>"))
164 KMLFileTokenParse( hquery ,NULL,KML_ICON_HQUERY_LENGTH, kstri, fid);
165
166 else if (!strncmp(kstri,"<",1))
167 KML_Object::Read(fid,kstri);
168
169 xDelete<char>(kstri);
170 }
171
172 this->AddCommnt(ncom,pcom);
173
174 for (ncom; ncom>0; ncom--)
175 xDelete<char>(pcom[ncom-1]);
176 xDelete<char*>(pcom);
177
178 return;
179}
180/*}}}*/
Note: See TracBrowser for help on using the repository browser.