casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
casa::AnnotationBase Class Reference

Base class for annotations. More...

#include <AnnotationBase.h>

Inheritance diagram for casa::AnnotationBase:
casa::AnnLine casa::AnnRegion casa::AnnSymbol casa::AnnText casa::AnnVector casa::AnnAnnulus casa::AnnCenterBox casa::AnnCircle casa::AnnEllipse casa::AnnPolygon casa::AnnPolyline casa::AnnRectBox casa::AnnRotBox

List of all members.

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
}
typedef vector< float > RGB
typedef Vector< std::pair
< Quantity, Quantity > > 
Direction

Public Member Functions

virtual ~AnnotationBase ()
Type getType () const
void setLabel (const String &label)
String getLabel () const
void setColor (const String &color)
 color must either be a recognized color name or a valid rgb hex string, else an expection is thrown
void setColor (const RGB &color)
 color must have three elements all with values between 0 and 255 inclusive or an exception is thrown.
String getColorString () const
 returns the color name if it is recognized or its rgb hex string
RGB getColor () const
 get the color associated with this object
void setLineStyle (const LineStyle lineStyle)
LineStyle getLineStyle () const
void setLineWidth (const uInt linewidth)
uInt getLineWidth () const
void setSymbolSize (const uInt symbolsize)
uInt getSymbolSize () const
void setSymbolThickness (const uInt symbolthickness)
uInt getSymbolThickness () const
void setFont (const String &font)
String getFont () const
void setFontSize (const uInt fontsize)
uInt getFontSize () const
void setFontStyle (const FontStyle &fontstyle)
FontStyle getFontStyle () const
void setUseTex (const Bool usetex)
Bool isUseTex () const
virtual Bool isRegion () const
 is the object a region?
virtual Bool isAnnotationOnly () const
 is the object only an annotation? Can only be false if the object is a region
void setLabelColor (const String &color)
 color must either be a recognized color name or a valid rgb hex string, else an expection is thrown
void setLabelColor (const RGB &color)
 color must have three elements all with values between 0 and 255 inclusive or an exception is thrown.
String getLabelColorString () const
 returns the color name if it is recognized or its rgb hex string
RGB getLabelColor () const
 get the color associated with this object's label
String getLabelPosition () const
 returns one of top, bottom, left, or right.
void setLabelPosition (const String &position)
 position must have a value in top, bottom, left, or right.
void setLabelOffset (const vector< Int > &offset)
 offset must have two elements
vector< IntgetLabelOffset () const
virtual ostream & print (ostream &os) const =0
void setGlobals (const Vector< Keyword > &globalKeys)
 These parameters are included at the global scope.
const CoordinateSystemgetCsys () const
 get the coordinate system associated with this object.
Direction getDirections () const
Vector< MFrequencygetFrequencyLimits () const
 get the frequency limits converted to the spectral frame of the coordinate system of this object.
Vector< Stokes::StokesTypesgetStokes () const
 Get the stokes for which the selection applies.

Static Public Member Functions

static LineStyle lineStyleFromString (const String &ls)
static Type typeFromString (const String &type)
 Given a string, return the corresponding annotation type or throw an error if the string does not correspond to an allowed type.
static String typeToString (const Type type)
static String keywordToString (const Keyword key)
static String lineStyleToString (const LineStyle linestyle)
static FontStyle fontStyleFromString (const String &fs)
static String fontStyleToString (const FontStyle fs)
static String colorToString (const RGB &color)
static void unitInit ()
 set "pix" as valid unit.
static ostream & print (ostream &os, const map< Keyword, String > &params)
 print a set of keyword value pairs
static ostream & print (ostream &os, const LineStyle ls)
 print a line style representation
static ostream & print (ostream &os, const FontStyle fs)
 print a font style representation
static std::list< std::string > colorChoices ()
 Get a list of the user-friendly color names supported.

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 String DEFAULT_LABEL
static const RGB DEFAULT_COLOR
static const LineStyle DEFAULT_LINESTYLE
static const uInt DEFAULT_LINEWIDTH
static const uInt DEFAULT_SYMBOLSIZE
static const uInt DEFAULT_SYMBOLTHICKNESS
static const String DEFAULT_FONT
static const uInt DEFAULT_FONTSIZE
static const FontStyle DEFAULT_FONTSTYLE
static const Bool DEFAULT_USETEX
static const RGB DEFAULT_LABELCOLOR
static const String DEFAULT_LABELPOS
static const vector< IntDEFAULT_LABELOFF
static const boost::regex rgbHexRegex

