casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
casa::MultiPVTool Class Reference

Base class for MultiWorldCanvas event-based rectangle tools. More...

#include <MultiPVTool.h>

Inheritance diagram for casa::MultiPVTool:
casa::RegionTool casa::DTVisible casa::viewer::RegionCreator casa::MultiWCTool casa::DisplayTool casa::WCPositionEH casa::WCMotionEH casa::WCRefreshEH casa::DisplayEH casa::MultiPVToolImpl casa::QtPVToolRegion casa::QtPVTool

Public Member Functions

 MultiPVTool (viewer::RegionSourceFactory *rsf, PanelDisplay *pd, Display::KeySym keysym=Display::K_Pointer_Button1, const casacore::Bool persistent=false)
 Constructor. More...
 
virtual ~MultiPVTool ()
 Destructor. More...
 
virtual void disable ()
 Switch the tool off - this erases the rectangle, if any, and calls the base class disable. More...
 
virtual void reset (casacore::Bool skipRefresh=false)
 reset to non-existent, non-active rectangle. More...
 
virtual casacore::Bool rectangleDefined ()
 Is a rectangle currently defined? More...
 
viewer::RegionSourcegetRegionSource ()
 
void checkPoint (WorldCanvas *wc, State &state)
 this is a non-const function because a non-const RegionTool ptr is returned in 'state' which can then be used for setting the state of the regions managed by the various tools.... More...
 
void revokeRegion (viewer::Region *)
 called when the user (read GUI user) indicates that a region should be deleted... More...
 
const std::set
< viewer::region::RegionTypes > & 
regionsCreated () const
 returns a set which indicates regions this creator creates... More...
 
