Commit 06af97dff22f061b249089c20a58dd93ba1f3ab2

Authored by Thierry Louge
1 parent d7a2fc8d

VOTable evolution, schema precisions

VOTableExemple.xml
... ... @@ -3,42 +3,40 @@
3 3 <RESOURCE name="Gammalib">
4 4 <TABLE name="GammalibTable">
5 5 <DESCRIPTION>VOTable coming from gammalib</DESCRIPTION>
6   - <FIELD name="naxes" ucd="" ID="axesnbr" datatype="int" width="4" precision="1" unit="">
7   - <DESCRIPTION>Number of axes</DESCRIPTION>
8   - </FIELD>
9   - <FIELD name="naxes" ucd="" ID="axesnbr" datatype="int" width="4" precision="1" unit="">
10   - <DESCRIPTION>Longitude axis</DESCRIPTION>
11   - </FIELD>
12   - <FIELD name="naxes" ucd="" ID="axesnbr" datatype="int" width="4" precision="1" unit="">
13   - <DESCRIPTION>Latitude axis</DESCRIPTION>
14   - </FIELD>
15   - <FIELD name="naxes" ucd="" ID="axesnbr" datatype="int" width="4" precision="1" unit="">
16   - <DESCRIPTION>Spectral axis</DESCRIPTION>
17   - </FIELD>
18   - <FIELD name="ra" ucd="pos.eq.ra" ID="refra" datatype="float" width="6" precision="1" unit="">
19   - <DESCRIPTION>RA of reference coordinate</DESCRIPTION>
20   - </FIELD>
21   - <FIELD name="dec" ucd="pos.eq.dec" ID="refdec" datatype="float" width="6" precision="1" unit="">
22   - <DESCRIPTION>DEC of reference coordinate</DESCRIPTION>
23   - </FIELD>
24   - <FIELD name="pixra" ucd="pos.eq.ra" ID="pixra" datatype="float" width="6" precision="1" unit="">
25   - <DESCRIPTION>RA of reference pixel</DESCRIPTION>
26   - </FIELD>
27   - <FIELD name="pixdec" ucd="pos.eq.dec" ID="pixdec" datatype="float" width="6" precision="1" unit="">
28   - <DESCRIPTION>DEC of reference pixel</DESCRIPTION>
29   - </FIELD>
30   - <FIELD name="pixdec" ucd="pos.eq.dec" ID="pixdec" datatype="char" width="6" precision="1" unit="">
31   - <DESCRIPTION>Coordinates system</DESCRIPTION>
32   - </FIELD>
33   - <TD>2</TD>
34   - <TD>0</TD>
35   - <TD>1</TD>
36   - <TD>-1</TD>
37   - <TD>201.365</TD>
38   - <TD>-43.0191</TD>
39   - <TD>61</TD>
40   - <TD>136</TD>
41   - <TD>EQU</TD>
  6 + <AstroCoordSystem id="gammalib_wcs">
  7 + <SpaceFrame>
  8 + <Name>EQU</Name>
  9 + <SPHERICAL coord_naxes="2" />
  10 + <Position2D>
  11 + <Value>
  12 + <C1 pos_unit="deg">201.365</C1>
  13 + <C2 pos_unit="deg">-43.0191</C2>
  14 + </Value>
  15 + </Position2D>
  16 + </SpaceFrame>
  17 + </AstroCoordSystem>
  18 + <PixelSpace>
  19 + <PixelCoordSystem id="GammalibPix">
  20 + <PixelCoordFrame id="spacepix" axis1_order="1" axis2_order="2" ref_frame_id="spaceFrame">
  21 + <Cart2DRefFrame projection="STG">
  22 + <Transform unit="">
  23 + <C1>-0.03333330.0333333UNDEFINED</C1>
  24 + <C2>0.0333333UNDEFINED</C2>
  25 + </Transform>
  26 + </Cart2DRefFrame>
  27 + <ReferencePixel>
  28 + <Pixel2D>
  29 + <Name1>Xposition</Name1>
  30 + <Name2>Yposition</Name2>
  31 + <Value>
  32 + <C1>61</C1>
  33 + <C2>136</C2>
  34 + </Value>
  35 + </Pixel2D>
  36 + </ReferencePixel>
  37 + </PixelCoordFrame>
  38 + </PixelCoordSystem>
  39 + </PixelSpace>
42 40 </TABLE>
43 41 </RESOURCE>
44 42 </VOTABLE>
... ...
include/GVOTable.hpp
... ... @@ -37,7 +37,7 @@
37 37 #include "GXml.hpp"
38 38 #include "GXmlNode.hpp"
39 39 #include "GSkymap.hpp"
40   -
  40 +#include "GWcs.hpp"
