Ice Sheet System Model  4.18
Code documentation
Functions
KMLOverlayx.cpp File Reference
#include "./KMLOverlayx.h"
#include "../../shared/shared.h"
#include "../../toolkits/toolkits.h"
#include "../../kml/kmlobjects.h"

Go to the source code of this file.

Functions

void KMLOverlayx (int *ierror, double *lataxis, double *longaxis, int nimages, char **pimages, FILE *fid)
 

Function Documentation

◆ KMLOverlayx()

void KMLOverlayx ( int *  ierror,
double *  lataxis,
double *  longaxis,
int  nimages,
char **  pimages,
FILE *  fid 
)

Definition at line 9 of file KMLOverlayx.cpp.

12  {
13 
14  int i;
15  char indent[81]="";
16  KML_File* kfile=NULL;
17  KML_Document* kdoc=NULL;
18  KML_Folder* kfold=NULL;
19  KML_GroundOverlay* kgover=NULL;
20  KML_Icon* kicon=NULL;
21  KML_LatLonBox* kllbox=NULL;
22 
23  clock_t clock0,clock1;
24  time_t time0, time1;
25 
26  clock0=clock();
27  time0 =time(NULL);
28  _printf0_("\nKMLOverlayx Module -- " << ctime(&time0));
29 
30 /* construct kml file */
31 
32  kfile=new KML_File();
33  kfile->AddAttrib("xmlns","http://www.opengis.net/kml/2.2");
34 
35 /* construct kml document */
36 
37  kdoc=new KML_Document();
38  sprintf(kdoc->name ,"Ground Overlays from ISSM");
39  kdoc->open =1;
40 
41 /* construct kml folder for overlays */
42 
43  kfold=new KML_Folder();
44  sprintf(kfold->name ,"Ground Overlays");
45  kfold->open =1;
46 
47 /* construct ground overlay, icon, and lat/long box for each image */
48 
49  for (i=0; i<nimages; i++) {
50  kgover=new KML_GroundOverlay();
51  sprintf(kgover->name ,"%s",pimages[i]);
52  kgover->visibility=0;
53 
54  kicon=new KML_Icon();
55  sprintf(kicon->href ,"%s",pimages[i]);
56  kgover->icon =kicon;
57  kicon=NULL;
58 
59  kllbox=new KML_LatLonBox();
60  kllbox->north =lataxis[1];
61  kllbox->south =lataxis[0];
62  kllbox->east =longaxis[1];
63  kllbox->west =longaxis[0];
64  kllbox->rotation = 0.;
65  kgover->llbox =kllbox;
66  kllbox=NULL;
67 
68  (kfold->feature )->AddObject((Object*)kgover);
69  kgover=NULL;
70  }
71 
72 /* assemble the rest of the kml hierarchy */
73 
74  (kdoc->feature )->AddObject((Object*)kfold);
75  kfold=NULL;
76  (kfile->kmlobj )->AddObject((Object*)kdoc);
77  kdoc=NULL;
78 
79 /* write kml file */
80 
81  _printf0_("Writing kml document to file.\n");
82  fprintf(fid,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
83  kfile->Write(fid,indent);
84 
85  delete kfile;
86 
87  clock1=clock();
88  time1 =time(NULL);
89  _printf_("KMLOverlayx Module -- " << ((double)(clock1-clock0))/CLOCKS_PER_SEC << " CPU seconds; " << difftime(time1,time0) << " elapsed seconds.\n\n\n");
90 
91  return;
92 }
KML_Document
Definition: KML_Document.h:15
KML_Feature::name
char name[KML_FEATURE_NAME_LENGTH+1]
Definition: KML_Feature.h:25
_printf0_
#define _printf0_(StreamArgs)
Definition: Print.h:29
_printf_
#define _printf_(StreamArgs)
Definition: Print.h:22
KML_Container::feature
DataSet * feature
Definition: KML_Container.h:19
KML_GroundOverlay
Definition: KML_GroundOverlay.h:17
KML_LatLonBox::rotation
double rotation
Definition: KML_LatLonBox.h:22
KML_File::Write
void Write(FILE *fid, const char *indent)
Definition: KML_File.cpp:63
KML_Feature::open
bool open
Definition: KML_Feature.h:27
KML_Folder
Definition: KML_Folder.h:15
KML_GroundOverlay::llbox
KML_LatLonBox * llbox
Definition: KML_GroundOverlay.h:23
KML_Object::kmlobj
DataSet * kmlobj
Definition: KML_Object.h:19
Object
Definition: Object.h:13
KML_File
Definition: KML_File.h:16
KML_LatLonBox::west
double west
Definition: KML_LatLonBox.h:21
KML_LatLonBox
Definition: KML_LatLonBox.h:14
KML_LatLonBox::east
double east
Definition: KML_LatLonBox.h:20
KML_Object::AddAttrib
virtual void AddAttrib(const char *name, const char *value)
Definition: KML_Object.cpp:277
KML_LatLonBox::south
double south
Definition: KML_LatLonBox.h:19
KML_Feature::visibility
bool visibility
Definition: KML_Feature.h:26
KML_Icon
Definition: KML_Icon.h:20
KML_Icon::href
char href[KML_ICON_HREF_LENGTH+1]
Definition: KML_Icon.h:24
KML_LatLonBox::north
double north
Definition: KML_LatLonBox.h:18
KML_Overlay::icon
KML_Icon * icon
Definition: KML_Overlay.h:23