CARTA Backend
The backend component of CARTA
Loading...
Searching...
No Matches
carta::RegionImportExport Class Referenceabstract

#include <RegionImportExport.h>

Inheritance diagram for carta::RegionImportExport:
[legend]
Collaboration diagram for carta::RegionImportExport:
[legend]

Public Member Functions

 RegionImportExport (std::shared_ptr< casacore::CoordinateSystem > image_coord_sys, const casacore::IPosition &image_shape, int file_id)
 
 RegionImportExport (std::shared_ptr< casacore::CoordinateSystem > image_coord_sys, const casacore::IPosition &image_shape)
 
virtual ~RegionImportExport ()=default
 
std::vector< RegionPropertiesGetImportedRegions (std::string &error)
 
virtual bool AddExportRegion (const RegionState &region_state, const CARTA::RegionStyle &region_style)=0
 
bool AddExportRegion (const RegionState &region_state, const CARTA::RegionStyle &region_style, const casacore::RecordInterface &region_record, bool pixel_coord)
 
virtual bool ExportRegions (std::string &filename, std::string &error)=0
 
virtual bool ExportRegions (std::vector< std::string > &contents, std::string &error)=0
 

Protected Member Functions

virtual void AddRegionNames ()=0
 
virtual std::vector< std::string > ReadRegionFile (const std::string &file, bool file_is_filename, const char extra_delim='\0')
 
virtual bool IsCommentLine (const std::string &line)
 
virtual void SetParserDelim (const std::string &delim)
 
virtual void ParseRegionParameters (std::string &region_definition, std::vector< std::string > &parameters, std::unordered_map< std::string, std::string > &properties)
 
CARTA::TextAnnotationPosition GetTextPosition (const std::string &position)
 
void AddTextStyleToProperties (const CARTA::RegionStyle &text_style, RegionProperties &textbox_properties)
 
virtual bool AddExportRegion (CARTA::RegionType region_type, const std::vector< casacore::Quantity > &control_points, const casacore::Quantity &rotation, const CARTA::RegionStyle &region_style)=0
 
bool ConvertPointToPixels (std::string &region_frame, std::vector< casacore::Quantity > &point, casacore::Vector< casacore::Double > &pixel_coords)
 
double WorldToPixelLength (casacore::Quantity input, unsigned int pixel_axis)
 
std::string FormatColor (const std::string &color)
 
void ExportAnnCompassStyle (const CARTA::RegionStyle &region_style, const std::string &ann_coord_sys, std::string &region_line)
 
void ImportCompassStyle (std::string &compass_properties, std::string &coordinate_system, CARTA::AnnotationStyle *annotation_style)
 
void ImportRulerStyle (std::string &ruler_properties, std::string &coordinate_system)
 

Protected Attributes

std::shared_ptr< casacore::CoordinateSystem > _coord_sys
 
casacore::IPosition _image_shape
 
int _file_id
 
std::string _parser_delim
 
std::string _import_errors
 
std::vector< RegionProperties_import_regions
 
std::vector< std::string > _export_regions
 
std::unordered_map< CARTA::RegionType, std::string > _region_names
 
std::unordered_map< CARTA::TextAnnotationPosition, std::string > _text_positions
 

Private Member Functions

bool ConvertRecordToPoint (const casacore::RecordInterface &region_record, bool pixel_coord, std::vector< casacore::Quantity > &control_points)
 
bool ConvertRecordToRectangle (const casacore::RecordInterface &region_record, bool pixel_coord, std::vector< casacore::Quantity > &control_points)
 
bool ConvertRecordToEllipse (const RegionState &region_state, const casacore::RecordInterface &region_record, bool pixel_coord, std::vector< casacore::Quantity > &control_points, casacore::Quantity &qrotation)
 
bool ConvertRecordToPolygonLine (const casacore::RecordInterface &region_record, bool pixel_coord, std::vector< casacore::Quantity > &control_points)
 

Constructor & Destructor Documentation

◆ RegionImportExport() [1/2]

RegionImportExport::RegionImportExport ( std::shared_ptr< casacore::CoordinateSystem >  image_coord_sys,
const casacore::IPosition &  image_shape,
int  file_id 
)

◆ RegionImportExport() [2/2]

RegionImportExport::RegionImportExport ( std::shared_ptr< casacore::CoordinateSystem >  image_coord_sys,
const casacore::IPosition &  image_shape 
)

◆ ~RegionImportExport()

virtual carta::RegionImportExport::~RegionImportExport ( )
virtualdefault

Member Function Documentation

◆ AddExportRegion() [1/3]

virtual bool carta::RegionImportExport::AddExportRegion ( CARTA::RegionType  region_type,
const std::vector< casacore::Quantity > &  control_points,
const casacore::Quantity &  rotation,
const CARTA::RegionStyle &  region_style 
)
protectedpure virtual

◆ AddExportRegion() [2/3]

virtual bool carta::RegionImportExport::AddExportRegion ( const RegionState region_state,
const CARTA::RegionStyle &  region_style 
)
pure virtual

Implemented in carta::CrtfImportExport, and carta::Ds9ImportExport.

Here is the caller graph for this function:

◆ AddExportRegion() [3/3]

bool RegionImportExport::AddExportRegion ( const RegionState region_state,
const CARTA::RegionStyle &  region_style,
const casacore::RecordInterface &  region_record,
bool  pixel_coord 
)
Here is the call graph for this function:

◆ AddRegionNames()

virtual void carta::RegionImportExport::AddRegionNames ( )
protectedpure virtual

◆ AddTextStyleToProperties()

void RegionImportExport::AddTextStyleToProperties ( const CARTA::RegionStyle &  text_style,
RegionProperties textbox_properties 
)
protected
Here is the caller graph for this function:

