KmlOut module

Module contents

class kml

Handles writing tracks as kml Has lots of internal structure to make the following use cases work:

std::cout << kml::header;
std::cout << kml(t);
std::cout << kml::footer;

out = ofstream;
out << kml(t);

For both of the above a default style will be used (green, width = 3) in the case of a single trajectory and a random color will be used with the same default

width = 3 for a vector of trajectories.

To control color and width:

std::cout << kml::header;
kml::write(std::cout, t, "AABBGGRR", 4)
std::cout << kml::footer;

kml::write("filname", t, "AABBGGRR", 5)

These are the limits of style control at this time.

TODO: Simplify use of multipoint and linepoint methods (requires placemark) TODO: Implement placemark manipulation TODO: Implement style manipulation

Overloaded KML Methods

These methods generate kml objects for output for a given tracjectory or point. If a file is specified, the header and footer are automatically written. If a stream is specified, the header and footer are NOT automatically written. Write can be called with either a single trajectory or a vector.

inline kml(const TrajectoryT &_t)
inline kml(const TrajectoryVectorT &_v)
inline kml(const PointerT &_p)
inline kml(const PointerVectorT &_vp)

Overloaded Write Methods

These methods output kml. If a file is specified, the header and footer are automatically written. If a stream is specified, the header and footer are NOT automatically written. Write can be called with either a single trajectory or a vector.

static void write(const std::string &_filename, const TrajectoryVectorT &_trajectories)
static void write(std::ostream &_o, const TrajectoryVectorT &_trajectories)
static void write(std::ostream &_o, const PointerVectorT &_trajectories)
static void write(const std::string &_filename, const TrajectoryT &_trajectory)
static void write(const std::string &_filename, const TrajectoryT &_trajectory, const std::string &_color, const double &_width)
static void write(std::ostream &_o, const TrajectoryT &_trajectory, const std::string &_color, const double &_width)

Public Types

using TrajectoryT = tracktable::domain::terrestrial::trajectory_type
using TrajectoryVectorT = std::vector<TrajectoryT>
using PointerT = std::shared_ptr<TrajectoryT>
using PointerVectorT = std::vector<PointerT>
using VectorT = std::vector<TrajectoryT>
using PointT = TrajectoryT::point_type

Public Static Functions

static std::string generateColorString()
static void writeStyle(std::ostream &_o, const std::string &_id, const std::string &_color, double _width)

Writes a style

Parameters:
  • _o – Where to write

  • _id – The id to use for the style, referenced by placemarks later

  • _color – ABGR hex value for color

  • _width – pixel width to use

static void writeLinestring(std::ostream &_o, const TrajectoryT &_trajectory)

Writes a placemark that renders as lines

Parameters:
  • _o – where to write

  • _trajectory – what to write

static void writeMultipoint(std::ostream &_o, const TrajectoryT &_trajectory)

Writes a placemark that renders as points

Parameters:
  • _o – where to write

  • _trajectory – what to write

static void writePoint(std::ostream &_o, const PointT &_point)

Writes a placemark that renders as a single point

Parameters:
  • _o – where to write

  • _point – what to write

static void writeLineAndPoints(std::ostream &_o, const TrajectoryT &_trajectory)

Writes a placemark that uses multigeomtry to render a line with points

Parameters:
  • _o – where to write

  • _trajectory – what to write

static void writeBox(std::ostream &_o, const box &_box)

Writes a placemark that uses multigeomtry to render a line with points

Parameters:
  • _o – where to write

  • _trajectory – what to write

static void writeCoords(std::ostream &_o, const PointT &_point)

Utility to minimize maintenance on writing points as coordinates

Parameters:
  • _o – where to write

  • _point – what to write

static void writeToSeparateKmls(const TrajectoryVectorT &_trajectories, const std::string &_output_dir)

This simplifies writing individual files for a set of trajectories The directory to write the files is specified instead of a filename

Parameters:
  • _trajectories – trajectories to write

  • _output_dir – directory to write to

static void writePlacemarkHeader(std::ostream &_o)

