source: issm/trunk-jpl/src/c/classes/KML/KML_Overlay.cpp@ 15012

Last change on this file since 15012 was 15012, checked in by Mathieu Morlighem, 12 years ago

CHG: moved classes/objects back to classes

File size: 2.8 KB
Line 
1/*!\file KML_Overlay.cpp
2 * \brief: implementation of the kml_overlay 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 "../classes.h"
14#include "shared/shared.h"
15/*}}}*/
16
17/*Constructors/destructor/copy*/
18/*FUNCTION KML_Overlay::KML_Overlay(){{{*/
19KML_Overlay::KML_Overlay(){
20
21 strcpy(color ,"ffffffff");
22 memcpy(color,"ffffffff",(strlen("ffffffff")+1)*sizeof(char));
23
24 draword = 0;
25 icon =NULL;
26
27}
28/*}}}*/
29/*FUNCTION KML_Overlay::~KML_Overlay(){{{*/
30KML_Overlay::~KML_Overlay(){
31
32 if (icon) {
33 delete icon;
34 icon =NULL;
35 }
36
37}
38/*}}}*/
39
40/*Other*/
41/*FUNCTION KML_Overlay::Echo {{{*/
42void KML_Overlay::Echo(){
43
44 KML_Feature::Echo();
45 _pprintLine_(" color: \"" << color << "\"");
46 _pprintLine_(" draword: " << draword);
47 _pprintLine_(" icon: " << icon);
48}
49/*}}}*/
50/*FUNCTION KML_Overlay::DeepEcho {{{*/
51void KML_Overlay::DeepEcho(){
52
53 char indent[81]="";
54
55 KML_Overlay::DeepEcho(indent);
56
57 return;
58}
59/*}}}*/
60/*FUNCTION KML_Overlay::DeepEcho {{{*/
61void KML_Overlay::DeepEcho(const char* indent){
62
63 char indent2[81];
64 KML_Feature::DeepEcho(indent);
65
66 memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char));
67 strcat(indent2," ");
68
69 _pprintLine_(indent << " color: " << color);
70 _pprintLine_(indent << " draword: " << draword);
71 if (icon)
72 icon->DeepEcho(indent2);
73 else
74 _pprintLine_(indent << " icon: " << icon);
75}
76/*}}}*/
77/*FUNCTION KML_Overlay::Write {{{*/
78void KML_Overlay::Write(FILE* filout,const char* indent){
79
80 char indent2[81];
81
82 KML_Feature::Write(filout,indent);
83
84 memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char));
85
86 strcat(indent2," ");
87
88 if (color && strlen(color))
89 fprintf(filout,"%s <color>%s</color>\n",indent,color);
90 fprintf(filout,"%s <drawOrder>%d</drawOrder>\n",indent,draword);
91 if (icon)
92 icon->Write(filout,indent2);
93
94 return;
95}
96/*}}}*/
97/*FUNCTION KML_Overlay::Read {{{*/
98void KML_Overlay::Read(FILE* fid,char* kstr){
99
100/* process field within opening and closing tags */
101
102 if (!strncmp(kstr,"</Overlay", 9)) {
103 xDelete<char>(kstr);
104 return;
105 }
106 else if (!strncmp(kstr,"</",2))
107 {_error_("KML_Overlay::Read -- Unexpected closing tag " << kstr << ".\n");}
108 else if (strncmp(kstr,"<",1))
109 {_error_("KML_Overlay::Read -- Unexpected field \"" << kstr << "\".\n");}
110
111 else if (!strcmp(kstr,"<color>"))
112 KMLFileTokenParse( color ,NULL,KML_OVERLAY_COLOR_LENGTH,
113 kstr,
114 fid);
115 else if (!strcmp(kstr,"<drawOrder>"))
116 KMLFileTokenParse(&draword ,
117 kstr,
118 fid);
119
120 else if (!strncmp(kstr,"<Icon", 5)) {
121 icon =new KML_Icon();
122 icon ->Read(fid,kstr);
123 }
124
125 else if (!strncmp(kstr,"<",1))
126 KML_Feature::Read(fid,kstr);
127
128 return;
129}
130/*}}}*/
Note: See TracBrowser for help on using the repository browser.