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

#include <Polygon.h>

Inheritance diagram for casa::viewer::Polygon:
casa::viewer::Region casa::viewer::dtorNotifier

Public Types

typedef std::pair< double, double > pt
 
typedef std::vector< ptpoint_list
 

Public Member Functions

 Polygon (WorldCanvas *wc, QtRegionDock *d, double x1, double y1)
 
 Polygon (WorldCanvas *wc, QtRegionDock *d, const std::vector< std::pair< double, double > > &pts)
 
 Polygon (QtRegionSourceKernel *, WorldCanvas *wc, const std::vector< std::pair< double, double > > &pts, bool hold_signals=false)
 carry over from QtRegion... More...
 
 Polygon (QtRegionSourceKernel *rs, WorldCanvas *wc, double x1, double y1, bool hold_signals=false)
 
 ~Polygon ()
 
bool clickWithin (double x, double y) const
 
int clickHandle (double x, double y) const
 
int moveHandle (int handle, double x, double y)
 for rectangles, resizing can change the handle... More...
 
void move (double dx, double dy)
 
void resize (double, double)
 
bool valid_translation (double dx, double dy, double width_delta, double height_delta)
 
region::PointInfo checkPoint (double x, double y) const
 returns point state (Region::PointLocation) More...
 
unsigned int mouseMovement (double x, double y, bool other_selected)
 returns mouse state (Region::MouseState) More...
 
void linearCenter (double &x, double &y) const
 
void pixelCenter (double &x, double &y) const
 
void closeFigure (bool signal_complete=true)
 
void polygonComplete ()
 
void addVertex (double x, double y, bool rewrite_last_point=false)
 
AnnotationBaseannotation () const
 
void boundingRectangle (double &blcx, double &blcy, double &trcx, double &trcy) const
 return the drawing bounding rectangle... More...
 
int numVertices () const
 
void output (ds9writer &out) const
 
region::RegionTypes type () const
 fetch region type... More...
 
- Public Member Functions inherited from casa::viewer::Region
const std::string name () const
 user specified name More...
 
std::string lineColor () const
 
std::string centerColor () const
 
int lineWidth () const
 
region::LineStyle lineStyle () const
 
std::string textColor () const
 
std::string textFont () const
 
int textFontSize () const
 
int textFontStyle () const
 
std::string textValue () const
 
region::TextPosition textPosition () const
 
void textPositionDelta (int &x, int &y) const
 
virtual void setLabel (const std::string &l)
 
virtual void setLabelPosition (region::TextPosition)
 
virtual void setLabelDelta (const std::vector< int > &)
 
virtual void setFont (const std::string &font="", int font_size=-1, int font_style=0, const std::string &font_color="")
 
virtual void setLine (const std::string &line_color="", region::LineStyle line_style=region::SolidLine, unsigned int line_width=1)
 
virtual void setAnnotation (bool)
 
void getCoordinatesAndUnits (region::Coord &c, region::Units &x_units, region::Units &y_units, std::string &width_height_units) const
 
void getPositionString (std::string &x, std::string &y, std::string &angle, double &bounding_width, double &bounding_height, region::Coord coord=region::DefaultCoord, region::Units x_units=region::DefaultUnits, region::Units y_units=region::DefaultUnits, const std::string &bounding_units="rad") const
 
bool translateX (const std::string &, const std::string &, const std::string &)
 
bool translateY (const std::string &, const std::string &, const std::string &)
 
bool resizeX (const std::string &, const std::string &, const std::string &)
 
bool resizeY (const std::string &, const std::string &, const std::string &)
 
int numFrames () const
 
void zRange (int &x, int &y) const
 
int zIndex () const
 
bool regionVisible () const
 
bool worldBoundingRectangle (double &, double &, const std::string &) const
 
virtual ~Region ()
 
 Region ()
 
 Region (const std::string &name, WorldCanvas *wc, QtRegionDock *, bool hold_signals_=false, QtRegionState *supplied_state=0, QtMouseToolNames::PointRegionSymbols sym=QtMouseToolNames::SYM_UNKNOWN)
 
