casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ds9writer.h
Go to the documentation of this file.
1 //# ds9writer.h: class used for writing ds9 region files
2 //# Copyright (C) 2012
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id: $
27 
28 #ifndef DISPLAY_DS9_DS9WRITER_H_
29 #define DISPLAY_DS9_DS9WRITER_H_
30 #include <stdio.h>
31 
32 namespace casa {
33 
34  class WorldCanvas;
35 
36  namespace viewer {
37 
38  class ds9writer {
39  public:
40  ds9writer( const char *output_path, const char *coord_sys );
41  virtual ~ds9writer( );
42  void setCsysSource(const char *);
43  bool open( );
44  bool rectangle( WorldCanvas *, const std::vector<std::pair<double,double> > &pts );
45  bool ellipse( WorldCanvas *, const std::vector<std::pair<double,double> > &pts );
46  bool polygon( WorldCanvas *, const std::vector<std::pair<double,double> > &pts );
47  bool polyline( WorldCanvas *, const std::vector<std::pair<double,double> > &pts );
48  bool point( WorldCanvas *, const std::vector<std::pair<double,double> > &pts );
49  private:
50  typedef std::map<std::string,std::string> str_map_type;
52 
53  struct cs {
54  typedef void (*from_linear_2_type)(WorldCanvas*wc,double,double,double&,double&);
55  typedef void (*from_linear_4_type)(WorldCanvas*wc,double,double,double,double,double&,double&,double&,double&);
56  cs( const char *ds9_type, casacore::MDirection::Types t,
57  from_linear_2_type func2, from_linear_4_type func4 ) : ds9(ds9_type), type(t), cvt2(func2), cvt4(func4) { }
58  ~cs( ) { }
59  const std::string ds9;
63  };
64  typedef std::map<std::string,cs> coord_map_type;
66  char *path;
67  char *csys;
69  bool opened;
70  FILE *fptr;
71  };
72  }
73 }
74 
75 #endif
ds9writer(const char *output_path, const char *coord_sys)
cs(const char *ds9_type, casacore::MDirection::Types t, from_linear_2_type func2, from_linear_4_type func4)
Definition: ds9writer.h:56
void setCsysSource(const char *)
from_linear_4_type cvt4
Definition: ds9writer.h:62
coord_map_type coord_systems
Definition: ds9writer.h:65
std::map< std::string, cs > coord_map_type
Definition: ds9writer.h:64
str_map_type defaults
Definition: ds9writer.h:51
bool polyline(WorldCanvas *, const std::vector< std::pair< double, double > > &pts)
std::map< std::string, std::string > str_map_type
Definition: ds9writer.h:50
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
bool ellipse(WorldCanvas *, const std::vector< std::pair< double, double > > &pts)
const std::string ds9
Definition: ds9writer.h:59
const casacore::MDirection::Types type
Definition: ds9writer.h:60
from_linear_2_type cvt2
Definition: ds9writer.h:61
void(* from_linear_4_type)(WorldCanvas *wc, double, double, double, double, double &, double &, double &, double &)
Definition: ds9writer.h:55
void(* from_linear_2_type)(WorldCanvas *wc, double, double, double &, double &)
Definition: ds9writer.h:54
bool point(WorldCanvas *, const std::vector< std::pair< double, double > > &pts)
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
bool rectangle(WorldCanvas *, const std::vector< std::pair< double, double > > &pts)
bool polygon(WorldCanvas *, const std::vector< std::pair< double, double > > &pts)