casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
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< Stringproperties ()
 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 321 of file DS9FileReader.h.


Constructor & Destructor Documentation

Non-Static //.

Constructor, which types a type and a coordinate system.

Destructor.


Member Function Documentation

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

Returns the value for the given bool property.

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

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

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 471 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,
bool  value 
)

Defines the given bool property with the given value.

Returns false if the given property is invalid.

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.

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 396 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 388 of file DS9FileReader.h.

References properties().

Referenced by isBoolProperty().

Returns the last error found during toRegionShape().

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

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 369 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().

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

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.

Returns the String value for the given String property.

Returns a human-readable representation of this region.

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.

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 410 of file DS9FileReader.h.

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


Member Data Documentation

Definition at line 580 of file DS9FileReader.h.

Definition at line 578 of file DS9FileReader.h.

Last encountered error during toRegionShape.

Definition at line 583 of file DS9FileReader.h.

Definition at line 579 of file DS9FileReader.h.

Definition at line 577 of file DS9FileReader.h.

Definition at line 576 of file DS9FileReader.h.

friend class DS9RegionFileReader;

Public Static Members/Methods //

   Properties.

Definition at line 329 of file DS9FileReader.h.

Referenced by defaultBoolValue(), and properties().

Definition at line 331 of file DS9FileReader.h.

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

Definition at line 332 of file DS9FileReader.h.

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

Definition at line 333 of file DS9FileReader.h.

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

Definition at line 334 of file DS9FileReader.h.

Referenced by defaultBoolValue(), and properties().

Definition at line 335 of file DS9FileReader.h.

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

Definition at line 337 of file DS9FileReader.h.

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

Definition at line 338 of file DS9FileReader.h.

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

Definition at line 339 of file DS9FileReader.h.

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

Definition at line 341 of file DS9FileReader.h.

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

Definition at line 342 of file DS9FileReader.h.

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

Definition at line 343 of file DS9FileReader.h.

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

Definition at line 344 of file DS9FileReader.h.

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

Definition at line 345 of file DS9FileReader.h.

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

Definition at line 346 of file DS9FileReader.h.

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

Definition at line 347 of file DS9FileReader.h.

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

Definition at line 348 of file DS9FileReader.h.

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

Definition at line 349 of file DS9FileReader.h.

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

Definition at line 350 of file DS9FileReader.h.

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

Definition at line 351 of file DS9FileReader.h.

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

Definition at line 352 of file DS9FileReader.h.

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

Definition at line 353 of file DS9FileReader.h.

Referenced by defaultBoolValue(), and properties().


The documentation for this class was generated from the following file: