vpgl_xio_lvcs.cxx
Go to the documentation of this file.
1 // This is core/vpgl/xio/vpgl_xio_lvcs.cxx
2 #include "vpgl_xio_lvcs.h"
3 #include <vpgl/vpgl_lvcs.h>
5 
6 #include <utility>
7 
8 //=================================================================================
9 void x_write(std::ostream & os, vpgl_lvcs const& v, std::string element_name)
10 {
11  vsl_basic_xml_element xml_element(std::move(element_name));
12  xml_element.add_attribute("cs_name", v.cs_name_strings[ v.get_cs_name() ]);
13 
14  double lat, lon, elev;
15  v.get_origin(lat, lon, elev);
16  xml_element.add_attribute("origin_lon", lon);
17  xml_element.add_attribute("origin_lat", lat);
18  xml_element.add_attribute("origin_elev", elev);
19 
20  double lat_scale, lon_scale;
21  v.get_scale(lat_scale, lon_scale);
22  xml_element.add_attribute("lon_scale", lon_scale);
23  xml_element.add_attribute("lat_scale", lat_scale);
24 
25  std::string len_u = "meters", ang_u="degrees";
26  if (v.local_length_unit() == v.FEET)
27  len_u = "feet";
28  if (v.geo_angle_unit() == v.RADIANS)
29  ang_u= "radians";
30  xml_element.add_attribute("local_XYZ_unit", len_u);
31  xml_element.add_attribute("geo_angle_unit", ang_u);
32 
33  double lox, loy, theta;
34  v.get_transform(lox, loy, theta);
35  xml_element.add_attribute("local_origin_x", lox);
36  xml_element.add_attribute("local_origin_y", loy);
37  xml_element.add_attribute("theta", theta);
38  xml_element.x_write(os);
39 }
XML write a vpgl_lvcs Two functions which write a valid XML fragment to an ostream.
A geographic coordinate system.
void add_attribute(std::string attr_name, std::string value)
#define v
void x_write(std::ostream &ostr)
void x_write(std::ostream &os, vpgl_lvcs const &v, std::string element_name="vpgl_lvcs")
XML save vpgl_lvcs to stream.