41 41 /***********************************************************************//**
42 42 * @class GVOTable
43 43 *
... ... @@ -73,6 +73,10 @@ public:
73 73 void init_tabledata(void);
74 74 void close_tabledata(void);
75 75 void make_skymap_votable(const GSkymap& skymap);
  76 + void setup_world_coordinates(const GWcs* wcs);
  77 + void setup_pixel_coordinates(const GWcs* wcs);
  78 +
  79 + // Members
76 80 GXml* m_tablexml; //!< GXml object containing the VOTable
77 81  
78 82 protected:
... ... @@ -84,6 +88,8 @@ protected:
84 88 private:
85 89 //Protected members
86 90 std::string m_header; //!< header of the VOTable
  91 + std::string m_wcs; //!< representation of wcs in the VOTable
  92 + std::string m_pixels; //!< pixel system and values in the VOTable
87 93 std::string m_fields; //!< <FIELD> of the VOTable
88 94 std::string m_data; //!< data part of VOTable
89 95 std::string m_footer; //!< footer of the VOTable
... ...
src/sky/GWcs.cpp
... ... @@ -864,7 +864,7 @@ std::string GWcs::tell_wcs_info(int information) const
864 864 case 3:
865 865 result.append(gammalib::str(m_spec));
866 866 break;
867   - //RA Ref coordinate
  867 + //RA Ref pixel
868 868 case 4:
869 869 for (int i = 0; i < m_crval.size(); ++i) {
870 870 if (i <= 0) {
... ... @@ -872,7 +872,7 @@ std::string GWcs::tell_wcs_info(int information) const
872 872 }
873 873 }
874 874 break;
875   - //DEC Ref coordinate
  875 + //DEC Ref pixel
876 876 case 5:
877 877 for (int i = 0; i < m_crval.size(); ++i) {
878 878 if (i > 0) {
... ... @@ -880,7 +880,7 @@ std::string GWcs::tell_wcs_info(int information) const
880 880 }
881 881 }
882 882 break;
883   - //RA of Ref pixel
  883 + //x of Ref pixel
884 884 case 6:
885 885 for (int i = 0; i < m_crpix.size(); ++i) {
886 886 if (i <= 0) {
... ... @@ -888,7 +888,7 @@ std::string GWcs::tell_wcs_info(int information) const
888 888 }
889 889 }
890 890 break;
891   - //DEC of Ref pixel
  891 + //y of Ref pixel
892 892 case 7:
893 893 for (int i = 0; i < m_crpix.size(); ++i) {
894 894 if (i > 0) {
... ... @@ -900,138 +900,28 @@ std::string GWcs::tell_wcs_info(int information) const
900 900 case 8:
901 901 result.append(coordsys());
902 902 break;
  903 + //Projection code
  904 + case 9:
  905 + result.append(code());
  906 + break;
  907 + //Projection name
  908 + case 10:
  909 + result.append(name());
  910 + break;
  911 + //Units of coordinate increment and value
  912 + case 11:
  913 + result.append(gammalib::strip_whitespace(m_cunit[0]));
  914 + break;
  915 + //Pixel increment value in x
  916 + case 12:
  917 + result.append(gammalib::str(m_cdelt.at(0)));
  918 + //Pixel increment value in y
  919 + case 13:
  920 + result.append(gammalib::str(m_cdelt[1]));
903 921 //Didn't recognize case. Should not be encountered.
904 922 default:
905 923 result.append("UNDEFINED");
906 924 break;
907   - }
908   - /*
909   - result.append("\n"+gammalib::parformat("Increment at reference")+"(");
910   - for (int i = 0; i < m_cdelt.size(); ++i) {
911   - if (i > 0) {
912   - result.append(", ");
913   - }
914   - result.append(gammalib::str(m_cdelt[i]));
915   - if (m_cunit[i].length() > 0) {
916   - result.append(" "+m_cunit[i]);
917   - }
918   - }
919   - result.append(")");
920   -
921   - // Append origin
922   - result.append("\n"+gammalib::parformat("(Phi_0, Theta_0)")+"(");
923   - result.append(wcs_print_value(m_phi0)+", ");
924   - result.append(wcs_print_value(m_theta0)+") deg");
925   -
926   - // Append native pole
927   - result.append("\n"+gammalib::parformat("(Phi_p, Theta_p)")+"(");
928   - result.append(wcs_print_value(m_lonpole)+", ");
929   - result.append(wcs_print_value(m_latpole)+") deg");
930   -
931   - // Append LATPOLEa keyword usage
932   - result.append("\n"+gammalib::parformat("LATPOLE keyword usage"));
933   - switch (m_latpreq) {
934   - case 0:
935   - result.append("Not used. Theta_p determined uniquely by"
936   - " CRVALia and LONPOLEa keywords.");
937   - break;
938   - case 1:
939   - result.append("Required to select between two valid solutions"
940   - " of Theta_p.");
941   - break;
942   - case 2:
943   - result.append("Theta_p was specified solely by LATPOLE.");
944   - break;
945   - default:
946   - result.append("UNDEFINED");
947   - break;
948   - }
949   -
950   - // Append celestial transformation parameters
951   - result.append("\n"+gammalib::parformat("Reference vector (m_ref)")+"(");
952   - for (int k = 0; k < 4; ++k) {
953   - if (k > 0) {
954   - result.append(", ");
955   - }
956   - result.append(wcs_print_value(m_ref[k]));
957   - }
958   - result.append(") deg");
959   -
960   - // Append Euler angles
961   - result.append("\n"+gammalib::parformat("Euler angles")+"(");
962   - for (int k = 0; k < 5; ++k) {
963   - if (k > 0) {
964   - result.append(", ");
965   - }
966   - result.append(gammalib::str(m_euler[k]));
967   - if (k < 3) {
968   - result.append(" deg");
969   - }
970   - }
971   - result.append(")");
972   -
973   - // Append latitude preservement flag
974   - if (m_isolat) {
975   - result.append("\n"+gammalib::parformat("Latitude preserved")+"True");
976   - }
977   - else {
978   - result.append("\n"+gammalib::parformat("Latitude preserved")+"False");
979   - }
980   -
981   - // Append linear transformation parameters
982   - if (m_unity) {
983   - result.append("\n"+gammalib::parformat("Unity PC matrix")+"True");
984   - }
985   - else {
986   - result.append("\n"+gammalib::parformat("Unity PC matrix")+"False");
987   - }
988   - result.append("\n"+gammalib::parformat("Pixel-to-image trafo")+"(");
989   - for (int k = 0; k < m_piximg.size(); ++k) {
990   - if (k > 0) {
991   - result.append(", ");
992   - }
993   - result.append(gammalib::str(m_piximg[k]));
994   - }
995   - result.append(")");
996   - result.append("\n"+gammalib::parformat("Image-to-pixel trafo")+"(");
997   - for (int k = 0; k < m_imgpix.size(); ++k) {
998   - if (k > 0) {
999   - result.append(", ");
1000   - }
1001   - result.append(gammalib::str(m_imgpix[k]));
1002   - }
1003   - result.append(")");
1004   -
1005   - // Append projection parameters
1006   - result.append("\n"+gammalib::parformat("Projection code")+code());
1007   - result.append("\n"+gammalib::parformat("Projection name")+name());
1008   - result.append("\n"+gammalib::parformat("Radius of the gen. sphere"));
1009   - result.append(gammalib::str(m_r0)+" deg");
1010   -
1011   - // Append boundary checking information
1012   - result.append("\n"+gammalib::parformat("Strict bounds checking"));
1013   - if (m_bounds) {
1014   - result.append("True");
1015   - }
1016   - else {
1017   - result.append("False");
1018   - }
1019   -
1020   - // Append fiducial offset information
1021   - result.append("\n"+gammalib::parformat("Use fiducial offset"));
1022   - if (m_offset) {
1023   - result.append("True");
1024   - }
1025   - else {
1026   - result.append("False");
1027   - }
1028   - result.append("\n"+gammalib::parformat("Fiducial offset"));
1029   - result.append("("+gammalib::str(m_x0)+", "+gammalib::str(m_y0)+")");
1030   -
1031   - // Append spectral transformation parameters
1032   - result.append("\n"+gammalib::parformat("Rest frequency")+wcs_print_value(m_restfrq));
1033   - result.append("\n"+gammalib::parformat("Rest wavelength")+wcs_print_value(m_restwav));
1034   - */
1035 925 // Return
1036 926 return result;
1037 927 }
... ...
src/sky/GWcs.cpp~
... ... @@ -864,7 +864,7 @@ std::string GWcs::tell_wcs_info(int information) const
864 864 case 3:
865 865 result.append(gammalib::str(m_spec));
866 866 break;
867   - //RA Ref coordinate
  867 + //RA Ref pixel
