casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Namespaces | Functions | Variables
DS9FileWriter.qo.h File Reference
#include <QTextStream>
#include <display/RegionShapes/QtDS9WriteOptions.ui.h>
#include <display/RegionShapes/RSFileReaderWriter.h>
#include <display/RegionShapes/DS9FileReader.h>
#include <casa/namespace.h>

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

 casa
 -*- mode: c++ -*-
 

Functions

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

Variables

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

Function Documentation

Destructor.

static std::vector<RSMarker*> convertMarker ( const RSMarker marker,
bool &  conversionWasNeeded 
)
staticprivate

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 casacore::String toUnits,
int  precision 
)
staticprivate

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 casacore::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::DS9::Ecliptic, casa::DS9::FK4, casa::DS9::FK5, casa::DS9::Galactic, and casa::DS9::Image.

DS9FileWriter ( )

Constructor.

static std::vector<casacore::String> globalProperties ( )
staticprivate
static bool isValidDS9System ( casacore::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 casacore::MDirection::B1950, casacore::MDirection::ECLIPTIC, casacore::MDirection::GALACTIC, and casacore::MDirection::J2000.

QWidget* optionsWidget ( ) const

Implements RegionFileWriter::optionsWidget.

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

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 
)
staticprivate
void resetOptions ( ) const
private

Rests custom options to defaults.

void setOptions ( const QWidget *  widget)

Implements RegionFileWriter::setOptions.

static casacore::String sgUnit ( const casacore::String posUnit,
int  index,
const casacore::String coordSys 
)
staticprivate

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 183 of file DS9FileWriter.qo.h.

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

bool write ( const std::vector< RegionShape * > &  shapes) const
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

casacore::String m_comments

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

casacore::String m_coordSys

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

bool m_custCoordSys

Custom options.

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

bool m_pixelCoordSys

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

casacore::String m_posUnits

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

int m_precision

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

casacore::String m_sizeUnits

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