core/vpgl/xio/vpgl_xio_lvcs.cxx
Go to the documentation of this file.
00001 // This is core/vpgl/xio/vpgl_xio_lvcs.cxx
00002 #include "vpgl_xio_lvcs.h"
00003 #include <vpgl/vpgl_lvcs.h>
00004 #include <vsl/vsl_basic_xml_element.h>
00005 
00006 //=================================================================================
00007 void x_write(vcl_ostream & os, vpgl_lvcs const& v, vcl_string element_name)
00008 {
00009   vsl_basic_xml_element xml_element(element_name);
00010   xml_element.add_attribute("cs_name", v.cs_name_strings[ v.get_cs_name() ]);
00011   
00012   double lat, lon, elev; 
00013   v.get_origin(lat, lon, elev); 
00014   xml_element.add_attribute("origin_lon", lon);
00015   xml_element.add_attribute("origin_lat", lat);
00016   xml_element.add_attribute("origin_elev", elev);
00017 
00018   double lat_scale, lon_scale; 
00019   v.get_scale(lat_scale, lon_scale);
00020   xml_element.add_attribute("lon_scale", lon_scale);
00021   xml_element.add_attribute("lat_scale", lat_scale);
00022   
00023   vcl_string len_u = "meters", ang_u="degrees";
00024   if (v.local_length_unit() == v.FEET)
00025     len_u = "feet";
00026   if (v.geo_angle_unit() == v.RADIANS)
00027     ang_u= "radians";
00028   xml_element.add_attribute("local_XYZ_unit", len_u);
00029   xml_element.add_attribute("geo_angle_unit", ang_u);
00030 
00031   double lox, loy, theta; 
00032   v.get_transform(lox, loy, theta);
00033   xml_element.add_attribute("local_origin_x", lox);
00034   xml_element.add_attribute("local_origin_y", loy);
00035   xml_element.add_attribute("theta", theta);
00036   xml_element.x_write(os);
00037 }
00038