Writes a default Placemark header tag

Parameters:

_o – where to write

static void writePlacemarkFooter(std::ostream &_o)

Writes a default Placemark footer tag

Parameters:

_o – where to write

static void writeMultiGeometryHeader(std::ostream &_o)

Writes a default MultiGeometry header tag

Parameters:

_o – where to write

static void writeMultiGeometryFooter(std::ostream &_o)

Writes a default MultiGeometry footer tag

Parameters:

_o – where to write

Public Static Attributes

static double _width = 3
static std::string _color = "FFFFFFFF"
static std::string _name = "UNIDFENTIFIED"
static std::string _styleid = "tracktable_style"
static bool _isInsidePlacemark = false
static bool _isInsideMultiGeometry = false
static tracktable::Timestamp _start
static tracktable::Timestamp _stop
struct box

Helper struct that allows for for

out << box(corner1, corner2)

which will render a box This will be missing some header/footer neccesary for full kml rendering

Public Functions

box() = delete
inline box(const PointT &_c1, const PointT &_c2)

Public Members

PointT const *const corner1
PointT const *const corner2
struct color

Helper struct that sets the KML object’s color This will be missing some header/footer neccesary for full kml rendering

Public Functions

inline color(const std::string &_c)
inline operator std::string()
struct linepoints

Helper struct that allows for for

out << linepoints(t)

which will render as lines with points This will be missing some header/footer neccesary for full kml rendering

Public Functions

linepoints() = delete
inline linepoints(const TrajectoryT &_t)

Public Members

TrajectoryT const *const trajectory
struct linestring

Helper struct that allows for

out << linestring(t)

which will render as a line. This will be missing some header/footer information neccesary for full kml rendering.

Public Functions

linestring() = delete
inline linestring(const TrajectoryT &_t)

Public Members

TrajectoryT const *const trajectory
struct multipoint

Helper struct that allows for for

out << multipoint(t)

which will render as set of points. This will be missing some header/footer information neccesary for full kml rendering.

Public Functions

multipoint() = delete
inline multipoint(const TrajectoryT &_t)

Public Members

TrajectoryT const *const trajectory
struct name

Helper struct that sets the KML object’s name This will be missing some header/footer neccesary for full kml rendering

Public Functions

inline name(const std::string &_name)
inline operator std::string()
struct point

Helper struct that allows for for

out << point(t)

which will render as a single point This will be missing some header/footer neccesary for full kml rendering

Public Functions

point() = delete
inline point(const PointT &_t)

Public Members

PointT const *const trajectory
struct startmulti

Helper struct that sets the KML object’s starting Multigeometry This will be missing some header/footer neccesary for full kml rendering

Public Functions

inline startmulti()
struct startpm

Helper struct that sets the KML object’s starting Placemark This will be missing some header/footer neccesary for full kml rendering

Public Functions

inline startpm()
struct stopmulti

Helper struct that sets the KML object’s stopping Multigeometry This will be missing some header/footer neccesary for full kml rendering

Public Functions

inline stopmulti()
struct stoppm

Helper struct that sets the KML object’s stopping Placemark This will be missing some header/footer neccesary for full kml rendering

Public Functions

inline stoppm()
struct style

Helper struct that sets the KML object’s style This will be missing some header/footer neccesary for full kml rendering

Public Functions

inline style(const std::string &_id, const std::string &_c, const double &_w)

Public Members

const std::string &id
const std::string &color
const double width
struct style_id

Helper struct that sets the KML object’s style id This will be missing some header/footer neccesary for full kml rendering

Public Functions

inline style_id(const std::string &_id)
inline operator std::string()
struct time_span

Helper struct that allows for for

out << time_span(start, stop)

which will render a timespan between two timestamps This will be missing some header/footer neccesary for full kml rendering

Public Functions

time_span() = delete
inline time_span(const tracktable::Timestamp &_start, const tracktable::Timestamp &_stop)
struct width

Helper struct that sets the KML object’s width This will be missing some header/footer neccesary for full kml rendering

Public Functions

inline width(double _w)
inline operator double()