CARTA Backend
The backend component of CARTA
Loading...
Searching...
No Matches
carta::Ds9ImportExport Class Reference

#include <Ds9ImportExport.h>

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

Public Member Functions

 Ds9ImportExport (std::shared_ptr< casacore::CoordinateSystem > image_coord_sys, const casacore::IPosition &image_shape, int file_id, const std::string &file, bool file_is_filename)
 
 Ds9ImportExport (std::shared_ptr< casacore::CoordinateSystem > image_coord_sys, const casacore::IPosition &image_shape, bool pixel_coord)
 
bool AddExportRegion (const RegionState &region_state, const CARTA::RegionStyle &region_style) override
 
bool ExportRegions (std::string &filename, std::string &error) override
 
bool ExportRegions (std::vector< std::string > &contents, std::string &error) override
 
- Public Member Functions inherited from carta::RegionImportExport
 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)
 
bool AddExportRegion (const RegionState &region_state, const CARTA::RegionStyle &region_style, const casacore::RecordInterface &region_record, bool pixel_coord)
 

Protected Member Functions

void AddRegionNames () override
 
bool AddExportRegion (CARTA::RegionType region_type, const std::vector< casacore::Quantity > &control_points, const casacore::Quantity &rotation, const CARTA::RegionStyle &style) override
 
- Protected Member Functions inherited from carta::RegionImportExport
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)
 
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)
 

Private Member Functions

void InitGlobalProperties ()
 
void ProcessFileLines (std::vector< std::string > &lines)
 
void InitDs9CoordMap ()
 
bool IsDs9CoordSysKeyword (std::string &input_line)
 
bool SetFileReferenceFrame (std::string &ds9_coord)
 
void SetImageReferenceFrame ()
 
void SetGlobals (std::string &global_line)
 
RegionProperties SetRegion (std::string &region_definition)
 
RegionState ImportPointRegion (std::vector< std::string > &parameters, bool is_annotation=false)
 
RegionState ImportCircleRegion (std::vector< std::string > &parameters, bool is_annotation=false)
 
RegionState ImportEllipseRegion (std::vector< std::string > &parameters, bool is_annotation=false)
 
RegionState ImportRectangleRegion (std::vector< std::string > &parameters, bool is_annotation=false)
 
RegionState ImportPolygonLineRegion (std::vector< std::string > &parameters, bool is_annotation=false)
 
RegionState ImportVectorRegion (std::vector< std::string > &parameters)
 
RegionState ImportRulerRegion (std::vector< std::string > &parameters, std::unordered_map< std::string, std::string > &properties, CARTA::RegionStyle &region_style)
 
RegionState ImportCompassRegion (std::vector< std::string > &parameters, std::unordered_map< std::string, std::string > &properties, CARTA::RegionStyle &region_style)
 
CARTA::RegionStyle ImportStyleParameters (CARTA::RegionType region_type, std::unordered_map< std::string, std::string > &properties)
 
void ImportPointStyleParameters (std::unordered_map< std::string, std::string > &properties, CARTA::AnnotationStyle *annotation_style)
 
void ImportFontStyleParameters (std::unordered_map< std::string, std::string > &properties, CARTA::AnnotationStyle *annotation_style)
 
bool ParamToQuantity (std::string &param, bool is_angle, bool is_xy, std::string &region_name, casacore::Quantity &param_quantity)
 
bool Ds9ToCasacoreUnit (std::string &parameter, const std::string &region_type)
 
void ConvertTimeFormatToAngle (std::string &parameter)
 
void AddHeader ()
 
std::string AddExportRegionPixel (CARTA::RegionType region_type, const std::vector< casacore::Quantity > &control_points, float angle, const CARTA::RegionStyle &region_style)
 
std::string AddExportRegionWorld (CARTA::RegionType region_type, const std::vector< casacore::Quantity > &control_points, float angle, const CARTA::RegionStyle &region_style)
 
void ExportStyleParameters (const CARTA::RegionStyle &region_style, std::string &region_line)
 
void ExportTextboxStyleParameters (const CARTA::RegionStyle &region_style, std::string &region_line)
 