868 868 case 4:
869 869 for (int i = 0; i < m_crval.size(); ++i) {
870 870 if (i <= 0) {
... ... @@ -872,7 +872,7 @@ std::string GWcs::tell_wcs_info(int information) const
872 872 }
873 873 }
874 874 break;
875   - //DEC Ref coordinate
  875 + //DEC Ref pixel
876 876 case 5:
877 877 for (int i = 0; i < m_crval.size(); ++i) {
878 878 if (i > 0) {
... ... @@ -880,7 +880,7 @@ std::string GWcs::tell_wcs_info(int information) const
880 880 }
881 881 }
882 882 break;
883   - //RA of Ref pixel
  883 + //x of Ref pixel
884 884 case 6:
885 885 for (int i = 0; i < m_crpix.size(); ++i) {
886 886 if (i <= 0) {
... ... @@ -888,7 +888,7 @@ std::string GWcs::tell_wcs_info(int information) const
888 888 }
889 889 }
890 890 break;
891   - //DEC of Ref pixel
  891 + //y of Ref pixel
892 892 case 7:
893 893 for (int i = 0; i < m_crpix.size(); ++i) {
894 894 if (i > 0) {
... ... @@ -900,137 +900,28 @@ std::string GWcs::tell_wcs_info(int information) const
900 900 case 8:
901 901 result.append(coordsys());
902 902 break;
  903 + //Projection code
  904 + case 9:
  905 + result.append(code());
  906 + break;
  907 + //Projection name
  908 + case 10:
  909 + result.append(name());
  910 + break;
  911 + //Units of coordinate increment and value
  912 + case 11:
  913 + result.append(gammalib::strip_whitespace(m_cunit[0]));
  914 + break;
  915 + //Pixel increment value in x
  916 + case 12:
  917 + result.append(gammalib::str(m_cdelt.at(0)));
  918 + //Pixel increment value in y
  919 + case 13:
  920 + result.append(gammalib::str(m_cdelt[1]));
  921 + //Didn't recognize case. Should not be encountered.
903 922 default:
904 923 result.append("UNDEFINED");
905 924 break;
906   - }
907   - /*
908   - result.append("\n"+gammalib::parformat("Increment at reference")+"(");
909   - for (int i = 0; i < m_cdelt.size(); ++i) {
910   - if (i > 0) {
911   - result.append(", ");
912   - }
913   - result.append(gammalib::str(m_cdelt[i]));
914   - if (m_cunit[i].length() > 0) {
915   - result.append(" "+m_cunit[i]);
916   - }
917   - }
918   - result.append(")");
919   -
920   - // Append origin
921   - result.append("\n"+gammalib::parformat("(Phi_0, Theta_0)")+"(");
922   - result.append(wcs_print_value(m_phi0)+", ");
923   - result.append(wcs_print_value(m_theta0)+") deg");
924   -
925   - // Append native pole
926   - result.append("\n"+gammalib::parformat("(Phi_p, Theta_p)")+"(");
927   - result.append(wcs_print_value(m_lonpole)+", ");
928   - result.append(wcs_print_value(m_latpole)+") deg");
929   -
930   - // Append LATPOLEa keyword usage
931   - result.append("\n"+gammalib::parformat("LATPOLE keyword usage"));
932   - switch (m_latpreq) {
933   - case 0:
934   - result.append("Not used. Theta_p determined uniquely by"
935   - " CRVALia and LONPOLEa keywords.");
936   - break;
937   - case 1:
938   - result.append("Required to select between two valid solutions"
939   - " of Theta_p.");
940   - break;
941   - case 2:
942   - result.append("Theta_p was specified solely by LATPOLE.");
943   - break;
944   - default:
945   - result.append("UNDEFINED");
946   - break;
947   - }
948   -
949   - // Append celestial transformation parameters
950   - result.append("\n"+gammalib::parformat("Reference vector (m_ref)")+"(");
951   - for (int k = 0; k < 4; ++k) {
952   - if (k > 0) {
953   - result.append(", ");
954   - }
955   - result.append(wcs_print_value(m_ref[k]));
956   - }
957   - result.append(") deg");
958   -
959   - // Append Euler angles
960   - result.append("\n"+gammalib::parformat("Euler angles")+"(");
961   - for (int k = 0; k < 5; ++k) {
962   - if (k > 0) {
963   - result.append(", ");
964   - }
965   - result.append(gammalib::str(m_euler[k]));
966   - if (k < 3) {
967   - result.append(" deg");
968   - }
969   - }
970   - result.append(")");
971   -
972   - // Append latitude preservement flag
973   - if (m_isolat) {
974   - result.append("\n"+gammalib::parformat("Latitude preserved")+"True");
975   - }
976   - else {
977   - result.append("\n"+gammalib::parformat("Latitude preserved")+"False");
978   - }
979   -
980   - // Append linear transformation parameters
981   - if (m_unity) {
982   - result.append("\n"+gammalib::parformat("Unity PC matrix")+"True");
983   - }
984   - else {
985   - result.append("\n"+gammalib::parformat("Unity PC matrix")+"False");
986   - }
987   - result.append("\n"+gammalib::parformat("Pixel-to-image trafo")+"(");
988   - for (int k = 0; k < m_piximg.size(); ++k) {
989   - if (k > 0) {
990   - result.append(", ");
991   - }
992   - result.append(gammalib::str(m_piximg[k]));
993   - }
994   - result.append(")");
995   - result.append("\n"+gammalib::parformat("Image-to-pixel trafo")+"(");
996   - for (int k = 0; k < m_imgpix.size(); ++k) {
997   - if (k > 0) {
998   - result.append(", ");
999   - }
1000   - result.append(gammalib::str(m_imgpix[k]));
1001   - }
1002   - result.append(")");
1003   -
1004   - // Append projection parameters
1005   - result.append("\n"+gammalib::parformat("Projection code")+code());
1006   - result.append("\n"+gammalib::parformat("Projection name")+name());
1007   - result.append("\n"+gammalib::parformat("Radius of the gen. sphere"));
1008   - result.append(gammalib::str(m_r0)+" deg");
1009   -
1010   - // Append boundary checking information
1011   - result.append("\n"+gammalib::parformat("Strict bounds checking"));
1012   - if (m_bounds) {
1013   - result.append("True");
1014   - }
1015   - else {
1016   - result.append("False");
1017   - }
1018   -
1019   - // Append fiducial offset information
1020   - result.append("\n"+gammalib::parformat("Use fiducial offset"));
1021   - if (m_offset) {
1022   - result.append("True");
1023   - }
1024   - else {
1025   - result.append("False");
1026   - }
1027   - result.append("\n"+gammalib::parformat("Fiducial offset"));
1028   - result.append("("+gammalib::str(m_x0)+", "+gammalib::str(m_y0)+")");
1029   -
1030   - // Append spectral transformation parameters
1031   - result.append("\n"+gammalib::parformat("Rest frequency")+wcs_print_value(m_restfrq));
1032   - result.append("\n"+gammalib::parformat("Rest wavelength")+wcs_print_value(m_restwav));
1033   - */
1034 925 // Return
1035 926 return result;
1036 927 }
... ...
src/vo/GVOTable.cpp
... ... @@ -241,7 +241,7 @@ void GVOTable::close_votable(void)
241 241 m_footer.append("\t</RESOURCE>\n");
242 242 m_footer.append("</VOTABLE>\n");
243 243  
244   - std::string table = m_header + m_fields + m_data + m_footer;
  244 + std::string table = m_header + m_wcs + m_pixels + m_fields + m_data + m_footer;
