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

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

CHG: got rid of the include/include.h headere file, finally :)

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