casa::DS9Region Class Reference

Holds information for read DS9 regions. More...

#include <DS9FileReader.h>

List of all members.

Public Member Functions

 DS9Region (DS9::RegionType type, DS9::CoordinateSystem coordSys)
 Non-Static //.
 ~DS9Region ()
 Destructor.
String toPrintString () const
 Returns a human-readable representation of this region.
String name () const
 Returns a name.
RegionShapetoRegionShape () const
 Converts this region to a RegionShape.
DS9::RegionType type () const
 Returns the region type.
bool setProperties (const RecordInterface &properties)
 Sets/adds the given properties to this region's.
bool define (const String &property, bool value)
 Defines the given bool property with the given value.
bool define (const String &property, const String &value)
 Defines the given String property with the given value.
bool isDefined (const String &property)
 Returns true if the given property is defined, false otherwise.
bool boolValue (const String &property)
 Returns the value for the given bool property.
String stringValue (const String &property)
 Returns the String value for the given String property.
void pushCoordinate (const DS9Coordinate &coord)
 Adds the given coordinate to the region.
void pushCompositeRegion (const DS9Region &region)
 Adds the given region to this composite region (does nothing for non- composite regions).
bool checkCoordinates ()
 Returns true if this region's coordinates are valid, false otherwise.
bool checkProperties ()
 Returns true if this region's properties are valid, false otherwise.
const RFErrorlastError () const
 Returns the last error found during toRegionShape().

Static Public Member Functions

static vector< String > properties ()
 Note: when adding new properties: 1) add to properties(), DS9RegionFileWriter::globalProperties() (if necessary) 2) add to isBoolProperty() 3) for strings, add to valueIsValid 4) add to defaultBoolValue() or defaultStringValue() 5) if special printing is required, edit toPrintString, DS9RegionFileWriter::writeGlobals() 6) if special input is required, edit DS9RegionFileReader::readProperties().
static bool isProperty (const String &prp)
 Returns true if the given String is a valid property, false otherwise.
static bool isBoolProperty (const String &property)
 Returns true if the given String is a valid bool property, false otherwise.
static bool valueIsValid (const String &property, const String &value, DS9::RegionType type)
 Returns true if the given value is valid for the given String property and region type, false otherwise.
static bool defaultBoolValue (const String &property)
 Returns the default value for the given bool property.
static String defaultStringValue (const String &property)
 Returns the default value for the given String property.

Static Public Attributes

static const String PROP_BACKGROUND
 friend class DS9RegionFileReader;
static const String PROP_COLOR
static const String PROP_COMPASS
static const String PROP_COMPASS_ELABEL
static const String PROP_COMPASS_NLABEL
static const String PROP_COMPOSITE
static const String PROP_DASH
static const String PROP_DASHLIST
static const String PROP_DELETE
static const String PROP_EDIT
static const String PROP_FIXED
static const String PROP_FONT
static const String PROP_HIGHLITE
static const String PROP_INCLUDE
static const String PROP_LINE
static const String PROP_MARKER_SIZE
static const String PROP_MOVE
static const String PROP_ROTATE
static const String PROP_RULER
static const String PROP_SELECT
static const String PROP_SOURCE
static const String PROP_TAG
static const String PROP_TEXT
static const String PROP_TEXTANGLE
static const String PROP_VECTOR
static const String PROP_WIDTH

Private Member Functions

void setError (const String &error, bool isFatal=false) const
 Convenience method for setting the last error during toRegionShape.

Private Attributes

DS9::RegionType m_type
DS9::CoordinateSystem m_system
vector< DS9Coordinatem_coords
Record m_props
vector< DS9Regionm_compositeRegions
RFError m_lastError
 Last encountered error during toRegionShape.

Detailed Description

Holds information for read DS9 regions.

A DS9Region consists of a type, a list of coordinates, a coordinate system, and a set of properties. Composite regions also have a list of children regions. For simplicity, properties are either bool properties or String properties. All properties have defaults which are set during construction.

Definition at line 366 of file DS9FileReader.h.


Constructor & Destructor Documentation

casa::DS9Region::DS9Region ( DS9::RegionType  type,
DS9::CoordinateSystem  coordSys 
)

Non-Static //.

Constructor, which types a type and a coordinate system.

casa::DS9Region::~DS9Region (  ) 

Destructor.


Member Function Documentation

bool casa::DS9Region::boolValue ( const String &  property  ) 

Returns the value for the given bool property.

bool casa::DS9Region::checkCoordinates (  ) 

Returns true if this region's coordinates are valid, false otherwise.

If the coordinates are invalid, this method will attempt to fix them first.

bool casa::DS9Region::checkProperties (  ) 

Returns true if this region's properties are valid, false otherwise.

If the properties are invalid, this method will attempt to fix them first.

static bool casa::DS9Region::defaultBoolValue ( const String &  property  )  [inline, static]

