27 #ifndef REGIONSHAPE_H_
28 #define REGIONSHAPE_H_
113 double angle()
const;
294 static std::vector<LineStyle> v(3);
345 return std::vector<int>( );
403 virtual double xMin()
const;
404 virtual double xMax()
const;
405 virtual double yMin()
const;
406 virtual double yMax()
const;
548 virtual std::vector<casacore::String>
optionNames()
const = 0;
551 virtual std::vector<OptionType>
optionTypes()
const = 0;
556 return std::vector<std::vector<casacore::String> >();
670 linY(worldY.getValue().size());
683 std::vector<int>(),
false, error);
705 std::vector<int>(),
false, error);
virtual bool linethrough() const
Gets/sets this shape's linethrough properties.
A Vector of integers, for indexing into Array<T> objects.
static bool screenToLinear(const casacore::Vector< double > &screenX, const casacore::Vector< double > &screenY, casacore::Vector< double > &linearX, casacore::Vector< double > &linearY, WorldCanvasHolder &wch, casacore::String *error=NULL)
virtual void setCoordParameters(const std::vector< double > &vals)=0
Sets the coordinate parameter values to the given, in the same order as coordParameterValues().
void initDefaults()
Sets default values where needed for all member variables, EXCEPT m_isWorld and m_worldSystem.
virtual void getShapeSpecificProperties(casacore::Record &properties) const =0
Pure Virtual Methods //.
Assistance class for auto-caching of DisplayData objects.
virtual double xMin() const
Min/max methods for world/pixel coordinates.
CoordinateParameterType
Different types for coordinate parameters.
virtual std::vector< RSOption > optionValues() const =0
Returns the current values for options.
static const casacore::String PROPTEXT_COLOR
virtual LineStyle linethroughStyle() const
static const casacore::String PROPLINE_WIDTH
static const int DEFAULT_POINTSIZE
bool draw(WorldCanvasHolder &wch)
Checks whether the given WorldCanvasHolder has a direction coordinate.
void setBold(bool bold=true)
Sets whether the label's font is bold or not.
static const casacore::String PROPTEXT
static const LineStyle DEFAULT_STYLE
static const casacore::String UNIT
Static Members //.
void resetLineStyle(PixelCanvas *pc) const
Used for resetting the line style on the given PixelCanvas back to solid, in case future uses are exp...
static const casacore::String PROPWORLDSYSTEM
virtual void setLinethrough(bool linethrough, casacore::String color="red", double width=1, LineStyle style=SOLID)
A "handle" is a four-point structure (usually a rectangle) that describes the boundaries in screen pi...
static const casacore::String PROPOPTIONS
static casacore::String convLineStyle(LineStyle style)
Convert between line style enum and String.
virtual std::vector< casacore::String > optionNames() const =0
Returns the names for options.
virtual const RegionShapeLabel & label() const
Gets/sets this shape's label.
static const double UNIT_WRAPAROUND
Value used for wrapping negative/positive unit values.
bool isEmpty() const
Returns true if this label has empty text, false otherwise.
static const casacore::String PROPTYPE_MARKER
double angle() const
Returns this label's angle.
static const casacore::String PROPLINETHROUGH_STYLE
virtual double xMax() const
Display::DisplayDataType classType()
Implements PassiveCachingDD::classType.
DisplayDataType
WorldCanvasHolder - what type of DisplayData is this, need to know for drawing order.
Buffer for storing Attributes.
const casacore::String & text() const
Returns the text for this label.
bool m_lt
Linethrough properties.
const casacore::String & color() const
Returns the color for this label.
void setText(const casacore::String &text)
Sets this label's text to the given.
RegionShapeLabel m_label
Label.
bool isBold() const
Returns true if this label's font is bold, false otherwise.
bool m_hadDrawingError
For keeping track of drawing/conversion errors.
static const casacore::String PROPTYPE_TEXT
casacore::String dataType() const
Pure virtual function from DisplayData...
virtual std::vector< std::vector< casacore::String > > optionChoices() const
For options that are string choices, return the available choices.
void setAngle(double angle)
Sets the rotation angle to the given (in degrees).
std::string errorMessage() const
static const casacore::String PROPTYPE_CIRCLE
virtual casacore::MDirection::Types worldSystem() const
If this shape is in world coordinates, returns the system used.
static const casacore::String PROPTYPE_POLYGON
RegionShape()
Pixel Constructor.
bool linearToWorld(const casacore::Vector< double > &linearX, const casacore::Vector< double > &linearY, casacore::Quantum< casacore::Vector< double > > &worldX, casacore::Quantum< casacore::Vector< double > > &worldY, WorldCanvasHolder &wch, casacore::String *error=NULL) const
casacore::Bool drawIntoList(Display::RefreshReason reason, WorldCanvasHolder &wch)
Implementation of CachingDisplayMethod::drawIntoList.
virtual bool drawAndUpdateBoundingBox(WorldCanvasHolder &wch, casacore::String *error=NULL)=0
Pure Virtual Methods //.
virtual casacore::String type() const =0
Returns the name/type of this shape, for displaying to the user.
static const casacore::String PROPTYPE_ELLIPSE
bool linearToWorld(const casacore::Vector< double > &linearX, const casacore::Vector< double > &linearY, casacore::Quantum< casacore::Vector< double > > &worldX, casacore::Quantum< casacore::Vector< double > > &worldY, WorldCanvasHolder &wch, const std::vector< int > &xSign, const std::vector< int > &ySign, casacore::String *error=NULL) const
virtual std::vector< OptionType > optionTypes() const =0
Returns the types for options.
virtual double linethroughWidth() const
virtual bool hadDrawingError() const
Returns whether there was an error during the last call to draw() or not.
virtual void move(double dx, double dy, casacore::String system="")=0
Moves this shape the given delta x and delta y in the given system (empty for shape's native system)...
LineStyle
Different line styles.
virtual casacore::String oneWordType() const
Can be overridden by children.
virtual casacore::String linethroughColor() const
Base class defining interface to pixel-based output devices.
static bool linearToScreen(const casacore::Vector< double > &linearX, const casacore::Vector< double > &linearY, casacore::Vector< double > &screenX, casacore::Vector< double > &screenY, WorldCanvasHolder &wch, casacore::String *error=NULL)
virtual ~RegionShape()
Destructor.
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
void setFont(const casacore::String &font)
Sets this label's font family to the given.
virtual void setLabel(const RegionShapeLabel &label)
virtual double lineWidth() const
Gets/sets this shape's line width.
virtual double screenXMin() const
Bounding box methods.
casacore::MDirection::Types m_worldSystem
World system (undefined if m_isWorld is false).
double m_xMin
Bounding box, in world/pixel coords.
WorldCanvasHolder * m_lastWCH
Last seen WorldCanvasHolder.
static const casacore::String PROPTEXT_FONT
void setSize(int size)
Sets the label's font point size to the given.
Implementation of CachingDisplayMethod to be used by RegionShapes.
virtual void setOptionValues(const std::vector< RSOption > &options)=0
Sets the options to the given.
void setItalic(bool italic=true)
Sets whether the label's font is italic or not.
virtual void setText(const casacore::String &text)
virtual RSHandle getHandle() const =0
Returns a RSHandle (four points in screen coords that are like a bounding box for the shape) for this...
static const casacore::String PROPLINE_COLOR
static std::vector< LineStyle > allLineStyles()
Returns all available line styles.
bool draw(PixelCanvas *pc, int x, int y, bool bottom=false, casacore::String *error=NULL)
Draws itself on the given pixel canvas and returns whether the operation succeeded or not...
void setProperties(const casacore::RecordInterface &properties)
Sets this shape's properties from the given Record.
void setLineProperties(PixelCanvas *pc)
Common RegionShape Methods //.
virtual void setLineColor(const casacore::String &newColor, bool alsoSetLabel=true)
static const casacore::String PROPLINETHROUGH
static const casacore::String PROPTEXT_ITALIC
casacore::Record getProperties() const
Returns this shape's properties as a Record.
Base class for auto-caching DisplayData objects.
static const casacore::String PROPTYPE
virtual void setLineStyle(LineStyle style)
static bool pixelToWorld(const casacore::Vector< double > &pixelX, const casacore::Vector< double > &pixelY, casacore::Quantum< casacore::Vector< double > > &worldX, casacore::Quantum< casacore::Vector< double > > &worldY, WorldCanvasHolder &wch, casacore::MDirection::Types toSys, bool wrap=true, casacore::String *error=NULL)
double m_width
Line width.
void setColor(const casacore::String &color)
Sets the label's font color to the given.
virtual casacore::String lineColor() const
Common RegionShape methods //.
bool m_isWorld
Common RegionShape Members //.
virtual casacore::String text() const
Gets/sets this shape's label's text.
virtual double yMax() const
bool worldToLinear(const casacore::Quantum< casacore::Vector< double > > &worldX, const casacore::Quantum< casacore::Vector< double > > &worldY, casacore::Vector< double > &linearX, casacore::Vector< double > &linearY, WorldCanvasHolder &wch, bool wrap=true, casacore::String *error=NULL) const
static bool worldToPixel(const casacore::Quantum< casacore::Vector< double > > &worldX, const casacore::Quantum< casacore::Vector< double > > &worldY, casacore::Vector< double > &pixelX, casacore::Vector< double > &pixelY, WorldCanvasHolder &wch, casacore::MDirection::Types fromSys, bool wrap=true, casacore::String *error=NULL)
Converts the given coordinates between different systems, using the given WorldCanvas and world syste...
bool worldToPixel(const casacore::Quantum< casacore::Vector< double > > &worldX, const casacore::Quantum< casacore::Vector< double > > &worldY, casacore::Vector< double > &pixelX, casacore::Vector< double > &pixelY, WorldCanvasHolder &wch, bool wrap=true, casacore::String *error=NULL) const
Convenience access to RSUtils conversion methods.
static RegionShape * shapeFromRecord(const casacore::RecordInterface &properties, casacore::String &error)
Creates a record of the correct type from the given record (see RegionShape class description)...
static const casacore::String PROPLINETHROUGH_COLOR
CachingDisplayMethod * newDisplayMethod(WorldCanvas *wc, AttributeBuffer *wchAttr, AttributeBuffer *ddAttr, CachingDisplayData *dd)
Implements PassiveCachingDD::newDisplayMethod.
A hierarchical collection of named fields of various types.
bool Bool
Define the standard types used by Casacore.
bool screenToWorld(const casacore::Vector< double > &screenX, const casacore::Vector< double > &screenY, casacore::Quantum< casacore::Vector< double > > &worldX, casacore::Quantum< casacore::Vector< double > > &worldY, WorldCanvasHolder &wch, casacore::String *error=NULL) const
bool worldToScreen(const casacore::Quantum< casacore::Vector< double > > &worldX, const casacore::Quantum< casacore::Vector< double > > &worldY, casacore::Vector< double > &screenX, casacore::Vector< double > &screenY, WorldCanvasHolder &wch, bool wrap=true, casacore::String *error=NULL) const
virtual bool isWorld() const
Returns whether this shape's coordinates are in world or pixel.
const casacore::IPosition dataShape() const
Text label associated with a RegionShape.
int width(PixelCanvas *pc) const
Returns the result of pc->textWidth() after setting the font.
virtual std::vector< casacore::String > coordParameterNames() const =0
Returns the name for the coordinate parameters, in the same order as coordParameterValues().
Parent class for all RegionShapes.
virtual void setWorldSystem(casacore::MDirection::Types sys)
Set world system.
virtual void setIsWorld(bool isWorld)
Set world or pixel system.
virtual casacore::String title() const
Returns this shape's type (color + type).
Quantities (i.e. dimensioned values)
double m_screenXMin
Bounding box, in screen pixels.
Class providing passive behaviour for CachingDisplayDatas.
void setLinethroughProperties(PixelCanvas *pc)
Sets the linethrough properties (color, width, style) of this shape for the given PixelCanvas...
casacore::Record toRecord() const
Synonym.
LineStyle m_style
Line style.
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape...
casacore::String m_ltColor
virtual void setLineWidth(double width)
static const casacore::String DEFAULT_FONT
Static Members //.
RegionShapeDM(RegionShape &shape, WorldCanvas *wc, AttributeBuffer *wcAttr, AttributeBuffer *ddAttr, CachingDisplayData *dd)
Constructor that takes the RegionShape to draw, as well as the other parameters for the CachingDispla...
static const casacore::String PROPTEXT_SIZE
static const double DEFAULT_WIDTH
RefreshReason
Callback reasons for PCRefreshEvent and WCRefreshEvent.
static const casacore::String PROPTYPE_VECTOR
static const casacore::String PROPCOORDINATES
const casacore::String & font() const
Returns the font family for this label.
static bool worldToLinear(const casacore::Quantum< casacore::Vector< double > > &worldX, const casacore::Quantum< casacore::Vector< double > > &worldY, casacore::Vector< double > &linearX, casacore::Vector< double > &linearY, WorldCanvasHolder &wch, casacore::MDirection::Types fromSys, bool wrap=true, casacore::String *error=NULL)
int size() const
Returns the point size for this label.
A holder to interface between DisplayDatas and a WorldCanvas.
static const casacore::String PROPTYPE_COMPOSITE
casacore::String m_color
Line color.
Implementation of drawing in world coordinates on top of a PixelCanvas.
const casacore::String & lastDrawingError() const
Returns the error that occurred during the last call to draw().
static const casacore::String PROPTEXT_BOLD
static const casacore::String PROPISWORLD
Properties.
bool isItalic() const
Returns true if this label's font is italic, false otherwise.
casacore::String m_drawingError
virtual double screenXMax() const
String: the storage and methods of handling collections of characters.
~RegionShapeDM()
Destructor.
casacore::uInt dataDim() const
virtual double yMin() const
virtual std::vector< double > coordParameterValues() const =0
Returns the current values for the coordinate parameters.
virtual std::vector< CoordinateParameterType > coordParameterTypes() const =0
Returns a vector indicating the types of the coordinate parameters, in the same order as coordParamet...
const casacore::Unit dataUnit() const
PassiveCachingDD methods //.
OptionType
Different types for options.
Abstract base class for Record classes.
static const casacore::String DEFAULT_COLOR
Defaults.
static const casacore::String PROPTYPE_LINE
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the color(i.e.,"000000"for black) and
static bool linearToWorld(const casacore::Vector< double > &linearX, const casacore::Vector< double > &linearY, casacore::Quantum< casacore::Vector< double > > &worldX, casacore::Quantum< casacore::Vector< double > > &worldY, WorldCanvasHolder &wch, casacore::MDirection::Types toSys, const std::vector< int > &xSign, const std::vector< int > &ySign, bool wrap=true, casacore::String *error=NULL)
virtual void setShapeSpecificProperties(const casacore::RecordInterface &props)=0
Sets shape-specific properties from the given record.
virtual double screenYMax() const
virtual LineStyle lineStyle() const
Gets/sets this shape's line style.
static const casacore::String PROPLINE_STYLE
int height(PixelCanvas *pc) const
Returns the result of pc->textHeight() after setting the font.
bool screenToWorld(const casacore::Vector< double > &screenX, const casacore::Vector< double > &screenY, casacore::Quantum< casacore::Vector< double > > &worldX, casacore::Quantum< casacore::Vector< double > > &worldY, WorldCanvasHolder &wch, const std::vector< int > &xSign, const std::vector< int > &ySign, casacore::String *error=NULL) const
virtual double screenYMin() const
std::vector< int > displayAxes() const
~RegionShapeLabel()
Destructor.
bool pixelToWorld(const casacore::Vector< double > &pixelX, const casacore::Vector< double > &pixelY, casacore::Quantum< casacore::Vector< double > > &worldX, casacore::Quantum< casacore::Vector< double > > &worldY, WorldCanvasHolder &wch, bool wrap=true, casacore::String *error=NULL) const
RegionShapeLabel(casacore::String text="")
Constructor.
static const casacore::String PROPTYPE_RECTANGLE
static const casacore::String PROPLINETHROUGH_WIDTH