Protected Member Functions

 AnnotationBase (const Type type, const String &dirRefFrameString, const CoordinateSystem &csys, const Quantity &beginFreq, const Quantity &endFreq, const String &freqRefFrame, const String &dopplerString, const Quantity &restfreq, const Vector< Stokes::StokesTypes > &stokes)
 AnnotationBase (const Type type, const CoordinateSystem &csys, const Vector< Stokes::StokesTypes > &stokes)
 use only if the frame of the input directions is the same as the frame of the coordinate system.
AnnotationBaseoperator= (const AnnotationBase &other)
 the implicitly defined copy constructor is fine AnnotationBase(const AnnotationBase& other);
MDirection _directionFromQuantities (const Quantity &q0, const Quantity &q1)
void _checkAndConvertDirections (const String &origin, const Direction &dirs)
virtual void _printPairs (ostream &os) const
const Vector< MDirection > & _getConvertedDirections () const
const IPosition_getDirectionAxes () const
String _printDirection (const Quantity &longitude, const Quantity &latitude) const
 direction to string, precision of 0.1 mas ra and dec in sexigesimal format, non-equatorial coords in degrees
void _setParam (const Keyword k, const String &s)
virtual Bool _setFrequencyLimits (const Quantity &beginFreq, const Quantity &endFreq, const String &freqRefFrame, const String &dopplerString, const 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=Quantity(0, "Hz") -> use the rest frequency associated with the coordinate system Tacitly does nothing if the coordinate system has no spectral axis.

Static Protected Member Functions

static void _checkMixed (const String &origin, const Direction &dirs)
static String _toArcsec (const Quantity &angle)
 convert angle to arcsec, precision 0.1 mas
static String _toDeg (const Quantity &angle)
 convert angle to degrees, precision 0.1 mas
static String _printPixel (const Double &d)
 return a string representing a pixel value, precision 1.

Private Member Functions

void _init ()
void _initParams ()
void _testConvertToPixel () const
void _checkAndConvertFrequencies ()
String _printFreqRange () const

Static Private Member Functions

static void _initColors ()
static RGB _colorStringToRGB (const String &s)
static Bool _isRGB (const RGB &rgb)
static void _initTypeMap ()
static String _printFreq (const Quantity &freq)

Private Attributes

Type _type
MDirection::Types _directionRefFrame
CoordinateSystem _csys
IPosition _directionAxes
String _label
String _font
String _labelPos
RGB _color
RGB _labelColor
FontStyle _fontstyle
LineStyle _linestyle
uInt _fontsize
uInt _linewidth
uInt _symbolsize
uInt _symbolthickness
Bool _usetex
Vector< MDirection_convertedDirections
Vector< MFrequency_convertedFreqLimits
Quantity _beginFreq
Quantity _endFreq
Quantity _restFreq
Vector< Stokes::StokesTypes_stokes
MFrequency::Types _freqRefFrame
MDoppler::Types _dopplerType
map< Keyword, Bool_globals
map< Keyword, String_params
Bool _printGlobals
vector< Int_labelOff
Direction _convertedDQs

Static Private Attributes

static Bool _doneUnitInit
static Bool _doneColorInit
static map< String, LineStyle_lineStyleMap
static map< String, Type_typeMap
static map< string, RGB_colors
static map< RGB, string > _rgbNameMap
static std::list< std::string > _colorNames
static const String _class

Detailed Description

Base class for annotations.

Intended use:

Public interface

 <h3>Review Status</h3><dl><dt>Date Reviewed:<dd>yyyy/mm/dd</dl> 

<h3>Synopsis</h3>
Base class for annotations

In order to minimize maintainability, many parameters are not
set in the constructor but can be set by mutator methods.

Input directions will be converted to the reference frame of the
input coordinate system upon construction if necessary.

Definition at line 56 of file AnnotationBase.h.


Member Typedef Documentation

Definition at line 61 of file AnnotationBase.h.

typedef vector<float> casa::AnnotationBase::RGB

Definition at line 59 of file AnnotationBase.h.


Member Enumeration Documentation

Enumerator:
NORMAL 
BOLD 
ITALIC 
ITALIC_BOLD 

Definition at line 111 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 80 of file AnnotationBase.h.

Enumerator:
SOLID 
DASHED 
DOT_DASHED 
DOTTED 

Definition at line 104 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 63 of file AnnotationBase.h.


Constructor & Destructor Documentation

casa::AnnotationBase::AnnotationBase ( const Type  type,
const String dirRefFrameString,
const CoordinateSystem csys,
const Quantity beginFreq,
const Quantity endFreq,
const String freqRefFrame,
const String dopplerString,
const Quantity restfreq,
const Vector< Stokes::StokesTypes > &  stokes 
) [protected]
casa::AnnotationBase::AnnotationBase ( const Type  type,
const CoordinateSystem csys,
const Vector< Stokes::StokesTypes > &  stokes 
) [protected]

use only if the frame of the input directions is the same as the frame of the coordinate system.

All frequencies are used.


Member Function Documentation

void casa::AnnotationBase::_checkAndConvertDirections ( const String origin,
const Direction dirs 
) [protected]
static void casa::AnnotationBase::_checkMixed ( const String origin,
const Direction dirs 
) [static, protected]
static RGB casa::AnnotationBase::_colorStringToRGB ( const String s) [static, private]
MDirection casa::AnnotationBase::_directionFromQuantities ( const Quantity q0,
const Quantity q1 
) [protected]
const Vector<MDirection>& casa::AnnotationBase::_getConvertedDirections ( ) const [inline, protected]

Definition at line 343 of file AnnotationBase.h.

References _convertedDirections.

const IPosition& casa::AnnotationBase::_getDirectionAxes ( ) const [inline, protected]

Definition at line 347 of file AnnotationBase.h.

References _directionAxes.

void casa::AnnotationBase::_init ( ) [private]
static void casa::AnnotationBase::_initColors ( ) [static, private]
static void casa::AnnotationBase::_initTypeMap ( ) [static, private]
static Bool casa::AnnotationBase::_isRGB ( const RGB rgb) [static, private]
String casa::AnnotationBase::_printDirection ( const Quantity longitude,
const Quantity latitude 
) const [protected]

direction to string, precision of 0.1 mas ra and dec in sexigesimal format, non-equatorial coords in degrees

static String casa::AnnotationBase::_printFreq ( const Quantity freq) [static, private]
virtual void casa::AnnotationBase::_printPairs ( ostream &  os) const [protected, virtual]
static String casa::AnnotationBase::_printPixel ( const Double d) [static, protected]

return a string representing a pixel value, precision 1.

virtual Bool casa::AnnotationBase::_setFrequencyLimits ( const Quantity beginFreq,
const Quantity endFreq,
const String freqRefFrame,
const String dopplerString,
const Quantity restfreq 
) [protected, virtual]

if freqRefFrame=="" -> use the reference frame of the coordinate system if dopplerString=="" -> use the doppler system associated with the coordinate system if restfreq=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::_setParam ( const Keyword  k,
const String s 
) [inline, protected]

Definition at line 363 of file AnnotationBase.h.

References _params.

static String casa::AnnotationBase::_toArcsec ( const Quantity angle) [static, protected]

convert angle to arcsec, precision 0.1 mas

static String casa::AnnotationBase::_toDeg ( const Quantity angle) [static, protected]

convert angle to degrees, precision 0.1 mas

static std::list<std::string> casa::AnnotationBase::colorChoices ( ) [static]

Get a list of the user-friendly color names supported.

static String casa::AnnotationBase::colorToString ( const RGB color) [static]

get the color associated with this object

returns the color name if it is recognized or its rgb hex string

get the coordinate system associated with this object.

This is the same coordinates system used to construct the object.

Definition at line 284 of file AnnotationBase.h.

References _csys.

Definition at line 288 of file AnnotationBase.h.

References _convertedDQs.

get the frequency limits converted to the spectral frame of the coordinate system of this object.

An empty Vector implies all applicable frequencies have been selected.

get the color associated with this object's label

returns the color name if it is recognized or its rgb hex string

returns one of top, bottom, left, or right.

Get the stokes for which the selection applies.

An empty Vector implies all applicable stokes have been selected.

virtual Bool casa::AnnotationBase::isAnnotationOnly ( ) const [inline, virtual]

is the object only an annotation? Can only be false if the object is a region

Reimplemented in casa::AnnRegion.

Definition at line 222 of file AnnotationBase.h.

References casa::True.

virtual Bool casa::AnnotationBase::isRegion ( ) const [virtual]

is the object a region?

Reimplemented in casa::AnnRegion.

static String casa::AnnotationBase::keywordToString ( const Keyword  key) [static]
static String casa::AnnotationBase::lineStyleToString ( const LineStyle  linestyle) [static]
AnnotationBase& casa::AnnotationBase::operator= ( const AnnotationBase other) [protected]

the implicitly defined copy constructor is fine AnnotationBase(const AnnotationBase& other);

assignment operator

virtual ostream& casa::AnnotationBase::print ( ostream &  os) const [pure virtual]
static ostream& casa::AnnotationBase::print ( ostream &  os,
const map< Keyword, String > &  params 
) [static]

print a set of keyword value pairs

static ostream& casa::AnnotationBase::print ( ostream &  os,
const LineStyle  ls 
) [static]

print a line style representation

static ostream& casa::AnnotationBase::print ( ostream &  os,
const FontStyle  fs 
) [static]

print a font style representation

void casa::AnnotationBase::setColor ( const 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 String font)
void casa::AnnotationBase::setFontSize ( const uInt  fontsize)
void casa::AnnotationBase::setFontStyle ( const FontStyle fontstyle)
void casa::AnnotationBase::setGlobals ( const 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 String label)

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 vector< Int > &  offset)