Returns the default value for the given bool property.

Definition at line 529 of file DS9FileReader.h.

References PROP_BACKGROUND, PROP_COMPOSITE, PROP_DASH, PROP_DELETE, PROP_EDIT, PROP_FIXED, PROP_HIGHLITE, PROP_INCLUDE, PROP_MOVE, PROP_ROTATE, PROP_SELECT, PROP_SOURCE, and PROP_VECTOR.

static String casa::DS9Region::defaultStringValue ( const String &  property  )  [inline, static]
bool casa::DS9Region::define ( const String &  property,
const String &  value 
)

Defines the given String property with the given value.

Returns false if the given property or value is invalid.

bool casa::DS9Region::define ( const String &  property,
bool  value 
)

Defines the given bool property with the given value.

Returns false if the given property is invalid.

static bool casa::DS9Region::isBoolProperty ( const String &  property  )  [inline, static]

Returns true if the given String is a valid bool property, false otherwise.

Definition at line 454 of file DS9FileReader.h.

References isProperty(), PROP_COLOR, PROP_COMPASS, PROP_COMPASS_ELABEL, PROP_COMPASS_NLABEL, PROP_DASHLIST, PROP_FONT, PROP_LINE, PROP_MARKER_SIZE, PROP_RULER, PROP_TAG, PROP_TEXT, PROP_TEXTANGLE, and PROP_WIDTH.

Referenced by valueIsValid().

bool casa::DS9Region::isDefined ( const String &  property  ) 

Returns true if the given property is defined, false otherwise.

static bool casa::DS9Region::isProperty ( const String &  prp  )  [inline, static]

Returns true if the given String is a valid property, false otherwise.

Definition at line 446 of file DS9FileReader.h.

References properties().

Referenced by isBoolProperty().

const RFError& casa::DS9Region::lastError (  )  const

Returns the last error found during toRegionShape().

This error is only valid if toRegionShape() returns NULL which indicates an error was encountered.

String casa::DS9Region::name (  )  const

Returns a name.

static vector<String> casa::DS9Region::properties (  )  [inline, static]

Note: when adding new properties: 1) add to properties(), DS9RegionFileWriter::globalProperties() (if necessary) 2) add to isBoolProperty() 3) for strings, add to valueIsValid 4) add to defaultBoolValue() or defaultStringValue() 5) if special printing is required, edit toPrintString, DS9RegionFileWriter::writeGlobals() 6) if special input is required, edit DS9RegionFileReader::readProperties().

Returns all valid properties.

Definition at line 414 of file DS9FileReader.h.

References PROP_BACKGROUND, PROP_COLOR, PROP_COMPASS, PROP_COMPASS_ELABEL, PROP_COMPASS_NLABEL, PROP_COMPOSITE, PROP_DASH, PROP_DASHLIST, PROP_DELETE, PROP_EDIT, PROP_FIXED, PROP_FONT, PROP_HIGHLITE, PROP_INCLUDE, PROP_LINE, PROP_MARKER_SIZE, PROP_MOVE, PROP_ROTATE, PROP_RULER, PROP_SELECT, PROP_SOURCE, PROP_TAG, PROP_TEXT, PROP_TEXTANGLE, PROP_VECTOR, and PROP_WIDTH.

Referenced by isProperty().

void casa::DS9Region::pushCompositeRegion ( const DS9Region region  ) 

Adds the given region to this composite region (does nothing for non- composite regions).

void casa::DS9Region::pushCoordinate ( const DS9Coordinate coord  ) 

Adds the given coordinate to the region.

void casa::DS9Region::setError ( const String &  error,
bool  isFatal = false 
) const [private]

Convenience method for setting the last error during toRegionShape.

bool casa::DS9Region::setProperties ( const RecordInterface &  properties  ) 

Sets/adds the given properties to this region's.

Returns false if an error occured.

String casa::DS9Region::stringValue ( const String &  property  ) 

Returns the String value for the given String property.

String casa::DS9Region::toPrintString (  )  const

Returns a human-readable representation of this region.

RegionShape* casa::DS9Region::toRegionShape (  )  const

Converts this region to a RegionShape.

Not all DS9 region types are supported and thus this may return NULL. For unsupported regions, see cookbook documentation.

DS9::RegionType casa::DS9Region::type (  )  const

Returns the region type.

static bool casa::DS9Region::valueIsValid ( const String &  property,
const String &  value,
DS9::RegionType  type 
) [inline, static]

Returns true if the given value is valid for the given String property and region type, false otherwise.

Definition at line 468 of file DS9FileReader.h.

References casa::DS9::coordinateSystemFirstWords(), isBoolProperty(), PROP_COLOR, PROP_COMPASS, PROP_DASHLIST, PROP_FONT, PROP_LINE, PROP_MARKER_SIZE, PROP_RULER, PROP_TEXTANGLE, PROP_WIDTH, casacore::split(), casa::DS9::Text, and casacore::toDouble().


