casa
$Rev:20696$
|
Base class describing interface for objects supported by DrawingDisplayData. More...
#include <DDDObject.h>
Public Types | |
enum | Mode { None, Handle, Move, Rotate } |
Public Member Functions | |
DDDObject (const Record &description, DrawingDisplayData *owner) | |
Constructor taking a Record description. | |
virtual | ~DDDObject () |
Destructor. | |
virtual void | draw (const Display::RefreshReason &reason, WorldCanvas *worldcanvas)=0 |
Draw this DrawingDisplayData object for the given reason on the provided WorldCanvas. | |
virtual void | showHandles (const Bool show, const Bool tellOwner=True) |
Indicate whether the object should show its handles or not. | |
virtual Bool | showingHandles () |
Query whether the object is showing its handles. | |
virtual Record | description () |
Return a record describing this object. | |
virtual void | setDescription (const Record &rec) |
Update this object based on the information in the provided Record. | |
virtual Bool | storeClick (const DisplayEvent &ev) |
Store a click in the buffer and look for a double-click event. | |
virtual void | clearClickBuffer () |
Clear the click buffer. | |
Int | objectID () const |
Return the unique id of this object. | |
virtual void | operator() (const WCRefreshEvent &ev)=0 |
Event handlers. | |
virtual void | operator() (const WCPositionEvent &ev)=0 |
Default just prints the event to cout. | |
virtual void | operator() (const WCMotionEvent &ev)=0 |
default sends event to cout | |
Protected Member Functions | |
DrawingDisplayData * | owner () |
String | color () const |
Return the color to use to draw this object. | |
String | label () const |
Return the label of this object. | |
Int | lineWidth () const |
Return the line width of this object. | |
Bool | isEditable () const |
Bool | isMovable () const |
Bool | isFixed () const |
DDDObject () | |
(Required) default constructor. | |
DDDObject (const DDDObject &other) | |
(Required) copy constructor. | |
void | operator= (const DDDObject &other) |
(Required) copy assignment. | |
void | translateMatrix (Matrix< Double > &points, Double dx, Double dy) |
Translate Matrix. | |
Matrix< Double > | rotateMatrix (const Matrix< Double > &points, Double angle) |
Rotate Matrix. | |
Bool | inPolygon (const Matrix< Double > &points, Double x, Double y) |
Is point inside the polygon. | |
Bool | inPolygon (const Vector< Double > &xP, const Vector< Double > &yP, Double x, Double y) |
void | convertCoordinateSystem (CoordinateSystem &cSys, WorldCanvas *wcPtr) const |
Convert CoordinateSystem to screen pixels. | |
Bool | onHandle (const Block< DDDHandle > &handles, Double x, Double y) |
Is the point on a handle. | |
Private Attributes | |
DrawingDisplayData * | itsOwner |
DrawingDisplayData which owns this DDDObject. | |
Bool | itsShowHandles |
Whether the handles are showing, and therefore whether this DDDObject is presently editable. | |
Bool | itsEditable |
Is this object editable. | |
Bool | itsMovable |
Is it movable. | |
Double | itsLastClickTime |
Timing for double clicks. | |
Double | its2ndLastClickTime |
String | itsColor |
Color of this object. | |
Int | itsLineWidth |
Line width of the lines drawn. | |
String | itsLabel |
Label for this object. | |
Int | itsObjectID |
Unique identification for this object. |
Base class describing interface for objects supported by DrawingDisplayData.
This class defines the interface which objects that are drawable by the DrawingDisplayData class must provide.
World units of 'pix' and 'frac' are defined. 'pix' units are in screen pixel units. They are not very useful once the display has been zoomed. 'frac' units have range [0,0] -> [1,1] mapping to the display part of the pixel canvas.
Definition at line 62 of file DDDObject.h.
Definition at line 67 of file DDDObject.h.
casa::DDDObject::DDDObject | ( | const Record & | description, |
DrawingDisplayData * | owner | ||
) |
Constructor taking a Record description.
Fields in the record are: color
and label
.
virtual casa::DDDObject::~DDDObject | ( | ) | [virtual] |
Destructor.
casa::DDDObject::DDDObject | ( | ) | [protected] |
(Required) default constructor.
casa::DDDObject::DDDObject | ( | const DDDObject & | other | ) | [protected] |
(Required) copy constructor.
virtual void casa::DDDObject::clearClickBuffer | ( | ) | [virtual] |
Clear the click buffer.
String casa::DDDObject::color | ( | ) | const [inline, protected] |
Return the color to use to draw this object.
Definition at line 133 of file DDDObject.h.
References itsColor.
void casa::DDDObject::convertCoordinateSystem | ( | CoordinateSystem & | cSys, |
WorldCanvas * | wcPtr | ||
) | const [protected] |
Convert CoordinateSystem to screen pixels.
virtual Record casa::DDDObject::description | ( | ) | [virtual] |
Return a record describing this object.
Reimplemented in casa::DDDEllipse, casa::DDDPolygon, and casa::DDDRectangle.
virtual void casa::DDDObject::draw | ( | const Display::RefreshReason & | reason, |
WorldCanvas * | worldcanvas | ||
) | [pure virtual] |
Draw this DrawingDisplayData object for the given reason on the provided WorldCanvas.
Implemented in casa::DDDEllipse, casa::DDDPolygon, and casa::DDDRectangle.
Is point inside the polygon.
Bool casa::DDDObject::inPolygon | ( | const Vector< Double > & | xP, |
const Vector< Double > & | yP, | ||
Double | x, | ||
Double | y | ||
) | [protected] |
Bool casa::DDDObject::isEditable | ( | ) | const [inline, protected] |
Definition at line 144 of file DDDObject.h.
References itsEditable.
Bool casa::DDDObject::isFixed | ( | ) | const [inline, protected] |
Definition at line 150 of file DDDObject.h.
References itsEditable, and itsMovable.
Bool casa::DDDObject::isMovable | ( | ) | const [inline, protected] |
Definition at line 147 of file DDDObject.h.
References itsMovable.
String casa::DDDObject::label | ( | ) | const [inline, protected] |
Int casa::DDDObject::lineWidth | ( | ) | const [inline, protected] |
Return the line width of this object.
Definition at line 141 of file DDDObject.h.
References itsLineWidth.
Int casa::DDDObject::objectID | ( | ) | const [inline] |
Return the unique id of this object.
Definition at line 115 of file DDDObject.h.
References itsObjectID.
Bool casa::DDDObject::onHandle | ( | const Block< DDDHandle > & | handles, |
Double | x, | ||
Double | y | ||
) | [protected] |
Is the point on a handle.
virtual void casa::DDDObject::operator() | ( | const WCRefreshEvent & | ev | ) | [pure virtual] |
Event handlers.
The parent DrawingDisplayData will distribute events as necessary to the various DDDObjects which comprise it.
Implements casa::WCRefreshEH.
Implemented in casa::DDDEllipse, casa::DDDPolygon, and casa::DDDRectangle.
virtual void casa::DDDObject::operator() | ( | const WCPositionEvent & | ev | ) | [pure virtual] |
Default just prints the event to cout.
Implements casa::WCPositionEH.
Implemented in casa::DDDEllipse, casa::DDDPolygon, and casa::DDDRectangle.
virtual void casa::DDDObject::operator() | ( | const WCMotionEvent & | ev | ) | [pure virtual] |
default sends event to cout
Implements casa::WCMotionEH.
Implemented in casa::DDDEllipse, casa::DDDPolygon, and casa::DDDRectangle.
void casa::DDDObject::operator= | ( | const DDDObject & | other | ) | [protected] |
(Required) copy assignment.
DrawingDisplayData* casa::DDDObject::owner | ( | ) | [inline, protected] |
Matrix<Double> casa::DDDObject::rotateMatrix | ( | const Matrix< Double > & | points, |
Double | angle | ||
) | [protected] |
Rotate Matrix.
virtual void casa::DDDObject::setDescription | ( | const Record & | rec | ) | [virtual] |
Update this object based on the information in the provided Record.
Reimplemented in casa::DDDEllipse, casa::DDDPolygon, and casa::DDDRectangle.
virtual void casa::DDDObject::showHandles | ( | const Bool | show, |
const Bool | tellOwner = True |
||
) | [virtual] |
Indicate whether the object should show its handles or not.
The parent DrawingDisplayData will control this, and either ask all DDDObjects to show their handles or not, via the user setting an option. This actually controls the state of whether this DDDObject is editable, so the parent DrawingDisplayData could also allow editing of only one DDDObject at a time.
virtual Bool casa::DDDObject::showingHandles | ( | ) | [inline, virtual] |
Query whether the object is showing its handles.
Definition at line 95 of file DDDObject.h.
References itsShowHandles.
virtual Bool casa::DDDObject::storeClick | ( | const DisplayEvent & | ev | ) | [virtual] |
Store a click in the buffer and look for a double-click event.
If one is found, then call the doubleClick function in the owning DisplayData. Returns True
if a double click was detected.
void casa::DDDObject::translateMatrix | ( | Matrix< Double > & | points, |
Double | dx, | ||
Double | dy | ||
) | [protected] |
Translate Matrix.
Double casa::DDDObject::its2ndLastClickTime [private] |
Definition at line 197 of file DDDObject.h.
String casa::DDDObject::itsColor [private] |
Bool casa::DDDObject::itsEditable [private] |
Is this object editable.
Definition at line 192 of file DDDObject.h.
Referenced by isEditable(), and isFixed().
String casa::DDDObject::itsLabel [private] |
Double casa::DDDObject::itsLastClickTime [private] |
Timing for double clicks.
Definition at line 197 of file DDDObject.h.
Int casa::DDDObject::itsLineWidth [private] |
Line width of the lines drawn.
Definition at line 203 of file DDDObject.h.
Referenced by lineWidth().
Bool casa::DDDObject::itsMovable [private] |
Is it movable.
Definition at line 194 of file DDDObject.h.
Referenced by isFixed(), and isMovable().
Int casa::DDDObject::itsObjectID [private] |
Unique identification for this object.
Definition at line 209 of file DDDObject.h.
Referenced by objectID().
DrawingDisplayData* casa::DDDObject::itsOwner [private] |
DrawingDisplayData which owns this DDDObject.
Definition at line 185 of file DDDObject.h.
Referenced by owner().
Bool casa::DDDObject::itsShowHandles [private] |
Whether the handles are showing, and therefore whether this DDDObject is presently editable.
Definition at line 189 of file DDDObject.h.
Referenced by showingHandles().