virtual bool degenerate () const
 is this region degenerate? More...
 
void setDrawingEnv ()
 
void resetDrawingEnv ()
 
void setTextEnv ()
 
void resetTextEnv ()
 
void pushDrawingEnv (region::LineStyle ls, int thickness=-1)
 
void popDrawingEnv ()
 
void setDrawCenter (bool draw_center)
 
bool getDrawCenter ()
 
void refresh ()
 duplicate of MultiWCTool::refresh() More...
 
void invalidateCenterInfo ()
 indicates that the center info is no longer valid More...
 
bool selected () const
 
virtual bool weaklySelected () const
 is this region weakly or temporarily selected? More...
 
virtual void weaklySelect (bool scroll_dock=true)
 
virtual void weaklyUnselect ()
 weaklyUnselectLimited() plus extra processing... More...
 
virtual void weaklyUnselectLimited ()
 just unmark this region (called from RegionToolManager); do not do the rest of the reorganization that weaklyUnselect() does... More...
 
virtual void selectedInCanvas ()
 indicates that the user has selected this rectangle... More...
 
virtual void mark (bool set=true)
 functions added with the introduction of RegionToolManager and the unified selection and manipulation of the various region types... More...
 
virtual bool marked () const
 
virtual bool mark_toggle ()
 returns the new state... More...
 
size_t selected_region_count ()
 
size_t marked_region_count ()
 
void clearMouseInRegion ()
 
virtual void status (const std::string &msg, const std::string &type="info")
 update status information... More...
 
virtual bool markCenter () const
 
virtual bool skyComponent () const
 
void holdSignals ()
 postpone signal processing (important for signals generated during construction)... More...
 
virtual void releaseSignals ()
 
virtual std::list
< std::shared_ptr< RegionInfo > > * 
statistics ()
 
int getId () const
 Histogram functionality. More...
 
casacore::ImageRegiongetImageRegion (DisplayData *dd) const
 
QtRegionStatestate ()
 DISPLAY_PURE_VIRTUAL(Region::pixelCenter,);. More...
 
int markerScale () const
 how much to scale the symbol used to mark point regions... More...
 
void setMarkerScale (int v)
 
void updateStateInfo (bool region_modified, region::RegionChanges)
 indicates that region movement requires the update of state information... More...
 
void refresh_state_gui ()
 
void clearStatistics ()
 blank out the statistics for this region More...
 
void statisticsUpdateNeeded ()
 
int & colorIndex ()
 used to synchronize the default color for all of the RegionDock's RegionState objects... More...
 
std::pair< int, int > & tabState ()
 used to synchronize all of the RegionDock's RegionState tab configuration... More...
 
std::map< std::string, int > & coordState ()
 used to synchronize all of the RegionDock's RegionState coordinate configuration... More...
 
void selectedCountUpdateNeeded ()
 forward state update information to the dock wherere a count of selected regions, information is maintained. More...
 
QString getSaveDir ()
 used to synchronize all region directories per QtDisplayPanelGUI... More...
 
void putSaveDir (QString)
 
QString getLoadDir ()
 
void putLoadDir (QString)
 
virtual bool setMarker (QtMouseToolNames::PointRegionSymbols)
 
- Public Member Functions inherited from casa::viewer::dtorNotifier
 dtorNotifier ()
 
 ~dtorNotifier ()
 signals any dtorNotifiee's that are registered More...
 
void addNotifiee (dtorNotifiee *)
 
void removeNotifiee (dtorNotifiee *)
 

Protected Types

enum  YScaleTo {
  ScaleTop,
  ScaleBottom
}
 
enum  XScaleTo {
  ScaleLeft,
  ScaleRight
}
 
enum  Tranformations {
  FLIP_X,
  FLIP_Y
}
 
