casa
5.7.0-16
|
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... | |
RegionShape * | toRegionShape () 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 ®ion) |
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 RFError & | lastError () 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... | |
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< DS9Coordinate > | m_coords |
casacore::Record | m_props |
vector< DS9Region > | m_compositeRegions |
RFError | m_lastError |
Last encountered error during toRegionShape. More... | |
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.
casa::DS9Region::DS9Region | ( | DS9::RegionType | type, |
DS9::CoordinateSystem | coordSys | ||
) |
Non-Static //.
Constructor, which types a type and a coordinate system.
casa::DS9Region::~DS9Region | ( | ) |
Destructor.
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.
|
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.
|
inlinestatic |
Returns the default value for the given casacore::String property.
Definition at line 547 of file DS9FileReader.h.
References casa::DS9::MARKER_SIZE, 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, PROP_WIDTH, and casacore::String::toString().
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.
|
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.
|
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.
|
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.
|
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.
|
inlinestatic |
Returns true if the given value is valid for the given casacore::String property and region type, false otherwise.
Definition at line 468 of file DS9FileReader.h.
References casacore::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::utilj::split(), casa::DS9::Text, and casacore::toDouble().
|
private |
Definition at line 638 of file DS9FileReader.h.
|
private |
Definition at line 636 of file DS9FileReader.h.
|
private |
Last encountered error during toRegionShape.
Definition at line 641 of file DS9FileReader.h.
|
private |
Definition at line 637 of file DS9FileReader.h.
|
private |
Definition at line 635 of file DS9FileReader.h.
|
private |
Definition at line 634 of file DS9FileReader.h.
|
static |
friend class DS9RegionFileReader;
Public Static Members/Methods //
Properties.
Definition at line 374 of file DS9FileReader.h.
Referenced by defaultBoolValue(), and properties().
|
static |
Definition at line 375 of file DS9FileReader.h.
Referenced by defaultStringValue(), globalProperties(), isBoolProperty(), properties(), and valueIsValid().
|
static |
Definition at line 376 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), properties(), and valueIsValid().
|
static |
Definition at line 377 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), and properties().
|
static |
Definition at line 378 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), and properties().
|
static |
Definition at line 379 of file DS9FileReader.h.
Referenced by defaultBoolValue(), and properties().
|
static |
Definition at line 380 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
|
static |
Definition at line 381 of file DS9FileReader.h.
Referenced by defaultStringValue(), globalProperties(), isBoolProperty(), properties(), and valueIsValid().
|
static |
Definition at line 382 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
|
static |
Definition at line 383 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
|
static |
Definition at line 384 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
|
static |
Definition at line 385 of file DS9FileReader.h.
Referenced by defaultStringValue(), globalProperties(), isBoolProperty(), properties(), and valueIsValid().
|
static |
Definition at line 386 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
|
static |
Definition at line 387 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
|
static |
Definition at line 388 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), properties(), and valueIsValid().
|
static |
Definition at line 389 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), properties(), and valueIsValid().
|
static |
Definition at line 390 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
|
static |
Definition at line 391 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
|
static |
Definition at line 392 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), properties(), and valueIsValid().
|
static |
Definition at line 393 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
|
static |
Definition at line 394 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
|
static |
Definition at line 395 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), and properties().
|
static |
Definition at line 396 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), and properties().
|
static |
Definition at line 397 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), properties(), and valueIsValid().
|
static |
Definition at line 398 of file DS9FileReader.h.
Referenced by defaultBoolValue(), and properties().
|
static |
Definition at line 399 of file DS9FileReader.h.
Referenced by defaultStringValue(), globalProperties(), isBoolProperty(), properties(), and valueIsValid().