casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
casa::DS9Region Class Reference

Holds information for read DS9 regions. More...

#include <DS9FileReader.h>

Public Member Functions

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

Static Public Member Functions

static std::vector
< casacore::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() More...
 
static bool isProperty (const casacore::String &prp)
 Returns true if the given casacore::String is a valid property, false otherwise. More...
 
static bool isBoolProperty (const casacore::String &property)
 Returns true if the given casacore::String is a valid bool property, false otherwise. More...
 
static bool valueIsValid (const casacore::String &property, const casacore::String &value, DS9::RegionType type)
 Returns true if the given value is valid for the given casacore::String property and region type, false otherwise. More...
 
static bool defaultBoolValue (const casacore::String &property)
 Returns the default value for the given bool property. More...
 
static casacore::String defaultStringValue (const casacore::String &property)
 Returns the default value for the given casacore::String property. More...
 

Static Public Attributes

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

Private Member Functions

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

Private Attributes

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

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 casacore::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 casacore::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 casacore::String property)
inlinestatic

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 casacore::String casa::DS9Region::defaultStringValue ( const casacore::String property)
inlinestatic
bool casa::DS9Region::define ( const casacore::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 casacore::String property,
const casacore::String value 
)

Defines the given casacore::String property with the given value.

Returns false if the given property or value is invalid.

static bool casa::DS9Region::isBoolProperty ( const casacore::String property)
inlinestatic

Returns true if the given casacore::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 casacore::String property)

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

static bool casa::DS9Region::isProperty ( const casacore::String prp)
inlinestatic

Returns true if the given casacore::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.

casacore::String casa::DS9Region::name ( ) const

Returns a name.

static std::vector<casacore::String> casa::DS9Region::properties ( )
inlinestatic

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 casacore::String error,
bool  isFatal = false 
) const
private

Convenience method for setting the last error during toRegionShape.

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

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

Returns false if an error occured.

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

Returns the casacore::String value for the given casacore::String property.

casacore::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 casacore::String property,
const casacore::String value,
DS9::RegionType  type 
)
inlinestatic

Member Data Documentation

vector<DS9Region> casa::DS9Region::m_compositeRegions
private

Definition at line 638 of file DS9FileReader.h.

vector<DS9Coordinate> casa::DS9Region::m_coords
private

Definition at line 636 of file DS9FileReader.h.

RFError casa::DS9Region::m_lastError
private

Last encountered error during toRegionShape.

Definition at line 641 of file DS9FileReader.h.

casacore::Record casa::DS9Region::m_props
private

Definition at line 637 of file DS9FileReader.h.

DS9::CoordinateSystem casa::DS9Region::m_system
private

Definition at line 635 of file DS9FileReader.h.

DS9::RegionType casa::DS9Region::m_type
private

Definition at line 634 of file DS9FileReader.h.

const casacore::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 casacore::String casa::DS9Region::PROP_COLOR
static
const casacore::String casa::DS9Region::PROP_COMPASS
static

Definition at line 376 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_COMPASS_ELABEL
static

Definition at line 377 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_COMPASS_NLABEL
static

Definition at line 378 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_COMPOSITE
static

Definition at line 379 of file DS9FileReader.h.

Referenced by defaultBoolValue(), and properties().

const casacore::String casa::DS9Region::PROP_DASH
static

Definition at line 380 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_DASHLIST
static
const casacore::String casa::DS9Region::PROP_DELETE
static

Definition at line 382 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_EDIT
static

Definition at line 383 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_FIXED
static

Definition at line 384 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_FONT
static
const casacore::String casa::DS9Region::PROP_HIGHLITE
static

Definition at line 386 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_INCLUDE
static

Definition at line 387 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_LINE
static

Definition at line 388 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_MARKER_SIZE
static

Definition at line 389 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_MOVE
static

Definition at line 390 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_ROTATE
static

Definition at line 391 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_RULER
static

Definition at line 392 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_SELECT
static

Definition at line 393 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_SOURCE
static

Definition at line 394 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_TAG
static

Definition at line 395 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_TEXT
static

Definition at line 396 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_TEXTANGLE
static

Definition at line 397 of file DS9FileReader.h.

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

const casacore::String casa::DS9Region::PROP_VECTOR
static

Definition at line 398 of file DS9FileReader.h.

Referenced by defaultBoolValue(), and properties().

const casacore::String casa::DS9Region::PROP_WIDTH
static

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