- Protected Types inherited from casa::viewer::Region
typedef std::pair
< region::LineStyle, int > 
ls_ele
 

Protected Member Functions

unsigned int check_handle (double x, double y) const
 
std::list< std::shared_ptr
< RegionInfo > > * 
generate_dds_centers ()
 
casacore::ImageRegionget_image_region (DisplayData *) const
 
void drawRegion (bool)
 
virtual void fetch_region_details (region::RegionTypes &type, std::vector< std::pair< int, int > > &pixel_pts, std::vector< std::pair< double, double > > &world_pts) const
 
const point_listdrawing_points () const
 
- Protected Member Functions inherited from casa::viewer::Region
void fetch_details (region::RegionTypes &type, QList< int > &pixelx, QList< int > &pixely, QList< double > &worldx, QList< double > &worldy)
 
void signal_region_change (region::RegionChanges)
 
void initHistogram ()
 -----------------—==================== from old QtRegion ====================-----------------— More...
 
virtual std::list
< std::shared_ptr< RegionInfo > > * 
generate_dds_statistics ()
 
virtual void generate_nonimage_statistics (DisplayData *, std::list< std::shared_ptr< RegionInfo > > *)
 hook to allow generate_dds_statistics() to generate statistics for rectangular measurement set regions... More...
 
virtual RegionInfonewInfoObject (casacore::ImageInterface< float > *, PrincipalAxesDD *)
 newInfoObject(...) is currently only used for PVLine regions, but it should be used for other regions to allow for specialized creation of the region info objects for display in "statistics"... More...
 
virtual ImageRegion_state get_image_selected_region (DisplayData *)
 
double linear_average (double a, double b) const
 
RegionInfo::center_tgetLayerCenter (PrincipalAxesDD *padd, std::shared_ptr< casacore::ImageInterface< float > > image, casacore::ImageRegion &imgReg)
 
RegionInfo::stats_tgetLayerStats (PrincipalAxesDD *padd, casacore::ImageInterface< float > *image, casacore::ImageRegion &imgReg)
 
region::Units current_xunits () const
 
region::Units current_yunits () const
 
region::Coord current_region_coordsys () const
 
casacore::MDirection::Types current_casa_coordsys () const
 
virtual void drawText ()
 
virtual void drawCenter (double &x, double &y, double &deltx, double &delty)
 
virtual bool within_drawing_area ()
 

Private Member Functions

bool within_vertex_handle (double x, double y) const
 
int move_sizing_rectangle_handle (int handle, double x, double y)
 
int move_vertex (int handle, double x, double y)
 
void update_drawing_bounds_rectangle ()
 
void update_reference_bounds_rectangle ()
 
void update_drawing_state ()
 
void update_reference_state (int transformations, int handle, int new_handle)
 
virtual void setCenter (double &x, double &y, double &deltx, double &delty)
 

Private Attributes

double handle_delta_x
 
double handle_delta_y
 
point_list _ref_points_
 
double _ref_blc_x_
 
double _ref_blc_y_
 
double _ref_trc_x_
 
double _ref_trc_y_
 
double _ref_width_
 
double _ref_height_
 
point_list _drawing_points_
 
double _drawing_blc_x_
 
double _drawing_blc_y_
 
double _drawing_trc_x_
 
double _drawing_trc_y_
 
double _drawing_width_
 
double _drawing_height_
 
double _center_x
 
double _center_y
 
double _center_delta_x
 
double _center_delta_y
 
XScaleTo _x_origin_
 
YScaleTo _y_origin_
 

Additional Inherited Members

- Signals inherited from casa::viewer::Region
void selectionChanged (viewer::Region *, bool)
 
void regionCreated (int, const QString &shape, const QString &name, const QList< double > &world_x, const QList< double > &world_y, const QList< int > &pixel_x, const QList< int > &pixel_y, const QString &linecolor, const QString &text, const QString &font, int fontsize, int fontstyle)
 