offset must have two elements

void casa::AnnotationBase::setLabelPosition ( const 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 uInt  linewidth)
void casa::AnnotationBase::setSymbolSize ( const uInt  symbolsize)
void casa::AnnotationBase::setSymbolThickness ( const uInt  symbolthickness)
void casa::AnnotationBase::setUseTex ( const Bool  usetex)
static Type casa::AnnotationBase::typeFromString ( const String type) [static]

Given a string, return the corresponding annotation type or throw an error if the string does not correspond to an allowed type.

static String casa::AnnotationBase::typeToString ( const Type  type) [static]
static void casa::AnnotationBase::unitInit ( ) [static]

set "pix" as valid unit.

This should be called externally before creating quantities which have pixel units.


Member Data Documentation

Definition at line 397 of file AnnotationBase.h.

const String casa::AnnotationBase::_class [static, private]

Reimplemented in casa::AnnRegion, and casa::AnnSymbol.

Definition at line 415 of file AnnotationBase.h.

Definition at line 389 of file AnnotationBase.h.

std::list<std::string> casa::AnnotationBase::_colorNames [static, private]

Definition at line 413 of file AnnotationBase.h.

map<string, RGB> casa::AnnotationBase::_colors [static, private]

Definition at line 411 of file AnnotationBase.h.