245 245 m_tablexml = new GXml(table);
246 246 m_tablexml->save("VOTableExemple.xml");
247 247 // Return
... ... @@ -362,6 +362,8 @@ void GVOTable::init_members(void)
362 362 m_fields = "";
363 363 m_data = "";
364 364 m_footer = "";
  365 + m_pixels = "";
  366 + m_wcs = "";
365 367 // Return
366 368 return;
367 369 }
... ... @@ -392,6 +394,82 @@ void GVOTable::free_members(void)
392 394 }
393 395  
394 396 /***********************************************************************//**
  397 + * @brief Sets the world coordinates system in VOTable format
  398 + *
  399 + * Space-Time Coordinate Metadata for the Virtual Observatory Version 1.33
  400 + * IVOA Recommendation 30 October 2007
  401 + * http://www.ivoa.net/documents/REC/DM/STC-20071030.html
  402 + *
  403 + * @param[in]
  404 + *
  405 + * @exception GException::
  406 + *
  407 + ***************************************************************************/
  408 +void GVOTable::setup_world_coordinates(const GWcs* wcs)
  409 +{
  410 + m_wcs.append("<AstroCoordSystem id=\"gammalib_wcs\">\n");
  411 + m_wcs.append("<SpaceFrame>\n\t<Name>"+wcs->tell_wcs_info(8)+"</Name>\n\t<SPHERICAL coord_naxes=\""+wcs->tell_wcs_info(0)+"\"/>\n");
  412 + m_wcs.append("\t<Position2D>\n\t\t<Value>\n");
  413 + m_wcs.append("\t\t\t<C1 pos_unit=\"deg\">"+wcs->tell_wcs_info(4)+"</C1>\n");
  414 + m_wcs.append("\t\t\t<C2 pos_unit=\"deg\">"+wcs->tell_wcs_info(5)+"</C2>\n");
  415 + m_wcs.append("\t\t</Value>\n\t</Position2D></SpaceFrame>");
  416 + m_wcs.append("</AstroCoordSystem>\n");
  417 + // Return
  418 + return;
  419 +}
  420 +
  421 +/***********************************************************************//**
  422 + * @brief Sets the pixel coordinates definition in VOTable format
  423 + *
  424 + * Space-Time Coordinate Metadata for the Virtual Observatory Version 1.33
  425 + * IVOA Recommendation 30 October 2007
  426 + * http://www.ivoa.net/documents/REC/DM/STC-20071030.html
  427 + *
  428 + * @param[in]
  429 + *
  430 + * @exception GException::
  431 + *
  432 + ***************************************************************************/
  433 +void GVOTable::setup_pixel_coordinates(const GWcs* wcs)
  434 +{
  435 + m_pixels.append("<PixelSpace>\n");
  436 + m_pixels.append("<PixelCoordSystem id=\"GammalibPix\">\n");
  437 + m_pixels.append("<PixelCoordFrame id=\"spacepix\" axis1_order=\"1\" axis2_order=\"2\" ref_frame_id=\"spaceFrame\">\n");
  438 + m_pixels.append(" <Cart2DRefFrame projection=\""+wcs->tell_wcs_info(9)+"\">\n");
  439 + m_pixels.append(" <Transform unit=\""+wcs->tell_wcs_info(11)+"\">\n");
  440 + m_pixels.append(" <C1>"+wcs->tell_wcs_info(12)+"</C1>\n");
  441 + m_pixels.append(" <C2>"+wcs->tell_wcs_info(13)+"</C2>\n");
  442 + m_pixels.append(" </Transform>\n");
  443 + m_pixels.append(" </Cart2DRefFrame>\n");
  444 + m_pixels.append(" <ReferencePixel>\n");
  445 + m_pixels.append(" <Pixel2D>\n");
  446 + m_pixels.append(" <Name1>Xposition</Name1>\n");
  447 + m_pixels.append(" <Name2>Yposition</Name2>\n");
  448 + m_pixels.append(" <Value>\n");
  449 + m_pixels.append(" <C1>"+wcs->tell_wcs_info(6)+"</C1>\n");
  450 + m_pixels.append(" <C2>"+wcs->tell_wcs_info(7)+"</C2>\n");
  451 + m_pixels.append(" </Value>\n");
  452 + m_pixels.append(" </Pixel2D>\n");
  453 + m_pixels.append(" </ReferencePixel>\n");
  454 + m_pixels.append(" </PixelCoordFrame>\n");
  455 + m_pixels.append(" </PixelCoordSystem>\n");
  456 + /*m_pixels.append(" <PixelCoordArea coord_system_id=\"GammalibPix\" id=\"GammalibPixImage\">\n");
  457 + m_pixels.append(" <PixelCoord2VecInterval frame_id=\"spacepix\">\n");
  458 + m_pixels.append(" <LoLimit2Vec>\n");
  459 + m_pixels.append(" <C1>1</C1>\n");
  460 + m_pixels.append(" <C2>1</C2>\n");
  461 + m_pixels.append("</LoLimit2Vec>\n");
  462 + m_pixels.append(" <HiLimit2Vec>\n");
  463 + m_pixels.append(" <C1>1024</C1>\n");
  464 + m_pixels.append(" <C2>1024</C2>\n");
  465 + m_pixels.append(" </HiLimit2Vec>\n");
  466 + m_pixels.append("</PixelCoord2VecInterval>\n");
  467 + m_pixels.append(" </PixelCoordArea>\n");*/
  468 + m_pixels.append("</PixelSpace>\n");
  469 + // Return
  470 + return;
  471 +}
  472 +/***********************************************************************//**
395 473 * @brief makes GVOTable object and fills ot with current skymap(s)
396 474 *
397 475 * Space-Time Coordinate Metadata for the Virtual Observatory Version 1.33
... ... @@ -409,34 +487,8 @@ void GVOTable::make_skymap_votable(const GSkymap&amp; skymap)
409 487  
410 488 const GWcs* wcs = dynamic_cast<const GWcs*>(proj);
411 489 if (wcs != NULL) {
412   - //Number of axes
413   - fill_tabledata(wcs->tell_wcs_info(0));
414   - fill_fields("naxes","","axesnbr","int","4","1","","Number of axes");
415   - //Longitude axis
416   - fill_tabledata(wcs->tell_wcs_info(1));
417   - fill_fields("naxes","","axesnbr","int","4","1","","Longitude axis");
418   - //Latitude axis
419   - fill_tabledata(wcs->tell_wcs_info(2));
420   - fill_fields("naxes","","axesnbr","int","4","1","","Latitude axis");
421   - //Spectral axis
422   - fill_tabledata(wcs->tell_wcs_info(3));
423   - fill_fields("naxes","","axesnbr","int","4","1","","Spectral axis");
424   - //RA of reference coordinate
425   - fill_tabledata(wcs->tell_wcs_info(4));
426   - fill_fields("ra","pos.eq.ra","refra","float","6","1","","RA of reference coordinate");
427   - //DEC of reference coordinate
428   - fill_tabledata(wcs->tell_wcs_info(5));
429   - fill_fields("dec","pos.eq.dec","refdec","float","6","1","","DEC of reference coordinate");
430   - //RA of reference pixel
431   - fill_tabledata(wcs->tell_wcs_info(6));
432   - fill_fields("pixra","pos.eq.ra","pixra","float","6","1","","RA of reference pixel");
433   - //DEC of reference pixel
434   - fill_tabledata(wcs->tell_wcs_info(7));
435   - fill_fields("pixdec","pos.eq.dec","pixdec","float","6","1","","DEC of reference pixel");
436   - //System of coordinates
437   - fill_tabledata(wcs->tell_wcs_info(8));
438   - fill_fields("pixdec","pos.eq.dec","pixdec","char","6","1","","Coordinates system");
439   -
  490 + setup_world_coordinates(wcs);
  491 + setup_pixel_coordinates(wcs);
440 492 }
441 493 // Return
442 494 return;
... ...
src/vo/GVOTable.cpp~
... ... @@ -241,7 +241,7 @@ void GVOTable::close_votable(void)
241 241 m_footer.append("\t</RESOURCE>\n");
242 242 m_footer.append("</VOTABLE>\n");
243 243  
244   - std::string table = m_header + m_fields + m_data + m_footer;
  244 + std::string table = m_header + m_wcs + m_pixels + m_fields + m_data + m_footer;
245 245 m_tablexml = new GXml(table);
246 246 m_tablexml->save("VOTableExemple.xml");
247 247 // Return
... ... @@ -362,6 +362,8 @@ void GVOTable::init_members(void)
362 362 m_fields = "";
363 363 m_data = "";
364 364 m_footer = "";
  365 + m_pixels = "";
  366 + m_wcs = "";
365 367 // Return
366 368 return;
367 369 }
... ... @@ -392,6 +394,82 @@ void GVOTable::free_members(void)
392 394 }
393 395  
394 396 /***********************************************************************//**
  397 + * @brief Sets the world coordinates system in VOTable format
  398 + *
  399 + * Space-Time Coordinate Metadata for the Virtual Observatory Version 1.33
  400 + * IVOA Recommendation 30 October 2007
  401 + * http://www.ivoa.net/documents/REC/DM/STC-20071030.html
  402 + *
  403 + * @param[in]
  404 + *
  405 + * @exception GException::
  406 + *
  407 + ***************************************************************************/
  408 +void GVOTable::setup_world_coordinates(const GWcs* wcs)
  409 +{
  410 + m_wcs.append("<AstroCoordSystem id=\"gammalib_wcs\">\n");
  411 + m_wcs.append("<SpaceFrame>\n\t<Name>"+wcs->tell_wcs_info(8)+"</Name>\n\t<SPHERICAL coord_naxes=\""+wcs->tell_wcs_info(0)+"\"/>\n");
  412 + m_wcs.append("\t<Position2D>\n\t\t<Value>\n");
  413 + m_wcs.append("\t\t\t<C1 pos_unit=\"deg\">"+wcs->tell_wcs_info(4)+"</C1>\n");
  414 + m_wcs.append("\t\t\t<C2 pos_unit=\"deg\">"+wcs->tell_wcs_info(5)+"</C2>\n");
  415 + m_wcs.append("\t\t</Value>\n\t</Position2D></SpaceFrame>");
  416 + m_wcs.append("</AstroCoordSystem>\n");
  417 + // Return
  418 + return;
  419 +}
  420 +
  421 +/***********************************************************************//**
  422 + * @brief Sets the pixel coordinates definition in VOTable format
  423 + *
  424 + * Space-Time Coordinate Metadata for the Virtual Observatory Version 1.33
  425 + * IVOA Recommendation 30 October 2007
  426 + * http://www.ivoa.net/documents/REC/DM/STC-20071030.html
  427 + *
  428 + * @param[in]
  429 + *
  430 + * @exception GException::
  431 + *
  432 + ***************************************************************************/
  433 +void GVOTable::setup_pixel_coordinates(const GWcs* wcs)
  434 +{
  435 + m_pixels.append("<PixelSpace>\n");
  436 + m_pixels.append("<PixelCoordSystem id=\"GammalibPix\">\n");
  437 + m_pixels.append("<PixelCoordFrame id=\"spacepix\" axis1_order=\"1\" axis2_order=\"2\" ref_frame_id=\"spaceFrame\">\n");
  438 + m_pixels.append(" <Cart2DRefFrame projection=\""+wcs->tell_wcs_info(9)+"\">\n");
  439 + m_pixels.append(" <Transform unit=\""+wcs->tell_wcs_info(11)+"\">\n");
  440 + m_pixels.append(" <C1>"+wcs->tell_wcs_info(12)+"</C1>\n");
  441 + m_pixels.append(" <C2>0.0001</C2>\n");
  442 + m_pixels.append(" </Transform>\n");
  443 + m_pixels.append(" </Cart2DRefFrame>\n");
  444 + m_pixels.append(" <ReferencePixel>\n");
  445 + m_pixels.append(" <Pixel2D>\n");
  446 + m_pixels.append(" <Name1>Xposition</Name1>\n");
  447 + m_pixels.append(" <Name2>Yposition</Name2>\n");
  448 + m_pixels.append(" <Value>\n");
  449 + m_pixels.append(" <C1>"+wcs->tell_wcs_info(6)+"</C1>\n");
  450 + m_pixels.append(" <C2>"+wcs->tell_wcs_info(7)+"</C2>\n");
  451 + m_pixels.append(" </Value>\n");
  452 + m_pixels.append(" </Pixel2D>\n");
  453 + m_pixels.append(" </ReferencePixel>\n");
  454 + m_pixels.append(" </PixelCoordFrame>\n");
  455 + m_pixels.append(" </PixelCoordSystem>\n");
  456 + /*m_pixels.append(" <PixelCoordArea coord_system_id=\"GammalibPix\" id=\"GammalibPixImage\">\n");
  457 + m_pixels.append(" <PixelCoord2VecInterval frame_id=\"spacepix\">\n");
  458 + m_pixels.append(" <LoLimit2Vec>\n");
  459 + m_pixels.append(" <C1>1</C1>\n");
  460 + m_pixels.append(" <C2>1</C2>\n");
  461 + m_pixels.append("</LoLimit2Vec>\n");
  462 + m_pixels.append(" <HiLimit2Vec>\n");
  463 + m_pixels.append(" <C1>1024</C1>\n");
  464 + m_pixels.append(" <C2>1024</C2>\n");
  465 + m_pixels.append(" </HiLimit2Vec>\n");
  466 + m_pixels.append("</PixelCoord2VecInterval>\n");
  467 + m_pixels.append(" </PixelCoordArea>\n");*/
  468 + m_pixels.append("</PixelSpace>\n");
  469 + // Return
  470 + return;
  471 +}
  472 +/***********************************************************************//**
395 473 * @brief makes GVOTable object and fills ot with current skymap(s)
396 474 *
397 475 * Space-Time Coordinate Metadata for the Virtual Observatory Version 1.33
... ... @@ -409,34 +487,8 @@ void GVOTable::make_skymap_votable(const GSkymap&amp; skymap)
409 487  
410 488 const GWcs* wcs = dynamic_cast<const GWcs*>(proj);
411 489 if (wcs != NULL) {
412   - //Number of axes
413   - fill_tabledata(wcs->tell_wcs_info(0));
414   - fill_fields("naxes","","axesnbr","int","4","1","","Number of axes");
415   - //Longitude axis
416   - fill_tabledata(wcs->tell_wcs_info(1));
417   - fill_fields("naxes","","axesnbr","int","4","1","","Longitude axis");
418   - //Latitude axis
419   - fill_tabledata(wcs->tell_wcs_info(2));
420   - fill_fields("naxes","","axesnbr","int","4","1","","Latitude axis");
421   - //Spectral axis
422   - fill_tabledata(wcs->tell_wcs_info(3));
423   - fill_fields("naxes","","axesnbr","int","4","1","","Spectral axis");
424   - //RA of reference coordinate
425   - fill_tabledata(wcs->tell_wcs_info(4));
426   - fill_fields("ra","pos.eq.ra","refra","float","6","1","","RA of reference coordinate");
427   - //DEC of reference coordinate
428   - fill_tabledata(wcs->tell_wcs_info(5));
429   - fill_fields("dec","pos.eq.dec","refdec","float","6","1","","DEC of reference coordinate");
430   - //RA of reference pixel
431   - fill_tabledata(wcs->tell_wcs_info(6));
432   - fill_fields("pixra","pos.eq.ra","pixra","float","6","1","","RA of reference pixel");
433   - //DEC of reference pixel
434   - fill_tabledata(wcs->tell_wcs_info(7));
435   - fill_fields("pixdec","pos.eq.dec","pixdec","float","6","1","","DEC of reference pixel");
436   - //System of coordinates
437   - fill_tabledata(wcs->tell_wcs_info(8));
438   - fill_fields("pixdec","pos.eq.dec","pixdec","char","6","1","","Coordinates system");
439   -
  490 + setup_world_coordinates(wcs);
  491 + setup_pixel_coordinates(wcs);
440 492 }
441 493 // Return
442 494 return;
... ...