Member Data Documentation

Definition at line 638 of file DS9FileReader.h.

Definition at line 636 of file DS9FileReader.h.

Last encountered error during toRegionShape.

Definition at line 641 of file DS9FileReader.h.

Record casa::DS9Region::m_props [private]

Definition at line 637 of file DS9FileReader.h.

Definition at line 635 of file DS9FileReader.h.

Definition at line 634 of file DS9FileReader.h.

const String casa::DS9Region::PROP_BACKGROUND [static]

friend class DS9RegionFileReader;

Public Static Members/Methods // Properties.

Definition at line 374 of file DS9FileReader.h.

Referenced by defaultBoolValue(), and properties().

const String casa::DS9Region::PROP_COLOR [static]
const String casa::DS9Region::PROP_COMPASS [static]

Definition at line 376 of file DS9FileReader.h.

Referenced by defaultStringValue(), isBoolProperty(), properties(), and valueIsValid().

const String casa::DS9Region::PROP_COMPASS_ELABEL [static]

Definition at line 377 of file DS9FileReader.h.

Referenced by defaultStringValue(), isBoolProperty(), and properties().

const String casa::DS9Region::PROP_COMPASS_NLABEL [static]

Definition at line 378 of file DS9FileReader.h.

Referenced by defaultStringValue(), isBoolProperty(), and properties().

const String casa::DS9Region::PROP_COMPOSITE [static]

Definition at line 379 of file DS9FileReader.h.

Referenced by defaultBoolValue(), and properties().

const String casa::DS9Region::PROP_DASH [static]

Definition at line 380 of file DS9FileReader.h.

Referenced by defaultBoolValue(), globalProperties(), and properties().

const String casa::DS9Region::PROP_DASHLIST [static]
const String casa::DS9Region::PROP_DELETE [static]

Definition at line 382 of file DS9FileReader.h.

Referenced by defaultBoolValue(), globalProperties(), and properties().

const String casa::DS9Region::PROP_EDIT [static]

Definition at line 383 of file DS9FileReader.h.

Referenced by defaultBoolValue(), globalProperties(), and properties().

const String casa::DS9Region::PROP_FIXED [static]

Definition at line 384 of file DS9FileReader.h.

Referenced by defaultBoolValue(), globalProperties(), and properties().

const String casa::DS9Region::PROP_FONT [static]
const String casa::DS9Region::PROP_HIGHLITE [static]

Definition at line 386 of file DS9FileReader.h.

Referenced by defaultBoolValue(), globalProperties(), and properties().

const String casa::DS9Region::PROP_INCLUDE [static]

Definition at line 387 of file DS9FileReader.h.

Referenced by defaultBoolValue(), globalProperties(), and properties().

const String casa::DS9Region::PROP_LINE [static]

Definition at line 388 of file DS9FileReader.h.

Referenced by defaultStringValue(), isBoolProperty(), properties(), and valueIsValid().

const String casa::DS9Region::PROP_MARKER_SIZE [static]

Definition at line 389 of file DS9FileReader.h.

Referenced by defaultStringValue(), isBoolProperty(), properties(), and valueIsValid().

const String casa::DS9Region::PROP_MOVE [static]

Definition at line 390 of file DS9FileReader.h.

Referenced by defaultBoolValue(), globalProperties(), and properties().

const String casa::DS9Region::PROP_ROTATE [static]

Definition at line 391 of file DS9FileReader.h.

Referenced by defaultBoolValue(), globalProperties(), and properties().

const String casa::DS9Region::PROP_RULER [static]

Definition at line 392 of file DS9FileReader.h.

Referenced by defaultStringValue(), isBoolProperty(), properties(), and valueIsValid().

const String casa::DS9Region::PROP_SELECT [static]

Definition at line 393 of file DS9FileReader.h.

Referenced by defaultBoolValue(), globalProperties(), and properties().

const String casa::DS9Region::PROP_SOURCE [static]

Definition at line 394 of file DS9FileReader.h.

Referenced by defaultBoolValue(), globalProperties(), and properties().

const String casa::DS9Region::PROP_TAG [static]

Definition at line 395 of file DS9FileReader.h.

Referenced by defaultStringValue(), isBoolProperty(), and properties().

const String casa::DS9Region::PROP_TEXT [static]

Definition at line 396 of file DS9FileReader.h.

Referenced by defaultStringValue(), isBoolProperty(), and properties().

const String casa::DS9Region::PROP_TEXTANGLE [static]

Definition at line 397 of file DS9FileReader.h.

Referenced by defaultStringValue(), isBoolProperty(), properties(), and valueIsValid().

const String casa::DS9Region::PROP_VECTOR [static]

Definition at line 398 of file DS9FileReader.h.

Referenced by defaultBoolValue(), and properties().

const String casa::DS9Region::PROP_WIDTH [static]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1