casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Namespaces | Functions | Variables
DS9FileWriter.qo.h File Reference

Go to the source code of this file.

Classes

class  casa::DS9FileWriter
 Implementation of RegionFileWriter for writing to DS9 files. More...
class  QtDS9RFWOptions
 Widget used for entering options specific to the DS9 format. More...

Namespaces

namespace  casa
 this file contains all the compiler specific defines

Functions

static DS9::CoordinateSystem coordinateSystem (const String &system)
 Converts a coordinate system constant (as used in DS9RFWOptions) into its DS9::CoordinateSystem equivalent.
static bool isValidDS9System (MDirection::Types worldSys)
 Returns true if the given CASA world system is supported by DS9.
 DS9FileWriter ()
 Constructor.
 ~DS9FileWriter ()
 Destructor.
QWidget * optionsWidget () const
 Implements RegionFileWriter::optionsWidget.
void setOptions (const QWidget *widget)
 Implements RegionFileWriter::setOptions.
bool write (const vector< RegionShape * > &shapes) const
 Implements RegionFileWriter::write.
bool writeHeader (QTextStream &) const
bool writeFooter (QTextStream &) const
bool write (QTextStream &, AnnRegion *) const
void resetOptions () const
 Rests custom options to defaults.
bool writeHeader (QTextStream &file, stringstream &errors) const
 Writes header comments to the file.
bool writeGlobals (QTextStream &file, stringstream &errors) const
 Writes globals (default DS9Region properties) and, if applicable, the overriding coordinate system.
bool writeShape (QTextStream &file, stringstream &errors, const RegionShape *shape, bool isComposite=false) const
 Writes a single shape to the file.
static vector< StringglobalProperties ()
 Returns list of all properties to be used in the globals.
static bool regionType (const RegionShape *shape, DS9::RegionType &type, stringstream &errors)
 Finds the DS9 region type for the given shape.
static bool regionType (const AnnRegion *shape, DS9::RegionType &type, stringstream &errors)
static vector< RSMarker * > convertMarker (const RSMarker *marker, bool &conversionWasNeeded)
 Converts the given RSMarker into one or more DS9-friendly RSMarkers.
static QString convertValue (double value, const String &toUnits, int precision)
 Converts the given value to a QString version using the given units.
static String sgUnit (const String &posUnit, int index, const String &coordSys)
 Converts the given position unit, if applicable, from sexagesimal to either HMS or DMS.

Variables

static const String casa::CSYS_INDIVIDUAL
static const String casa::CSYS_IMAGE
static const String casa::CSYS_B1950
static const String casa::CSYS_J2000
static const String casa::CSYS_GALACTIC
static const String casa::CSYS_ECLIPTIC
static const String casa::UNIT_IPIXELS
static const String casa::UNIT_DEGREES
static const String casa::UNIT_RADIANS
static const String casa::PUNIT_SEXAGESIMAL
static const String casa::PUNIT_HMS
static const String casa::PUNIT_DMS
static const String casa::SUNIT_ARCSEC
static const String casa::SUNIT_ARCMIN
static const String casa::DEFAULT_COMMENTS
bool m_custCoordSys
 Custom options.
bool m_pixelCoordSys
String m_coordSys
String m_posUnits
String m_sizeUnits
int m_precision
String m_comments

Function Documentation

Destructor.

static vector<RSMarker*> convertMarker ( const RSMarker marker,
bool &  conversionWasNeeded 
) [static, private]

Converts the given RSMarker into one or more DS9-friendly RSMarkers.

If marker is NULL or the markers is empty then an empty vector is returned. Note that the caller is responsible for deleting the new markers.

static QString convertValue ( double  value,
const String toUnits,
int  precision 
) [static, private]

Converts the given value to a QString version using the given units.

The value is assumed to be in units RegionShape::UNIT. toUnits should be one of: UNIT_IPIXELS, UNIT_DEGREES, UNIT_RADIANS, PUNIT_HMS, PUNIT_DMS, SUNIT_ARCSEC, SUNIT_ARCMIN, or "". If toUnits is blank, no converting or adding a unit is done.

static DS9::CoordinateSystem coordinateSystem ( const String system) [static]

Converts a coordinate system constant (as used in DS9RFWOptions) into its DS9::CoordinateSystem equivalent.

Definition at line 67 of file DS9FileWriter.qo.h.

References casa::CSYS_B1950, casa::CSYS_ECLIPTIC, casa::CSYS_GALACTIC, casa::CSYS_IMAGE, casa::CSYS_J2000, casa::DS9::defaultCoordinateSystem(), casa::viewer::region::Ecliptic, casa::viewer::FK4, casa::viewer::FK5, casa::viewer::region::Galactic, and casa::DS9::Image.

Constructor.

static vector<String> globalProperties ( ) [static, private]
static bool isValidDS9System ( MDirection::Types  worldSys) [static]

Returns true if the given CASA world system is supported by DS9.

Definition at line 78 of file DS9FileWriter.qo.h.

References casa::MDirection::B1950, casa::viewer::ECLIPTIC, casa::MDirection::GALACTIC, and casa::MDirection::J2000.

QWidget* optionsWidget ( ) const

Implements RegionFileWriter::optionsWidget.

static bool regionType ( const RegionShape *  shape,
DS9::RegionType &  type,
stringstream &  errors 
) [static, private]

Finds the DS9 region type for the given shape.

Returns true if no errors were reported, false otherwise. If errors occurred they are logged on the given stringstream. Note that RSMarkers are expected to already be converted to a DS9-friendly format. If this method returns false, the given shape should NOT be written.

static bool regionType ( const AnnRegion *  shape,
DS9::RegionType &  type,
stringstream &  errors 
) [static, private]
void resetOptions ( ) const [private]

Rests custom options to defaults.

void setOptions ( const QWidget *  widget)

Implements RegionFileWriter::setOptions.

static String sgUnit ( const String posUnit,
int  index,
const String coordSys 
) [static, private]

Converts the given position unit, if applicable, from sexagesimal to either HMS or DMS.

Does nothing if the position unit is not sexagesimal.

Definition at line 176 of file DS9FileWriter.qo.h.

References casa::CSYS_GALACTIC, casa::PUNIT_DMS, casa::PUNIT_HMS, and casa::PUNIT_SEXAGESIMAL.

bool write ( const vector< RegionShape * > &  shapes) const

Implements RegionFileWriter::write.

Referenced by casa::RSFileWriter::writeFile().

bool write ( QTextStream &  ,
AnnRegion *   
) const
bool writeFooter ( QTextStream &  ) const
bool writeGlobals ( QTextStream &  file,
stringstream &  errors 
) const [private]

Writes globals (default DS9Region properties) and, if applicable, the overriding coordinate system.

bool writeHeader ( QTextStream &  ) const
bool writeHeader ( QTextStream &  file,
stringstream &  errors 
) const [private]

Writes header comments to the file.

bool writeShape ( QTextStream &  file,
stringstream &  errors,
const RegionShape *  shape,
bool  isComposite = false 
) const [private]

Writes a single shape to the file.


Variable Documentation

Definition at line 114 of file DS9FileWriter.qo.h.

Definition at line 111 of file DS9FileWriter.qo.h.

Custom options.

Definition at line 109 of file DS9FileWriter.qo.h.

Definition at line 110 of file DS9FileWriter.qo.h.

Definition at line 112 of file DS9FileWriter.qo.h.

Definition at line 113 of file DS9FileWriter.qo.h.

Definition at line 112 of file DS9FileWriter.qo.h.