From GridLAB-D Wiki
kmldump - KML dump function
Synopsis
#include "gridlabd.h" EXPORT int kmldump(int (*stream)(const char *,...), OBJECT *obj);
Description
The KML dump function is used to output a KML data file for Google Earth when the --kml command option is used.
Example
- module/main.cpp
#include "gridlabd.h"
EXPORT int kmldump(int (*stream)(const char *,...), OBJECT *obj)
{
if ( gl_object_isa(obj,"class") )
return OBJECTDATA(obj,class)->kmldump(stream);
// TODO add other classes
else
return 0;
}
- module/class.h
class class : public gld_object {
// ... other declarations
int kmldump(int (*stream)(const char *,...));
};
- module/class.cpp
int class::kmldump(int (*stream)(const char*, ...))
{
if ( isnan(get_latitude()) || isnan(get_longitude()) ) return 0;
stream("<Placemark>\n");
stream(" <name>%s</name>\n", get_name());
stream(" <description>\n<![CDATA[\n");
// TODO add popup data here
stream(" ]]>\n");
stream(" </description>\n");
stream(" <Point>\n");
stream(" <coordinates>%f,%f</coordinates>\n", get_longitude(), get_latitude());
stream(" </Point>\n");
stream("</Placemark>");
}
See also
- Guide to Programming GridLAB-D
- Introduction
- Creating a module
- Creating a class
- Special Topics
- Source documentation
- Validation
- Debugging
- Code templates