Definition at line 395 of file AnnotationBase.h.

Referenced by _getConvertedDirections().

Definition at line 406 of file AnnotationBase.h.

Referenced by getDirections().

Definition at line 396 of file AnnotationBase.h.

Definition at line 386 of file AnnotationBase.h.

Referenced by getCsys().

Definition at line 387 of file AnnotationBase.h.

Referenced by _getDirectionAxes().

Definition at line 385 of file AnnotationBase.h.

Definition at line 408 of file AnnotationBase.h.

Definition at line 408 of file AnnotationBase.h.

Definition at line 400 of file AnnotationBase.h.

Definition at line 397 of file AnnotationBase.h.

Definition at line 388 of file AnnotationBase.h.

Definition at line 392 of file AnnotationBase.h.

Definition at line 390 of file AnnotationBase.h.

Definition at line 399 of file AnnotationBase.h.

Definition at line 402 of file AnnotationBase.h.

Definition at line 388 of file AnnotationBase.h.

Definition at line 389 of file AnnotationBase.h.

Definition at line 405 of file AnnotationBase.h.

Definition at line 388 of file AnnotationBase.h.

Definition at line 391 of file AnnotationBase.h.

Definition at line 409 of file AnnotationBase.h.

Definition at line 392 of file AnnotationBase.h.

Definition at line 403 of file AnnotationBase.h.

Referenced by _setParam().

Definition at line 404 of file AnnotationBase.h.

Definition at line 397 of file AnnotationBase.h.

map<RGB, string> casa::AnnotationBase::_rgbNameMap [static, private]

Definition at line 412 of file AnnotationBase.h.

Definition at line 398 of file AnnotationBase.h.

Definition at line 392 of file AnnotationBase.h.

Definition at line 392 of file AnnotationBase.h.

Definition at line 384 of file AnnotationBase.h.

map<String, Type> casa::AnnotationBase::_typeMap [static, private]

Definition at line 410 of file AnnotationBase.h.

Definition at line 394 of file AnnotationBase.h.

Definition at line 118 of file AnnotationBase.h.

Definition at line 119 of file AnnotationBase.h.

Definition at line 120 of file AnnotationBase.h.

Definition at line 130 of file AnnotationBase.h.

Definition at line 135 of file AnnotationBase.h.

Definition at line 136 of file AnnotationBase.h.

Definition at line 137 of file AnnotationBase.h.

Definition at line 129 of file AnnotationBase.h.

Definition at line 139 of file AnnotationBase.h.

Definition at line 141 of file AnnotationBase.h.

Definition at line 140 of file AnnotationBase.h.

Definition at line 131 of file AnnotationBase.h.

Definition at line 132 of file AnnotationBase.h.

Definition at line 133 of file AnnotationBase.h.

Definition at line 134 of file AnnotationBase.h.

Definition at line 138 of file AnnotationBase.h.

Definition at line 121 of file AnnotationBase.h.

Definition at line 122 of file AnnotationBase.h.

Definition at line 123 of file AnnotationBase.h.

Definition at line 124 of file AnnotationBase.h.

Definition at line 125 of file AnnotationBase.h.

const boost::regex casa::AnnotationBase::rgbHexRegex [static]

Definition at line 143 of file AnnotationBase.h.

Definition at line 126 of file AnnotationBase.h.

Definition at line 127 of file AnnotationBase.h.


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