void ExportFontParameters (const CARTA::RegionStyle &region_style, std::string &region_line)
 
void ExportAnnotationStyleParameters (CARTA::RegionType region_type, const CARTA::RegionStyle &region_style, std::string &region_line)
 
void ExportAnnPointParameters (const CARTA::RegionStyle &region_style, std::string &region_line)
 

Private Attributes

std::unordered_map< std::string, std::string > _coord_map
 
std::string _image_ref_frame
 
std::string _file_ref_frame
 
bool _pixel_coord
 
std::unordered_map< std::string, std::string > _global_properties
 

Additional Inherited Members

- Protected Attributes inherited from carta::RegionImportExport
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
 

Constructor & Destructor Documentation

◆ Ds9ImportExport() [1/2]

Ds9ImportExport::Ds9ImportExport ( std::shared_ptr< casacore::CoordinateSystem >  image_coord_sys,
const casacore::IPosition &  image_shape,
int  file_id,
const std::string &  file,
bool  file_is_filename 
)
Here is the call graph for this function:

◆ Ds9ImportExport() [2/2]

Ds9ImportExport::Ds9ImportExport ( std::shared_ptr< casacore::CoordinateSystem >  image_coord_sys,
const casacore::IPosition &  image_shape,
bool  pixel_coord 
)
Here is the call graph for this function:

Member Function Documentation

◆ AddExportRegion() [1/2]

bool Ds9ImportExport::AddExportRegion ( CARTA::RegionType  region_type,
const std::vector< casacore::Quantity > &  control_points,
const casacore::Quantity &  rotation,
const CARTA::RegionStyle &  style 
)
overrideprotectedvirtual

Implements carta::RegionImportExport.

Here is the call graph for this function:

◆ AddExportRegion() [2/2]

bool Ds9ImportExport::AddExportRegion ( const RegionState region_state,
const CARTA::RegionStyle &  region_style 
)
overridevirtual

Implements carta::RegionImportExport.

Here is the call graph for this function:

◆ AddExportRegionPixel()

