29 #ifndef REGION_REGION_H_
30 #define REGION_REGION_H_
52 #define DISPLAY_PURE_VIRTUAL(FUNCTION,RESULT) \
53 { casa_viewer_pure_virtual( __FILE__, __LINE__, #FUNCTION ); return RESULT; }
57 template <
class T>
class ImageInterface;
64 class PrincipalAxesDD;
79 void linear_to_screen( WorldCanvas *wc_,
double,
double,
double,
double,
int &,
int &,
int &,
int & );
81 void linear_to_pixel( WorldCanvas *wc_,
double,
double,
double &,
double & );
82 void linear_to_pixel( WorldCanvas *wc_,
double,
double,
double,
double,
double &,
double &,
double &,
double & );
85 void screen_to_linear( WorldCanvas *wc_,
int,
int,
int,
int,
double &,
double &,
double &,
double & );
87 void linear_to_world( WorldCanvas *wc_,
double,
double,
double &,
double & );
88 void linear_to_world( WorldCanvas *wc_,
double,
double,
double,
double,
double &,
double &,
double &,
double & );
90 void world_to_linear( WorldCanvas *wc_,
double,
double,
double &,
double & );
91 void world_to_linear( WorldCanvas *wc_,
double,
double,
double,
double,
double &,
double &,
double &,
double& );
93 void pixel_to_world( WorldCanvas *wc_,
double,
double,
double &,
double & );
94 void pixel_to_world( WorldCanvas *wc_,
double,
double,
double,
double,
double &,
double &,
double &,
double & );
96 void pixel_to_linear( WorldCanvas *wc_,
double,
double,
double &,
double & );
97 void pixel_to_linear( WorldCanvas *wc_,
double,
double,
double,
double,
double &,
double &,
double &,
double & );
100 void world_to_screen( WorldCanvas *wc_,
double,
double,
double,
double,
int &,
int &,
int &,
int & );
102 void world_to_pixel( WorldCanvas *wc_,
double,
double,
int &,
int & );
103 void world_to_pixel( WorldCanvas *wc_,
double,
double,
double,
double,
int &,
int &,
int &,
int & );
106 void linear_to_j2000( WorldCanvas *wc_,
double,
double,
double &,
double & );
107 void linear_to_j2000( WorldCanvas *wc_,
double,
double,
double,
double,
double &,
double &,
double &,
double & );
108 void linear_to_b1950( WorldCanvas *wc_,
double,
double,
double &,
double & );
109 void linear_to_b1950( WorldCanvas *wc_,
double,
double,
double,
double,
double &,
double &,
double &,
double & );
111 void linear_to_galactic( WorldCanvas *wc_,
double,
double,
double,
double,
double &,
double &,
double &,
double & );
113 void linear_to_ecliptic( WorldCanvas *wc_,
double,
double,
double,
double,
double &,
double &,
double &,
double & );
130 operator std::shared_ptr<casacore::ImageRegion>( ) {
137 void*
operator new (std::size_t)
throw (std::logic_error) {
138 throw std::logic_error(
"allocating an object not intended for dynamic allocation");
163 const std::string
name( )
const {
202 virtual void setLabel(
const std::string &l );
205 virtual void setFont(
const std::string &font=
"",
int font_size=-1,
int font_style=0,
const std::string &font_color=
"" );
210 std::string &width_height_units )
const;
212 double &bounding_width,
double &bounding_height,
216 const std::string &bounding_units =
"rad" )
const;
218 bool translateX(
const std::string &,
const std::string &,
const std::string & );
219 bool translateY(
const std::string &,
const std::string &,
const std::string & );
220 bool resizeX(
const std::string &,
const std::string &,
const std::string & );
221 bool resizeY(
const std::string &,
const std::string &,
const std::string & );
224 void zRange(
int &x,
int &y )
const;
263 virtual unsigned int mouseMovement(
double ,
double ,
bool )
266 virtual
void draw(
bool other_selected );
290 virtual
bool doubleClick(
double ,
double );
295 virtual
void resize(
double ,
double ) = 0;
296 virtual
bool valid_translation(
double dx,
double dy,
double width_delta,
double height_delta ) = 0;
300 virtual
void mark(
bool set=true );
314 virtual void status(
const std::string &msg,
const std::string &
type=
"info" );
328 virtual void boundingRectangle (
double &,
double &,
double &,
double &) const
342 virtual std::list<std::shared_ptr<RegionInfo> > *
statistics( ) {
362 return get_image_region( dd );
370 virtual void pixelCenter(
double &,
double & )
const = 0;
422 static
casacore::
Quantum< ::
casacore::
Vector<
double> > convert_angle(
double x, const std::
string &xunits,
double y, const std::
string &yunits,
429 const QList<
double> &world_y, const QList<
int> &pixel_x, const QList<
int> &pixel_y,
430 const QString &linecolor, const QString &text, const QString &font,
int fontsize,
int fontstyle );
432 const QList<
int> &pixel_x, const QList<
int> &pixel_y );
437 const QList<
double> &world_x, const QList<
double> &world_y,
438 const QList<
int> &pixel_x, const QList<
int> &pixel_y,
439 const QString &linecolor, const QString &text, const QString &font,
int fontsize,
int fontstyle );
447 void translate_x( const QString &, const QString &, const QString & );
448 void translate_y( const QString &, const QString &, const QString & );
449 void resize_x( const QString &, const QString &, const QString & );
450 void resize_y( const QString &, const QString &, const QString & );
484 QList<
int> &pixely, QList<
double> &worldx, QList<
double> &worldy );
486 std::vector<std::pair<
int,
int> > &pixel_pts,
487 std::vector<std::pair<
double,
double> > &world_pts )
const {
523 return (a + b) / 2.0;
539 virtual
void drawCenter(
double &x,
double &y,
double &deltx,
double &delty);
static int getAxisIndex(casacore::ImageInterface< float > *image, std::string axtype)
static std::shared_ptr< viewer::Region > creatingRegion()
called when creating regions to allow suppression of corner-handle drawing...
A Measure: astronomical direction.
Base class for annotations.
casacore::MDirection::Types get_coordinate_type(const DisplayCoordinateSystem &wc)
void getCoordinatesAndUnits(region::Coord &c, region::Units &x_units, region::Units &y_units, std::string &width_height_units) const
region::Units current_yunits() const
virtual void weaklyUnselectLimited()
just unmark this region (called from RegionToolManager); do not do the rest of the reorganization tha...
void refresh()
duplicate of MultiWCTool::refresh()
void setMarkerScale(int v)
std::pair< region::LineStyle, int > ls_ele
std::map< region::RegionChanges, bool > held_signals
std::vector< double > Vector
PointMarkerState(QtMouseToolNames::PointRegionSymbols t, int s)
std::string centerColor() const
std::shared_ptr< casacore::ImageRegion > imageregion
void refresh_zrange_event(int, int)
void setMarkerScale(int v)
region::Units current_xunits() const
void screen_offset_to_linear_offset(WorldCanvas *wc_, int, int, double &, double &)
region::LineStyle lineStyle() const
void resize_x(const QString &, const QString &, const QString &)
void to_linear(WorldCanvas *, casacore::MDirection::Types in_type, double, double, double &, double &)
bool z_index_within_range
An ordered list of annotations and comments representing an ascii region file. <author>Dave Mehringer...
virtual bool degenerate() const
is this region degenerate?
void selectedCountUpdateNeeded()
forward state update information to the dock wherere a count of selected regions, information is main...
void resize_y(const QString &, const QString &, const QString &)
void pixel_to_world(WorldCanvas *wc_, double, double, double &, double &)
convert casa pixel coordinates to world coordinates...
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
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 adjustCorners(double, double, double, double)
int textFontStyle() const
void linear_to_galactic(WorldCanvas *wc_, double, double, double &, double &)
void fetch_details(region::RegionTypes &type, QList< int > &pixelx, QList< int > &pixely, QList< double > &worldx, QList< double > &worldy)
void world_to_screen(WorldCanvas *wc_, double, double, int &, int &)
convert world coordantes to screen coordinates
void linear_to_screen(WorldCanvas *wc_, double, double, int &, int &)
convert linear coordinates to viewer screen coordinates...
QtMouseToolNames::PointRegionSymbols type() const
used to pass point specific marker information (marker type and scaling) to generic region creation r...
int getId() const
Histogram functionality.
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
virtual void pixelCenter(double &, double &) const =0
RegionInfo::stats_t * getLayerStats(PrincipalAxesDD *padd, casacore::ImageInterface< float > *image, casacore::ImageRegion &imgReg)
static std::shared_ptr< Region > creating_region
Holds a pointer to the region currently being created...
bool resizeX(const std::string &, const std::string &, const std::string &)
bool mouse_in_region
Derived classes set this to true and clear it when the mouse enters and exits this regions bounding b...
casacore::MDirection::Types current_casa_coordsys() const
void holdSignals()
postpone signal processing (important for signals generated during construction)...
void updateStateInfo(bool region_modified, region::RegionChanges)
indicates that region movement requires the update of state information...
void linear_to_ecliptic(WorldCanvas *wc_, double, double, double &, double &)
void linear_to_world(WorldCanvas *wc_, double, double, double &, double &)
convert linear coordinates to world coordinates...
virtual void move(double dx, double dy, casacore::String system="")
Implements RegionShape::move.
std::string textFont() const
void set_line_style(const ls_ele &)
region::Coord current_region_coordsys() const
static void creatingRegionBegin(std::shared_ptr< viewer::Region > r)
void statisticsUpdateNeeded()
void pushDrawingEnv(region::LineStyle ls, int thickness=-1)
std::map< std::string, int > & coordState()
used to synchronize all of the RegionDock's RegionState coordinate configuration...
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)
bool position_update_needed
virtual void setFont(const std::string &font="", int font_size=-1, int font_style=0, const std::string &font_color="")
void refresh_statistics_event(bool)
virtual void status(const std::string &msg, const std::string &type="info")
update status information...
virtual void setLabelDelta(const std::vector< int > &)
casacore::ImageRegion * getImageRegion(DisplayData *dd) const
virtual std::list< std::shared_ptr< RegionInfo > > * statistics()
void init()
common state-setup for constructors...
casacore::ImageStatistics< casacore::Float >::stat_list stats_t
void clearMouseInRegion()
ImageRegion_state(const ImageRegion_state &other)
void pixel_offset_to_linear_offset(WorldCanvas *wc_, double, double, double &, double &)
virtual std::list< std::shared_ptr< RegionInfo > > * generate_dds_statistics()
virtual casacore::ImageRegion *virtual get_image_region(DisplayData *) const DISPLAY_PURE_VIRTUAL(Region const std::set< Region * > get_selected_regions)()
std::list< ls_ele > ls_stack
virtual void mark(bool set=true)
functions added with the introduction of RegionToolManager and the unified selection and manipulation...
bool skyComponent() const
QtMouseToolNames::PointRegionSymbols type_
void initHistogram()
-----------------—==================== from old QtRegion ====================-----------------— ...
size_t selected_region_count()
Interface for DisplayDatas which have data arranged in axes.
void linear_to_pixel(WorldCanvas *wc_, double, double, double &, double &)
convert linear coordinates to casa pixel coordinates...
void to_linear_offset(WorldCanvas *, casacore::MDirection::Types in_type, double, double, double &, double &)
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
void pixel_to_linear(WorldCanvas *wc_, double, double, double &, double &)
convert casa pixel coordinates to linear coordinates...
void invalidateCenterInfo()
indicates that the center info is no longer valid
virtual bool marked() const
std::string textColor() const
void clearStatistics()
blank out the statistics for this region
std::string lineColor() const
bool statistics_update_needed
static bool regionSelected(int v)
void refresh_canvas_event()
std::string textColor() const
bool regionVisible() const
virtual void output(ds9writer &out) const =0
bool translateY(const std::string &, const std::string &, const std::string &)
All regions are specified in "linear coordinates", not "pixel coordinates".
virtual std::list< std::shared_ptr< RegionInfo > > * generate_dds_centers()=0
void setDrawCenter(bool draw_center)
std::string lineColor() const
virtual void setLabel(const std::string &l)
int & colorIndex()
used to synchronize the default color for all of the RegionDock's RegionState objects...
QString getSaveDir()
used to synchronize all region directories per QtDisplayPanelGUI...
virtual bool weaklySelected() const
is this region weakly or temporarily selected?
bool complete
Should this region be considered complete? Set to true by derived classes...
virtual void virtual setCenter(double &, double &, double &, double &) DISPLAY_PURE_VIRTUAL(Region void drawCenter(double &x, double &y)
size_t marked_region_count()
void zRange(int &x, int &y) const
region::TextPosition textPosition() const
virtual bool mark_toggle()
returns the new state...
static bool handleSelected(int v)
QtRegionState * state()
DISPLAY_PURE_VIRTUAL(Region::pixelCenter,);.
std::string textValue() const
virtual region::PointInfo checkPoint(double x, double y) const =0
bool resizeY(const std::string &, const std::string &, const std::string &)
virtual bool within_drawing_area()
void regionChange(viewer::Region *, std::string)
virtual void weaklySelect(bool scroll_dock=true)
region::TextPosition textPosition() const
size_t regionCount() const
virtual bool markCenter() const
void textPositionDelta(int &x, int &y) const
virtual bool skyComponent() const
void linear_offset_to_pixel_offset(WorldCanvas *wc_, double, double, double &, double &)
void updateHistogramRegion()
Quantities (i.e. dimensioned values)
region::LineStyle current_ls
int markerScale() const
how much to scale the symbol used to mark point regions...
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape...
ImageRegion_state(casacore::ImageRegion *ir, size_t region_count)
region::LineStyle lineStyle() const
void textPositionDelta(int &x, int &y) const
std::pair< int, int > & tabState()
used to synchronize all of the RegionDock's RegionState tab configuration...
void casa_viewer_pure_virtual(const char *file, int line, const char *func)
Class to hold a region of interest in an image.
LineStyle
LSDoubleDashed is only used to preserve state (it is a Display::LineStyle option) ...
int textFontStyle() const
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 region...
void linear_to_b1950(WorldCanvas *wc_, double, double, double &, double &)
static void creatingRegionEnd()
virtual void boundingRectangle(double &, double &, double &, double &) const DISPLAY_PURE_VIRTUAL(Region void emitUpdate()
in "linear" coordinates...
virtual void weaklyUnselect()
weaklyUnselectLimited() plus extra processing...
void signal_region_change(region::RegionChanges)
void update_histogram_event()
Called when the histogram stack needs to be changed due to the add/removal of an image.
bool translateX(const std::string &, const std::string &, const std::string &)
Implementation of drawing in world coordinates on top of a PixelCanvas.
std::string textValue() const
Manages a stack widget that displays histograms for a single region but multiple images.
void clear_signal_cache()
virtual RegionInfo * newInfoObject(casacore::ImageInterface< float > *, PrincipalAxesDD *)
newInfoObject(...) is currently only used for PVLine regions, but it should be used for other regions...
const Double c
Fundamental physical constants (SI units):
RegionInfo::center_t * getLayerCenter(PrincipalAxesDD *padd, std::shared_ptr< casacore::ImageInterface< float > > image, casacore::ImageRegion &imgReg)
std::string textFont() const
void world_to_pixel(WorldCanvas *wc_, double, double, int &, int &)
convert world to pixel coordinates
static const int SEXAGPREC
virtual void setAnnotation(bool)
void linear_to_j2000(WorldCanvas *wc_, double, double, double &, double &)
convert linear coordinates to specific coordinate systems...
virtual bool valid_translation(double dx, double dy, double width_delta, double height_delta)=0
static bool refreshNeeded(int v)
functions to query results from mouse functions...
void world_to_linear(WorldCanvas *wc_, double, double, double &, double &)
convert world coordinates to linear coordinates...
#define DISPLAY_PURE_VIRTUAL(FUNCTION, RESULT)
virtual void drawRegion(bool)=0
stats_t center_t
typedef std::pair<casacore::String,String> center_element; typedef std::list<center_element> center_t...
bool worldBoundingRectangle(double &, double &, const std::string &) const
void refresh_position_event(bool)
double linear_average(double a, double b) const
const std::string name() const
user specified name
virtual void releaseSignals()
Base class for display objects.
void revoke_region()
revoke...
void reload_statistics_event()
void process_held_signals()
void translate_x(const QString &, const QString &, const QString &)
void translate_y(const QString &, const QString &, const QString &)
std::string centerColor() const
virtual region::RegionTypes type() const =0
-----------------—==================== from old QtRegion ====================-----------------— ...
virtual void selectedInCanvas()
indicates that the user has selected this rectangle...
virtual void setLabelPosition(region::TextPosition)
void selectionChanged(viewer::Region *, bool)
void screen_to_linear(WorldCanvas *wc_, int, int, double &, double &)
convert viewer screen coordinates to linear coordinates...
virtual ImageRegion_state get_image_selected_region(DisplayData *)
virtual bool setMarker(QtMouseToolNames::PointRegionSymbols)
Defines nreal time structures used by the VLA table filler.
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()...
#define casacore
<X11/Intrinsic.h> #defines true, false, casacore::Bool, and String.
virtual void setLine(const std::string &line_color="", region::LineStyle line_style=region::SolidLine, unsigned int line_width=1)