52 #ifndef __PCL_AstrometricMetadata_h
53 #define __PCL_AstrometricMetadata_h
73 #ifdef __PCL_BUILDING_PIXINSIGHT_APPLICATION
99 #ifndef __PCL_BUILDING_PIXINSIGHT_APPLICATION
100 class PCL_CLASS ImageWindow;
103 class PCL_CLASS XISFReader;
104 class PCL_CLASS XISFWriter;
124 String wcsTransformationType;
133 String observationStartTime;
134 String observationEndTime;
140 String topLeftCoordinates;
141 String topRightCoordinates;
142 String bottomLeftCoordinates;
143 String bottomRightCoordinates;
159 : m_projection( x.m_projection->Clone() )
160 , m_transformWI( x.m_transformWI->Clone() )
161 , m_refSys( x.m_refSys )
162 , m_width( x.m_width )
163 , m_height( x.m_height )
164 , m_pixelSize( x.m_pixelSize )
165 , m_obsStartTime( x.m_obsStartTime )
166 , m_obsEndTime( x.m_obsEndTime )
167 , m_geoLongitude( x.m_geoLongitude )
168 , m_geoLatitude( x.m_geoLatitude )
169 , m_geoHeight( x.m_geoHeight )
170 , m_resolution( x.m_resolution )
171 , m_focalLength( x.m_focalLength )
172 , m_creationTime( x.m_creationTime )
173 , m_catalog( x.m_catalog )
174 , m_creatorApp( x.m_creatorApp )
175 , m_creatorModule( x.m_creatorModule )
176 , m_creatorOS( x.m_creatorOS )
177 , m_description( x.m_description )
207 #ifdef __PCL_BUILDING_PIXINSIGHT_APPLICATION
236 m_projection = x.m_projection->Clone();
237 m_transformWI = x.m_transformWI->Clone();
238 m_refSys = x.m_refSys;
239 m_equinox = x.m_equinox;
241 m_height = x.m_height;
242 m_pixelSize = x.m_pixelSize;
243 m_obsStartTime = x.m_obsStartTime;
244 m_obsEndTime = x.m_obsEndTime;
245 m_geoLongitude = x.m_geoLongitude;
246 m_geoLatitude = x.m_geoLatitude;
247 m_geoHeight = x.m_geoHeight;
248 m_resolution = x.m_resolution;
249 m_focalLength = x.m_focalLength;
250 m_creationTime = x.m_creationTime;
251 m_catalog = x.m_catalog;
252 m_creatorApp = x.m_creatorApp;
253 m_creatorModule = x.m_creatorModule;
254 m_creatorOS = x.m_creatorOS;
255 m_description = x.m_description;
270 return !m_projection.IsNull() && !m_transformWI.IsNull();
305 DPoint& bottomLeftErrors,
DPoint& bottomRightErrors )
const;
336 #ifdef __PCL_BUILDING_PIXINSIGHT_APPLICATION
338 void Write( pi::ImageWindow* window,
bool notify =
true )
const;
413 m_refSys = refSys.Trimmed();
469 return Rect( m_width, m_height );
478 return m_projection.Pointer();
487 return m_transformWI.Pointer();
490 #ifdef __PCL_BUILDING_PIXINSIGHT_APPLICATION
493 return m_transformWI.Pointer();
503 return (focal > 0) ? m_pixelSize.OrElse( 0 )/focal * 0.18/
Const<double>::pi() : 0.0;
512 return ResolutionFromFocal( resolution );
548 throw Error(
"Invalid call to AstrometricMetadata::SearchRadius(): No astrometric solution." );
550 if ( !ImageToCelestial( cRD,
DPoint( 0.5*m_width, 0.5*m_height ) ) )
551 throw Error(
"Failed to perform ImageToCelestial() coordinate transformation for the image center" );
552 DPoint pRD1, pRD2, pRD3, pRD4;
553 if ( !ImageToCelestial( pRD1,
DPoint( 0, 0 ) )
554 || !ImageToCelestial( pRD2,
DPoint( m_width, 0 ) )
555 || !ImageToCelestial( pRD3,
DPoint( 0, m_height ) )
556 || !ImageToCelestial( pRD4,
DPoint( m_width, m_height ) ) )
560 return Max(
Max(
Max( m_projection->Distance( cRD, pRD1 ), m_projection->Distance( cRD, pRD2 ) ),
561 m_projection->Distance( cRD, pRD3 ) ),
562 m_projection->Distance( cRD, pRD4 ) );
571 return m_obsStartTime;
580 m_obsStartTime = startTime;
598 m_obsEndTime = endTime;
609 if ( !m_obsStartTime.IsDefined() )
611 if ( !m_obsEndTime.IsDefined() )
612 return m_obsStartTime;
613 return m_obsStartTime() + (m_obsEndTime() - m_obsStartTime())/2;
623 return m_geoLongitude;
636 if ( longitude > 180 )
638 else if ( longitude <= -180 )
640 if ( longitude < -180 || longitude > +180 )
641 throw Error(
"AstrometricMetadata::SetLocationLongitude(): Geographic longitude out of range." );
642 m_geoLongitude = longitude;
652 return m_geoLatitude;
665 if ( latitude < -90 || latitude > +90 )
666 throw Error(
"AstrometricMetadata::SetLocationLatitude(): Geographic latitude out of range." );
667 m_geoLatitude = latitude;
684 m_geoHeight = height;
701 m_pixelSize = pixelSize;
702 m_focalLength = FocalFromResolution( m_resolution );
712 return m_creationTime;
743 return m_creatorModule;
783 throw Error(
"Invalid call to AstrometricMetadata::ImageToCelestial(): No astrometric solution." );
784 if ( m_projection->Inverse( pRD, m_transformWI->Inverse( pI ) ) )
789 else if ( pRD.
x >= 360 )
829 throw Error(
"Invalid call to AstrometricMetadata::RawImageToCelestial(): No astrometric solution." );
830 return m_projection->Inverse( pRD, m_transformWI->Inverse( pI ) );
856 throw Error(
"Invalid call to AstrometricMetadata::CelestialToImage(): No astrometric solution." );
858 if ( m_projection->Direct( pW, pRD ) )
860 pI = m_transformWI->Direct( pW );
1091 m_obsStartTime.Undefine();
1092 m_obsEndTime.Undefine();
1093 m_geoLongitude.Undefine();
1094 m_geoLatitude.Undefine();
1095 m_geoHeight.Undefine();
1108 m_obsStartTime = source.m_obsStartTime;
1109 m_obsEndTime = source.m_obsEndTime;
1110 m_geoLongitude = source.m_geoLongitude;
1111 m_geoLatitude = source.m_geoLatitude;
1112 m_geoHeight = source.m_geoHeight;
1128 m_obsStartTime.Undefine();
1133 m_obsEndTime.Undefine();
1136 m_geoLatitude = wcs.
latobs;
1137 m_geoHeight = wcs.
altobs;
1317 UpdateDescription();
1324 static void RemoveSplineWorldTransformationProperties(
PropertyArray& );
1326 #ifdef __PCL_BUILDING_PIXINSIGHT_APPLICATION
1328 static void RemoveSplineWorldTransformationProperties( pi::ImageWindow* );
1333 static void RemoveSplineWorldTransformationProperties(
ImageWindow& );
1350 double m_resolution = 0;
1361 void UpdateDescription()
const;
A smart pointer with exclusive object ownership and optional automatic object destruction.
A simple exception with an associated error message.
A generic point in the two-dimensional space.
component x
Abscissa (horizontal, or X-axis coordinate).
A generic rectangle in the two-dimensional space.
bool IsEmpty() const noexcept
High-level interface to an image window object in the PixInsight core application.
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
An object that can be in a defined or undefined state.
Base class of all projection systems.
An instant in any timescale.
A structure for management of WCS FITS header keywords and associated image properties.
Optional< double > altobs
Geodetic height of the observation location in meters.
Optional< double > longobs
Geodetic longitude of the observation location in degrees. Reckoned positive east of the reference me...
Optional< double > latobs
Geodetic latitude of the observation location in degrees. Reckoned positive north of the equator.
Optional< double > dateobs
Observation start time as a Julian date, UTC timescale.
Optional< double > dateend
Observation end time as a Julian date, UTC timescale.
constexpr const T & Max(const T &a, const T &b) noexcept