void regionUpdate (int, viewer::region::RegionChanges, const QList< double > &world_x, const QList< double > &world_y, const QList< int > &pixel_x, const QList< int > &pixel_y)
 
void regionChange (viewer::Region *, std::string)
 
void regionUpdateResponse (int, const QString &shape, const QString &name, const QList< double > &world_x, const QList< double > &world_y, const QList< int > &pixel_x, const QList< int > &pixel_y, const QString &linecolor, const QString &text, const QString &font, int fontsize, int fontstyle)
 generated by emitUpdate()... More...
 
void showHistogramTool ()
 
- Static Public Member Functions inherited from casa::viewer::Region
static bool refreshNeeded (int v)
 functions to query results from mouse functions... More...
 
static bool regionSelected (int v)
 
static bool handleSelected (int v)
 
static std::shared_ptr
< viewer::Region
creatingRegion ()
 called when creating regions to allow suppression of corner-handle drawing... More...
 
static void creatingRegionBegin (std::shared_ptr< viewer::Region > r)
 
static void creatingRegionEnd ()
 
- Public Attributes inherited from casa::viewer::Region
virtual void boundingRectangle(double
&, double &, double &, double
&) const DISPLAY_PURE_VIRTUAL(Region
void 
emitUpdate ()
 in "linear" coordinates... More...
 
- Protected Slots inherited from casa::viewer::Region
void refresh_canvas_event ()
 
void refresh_statistics_event (bool)
 
void refresh_position_event (bool)
 
void translate_x (const QString &, const QString &, const QString &)
 
void translate_y (const QString &, const QString &, const QString &)
 
void resize_x (const QString &, const QString &, const QString &)
 
void resize_y (const QString &, const QString &, const QString &)
 
void updateCenterInfo ()
 
void adjustCorners (double, double, double, double)
 
void refresh_zrange_event (int, int)
 
void revoke_region ()
 revoke... More...
 
void revoke_region (QtRegionState *)
 revoke if our state matches parameter... More...
 
void reload_statistics_event ()
 
void output (std::list< QtRegionState * >, RegionTextList &)
 
void output (std::list< QtRegionState * >, ds9writer &)
 
- Static Protected Member Functions inherited from casa::viewer::Region
static int getAxisIndex (casacore::ImageInterface< float > *image, std::string axtype)
 
- Protected Attributes inherited from casa::viewer::Region
QtRegionDockdock_
 
QtRegionStatemystate
 
HistogramTabhistogram
 
bool statistics_update_needed
 
bool position_visible
 
bool position_update_needed
 
int id_
 
bool statistics_visible
 
int hold_signals
 
std::map
< region::RegionChanges, bool > 
held_signals
 
virtual casacore::ImageRegion
*virtual get_image_region(DisplayData
*) const DISPLAY_PURE_VIRTUAL(Region
const std::set< Region * > 
get_selected_regions )()
 
virtual void virtual setCenter(double
&, double &, double &, double
&) DISPLAY_PURE_VIRTUAL(Region
void 
drawCenter (double &x, double &y)
 
region::LineStyle current_ls
 
std::list< ls_elels_stack
 
WorldCanvaswc_
 
int last_z_index
 
bool selected_
 
bool visible_
 
bool complete
 Should this region be considered complete? Set to true by derived classes... More...
 
bool mouse_in_region
 Derived classes set this to true and clear it when the mouse enters and exits this regions bounding box... More...
 
- Static Protected Attributes inherited from casa::viewer::Region
static const int SEXAGPREC
 
static std::shared_ptr< Regioncreating_region
 Holds a pointer to the region currently being created... More...
 

Detailed Description

Definition at line 47 of file Polygon.h.

Member Typedef Documentation

typedef std::vector<pt> casa::viewer::Polygon::point_list

Definition at line 50 of file Polygon.h.

typedef std::pair<double,double> casa::viewer::Polygon::pt

Definition at line 49 of file Polygon.h.

Member Enumeration Documentation

Enumerator
FLIP_X 
FLIP_Y 

Definition at line 109 of file Polygon.h.

Enumerator
ScaleLeft 
ScaleRight 

Definition at line 108 of file Polygon.h.

Enumerator
ScaleTop 
ScaleBottom 

Definition at line 107 of file Polygon.h.

Constructor & Destructor Documentation

casa::viewer::Polygon::Polygon ( WorldCanvas wc,
QtRegionDock d,
double  x1,
double  y1 
)
casa::viewer::Polygon::Polygon ( WorldCanvas wc,
QtRegionDock d,
const std::vector< std::pair< double, double > > &  pts 
)
casa::viewer::Polygon::Polygon ( QtRegionSourceKernel ,
WorldCanvas wc,
const std::vector< std::pair< double, double > > &  pts,
bool  hold_signals = false 
)

carry over from QtRegion...

hopefully, removed soon...

casa::viewer::Polygon::Polygon ( QtRegionSourceKernel rs,
WorldCanvas wc,
double  x1,
double  y1,
bool  hold_signals = false 
)
casa::viewer::Polygon::~Polygon ( )
inline

Definition at line 62 of file Polygon.h.

Member Function Documentation

void casa::viewer::Polygon::addVertex ( double  x,
double  y,
bool  rewrite_last_point = false 
)
AnnotationBase* casa::viewer::Polygon::annotation ( ) const
void casa::viewer::Polygon::boundingRectangle ( double &  blcx,
double &  blcy,
double &  trcx,
double &  trcy 
) const

return the drawing bounding rectangle...

in "linear" coordinates...

unsigned int casa::viewer::Polygon::check_handle ( double  x,
double  y 
) const
protected
region::PointInfo casa::viewer::Polygon::checkPoint ( double  x,
double  y 
) const
virtual

returns point state (Region::PointLocation)

Implements casa::viewer::Region.

int casa::viewer::Polygon::clickHandle ( double  x,
double  y 
) const
bool casa::viewer::Polygon::clickWithin ( double  x,
double  y 
) const
void casa::viewer::Polygon::closeFigure ( bool  signal_complete = true)
const point_list& casa::viewer::Polygon::drawing_points ( ) const
inlineprotected

Definition at line 118 of file Polygon.h.

References _drawing_points_.

Referenced by numVertices().

void casa::viewer::Polygon::drawRegion ( bool  )
protectedvirtual

Implements casa::viewer::Region.

virtual void casa::viewer::Polygon::fetch_region_details ( region::RegionTypes type,
std::vector< std::pair< int, int > > &  pixel_pts,
std::vector< std::pair< double, double > > &  world_pts 
) const
protectedvirtual

Reimplemented from casa::viewer::Region.

std::list<std::shared_ptr<RegionInfo> >* casa::viewer::Polygon::generate_dds_centers ( )
protectedvirtual

Implements casa::viewer::Region.

casacore::ImageRegion* casa::viewer::Polygon::get_image_region ( DisplayData ) const
protected
void casa::viewer::Polygon::linearCenter ( double &  x,
double &  y 
) const
unsigned int casa::viewer::Polygon::mouseMovement ( double  x,
double  y,
bool  other_selected 
)

returns mouse state (Region::MouseState)

void casa::viewer::Polygon::move ( double  dx,
double  dy 
)
int casa::viewer::Polygon::move_sizing_rectangle_handle ( int  handle,
double  x,
double  y 
)
private
int casa::viewer::Polygon::move_vertex ( int  handle,
double  x,
double  y 
)
private
int casa::viewer::Polygon::moveHandle ( int  handle,
double  x,
double  y 
)

for rectangles, resizing can change the handle...

for rectangles, moving a handle is resizing...

int casa::viewer::Polygon::numVertices ( ) const
inline

Definition at line 93 of file Polygon.h.

References drawing_points().

void casa::viewer::Polygon::output ( ds9writer out) const
virtual

Implements casa::viewer::Region.

void casa::viewer::Polygon::pixelCenter ( double &  x,
double &  y 
) const
virtual

Implements casa::viewer::Region.

void casa::viewer::Polygon::polygonComplete ( )
void casa::viewer::Polygon::resize ( double  ,
double   
)
virtual void casa::viewer::Polygon::setCenter ( double &  x,
double &  y,
double &  deltx,
double &  delty 
)
inlineprivatevirtual

Definition at line 134 of file Polygon.h.

References _center_delta_x, _center_delta_y, _center_x, and _center_y.

region::RegionTypes casa::viewer::Polygon::type ( ) const
inlinevirtual

fetch region type...

Implements casa::viewer::Region.

Definition at line 100 of file Polygon.h.

References casa::viewer::region::PolyRegion.

void casa::viewer::Polygon::update_drawing_bounds_rectangle ( )
private
void casa::viewer::Polygon::update_drawing_state ( )
private
void casa::viewer::Polygon::update_reference_bounds_rectangle ( )
private
void casa::viewer::Polygon::update_reference_state ( int  transformations,
int  handle,
int  new_handle 
)
private
bool casa::viewer::Polygon::valid_translation ( double  dx,
double  dy,
double  width_delta,
double  height_delta 
)
virtual

Implements casa::viewer::Region.

bool casa::viewer::Polygon::within_vertex_handle ( double  x,
double  y 
) const
private

Member Data Documentation

double casa::viewer::Polygon::_center_delta_x
private

Definition at line 154 of file Polygon.h.

Referenced by setCenter().

double casa::viewer::Polygon::_center_delta_y
private

Definition at line 154 of file Polygon.h.

Referenced by setCenter().

double casa::viewer::Polygon::_center_x
private

Definition at line 153 of file Polygon.h.

Referenced by setCenter().

double casa::viewer::Polygon::_center_y
private

Definition at line 153 of file Polygon.h.

Referenced by setCenter().

double casa::viewer::Polygon::_drawing_blc_x_
private

Definition at line 149 of file Polygon.h.

double casa::viewer::Polygon::_drawing_blc_y_
private

Definition at line 149 of file Polygon.h.

double casa::viewer::Polygon::_drawing_height_
private

Definition at line 151 of file Polygon.h.

point_list casa::viewer::Polygon::_drawing_points_
private

Definition at line 148 of file Polygon.h.

Referenced by drawing_points().

double casa::viewer::Polygon::_drawing_trc_x_
private

Definition at line 150 of file Polygon.h.

double casa::viewer::Polygon::_drawing_trc_y_
private

Definition at line 150 of file Polygon.h.

double casa::viewer::Polygon::_drawing_width_
private

Definition at line 151 of file Polygon.h.

double casa::viewer::Polygon::_ref_blc_x_
private

Definition at line 144 of file Polygon.h.

double casa::viewer::Polygon::_ref_blc_y_
private

Definition at line 144 of file Polygon.h.

double casa::viewer::Polygon::_ref_height_
private

Definition at line 146 of file Polygon.h.

point_list casa::viewer::Polygon::_ref_points_
private

Definition at line 143 of file Polygon.h.

double casa::viewer::Polygon::_ref_trc_x_
private

Definition at line 145 of file Polygon.h.

double casa::viewer::Polygon::_ref_trc_y_
private

Definition at line 145 of file Polygon.h.

double casa::viewer::Polygon::_ref_width_
private

Definition at line 146 of file Polygon.h.

XScaleTo casa::viewer::Polygon::_x_origin_
private

Definition at line 156 of file Polygon.h.

YScaleTo casa::viewer::Polygon::_y_origin_
private

Definition at line 157 of file Polygon.h.

double casa::viewer::Polygon::handle_delta_x
private

Definition at line 139 of file Polygon.h.

double casa::viewer::Polygon::handle_delta_y
private

Definition at line 139 of file Polygon.h.


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