casa
$Rev:20696$
|
Holds information for read DS9 regions. More...
#include <DS9FileReader.h>
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. | |
RegionShape * | toRegionShape () 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 ®ion) |
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 RFError & | lastError () 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< DS9Coordinate > | m_coords |
Record | m_props |
vector< DS9Region > | m_compositeRegions |
RFError | m_lastError |
Last encountered error during toRegionShape. |
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.
casa::DS9Region::DS9Region | ( | DS9::RegionType | type, |
DS9::CoordinateSystem | coordSys | ||
) |
Non-Static //.
Constructor, which types a type and a coordinate system.
Destructor.
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 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] |
Returns the default value for the given String property.
Definition at line 489 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 casa::vpf::toString().
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().
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 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().
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 | ) |
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 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().
vector<DS9Region> casa::DS9Region::m_compositeRegions [private] |
Definition at line 580 of file DS9FileReader.h.
vector<DS9Coordinate> casa::DS9Region::m_coords [private] |
Definition at line 578 of file DS9FileReader.h.
RFError casa::DS9Region::m_lastError [private] |
Last encountered error during toRegionShape.
Definition at line 583 of file DS9FileReader.h.
Record casa::DS9Region::m_props [private] |
Definition at line 579 of file DS9FileReader.h.
Definition at line 577 of file DS9FileReader.h.
DS9::RegionType casa::DS9Region::m_type [private] |
Definition at line 576 of file DS9FileReader.h.
const String casa::DS9Region::PROP_BACKGROUND [static] |
friend class DS9RegionFileReader;
Public Static Members/Methods //
Properties.
Definition at line 329 of file DS9FileReader.h.
Referenced by defaultBoolValue(), and properties().
const String casa::DS9Region::PROP_COLOR [static] |
Definition at line 330 of file DS9FileReader.h.
Referenced by defaultStringValue(), globalProperties(), isBoolProperty(), properties(), and valueIsValid().
const String casa::DS9Region::PROP_COMPASS [static] |
Definition at line 331 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), properties(), and valueIsValid().
const String casa::DS9Region::PROP_COMPASS_ELABEL [static] |
Definition at line 332 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), and properties().
const String casa::DS9Region::PROP_COMPASS_NLABEL [static] |
Definition at line 333 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), and properties().
const String casa::DS9Region::PROP_COMPOSITE [static] |
Definition at line 334 of file DS9FileReader.h.
Referenced by defaultBoolValue(), and properties().
const String casa::DS9Region::PROP_DASH [static] |
Definition at line 335 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
const String casa::DS9Region::PROP_DASHLIST [static] |
Definition at line 336 of file DS9FileReader.h.
Referenced by defaultStringValue(), globalProperties(), isBoolProperty(), properties(), and valueIsValid().
const String casa::DS9Region::PROP_DELETE [static] |
Definition at line 337 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
const String casa::DS9Region::PROP_EDIT [static] |
Definition at line 338 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
const String casa::DS9Region::PROP_FIXED [static] |
Definition at line 339 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
const String casa::DS9Region::PROP_FONT [static] |
Definition at line 340 of file DS9FileReader.h.
Referenced by defaultStringValue(), globalProperties(), isBoolProperty(), properties(), and valueIsValid().
const String casa::DS9Region::PROP_HIGHLITE [static] |
Definition at line 341 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
const String casa::DS9Region::PROP_INCLUDE [static] |
Definition at line 342 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
const String casa::DS9Region::PROP_LINE [static] |
Definition at line 343 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), properties(), and valueIsValid().
const String casa::DS9Region::PROP_MARKER_SIZE [static] |
Definition at line 344 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), properties(), and valueIsValid().
const String casa::DS9Region::PROP_MOVE [static] |
Definition at line 345 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
const String casa::DS9Region::PROP_ROTATE [static] |
Definition at line 346 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
const String casa::DS9Region::PROP_RULER [static] |
Definition at line 347 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), properties(), and valueIsValid().
const String casa::DS9Region::PROP_SELECT [static] |
Definition at line 348 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
const String casa::DS9Region::PROP_SOURCE [static] |
Definition at line 349 of file DS9FileReader.h.
Referenced by defaultBoolValue(), globalProperties(), and properties().
const String casa::DS9Region::PROP_TAG [static] |
Definition at line 350 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), and properties().
const String casa::DS9Region::PROP_TEXT [static] |
Definition at line 351 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), and properties().
const String casa::DS9Region::PROP_TEXTANGLE [static] |
Definition at line 352 of file DS9FileReader.h.
Referenced by defaultStringValue(), isBoolProperty(), properties(), and valueIsValid().
const String casa::DS9Region::PROP_VECTOR [static] |
Definition at line 353 of file DS9FileReader.h.
Referenced by defaultBoolValue(), and properties().
const String casa::DS9Region::PROP_WIDTH [static] |
Definition at line 354 of file DS9FileReader.h.
Referenced by defaultStringValue(), globalProperties(), isBoolProperty(), properties(), and valueIsValid().