bool create (viewer::region::RegionTypes, WorldCanvas *, const std::vector< std::pair< double, double > > &, const std::string &, viewer::region::TextPosition, const std::vector< int > &, const std::string &, int, int, const std::string &, const std::string &, viewer::region::LineStyle, unsigned int, bool, VOID *)
 create regions of various types (e.g. More...
 
RegionToolTypes type () const
 
- Public Member Functions inherited from casa::RegionTool
 RegionTool (Display::KeySym keysym=Display::K_Pointer_Button1)
 Constructor taking the primary key to which this tool will respond. More...
 
 ~RegionTool ()
 
void otherKeyReleased (const WCPositionEvent &)
 
void enable ()
 DISPLAY_PURE_VIRTUAL(RegionTool::create,true);. More...
 
- Public Member Functions inherited from casa::MultiWCTool
 MultiWCTool (const Display::KeySym &keysym=Display::K_Pointer_Button1, bool enable_events=true)
 Constructor taking the primary key to which this tool will respond. More...
 
virtual ~MultiWCTool ()
 Destructor. More...
 
virtual void addWorldCanvas (WorldCanvas &worldcanvas)
 Add/remove a WorldCanvas from the control of this tool. More...
 
virtual void removeWorldCanvas (WorldCanvas &worldcanvas)
 
virtual void addWorldCanvases (PanelDisplay *pdisp)
 Add/Remove a list of WorldCanvases from PanelDisplay. More...
 
virtual void removeWorldCanvases (PanelDisplay *pdisp)
 
virtual void operator() (const WCPositionEvent &ev)
 Required operators for event handling - these are called when events occur, and distribute the events to the "user-level" methods. More...
 
virtual void operator() (const WCMotionEvent &ev)
 default sends event to cout More...
 
virtual void operator() (const WCRefreshEvent &ev)
 original handler interface (still used for WCRefreshEvents) More...
 
- Public Member Functions inherited from casa::DisplayTool
virtual ~DisplayTool ()
 Destructor. More...
 
virtual void setKey (const Display::KeySym &keysym)
 Set/get which key to catch. More...
 
virtual Display::KeySym getKey () const
 
- Public Member Functions inherited from casa::WCPositionEH
 WCPositionEH ()
 Default Constructor Required. More...
 
virtual ~WCPositionEH ()
 Destructor. More...
 
- Public Member Functions inherited from casa::WCMotionEH
 WCMotionEH ()
 Default Constructor Required. More...
 
virtual ~WCMotionEH ()
 Destructor. More...
 
- Public Member Functions inherited from casa::WCRefreshEH
 WCRefreshEH ()
 Default Constructor Required. More...
 
virtual ~WCRefreshEH ()
 Destructor. More...
 
- Public Member Functions inherited from casa::DisplayEH
virtual void handleEvent (DisplayEvent &)
 Classes that contain this interface (i.e., derive from it) can override this method to implement actions for whatever types of DisplayEvent they're interested in. More...
 
virtual ~DisplayEH ()
 
- Public Member Functions inherited from casa::DTVisible
 DTVisible ()
 Default constructor. More...
 
virtual ~DTVisible ()
 Destructor. More...
 
virtual casacore::String drawColor () const
 Return the color to use. More...
 
virtual casacore::Int lineWidth () const
 Return the line width to use. More...
 
virtual casacore::Double doubleClickInterval () const
 Return the double click interval (in seconds). More...
 
- Public Member Functions inherited from casa::viewer::RegionCreator
 RegionCreator ()
 DISPLAY_PURE_VIRTUAL(RegionCreator::create,true);. More...
 
virtual ~RegionCreator ()
 

Protected Member Functions

virtual void keyPressed (const WCPositionEvent &ev)
 Functions called by the base class event handling operators–and normally only those. More...
 
virtual void keyReleased (const WCPositionEvent &ev)
 
virtual void otherKeyPressed (const WCPositionEvent &ev)
 
virtual void moved (const WCMotionEvent &ev, const viewer::region::region_list_type &)
 
virtual void draw (const WCRefreshEvent &, const viewer::region::region_list_type &)
 draw the rectangle (if any) on the object's currently active WC. More...
 
virtual void doubleInside ()
 Output callback functions–to be overridden in derived class. More...
 
virtual void doubleOutside ()
 
virtual void rectangleReady ()
 Called when a rectangle is ready and not being edited. More...
 
virtual void get (casacore::Int &x1, casacore::Int &y1, casacore::Int &x2, casacore::Int &y2) const
 Retrieve the rectangle coordinates, in screen pixels. More...
 
virtual bool checkType (viewer::region::RegionTypes t)
 
virtual std::shared_ptr
< viewer::PVLine
allocate_region (WorldCanvas *wc, double x1, double y1, double x2, double y2, VOID *region_specific_state) const
 
- Protected Member Functions inherited from casa::MultiWCTool
virtual void updateRegion ()
 
virtual void clicked (casacore::Int, casacore::Int)
 
virtual void doubleClicked (casacore::Int, casacore::Int)
 
virtual void refresh ()
 Copy back-to-front buffer (erasing all MWCTool drawings), then cause this (and all MWCTools on current WC's PC) to draw (or not draw) themselves, according to their current state. More...
 
virtual void setClipToDrawArea ()
 Cause subsequent drawing commands to be clipped to the current WC (or its drawing area). More...
 
virtual void setClipToWC ()
 
virtual void resetClip ()
 
- Protected Member Functions inherited from casa::DisplayTool
 DisplayTool (const Display::KeySym &keysym=Display::K_Pointer_Button1)
 
Constructor taking a key to which this tool will initially be

attached, typically one of the pointer buttons. More...

 
 DisplayTool (const DisplayTool &other)
 Copy constructor - construct a new DisplayTool from other, using copy semantics. More...
 
DisplayTooloperator= (const DisplayTool &other)
 Copy assignment using copy semantics. More...
 
Display::KeyModifier keyModifiers ()
 Return the modifier mask. More...
 
- Protected Member Functions inherited from casa::DTVisible
 DTVisible (const DTVisible &other)
 (Required) copy constructor. More...
 
DTVisibleoperator= (const DTVisible &other)
 (Required) copy assignment. More...
 

Protected Attributes

viewer::RegionSourcerfactory
 
- Protected Attributes inherited from casa::MultiWCTool
WorldCanvasitsCurrentWC
 WC being (or to be) drawn on (may be 0 initially). More...
 

Private Types

typedef std::list
< std::shared_ptr
< viewer::PVLine > > 
pvlinelist
 

Private Member Functions

void update_stats (const WCMotionEvent &ev)
 
void start_new_rectangle (WorldCanvas *, int x, int y)
 
virtual void set (const casacore::Int &x1, const casacore::Int &y1, const casacore::Int &x2, const casacore::Int &y2)
 set the pixel coordinates of the rectangle More...
 
virtual void get (casacore::Int &x1, casacore::Int &y1) const
 get only the anchor point More...
 

Private Attributes

casacore::Bool itsPVLineExists
 do we have a rectangle yet? (if true, itsCurrentWC, itsEmitted, P1, and P2 are valid) More...
 
casacore::Bool itsActive
 was the button pressed in the rectangle (or, if none, in an active WC) and not yet released/reset? More...
 
std::shared_ptr< viewer::PVLineresizing_region
 itsActive is being replaced by resizing_region More...
 
std::shared_ptr< viewer::PVLinecreating_region
 
int resizing_region_handle
 
casacore::Bool itsMoving
 (valid only if itsActive==true): true = being moved false = being resized More...
 
pvlinelist moving_regions
 itsMoving is being replaced by moving_regions More...
 
double moving_linx_
 
double moving_liny_
 
casacore::Bool itsEmitted
 (valid only if itsPVLineExists==true) Has doubleInside/Outside been called for this rectangle? If so, a key press outside the rectangle will start a new rectangle, as if itsPVLineExists were false. More...
 
casacore::Vector
< casacore::Double
itsP1
 (Linear) coordinates of the rectangle (invariant over zooms, but not coordinate system changes. More...
 
casacore::Vector
< casacore::Double
itsP2
 
casacore::Vector< casacore::IntitsHX
 storage of the handle (pixel) coordinates More...
 
casacore::Vector< casacore::IntitsHY
 
casacore::Int itsBaseMoveX
 position that move started from More...
 
casacore::Int itsBaseMoveY
 
casacore::Double itsLastPressTime
 store the times of the last two presses here: More...
 
casacore::Double its2ndLastPressTime
 
pvlinelist rectangles
 
PanelDisplaypd_
 

Additional Inherited Members

- Public Types inherited from casa::RegionTool
enum  RegionToolTypes {
  POLYTOOL,
  RECTTOOL,
  POINTTOOL,
  ELLIPSETOOL,
  POLYLINETOOL,
  PVLINETOOL
}
 
typedef std::map
< viewer::Region
*, viewer::region::PointInfo
region_map_type
 
- Public Types inherited from casa::viewer::RegionCreator
typedef std::list
< RegionCreator * > 
creator_list_type
 
- Static Public Member Functions inherited from casa::viewer::RegionCreator
static const creator_list_typefindCreator (region::RegionTypes type)
 

Detailed Description

Base class for MultiWorldCanvas event-based rectangle tools.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

<prerequisites> WCTool </prerequisites>

Etymology

MultiPVTool stands for MultiWorldCanvas PVLine Tool

Synopsis

This class adds to its base WCTool to provide a tool for drawing, resizing and moving rectangles on a WorldCanvas. While MultiPVTool is not abstract, it performs no useful function. The programmer should derive from this class, and implement the functions doubleInside and doubleOutside, which are called when the user double-clicks the key or mouse button inside or outside an existing rectangle respectively. It is up to the programmer to decide what double clicks inside and outside the rectangle correspond to, although it is recommended that a double click inside correspond to the main action of the tool, and a double click outside correspond to a secondary action of the tool, if indeed a secondary action exists.

The rectangle is drawn by dragging the mouse from one corner to the diagonally opposite corner. Once constructed, the rectangle can be resized by dragging its corners, or relocated by dragging inside the rectangle. The rectangle is removed from the display when the Esc key is pressed.

Example

Motivation

Many activities on the WorldCanvas will be based on the user drawing a rectangle, and then proceeding to some action with that rectangle. A nice example is zooming.

Definition at line 92 of file MultiPVTool.h.

Member Typedef Documentation

typedef std::list<std::shared_ptr<viewer::PVLine> > casa::MultiPVTool::pvlinelist
private

Definition at line 185 of file MultiPVTool.h.

Constructor & Destructor Documentation

casa::MultiPVTool::MultiPVTool ( viewer::RegionSourceFactory rsf,
PanelDisplay pd,
Display::KeySym  keysym = Display::K_Pointer_Button1,
const casacore::Bool  persistent = false 
)

Constructor.

virtual casa::MultiPVTool::~MultiPVTool ( )
virtual

Destructor.

Member Function Documentation

virtual std::shared_ptr<viewer::PVLine> casa::MultiPVTool::allocate_region ( WorldCanvas wc,
double  x1,
double  y1,
double  x2,
double  y2,
VOID region_specific_state 
) const
protectedvirtual
void casa::MultiPVTool::checkPoint ( WorldCanvas wc,
State state 
)
virtual

this is a non-const function because a non-const RegionTool ptr is returned in 'state' which can then be used for setting the state of the regions managed by the various tools....

Implements casa::RegionTool.

virtual bool casa::MultiPVTool::checkType ( viewer::region::RegionTypes  t)
inlineprotectedvirtual

Definition at line 176 of file MultiPVTool.h.

References casa::viewer::region::PVLineRegion.

bool casa::MultiPVTool::create ( viewer::region::RegionTypes  ,
WorldCanvas ,
const std::vector< std::pair< double, double > > &  ,
const std::string &  ,
viewer::region::TextPosition  ,
const std::vector< int > &  ,
const std::string &  ,
int  ,
int  ,
const std::string &  ,
const std::string &  ,
viewer::region::LineStyle  ,
unsigned  int,
bool  ,
VOID  
)
virtual

create regions of various types (e.g.

point, rect, poly, etc.). For use when loading casa region files...

Implements casa::RegionTool.

virtual void casa::MultiPVTool::disable ( )
virtual

Switch the tool off - this erases the rectangle, if any, and calls the base class disable.

Reimplemented from casa::RegionTool.

virtual void casa::MultiPVTool::doubleInside ( )
inlineprotectedvirtual

Output callback functions–to be overridden in derived class.

Called when there is a double click inside/outside the rectangle

Reimplemented in casa::MultiPVToolImpl.

Definition at line 162 of file MultiPVTool.h.

virtual void casa::MultiPVTool::doubleOutside ( )
inlineprotectedvirtual

Definition at line 163 of file MultiPVTool.h.

virtual void casa::MultiPVTool::draw ( const WCRefreshEvent ,
const viewer::region::region_list_type  
)
protectedvirtual

draw the rectangle (if any) on the object's currently active WC.

Only to be called by the base class refresh event handler. Derived objects should use refresh() if they need to redraw, but even that is normally handled automatically.

Reimplemented from casa::RegionTool.

virtual void casa::MultiPVTool::get ( casacore::Int x1,
casacore::Int y1,
casacore::Int x2,
casacore::Int y2 
) const
protectedvirtual

Retrieve the rectangle coordinates, in screen pixels.

Anchor (if applicable) is (x1,y1). Valid during the output callbacks; to be used by them, as well as internally.

virtual void casa::MultiPVTool::get ( casacore::Int x1,
casacore::Int y1 
) const
privatevirtual

get only the anchor point

viewer::RegionSource* casa::MultiPVTool::getRegionSource ( )
inline

Definition at line 118 of file MultiPVTool.h.

References rfactory.

virtual void casa::MultiPVTool::keyPressed ( const WCPositionEvent ev)
protectedvirtual

Functions called by the base class event handling operators–and normally only those.

This is the input that controls the rectangle's appearance and action. When the rectangle is ready and double-click is received, the doubleInside/Outside routine will be invoked.

Reimplemented from casa::RegionTool.

virtual void casa::MultiPVTool::keyReleased ( const WCPositionEvent ev)
protectedvirtual

Reimplemented from casa::RegionTool.

virtual void casa::MultiPVTool::moved ( const WCMotionEvent ev,
const viewer::region::region_list_type  
)
protectedvirtual

Reimplemented from casa::RegionTool.

virtual void casa::MultiPVTool::otherKeyPressed ( const WCPositionEvent ev)
protectedvirtual

Reimplemented from casa::RegionTool.

virtual casacore::Bool casa::MultiPVTool::rectangleDefined ( )
inlinevirtual

Is a rectangle currently defined?

Definition at line 114 of file MultiPVTool.h.

References itsPVLineExists.

virtual void casa::MultiPVTool::rectangleReady ( )
inlineprotectedvirtual

Called when a rectangle is ready and not being edited.

(Unused so far on the glish level (12/01)).

Definition at line 168 of file MultiPVTool.h.

const std::set<viewer::region::RegionTypes>& casa::MultiPVTool::regionsCreated ( ) const
virtual

returns a set which indicates regions this creator creates...

Implements casa::viewer::RegionCreator.

virtual void casa::MultiPVTool::reset ( casacore::Bool  skipRefresh = false)
virtual

reset to non-existent, non-active rectangle.

Refreshes if necessary to erase (unless skipRefresh==true In that case, the caller should do the refresh itself). (Does not unregister from WCs or disable future event handling).

Reimplemented from casa::MultiWCTool.

void casa::MultiPVTool::revokeRegion ( viewer::Region )
virtual

called when the user (read GUI user) indicates that a region should be deleted...

Implements casa::RegionTool.

virtual void casa::MultiPVTool::set ( const casacore::Int x1,
const casacore::Int y1,
const casacore::Int x2,
const casacore::Int y2 
)
privatevirtual

set the pixel coordinates of the rectangle

void casa::MultiPVTool::start_new_rectangle ( WorldCanvas ,
int  x,
int  y 
)
private
RegionToolTypes casa::MultiPVTool::type ( ) const
inlinevirtual

Implements casa::RegionTool.

Definition at line 136 of file MultiPVTool.h.

References casa::RegionTool::PVLINETOOL.

void casa::MultiPVTool::update_stats ( const WCMotionEvent ev)
private

Member Data Documentation

std::shared_ptr<viewer::PVLine> casa::MultiPVTool::creating_region
private

Definition at line 204 of file MultiPVTool.h.

casacore::Double casa::MultiPVTool::its2ndLastPressTime
private

Definition at line 236 of file MultiPVTool.h.

casacore::Bool casa::MultiPVTool::itsActive
private

was the button pressed in the rectangle (or, if none, in an active WC) and not yet released/reset?

Definition at line 201 of file MultiPVTool.h.

casacore::Int casa::MultiPVTool::itsBaseMoveX
private

position that move started from

Definition at line 233 of file MultiPVTool.h.

casacore::Int casa::MultiPVTool::itsBaseMoveY
private

Definition at line 233 of file MultiPVTool.h.

casacore::Bool casa::MultiPVTool::itsEmitted
private

(valid only if itsPVLineExists==true) Has doubleInside/Outside been called for this rectangle? If so, a key press outside the rectangle will start a new rectangle, as if itsPVLineExists were false.

However, a key press inside the rectangle will reset itsEmitted to false, allowing the rectangle to be reused (possibly moved or resized, and emitted again).

Definition at line 222 of file MultiPVTool.h.

casacore::Vector<casacore::Int> casa::MultiPVTool::itsHX
private

storage of the handle (pixel) coordinates

Definition at line 230 of file MultiPVTool.h.

casacore::Vector<casacore::Int> casa::MultiPVTool::itsHY
private

Definition at line 230 of file MultiPVTool.h.

casacore::Double casa::MultiPVTool::itsLastPressTime
private

store the times of the last two presses here:

Definition at line 236 of file MultiPVTool.h.

casacore::Bool casa::MultiPVTool::itsMoving
private

(valid only if itsActive==true): true = being moved false = being resized

Definition at line 209 of file MultiPVTool.h.

casacore::Vector<casacore::Double> casa::MultiPVTool::itsP1
private

(Linear) coordinates of the rectangle (invariant over zooms, but not coordinate system changes.

To do: support the WorldCoordinateChange refresh reason, and reset this tool when it occurs).

Definition at line 227 of file MultiPVTool.h.

casacore::Vector<casacore::Double> casa::MultiPVTool::itsP2
private

Definition at line 227 of file MultiPVTool.h.

casacore::Bool casa::MultiPVTool::itsPVLineExists
private

do we have a rectangle yet? (if true, itsCurrentWC, itsEmitted, P1, and P2 are valid)

Definition at line 197 of file MultiPVTool.h.

Referenced by rectangleDefined().

double casa::MultiPVTool::moving_linx_
private

Definition at line 212 of file MultiPVTool.h.

double casa::MultiPVTool::moving_liny_
private

Definition at line 213 of file MultiPVTool.h.

pvlinelist casa::MultiPVTool::moving_regions
private

itsMoving is being replaced by moving_regions

Definition at line 211 of file MultiPVTool.h.

PanelDisplay* casa::MultiPVTool::pd_
private

Definition at line 239 of file MultiPVTool.h.

pvlinelist casa::MultiPVTool::rectangles
private

Definition at line 238 of file MultiPVTool.h.

std::shared_ptr<viewer::PVLine> casa::MultiPVTool::resizing_region
private

itsActive is being replaced by resizing_region

Definition at line 203 of file MultiPVTool.h.

int casa::MultiPVTool::resizing_region_handle
private

Definition at line 205 of file MultiPVTool.h.

viewer::RegionSource* casa::MultiPVTool::rfactory
protected

Definition at line 182 of file MultiPVTool.h.

Referenced by getRegionSource().


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