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

Base class describing interface for objects supported by DrawingDisplayData. More...

#include <DDDObject.h>

Inheritance diagram for casa::DDDObject:
casa::WCRefreshEH casa::WCMotionEH casa::WCPositionEH casa::DisplayEH casa::DDDEllipse casa::DDDPolygon casa::DDDRectangle

List of all members.

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

DrawingDisplayDataowner ()
 
   

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< DoublerotateMatrix (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

DrawingDisplayDataitsOwner
 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.

Detailed Description

Base class describing interface for objects supported by DrawingDisplayData.

Synopsis

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.


Member Enumeration Documentation

Enumerator:
None 
Handle 
Move 
Rotate 

Definition at line 67 of file DDDObject.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

Bool casa::DDDObject::inPolygon ( const Matrix< Double > &  points,
Double  x,
Double  y 
) [protected]

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]

Return the label of this object.

Definition at line 137 of file DDDObject.h.

References itsLabel.

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]

   

Return the owner of this object.

Definition at line 129 of file DDDObject.h.

References itsOwner.

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.


Member Data Documentation

Definition at line 197 of file DDDObject.h.

Color of this object.

Definition at line 200 of file DDDObject.h.

Referenced by color().

Is this object editable.

Definition at line 192 of file DDDObject.h.

Referenced by isEditable(), and isFixed().

Label for this object.

Definition at line 206 of file DDDObject.h.

Referenced by label().

Timing for double clicks.

Definition at line 197 of file DDDObject.h.

Line width of the lines drawn.

Definition at line 203 of file DDDObject.h.

Referenced by lineWidth().

Is it movable.

Definition at line 194 of file DDDObject.h.

Referenced by isFixed(), and isMovable().

Unique identification for this object.

Definition at line 209 of file DDDObject.h.

Referenced by objectID().

DrawingDisplayData which owns this DDDObject.

Definition at line 185 of file DDDObject.h.

Referenced by owner().

Whether the handles are showing, and therefore whether this DDDObject is presently editable.

Definition at line 189 of file DDDObject.h.

Referenced by showingHandles().


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