casa
5.7.0-16
|
Base class for annotations. More...
#include <AnnotationBase.h>
Public Types | |
enum | Type { LINE, VECTOR, TEXT, SYMBOL, RECT_BOX, CENTER_BOX, ROTATED_BOX, POLYGON, POLYLINE, CIRCLE, ANNULUS, ELLIPSE } |
enum | Keyword { COORD, RANGE, FRAME, CORR, VELTYPE, RESTFREQ, LINEWIDTH, LINESTYLE, SYMSIZE, SYMTHICK, COLOR, FONT, FONTSIZE, FONTSTYLE, USETEX, LABEL, LABELCOLOR, LABELPOS, LABELOFF, UNKNOWN_KEYWORD, N_KEYS } |
enum | LineStyle { SOLID, DASHED, DOT_DASHED, DOTTED } |
enum | FontStyle { NORMAL, BOLD, ITALIC, ITALIC_BOLD } |
using | RGB = std::vector< float > |
using | Direction = casacore::Vector< std::pair< casacore::Quantity, casacore::Quantity > > |
The pairs have longitude as the first member and latitude as the second. More... | |
Public Member Functions | |
virtual | ~AnnotationBase () |
Type | getType () const |
void | setLabel (const casacore::String &label) |
casacore::String | getLabel () const |
void | setColor (const casacore::String &color) |
color must either be a recognized color name or a valid rgb hex string, else an expection is thrown More... | |
void | setColor (const RGB &color) |
color must have three elements all with values between 0 and 255 inclusive or an exception is thrown. More... | |
casacore::String | getColorString () const |
returns the color name if it is recognized or its rgb hex string More... | |
RGB | getColor () const |
get the color associated with this object More... | |
void | setLineStyle (const LineStyle lineStyle) |
LineStyle | getLineStyle () const |
void | setLineWidth (const casacore::uInt linewidth) |
casacore::uInt | getLineWidth () const |
void | setSymbolSize (const casacore::uInt symbolsize) |
casacore::uInt | getSymbolSize () const |
void | setSymbolThickness (const casacore::uInt symbolthickness) |
casacore::uInt | getSymbolThickness () const |
void | setFont (const casacore::String &font) |
casacore::String | getFont () const |
void | setFontSize (const casacore::uInt fontsize) |
casacore::uInt | getFontSize () const |
void | setFontStyle (const FontStyle &fontstyle) |
FontStyle | getFontStyle () const |
void | setUseTex (const casacore::Bool usetex) |
casacore::Bool | isUseTex () const |
virtual casacore::Bool | isRegion () const |
is the object a region? More... | |
virtual casacore::Bool | isAnnotationOnly () const |
is the object only an annotation? Can only be false if the object is a region More... | |
void | setLabelColor (const casacore::String &color) |
color must either be a recognized color name or a valid rgb hex string, else an expection is thrown More... | |
void | setLabelColor (const RGB &color) |
color must have three elements all with values between 0 and 255 inclusive or an exception is thrown. More... | |
casacore::String | getLabelColorString () const |
returns the color name if it is recognized or its rgb hex string More... | |
RGB | getLabelColor () const |
get the color associated with this object's label More... | |
casacore::String | getLabelPosition () const |
returns one of top, bottom, left, or right. More... | |
void | setLabelPosition (const casacore::String &position) |
position must have a value in top, bottom, left, or right. More... | |
void | setLabelOffset (const std::vector< casacore::Int > &offset) |
offset must have two elements More... | |
std::vector< casacore::Int > | getLabelOffset () const |
virtual std::ostream & | print (std::ostream &os) const =0 |
void | setGlobals (const casacore::Vector< Keyword > &globalKeys) |
These parameters are included at the global scope. More... | |
const casacore::CoordinateSystem & | getCsys () const |
get the coordinate system associated with this object. More... | |
Direction | getDirections () const |
DEPRECATED Please use getConvertedDirections() the pair elements have longitude as the first member and latitude as the second. More... | |
casacore::Vector < casacore::MFrequency > | getFrequencyLimits () const |
get the frequency limits converted to the spectral frame of the coordinate system of this object. More... | |
casacore::Vector < casacore::Stokes::StokesTypes > | getStokes () const |
Get the stokes for which the selection applies. More... | |
virtual casacore::Bool | setFrequencyLimits (const casacore::Quantity &beginFreq, const casacore::Quantity &endFreq, const casacore::String &freqRefFrame, const casacore::String &dopplerString, const casacore::Quantity &restfreq) |
if freqRefFrame=="" -> use the reference frame of the coordinate system if dopplerString=="" -> use the doppler system associated with the coordinate system if restfreq=casacore::Quantity(0, "Hz") -> use the rest frequency associated with the coordinate system Tacitly does nothing if the coordinate system has no spectral axis. More... | |
const casacore::Vector < casacore::MDirection > & | getConvertedDirections () const |
same as getDirections, only returns proper MDirections More... | |
Static Public Member Functions | |
static LineStyle | lineStyleFromString (const casacore::String &ls) |
static Type | typeFromString (const casacore::String &type) |
Given a string, return the corresponding annotation type or throw an error if the string does not correspond to an allowed type. More... | |
static casacore::String | typeToString (const Type type) |
static casacore::String | keywordToString (const Keyword key) |
static casacore::String | lineStyleToString (const LineStyle linestyle) |
static FontStyle | fontStyleFromString (const casacore::String &fs) |
static casacore::String | fontStyleToString (const FontStyle fs) |
static casacore::String | colorToString (const RGB &color) |
static void | unitInit () |
set "pix" as valid unit. More... | |
static std::ostream & | print (std::ostream &os, const std::map< Keyword, casacore::String > ¶ms) |
print a set of keyword value pairs More... | |
static std::ostream & | print (std::ostream &os, const LineStyle ls) |
print a line style representation More... | |
static std::ostream & | print (std::ostream &os, const FontStyle fs) |
print a font style representation More... | |
static std::ostream & | print (std::ostream &os, const Direction d) |
static std::list< std::string > | colorChoices () |
Get a list of the user-friendly color names supported. More... | |
Static Public Attributes | |
static const RGB | BLACK |
static const RGB | BLUE |
static const RGB | CYAN |
static const RGB | GRAY |
static const RGB | GREEN |
static const RGB | MAGENTA |
static const RGB | ORANGE |
static const RGB | RED |
static const RGB | WHITE |
static const RGB | YELLOW |
static const casacore::String | DEFAULT_LABEL |
static const RGB | DEFAULT_COLOR |
static const LineStyle | DEFAULT_LINESTYLE |
static const casacore::uInt | DEFAULT_LINEWIDTH |
static const casacore::uInt | DEFAULT_SYMBOLSIZE |
static const casacore::uInt | DEFAULT_SYMBOLTHICKNESS |
static const casacore::String | DEFAULT_FONT |
static const casacore::uInt | DEFAULT_FONTSIZE |
static const FontStyle | DEFAULT_FONTSTYLE |
static const casacore::Bool | DEFAULT_USETEX |
static const RGB | DEFAULT_LABELCOLOR |
static const casacore::String | DEFAULT_LABELPOS |
static const std::vector < casacore::Int > | DEFAULT_LABELOFF |
static const casacore::Regex | rgbHexRegex |
Protected Member Functions | |
AnnotationBase (const Type type, const casacore::String &dirRefFrameString, const casacore::CoordinateSystem &csys, const casacore::Quantity &beginFreq, const casacore::Quantity &endFreq, const casacore::String &freqRefFrame, const casacore::String &dopplerString, const casacore::Quantity &restfreq, const casacore::Vector< casacore::Stokes::StokesTypes > &stokes) | |
if freqRefFrame or dopplerString are empty, the values from the spectral coordinate of csys will be used, if one exists. More... | |
AnnotationBase (const Type type, const casacore::CoordinateSystem &csys, const casacore::Vector< casacore::Stokes::StokesTypes > &stokes) | |
use only if the frame of the input directions is the same as the frame of the coordinate system. More... | |
AnnotationBase & | operator= (const AnnotationBase &other) |
assignment operator More... | |
casacore::MDirection | _directionFromQuantities (const casacore::Quantity &q0, const casacore::Quantity &q1) |
void | _checkAndConvertDirections (const casacore::String &origin, const Direction &dirs) |
virtual void | _printPairs (std::ostream &os) const |
const casacore::IPosition & | _getDirectionAxes () const |
casacore::String | _printDirection (const casacore::Quantity &longitude, const casacore::Quantity &latitude) const |
direction to string, precision of 0.1 mas ra and dec in sexigesimal format, non-equatorial coords in degrees More... | |
void | _setParam (const Keyword k, const casacore::String &s) |
casacore::MDirection::Types | _getDirectionRefFrame () const |
Static Protected Member Functions | |
static void | _checkMixed (const casacore::String &origin, const Direction &dirs) |
static casacore::String | _toArcsec (const casacore::Quantity &angle) |
convert angle to arcsec, precision 0.1 mas More... | |
static casacore::String | _toDeg (const casacore::Quantity &angle) |
convert angle to degrees, precision 0.1 mas More... | |
static casacore::String | _printPixel (const casacore::Double &d) |
return a string representing a pixel value, precision 1. More... | |
Private Member Functions | |
void | _init () |
void | _initParams () |
void | _testConvertToPixel () const |
void | _checkAndConvertFrequencies () |
casacore::String | _printFreqRange () const |
Static Private Member Functions | |
static void | _initColors () |
static RGB | _colorStringToRGB (const casacore::String &s) |
static casacore::Bool | _isRGB (const RGB &rgb) |
static void | _initTypeMap () |
static casacore::String | _printFreq (const casacore::Quantity &freq) |
Static Private Attributes | |
static casacore::Bool | _doneUnitInit |
static casacore::Bool | _doneColorInit |
static std::map < casacore::String, LineStyle > | _lineStyleMap |
static std::map < casacore::String, Type > | _typeMap |
static std::map< string, RGB > | _colors |
static std::map< RGB, string > | _rgbNameMap |
static std::list< std::string > | _colorNames |
static const casacore::String | _class |
Base class for annotations.
Public interface
Base class for annotations
In order to minimize maintainability, many parameters are not set in the constructor but can be set by mutator methods.
casacore::Input directions will be converted to the reference frame of the input coordinate system upon construction if necessary. The coordinate system specified in the constructor should be that associated with the image to which the region/annotation is being applied.
Definition at line 56 of file AnnotationBase.h.
using casa::AnnotationBase::Direction = casacore::Vector<std::pair<casacore::Quantity,casacore::Quantity> > |
The pairs have longitude as the first member and latitude as the second.
Definition at line 62 of file AnnotationBase.h.
using casa::AnnotationBase::RGB = std::vector<float> |
Definition at line 59 of file AnnotationBase.h.
Enumerator | |
---|---|
NORMAL | |
BOLD | |
ITALIC | |
ITALIC_BOLD |
Definition at line 112 of file AnnotationBase.h.
Enumerator | |
---|---|
COORD | |
RANGE | |
FRAME | |
CORR | |
VELTYPE | |
RESTFREQ | |
LINEWIDTH | |
LINESTYLE | |
SYMSIZE | |
SYMTHICK | |
COLOR | |
FONT | |
FONTSIZE | |
FONTSTYLE | |
USETEX | |
LABEL | |
LABELCOLOR | |
LABELPOS | |
LABELOFF | |
UNKNOWN_KEYWORD | |
N_KEYS |
Definition at line 81 of file AnnotationBase.h.
Enumerator | |
---|---|
SOLID | |
DASHED | |
DOT_DASHED | |
DOTTED |
Definition at line 105 of file AnnotationBase.h.
Enumerator | |
---|---|
LINE |
annotations only |
VECTOR | |
TEXT | |
SYMBOL | |
RECT_BOX |
regions |
CENTER_BOX | |
ROTATED_BOX | |
POLYGON | |
POLYLINE | |
CIRCLE | |
ANNULUS | |
ELLIPSE |
Definition at line 64 of file AnnotationBase.h.
|
virtual |
|
protected |
if freqRefFrame
or dopplerString
are empty, the values from the spectral coordinate of csys will be used, if one exists.
if restfreq=casacore::Quantity(0, "Hz") -> use the rest frequency associated with the coordinate system. The provided coordinate system should be that of the image to which the region/annotation is being applied.
|
protected |
use only if the frame of the input directions is the same as the frame of the coordinate system.
All frequencies are used.
|
protected |
|
private |
|
staticprotected |
|
staticprivate |
|
protected |
|
inlineprotected |
Definition at line 371 of file AnnotationBase.h.
References _directionAxes.
|
inlineprotected |
Definition at line 394 of file AnnotationBase.h.
References _directionRefFrame.
|
private |
|
staticprivate |
|
private |
|
staticprivate |
|
staticprivate |
|
protected |
direction to string, precision of 0.1 mas ra and dec in sexigesimal format, non-equatorial coords in degrees
|
staticprivate |
|
private |
|
protectedvirtual |
|
staticprotected |
return a string representing a pixel value, precision 1.
|
inlineprotected |
Definition at line 387 of file AnnotationBase.h.
References _params.
|
private |
|
staticprotected |
convert angle to arcsec, precision 0.1 mas
|
staticprotected |
convert angle to degrees, precision 0.1 mas
|
static |
Get a list of the user-friendly color names supported.
|
static |
|
static |
|
static |
RGB casa::AnnotationBase::getColor | ( | ) | const |
get the color associated with this object
casacore::String casa::AnnotationBase::getColorString | ( | ) | const |
returns the color name if it is recognized or its rgb hex string
|
inline |
same as getDirections, only returns proper MDirections
Definition at line 321 of file AnnotationBase.h.
References _convertedDirections.
|
inline |
get the coordinate system associated with this object.
This is the same coordinate system used to construct the object.
Definition at line 288 of file AnnotationBase.h.
References _csys.
Direction casa::AnnotationBase::getDirections | ( | ) | const |
DEPRECATED Please use getConvertedDirections() the pair elements have longitude as the first member and latitude as the second.
FIXME make this return of vector of MVDirections Returns the same angles as getConvertedDirections()
casacore::String casa::AnnotationBase::getFont | ( | ) | const |
casacore::uInt casa::AnnotationBase::getFontSize | ( | ) | const |
FontStyle casa::AnnotationBase::getFontStyle | ( | ) | const |
casacore::Vector<casacore::MFrequency> casa::AnnotationBase::getFrequencyLimits | ( | ) | const |
get the frequency limits converted to the spectral frame of the coordinate system of this object.
An empty casacore::Vector implies all applicable frequencies have been selected.
casacore::String casa::AnnotationBase::getLabel | ( | ) | const |
RGB casa::AnnotationBase::getLabelColor | ( | ) | const |
get the color associated with this object's label
casacore::String casa::AnnotationBase::getLabelColorString | ( | ) | const |
returns the color name if it is recognized or its rgb hex string
std::vector<casacore::Int> casa::AnnotationBase::getLabelOffset | ( | ) | const |
casacore::String casa::AnnotationBase::getLabelPosition | ( | ) | const |
returns one of top, bottom, left, or right.
LineStyle casa::AnnotationBase::getLineStyle | ( | ) | const |
casacore::uInt casa::AnnotationBase::getLineWidth | ( | ) | const |
casacore::Vector<casacore::Stokes::StokesTypes> casa::AnnotationBase::getStokes | ( | ) | const |
Get the stokes for which the selection applies.
An empty casacore::Vector implies all applicable stokes have been selected.
casacore::uInt casa::AnnotationBase::getSymbolSize | ( | ) | const |
casacore::uInt casa::AnnotationBase::getSymbolThickness | ( | ) | const |
Type casa::AnnotationBase::getType | ( | ) | const |
|
inlinevirtual |
is the object only an annotation? Can only be false if the object is a region
Reimplemented in casa::AnnRegion.
Definition at line 223 of file AnnotationBase.h.
|
virtual |
is the object a region?
Reimplemented in casa::AnnRegion.
casacore::Bool casa::AnnotationBase::isUseTex | ( | ) | const |
|
static |
|
static |
|
static |
|
protected |
assignment operator
|
pure virtual |
Implemented in casa::AnnEllipse, casa::AnnSymbol, casa::AnnAnnulus, casa::AnnRectBox, casa::AnnCircle, casa::AnnPolygon, casa::AnnPolyline, casa::AnnCenterBox, casa::AnnRotBox, casa::AnnLine, casa::AnnVector, and casa::AnnText.
Referenced by casa::operator<<().
|
static |
print a set of keyword value pairs
|
static |
print a line style representation
|
static |
print a font style representation
|
static |
void casa::AnnotationBase::setColor | ( | const casacore::String & | color | ) |
color
must either be a recognized color name or a valid rgb hex string, else an expection is thrown
void casa::AnnotationBase::setColor | ( | const RGB & | color | ) |
color must have three elements all with values between 0 and 255 inclusive or an exception is thrown.
void casa::AnnotationBase::setFont | ( | const casacore::String & | font | ) |
void casa::AnnotationBase::setFontSize | ( | const casacore::uInt | fontsize | ) |
void casa::AnnotationBase::setFontStyle | ( | const FontStyle & | fontstyle | ) |
|
virtual |
if freqRefFrame=="" -> use the reference frame of the coordinate system if dopplerString=="" -> use the doppler system associated with the coordinate system if restfreq=casacore::Quantity(0, "Hz") -> use the rest frequency associated with the coordinate system Tacitly does nothing if the coordinate system has no spectral axis.
Returns true if frequencies actually need to be set and were set.
Reimplemented in casa::AnnRegion.
void casa::AnnotationBase::setGlobals | ( | const casacore::Vector< Keyword > & | globalKeys | ) |
These parameters are included at the global scope.
Multiple runs on the same object are cumulative; if a key exists in the current settings but not in globalKeys
that key will still exist in the globals after setGlobals has run.
void casa::AnnotationBase::setLabel | ( | const casacore::String & | label | ) |
void casa::AnnotationBase::setLabelColor | ( | const casacore::String & | color | ) |
color
must either be a recognized color name or a valid rgb hex string, else an expection is thrown
void casa::AnnotationBase::setLabelColor | ( | const RGB & | color | ) |
color must have three elements all with values between 0 and 255 inclusive or an exception is thrown.
void casa::AnnotationBase::setLabelOffset | ( | const std::vector< casacore::Int > & | offset | ) |
offset
must have two elements
void casa::AnnotationBase::setLabelPosition | ( | const casacore::String & | position | ) |
position
must have a value in top, bottom, left, or right.
case is ignored.
void casa::AnnotationBase::setLineStyle | ( | const LineStyle | lineStyle | ) |
void casa::AnnotationBase::setLineWidth | ( | const casacore::uInt | linewidth | ) |
void casa::AnnotationBase::setSymbolSize | ( | const casacore::uInt | symbolsize | ) |
void casa::AnnotationBase::setSymbolThickness | ( | const casacore::uInt | symbolthickness | ) |
void casa::AnnotationBase::setUseTex | ( | const casacore::Bool | usetex | ) |
|
static |
Given a string, return the corresponding annotation type or throw an error if the string does not correspond to an allowed type.
|
static |
|
static |
set "pix" as valid unit.
This should be called externally before creating quantities which have pixel units.
|
private |
Definition at line 410 of file AnnotationBase.h.
|
staticprivate |
Definition at line 427 of file AnnotationBase.h.
|
private |
Definition at line 402 of file AnnotationBase.h.
|
staticprivate |
Definition at line 425 of file AnnotationBase.h.
|
staticprivate |
Definition at line 423 of file AnnotationBase.h.
|
private |
Definition at line 408 of file AnnotationBase.h.
Referenced by getConvertedDirections().
|
private |
Definition at line 409 of file AnnotationBase.h.
|
private |
Definition at line 399 of file AnnotationBase.h.
Referenced by getCsys().
|
private |
Definition at line 400 of file AnnotationBase.h.
Referenced by _getDirectionAxes().
|
private |
Definition at line 398 of file AnnotationBase.h.
Referenced by _getDirectionRefFrame().
|
staticprivate |
Definition at line 420 of file AnnotationBase.h.
|
staticprivate |
Definition at line 420 of file AnnotationBase.h.
|
private |
Definition at line 413 of file AnnotationBase.h.
|
private |
Definition at line 410 of file AnnotationBase.h.
|
private |
Definition at line 401 of file AnnotationBase.h.
|
private |
Definition at line 405 of file AnnotationBase.h.
|
private |
Definition at line 403 of file AnnotationBase.h.
|
private |
Definition at line 412 of file AnnotationBase.h.
|
private |
Definition at line 415 of file AnnotationBase.h.
|
private |
Definition at line 401 of file AnnotationBase.h.
|
private |
Definition at line 402 of file AnnotationBase.h.
|
private |
Definition at line 418 of file AnnotationBase.h.
|
private |
Definition at line 401 of file AnnotationBase.h.
|
private |
Definition at line 404 of file AnnotationBase.h.
|
staticprivate |
Definition at line 421 of file AnnotationBase.h.
|
private |
Definition at line 405 of file AnnotationBase.h.
|
private |
Definition at line 416 of file AnnotationBase.h.
Referenced by _setParam().
|
private |
Definition at line 417 of file AnnotationBase.h.
|
private |
Definition at line 410 of file AnnotationBase.h.
|
staticprivate |
Definition at line 424 of file AnnotationBase.h.
|
private |
Definition at line 411 of file AnnotationBase.h.
|
private |
Definition at line 405 of file AnnotationBase.h.
|
private |
Definition at line 405 of file AnnotationBase.h.
|
private |
Definition at line 397 of file AnnotationBase.h.
|
staticprivate |
Definition at line 422 of file AnnotationBase.h.
|
private |
Definition at line 407 of file AnnotationBase.h.
|
static |
Definition at line 119 of file AnnotationBase.h.
|
static |
Definition at line 120 of file AnnotationBase.h.
|
static |
Definition at line 121 of file AnnotationBase.h.
|
static |
Definition at line 131 of file AnnotationBase.h.
|
static |
Definition at line 136 of file AnnotationBase.h.
|
static |
Definition at line 137 of file AnnotationBase.h.
|
static |
Definition at line 138 of file AnnotationBase.h.
|
static |
Definition at line 130 of file AnnotationBase.h.
|
static |
Definition at line 140 of file AnnotationBase.h.
|
static |
Definition at line 142 of file AnnotationBase.h.
|
static |
Definition at line 141 of file AnnotationBase.h.
|
static |
Definition at line 132 of file AnnotationBase.h.
|
static |
Definition at line 133 of file AnnotationBase.h.
|
static |
Definition at line 134 of file AnnotationBase.h.
|
static |
Definition at line 135 of file AnnotationBase.h.
|
static |
Definition at line 139 of file AnnotationBase.h.
|
static |
Definition at line 122 of file AnnotationBase.h.
|
static |
Definition at line 123 of file AnnotationBase.h.
|
static |
Definition at line 124 of file AnnotationBase.h.
|
static |
Definition at line 125 of file AnnotationBase.h.
|
static |
Definition at line 126 of file AnnotationBase.h.
|
static |
Definition at line 144 of file AnnotationBase.h.
|
static |
Definition at line 127 of file AnnotationBase.h.
|
static |
Definition at line 128 of file AnnotationBase.h.