std::string Ds9ImportExport::AddExportRegionPixel ( CARTA::RegionType  region_type,
const std::vector< casacore::Quantity > &  control_points,
float  angle,
const CARTA::RegionStyle &  region_style 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddExportRegionWorld()

std::string Ds9ImportExport::AddExportRegionWorld ( CARTA::RegionType  region_type,
const std::vector< casacore::Quantity > &  control_points,
float  angle,
const CARTA::RegionStyle &  region_style 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddHeader()

void Ds9ImportExport::AddHeader ( )
private
Here is the caller graph for this function:

◆ AddRegionNames()

void Ds9ImportExport::AddRegionNames ( )
overrideprotectedvirtual

Implements carta::RegionImportExport.

Here is the caller graph for this function:

◆ ConvertTimeFormatToAngle()

void Ds9ImportExport::ConvertTimeFormatToAngle ( std::string &  parameter)
private
Here is the caller graph for this function:

◆ Ds9ToCasacoreUnit()

bool Ds9ImportExport::Ds9ToCasacoreUnit ( std::string &  parameter,
const std::string &  region_type 
)
private
Here is the caller graph for this function:

◆ ExportAnnotationStyleParameters()

void Ds9ImportExport::ExportAnnotationStyleParameters ( CARTA::RegionType  region_type,
const CARTA::RegionStyle &  region_style,
std::string &  region_line 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ExportAnnPointParameters()

void Ds9ImportExport::ExportAnnPointParameters ( const CARTA::RegionStyle &  region_style,
std::string &  region_line 
)
private
Here is the caller graph for this function:

◆ ExportFontParameters()

void Ds9ImportExport::ExportFontParameters ( const CARTA::RegionStyle &  region_style,
std::string &  region_line 
)
private
Here is the caller graph for this function:

◆ ExportRegions() [1/2]

bool Ds9ImportExport::ExportRegions ( std::string &  filename,
std::string &  error 
)
overridevirtual

◆ ExportRegions() [2/2]

bool Ds9ImportExport::ExportRegions ( std::vector< std::string > &  contents,
std::string &  error 
)
overridevirtual

◆ ExportStyleParameters()

void Ds9ImportExport::ExportStyleParameters ( const CARTA::RegionStyle &  region_style,
std::string &  region_line 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ExportTextboxStyleParameters()

void Ds9ImportExport::ExportTextboxStyleParameters ( const CARTA::RegionStyle &  region_style,
std::string &  region_line 
)
private
Here is the caller graph for this function:

◆ ImportCircleRegion()

RegionState Ds9ImportExport::ImportCircleRegion ( std::vector< std::string > &  parameters,
bool  is_annotation = false 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ImportCompassRegion()

RegionState Ds9ImportExport::ImportCompassRegion ( std::vector< std::string > &  parameters,
std::unordered_map< std::string, std::string > &  properties,
CARTA::RegionStyle &  region_style 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ImportEllipseRegion()

RegionState Ds9ImportExport::ImportEllipseRegion ( std::vector< std::string > &  parameters,
bool  is_annotation = false 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ImportFontStyleParameters()

void Ds9ImportExport::ImportFontStyleParameters ( std::unordered_map< std::string, std::string > &  properties,
CARTA::AnnotationStyle *  annotation_style 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ImportPointRegion()

RegionState Ds9ImportExport::ImportPointRegion ( std::vector< std::string > &  parameters,
bool  is_annotation = false 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ImportPointStyleParameters()

void Ds9ImportExport::ImportPointStyleParameters ( std::unordered_map< std::string, std::string > &  properties,
CARTA::AnnotationStyle *  annotation_style 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ImportPolygonLineRegion()

RegionState Ds9ImportExport::ImportPolygonLineRegion ( std::vector< std::string > &  parameters,
bool  is_annotation = false 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ImportRectangleRegion()

RegionState Ds9ImportExport::ImportRectangleRegion ( std::vector< std::string > &  parameters,
bool  is_annotation = false 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ImportRulerRegion()

RegionState Ds9ImportExport::ImportRulerRegion ( std::vector< std::string > &  parameters,
std::unordered_map< std::string, std::string > &  properties,
CARTA::RegionStyle &  region_style 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ImportStyleParameters()

CARTA::RegionStyle Ds9ImportExport::ImportStyleParameters ( CARTA::RegionType  region_type,
std::unordered_map< std::string, std::string > &  properties 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ImportVectorRegion()

RegionState Ds9ImportExport::ImportVectorRegion ( std::vector< std::string > &  parameters)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitDs9CoordMap()

void Ds9ImportExport::InitDs9CoordMap ( )
private
Here is the caller graph for this function:

◆ InitGlobalProperties()

void Ds9ImportExport::InitGlobalProperties ( )
private
Here is the caller graph for this function:

◆ IsDs9CoordSysKeyword()

bool Ds9ImportExport::IsDs9CoordSysKeyword ( std::string &  input_line)
private
Here is the caller graph for this function:

◆ ParamToQuantity()

bool Ds9ImportExport::ParamToQuantity ( std::string &  param,
bool  is_angle,
bool  is_xy,
std::string &  region_name,
casacore::Quantity &  param_quantity 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessFileLines()

void Ds9ImportExport::ProcessFileLines ( std::vector< std::string > &  lines)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetFileReferenceFrame()

bool Ds9ImportExport::SetFileReferenceFrame ( std::string &  ds9_coord)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetGlobals()

void Ds9ImportExport::SetGlobals ( std::string &  global_line)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetImageReferenceFrame()

void Ds9ImportExport::SetImageReferenceFrame ( )
private
Here is the caller graph for this function:

◆ SetRegion()

RegionProperties Ds9ImportExport::SetRegion ( std::string &  region_definition)
private
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _coord_map

std::unordered_map<std::string, std::string> carta::Ds9ImportExport::_coord_map
private

◆ _file_ref_frame

std::string carta::Ds9ImportExport::_file_ref_frame
private

◆ _global_properties

std::unordered_map<std::string, std::string> carta::Ds9ImportExport::_global_properties
private

◆ _image_ref_frame

std::string carta::Ds9ImportExport::_image_ref_frame
private

◆ _pixel_coord

bool carta::Ds9ImportExport::_pixel_coord
private

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