![]() |
CARTA Backend
The backend component of CARTA
|
A class for exporting regions in CRTF format. More...
#include <CrtfExporter.h>
Public Member Functions | |
CrtfExporter (std::shared_ptr< casacore::CoordinateSystem > coord_sys, const casacore::IPosition &shape, int stokes_axis) | |
Constructor for CrtfExporter class for exporting regions to CRTF file. | |
![]() | |
RegionExporter (std::shared_ptr< casacore::CoordinateSystem > coord_sys, const casacore::IPosition &shape) | |
Constructor for RegionExporter class. | |
virtual | ~RegionExporter ()=default |
Default destructor. | |
bool | CanExportToFile (const std::string &filename, bool overwrite, CARTA::ExportRegionAck &export_ack) |
Determine if export file can be created or overwritten. | |
bool | AddRegion (int file_id, std::shared_ptr< Region > region, const CARTA::RegionStyle ®ion_style, bool export_pixels) |
Add file line for region. | |
void | ExportRegions (const std::string &filename, std::string &message, CARTA::ExportRegionAck &export_ack) |
Export region file lines to file or contents. | |
Protected Member Functions | |
bool | AddRegion (const RegionState ®ion_state, const CARTA::RegionStyle ®ion_style) override |
Add file line for region in pixel coordinates. | |
bool | AddRegion (CARTA::RegionType region_type, const std::vector< casacore::Quantity > &control_points, const casacore::Quantity &rotation, const CARTA::RegionStyle ®ion_style) override |
Add file line for region in world coordinates or in matched image. | |
bool | ExportRegions (const std::string &filename, std::string &error) override |
Write region file lines to filename. | |
bool | ExportRegions (std::vector< std::string > &contents, std::string &error) override |
Serialise region file lines to vector. | |
![]() | |
bool | AddRegion (const RegionState ®ion_state, const CARTA::RegionStyle ®ion_style, const casacore::RecordInterface ®ion_record, bool export_pixels) |
Add file line for region in world coordinates or for matched image. | |
void | AddCompassStyle (const CARTA::RegionStyle ®ion_style, const std::string &coord_frame, std::string &file_line) |
Append compass style parameters to region file line. | |
Private Member Functions | |
bool | GetAnnRegion (CARTA::RegionType region_type, const std::vector< casacore::Quantity > &control_points, const casacore::Quantity &rotation, const CARTA::RegionStyle ®ion_style, casa::AnnotationBase *&ann_base, casa::AnnRegion *&ann_region) |
Create casa AnnotationBase or AnnRegion from region parameters. | |
bool | AddFileLine (CARTA::RegionType region_type, std::string &file_line, const CARTA::RegionStyle ®ion_style) |
Add file line after adjusting line printed by CASA region. | |
bool | AddTextFileLines (CARTA::RegionType region_type, std::string &file_line, const std::vector< casacore::Quantity > &control_points, const CARTA::RegionStyle ®ion_style) |
Add file lines for text region, as textbox file line then text file line. | |
void | FixFontstyle (std::string &file_line) |
Fix fontstyle added by CASA region. | |
casa::AnnSymbol::Symbol | GetAnnSymbol (CARTA::PointAnnotationShape point_shape) |
Convert CARTA point shape to CASA annotation symbol. | |
char | GetAnnSymbolCharacter (CARTA::PointAnnotationShape point_shape) |
Convert CARTA point shape to CASA symbol character. | |
std::string | FormatColor (const std::string &color) |
Format color for file line. | |
casa::AnnotationBase::LineStyle | GetLineStyle (const CARTA::RegionStyle ®ion_style) |
Convert dash list to CASA line style else set default. | |
void | GetFontStyle (const CARTA::RegionStyle ®ion_style, std::string &font, unsigned int &font_size, casa::AnnotationBase::FontStyle &font_style) |
Extract font parameters from region style else set defaults. | |
void | GetSymbolStyle (const CARTA::RegionStyle ®ion_style, unsigned int &symbol_size, unsigned int &symbol_thickness) |
Extract CASA symbol style parameters from region style else set defaults. | |
void | AddStyle (const CARTA::RegionStyle ®ion_style, std::string &file_line) |
Add CRTF style parameters common to all regions to file line. | |
void | SetAnnotationRegionStyle (const CARTA::RegionStyle ®ion_style, casa::AnnotationBase *region) |
Set region style parameters in AnnotationBase region. | |
casacore::Vector< casacore::Stokes::StokesTypes > | GetStokesTypes () |
Get casacore stokes types for stokes axis set in constructor. | |
std::string | GetFileHeader () |
Get CRTF file header string. | |
Private Attributes | |
int | _stokes_axis |
stokes axis index for current stokes, set from constructor parameter for adding stokes type to export. | |
Additional Inherited Members | |
![]() | |
std::shared_ptr< casacore::CoordinateSystem > | _coord_sys |
Image coordinate system. | |
casacore::IPosition | _image_shape |
Image shape. | |
std::unordered_map< CARTA::RegionType, std::string > | _region_names |
Region names for conversion from CARTA type to CRTF or DS9 name. | |
std::string | _image_coord_frame |
casacore image reference frame from coordinate system. | |
std::string | _file_coord_frame |
Coordinate frame for file lines. | |
std::vector< std::string > | _file_lines |
Formatted lines for header, globals, and regions for region file. | |
A class for exporting regions in CRTF format.
CrtfExporter::CrtfExporter | ( | std::shared_ptr< casacore::CoordinateSystem > | coord_sys, |
const casacore::IPosition & | shape, | ||
int | stokes_axis | ||
) |
Constructor for CrtfExporter class for exporting regions to CRTF file.
coord_sys | casacore::CoordinateSystem of image from which region is exported |
shape | casacore::IPosition describing shape of image from which region is exported |
stokes_axis | Current stokes axis in image from which region is exported |
|
private |
Add file line after adjusting line printed by CASA region.
region_type | Region type |
file_line | Line to be adjusted and added |
region_style | Region style parameters |
|
overrideprotectedvirtual |
Add file line for region in world coordinates or in matched image.
region_type | Region type |
control_points | Region control points in world coordinates |
rotation | Region rotation |
region_style | Region style parameters |
Implements carta::RegionExporter.
|
overrideprotectedvirtual |
Add file line for region in pixel coordinates.
Implements carta::RegionExporter.
|
private |
Add CRTF style parameters common to all regions to file line.
[in] | region_style | Region style |
[in,out] | file_line | File line to append |
|
private |
Add file lines for text region, as textbox file line then text file line.
region_type | Region type |
file_line | Line for textbox region |
control_points | Region control points for text region |
region_style | Region style parameters |
|
overrideprotectedvirtual |
Write region file lines to filename.
[in] | filename | Name of region file |
[out] | error | Message describing error if export fails |
Implements carta::RegionExporter.
|
overrideprotectedvirtual |
Serialise region file lines to vector.
[out] | contents | Vector for lines |
[out] | error | Message describing error if export fails |
Implements carta::RegionExporter.
|
private |
Fix fontstyle added by CASA region.
[in,out] | file_line | Line to be fixed |
|
private |
Format color for file line.
color | Region color |
|
private |
Create casa AnnotationBase or AnnRegion from region parameters.
[in] | region_type | Region type |
[in] | control_points | Region control points |
[in] | rotation | Region rotation |
[in] | region_style | Region style parameters |
[out] | ann_base | Pointer to return new AnnotationBase region |
[out] | ann_region | Pointer to return new AnnRegion region |
|
private |
|
private |
|
private |
Get CRTF file header string.
|
private |
Extract font parameters from region style else set defaults.
[in] | region_style | Region style parameters |
[out] | font | Font name |
[out] | font_size | Font size |
[out] | font_style | Font style enum |
|
private |
Convert dash list to CASA line style else set default.
region_style | Region style parameters |
|
private |
Get casacore stokes types for stokes axis set in constructor.
|
private |
Extract CASA symbol style parameters from region style else set defaults.
[in] | region_style | Region style parameters |
[out] | symbol_size | Symbol size |
[out] | symbol_thickness | Symbol outline thickness. |
|
private |
Set region style parameters in AnnotationBase region.
[in] | region_style | Region style parameters |
[in,out] | region | Pointer to casa AnnotationBase region (AnnotationBase or AnnRegion) |
|
private |
stokes axis index for current stokes, set from constructor parameter for adding stokes type to export.