◆ ConvertPointToPixels()

bool RegionImportExport::ConvertPointToPixels ( std::string &  region_frame,
std::vector< casacore::Quantity > &  point,
casacore::Vector< casacore::Double > &  pixel_coords 
)
protected
Here is the caller graph for this function:

◆ ConvertRecordToEllipse()

bool RegionImportExport::ConvertRecordToEllipse ( const RegionState region_state,
const casacore::RecordInterface &  region_record,
bool  pixel_coord,
std::vector< casacore::Quantity > &  control_points,
casacore::Quantity &  qrotation 
)
private
Here is the caller graph for this function:

◆ ConvertRecordToPoint()

bool RegionImportExport::ConvertRecordToPoint ( const casacore::RecordInterface &  region_record,
bool  pixel_coord,
std::vector< casacore::Quantity > &  control_points 
)
private
Here is the caller graph for this function:

◆ ConvertRecordToPolygonLine()

bool RegionImportExport::ConvertRecordToPolygonLine ( const casacore::RecordInterface &  region_record,
bool  pixel_coord,
std::vector< casacore::Quantity > &  control_points 
)
private
Here is the caller graph for this function:

◆ ConvertRecordToRectangle()

bool RegionImportExport::ConvertRecordToRectangle ( const casacore::RecordInterface &  region_record,
bool  pixel_coord,
std::vector< casacore::Quantity > &  control_points 
)
private
Here is the caller graph for this function:

◆ ExportAnnCompassStyle()

void RegionImportExport::ExportAnnCompassStyle ( const CARTA::RegionStyle &  region_style,
const std::string &  ann_coord_sys,
std::string &  region_line 
)
protected
Here is the caller graph for this function:

◆ ExportRegions() [1/2]

virtual bool carta::RegionImportExport::ExportRegions ( std::string &  filename,
std::string &  error 
)
pure virtual

◆ ExportRegions() [2/2]

virtual bool carta::RegionImportExport::ExportRegions ( std::vector< std::string > &  contents,
std::string &  error 
)
pure virtual

◆ FormatColor()

std::string RegionImportExport::FormatColor ( const std::string &  color)
protected
Here is the caller graph for this function:

◆ GetImportedRegions()

std::vector< RegionProperties > RegionImportExport::GetImportedRegions ( std::string &  error)

◆ GetTextPosition()

CARTA::TextAnnotationPosition RegionImportExport::GetTextPosition ( const std::string &  position)
protected
Here is the caller graph for this function:

◆ ImportCompassStyle()

void RegionImportExport::ImportCompassStyle ( std::string &  compass_properties,
std::string &  coordinate_system,
CARTA::AnnotationStyle *  annotation_style 
)
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ImportRulerStyle()

void RegionImportExport::ImportRulerStyle ( std::string &  ruler_properties,
std::string &  coordinate_system 
)
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsCommentLine()

bool RegionImportExport::IsCommentLine ( const std::string &  line)
protectedvirtual
Here is the caller graph for this function:

◆ ParseRegionParameters()

void RegionImportExport::ParseRegionParameters ( std::string &  region_definition,
std::vector< std::string > &  parameters,
std::unordered_map< std::string, std::string > &  properties 
)
protectedvirtual
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadRegionFile()

std::vector< std::string > RegionImportExport::ReadRegionFile ( const std::string &  file,
bool  file_is_filename,
const char  extra_delim = '\0' 
)
protectedvirtual
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetParserDelim()

virtual void carta::RegionImportExport::SetParserDelim ( const std::string &  delim)
inlineprotectedvirtual
Here is the caller graph for this function:

◆ WorldToPixelLength()

double RegionImportExport::WorldToPixelLength ( casacore::Quantity  input,
unsigned int  pixel_axis 
)
protected
Here is the caller graph for this function:

Member Data Documentation

◆ _coord_sys

std::shared_ptr<casacore::CoordinateSystem> carta::RegionImportExport::_coord_sys
protected

◆ _export_regions

std::vector<std::string> carta::RegionImportExport::_export_regions
protected

◆ _file_id

int carta::RegionImportExport::_file_id
protected

◆ _image_shape

casacore::IPosition carta::RegionImportExport::_image_shape
protected

◆ _import_errors

std::string carta::RegionImportExport::_import_errors
protected

◆ _import_regions

std::vector<RegionProperties> carta::RegionImportExport::_import_regions
protected

◆ _parser_delim

std::string carta::RegionImportExport::_parser_delim
protected

◆ _region_names

std::unordered_map<CARTA::RegionType, std::string> carta::RegionImportExport::_region_names
protected
Initial value:
= {{CARTA::RegionType::LINE, "line"},
{CARTA::RegionType::POLYLINE, "polyline"}, {CARTA::RegionType::ELLIPSE, "ellipse"}, {CARTA::RegionType::ANNRULER, "# ruler"},
{CARTA::RegionType::ANNCOMPASS, "# compass"}}

◆ _text_positions

std::unordered_map<CARTA::TextAnnotationPosition, std::string> carta::RegionImportExport::_text_positions
protected
Initial value:
= {{CARTA::TextAnnotationPosition::CENTER, "center"},
{CARTA::TextAnnotationPosition::UPPER_LEFT, "uleft"}, {CARTA::TextAnnotationPosition::UPPER_RIGHT, "uright"},
{CARTA::TextAnnotationPosition::LOWER_LEFT, "lleft"}, {CARTA::TextAnnotationPosition::LOWER_RIGHT, "lright"},
{CARTA::TextAnnotationPosition::TOP, "top"}, {CARTA::TextAnnotationPosition::BOTTOM, "bottom"},
{CARTA::TextAnnotationPosition::LEFT, "left"}, {CARTA::TextAnnotationPosition::RIGHT, "right"}}

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