27 #include <kstandarddirs.h>
33 QString FileName = KStandardDirs::locate(
"appdata", s );
34 if ( !FileName.isNull() ) {
35 file.setFileName( FileName );
36 return file.open( QIODevice::ReadOnly );
43 dms ra(0.0), dec(0.0);
50 Q_ASSERT( dss_default_size > 0.0 && dss_padding >= 0.0 );
59 b = dso->
a() * dso->
e();
60 pa = dso->
pa() * dms::DegToRad;
66 width = a * sin( pa ) + b * cos( pa );
67 height = a * cos( pa ) + b * sin( pa );
71 height += dss_padding;
77 height = width = dss_default_size;
80 if( height < dss_default_size )
81 height = dss_default_size;
82 if( width < dss_default_size )
83 width = dss_default_size;
94 const QString URLprefix(
"http://archive.stsci.edu/cgi-bin/dss_search?v=poss2ukstu_blue" );
95 QString URLsuffix = QString(
"&e=J2000&f=%1&c=none&fov=NONE" ).arg(type);
98 char decsgn = ( dec.
Degrees() < 0.0 ) ?
'-' :
'+';
99 int dd = abs( dec.
degree() );
100 int dm = abs( dec.
arcmin() );
101 int ds = abs( dec.
arcsec() );
104 if( !qIsFinite( height ) )
105 height = dss_default_size;
106 if( !qIsFinite( width ) )
107 width = dss_default_size;
111 height = dss_default_size;
113 width = dss_default_size;
121 QString RAString, DecString, SizeString;
122 DecString = DecString.sprintf(
"&d=%c%02d+%02d+%02d", decsgn, dd, dm, ds );
123 RAString = RAString.sprintf(
"&r=%02d+%02d+%02d", ra.
hour(), ra.
minute(), ra.
second() );
124 SizeString = SizeString.sprintf(
"&h=%02.1f&w=%02.1f", height, width );
126 return ( URLprefix + RAString + DecString + SizeString + URLsuffix );
137 static const char *directions[] = {
138 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"N"),
139 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"NNE"),
140 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"NE"),
141 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"ENE"),
142 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"E"),
143 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"ESE"),
144 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"SE"),
145 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"SSE"),
146 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"S"),
147 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"SSW"),
148 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"SW"),
149 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"WSW"),
150 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"W"),
151 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"WNW"),
152 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"NW"),
153 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"NNW"),
154 I18N_NOOP2(
"Abbreviated cardinal / intercardinal etc. direction",
"N"),
157 int index = (int)( (angle.
Degrees() + 11.25) / 22.5);
159 return i18nc(
"Abbreviated cardinal / intercardinal etc. direction", directions[ index ] );
const double & Degrees() const
bool openDataFile(QFile &file, const QString &filename)
Attempt to open the data file named filename, using the QFile object "file".
The sky coordinates of a point in the sky.
QString getDSSURL(const SkyPoint *const p)
Create a URL to obtain a DSS image for a given SkyPoint.
i18nc("string from libindi, used in the config dialog","100x")
virtual double pa() const
static double defaultDSSImageSize()
Get Default size for DSS images.
An angle, stored as degrees, but expressible in many ways.
Provides all necessary information about a deep-sky object: data inherited from SkyObject (coordinate...
QString toDirectionString(dms angle)
Return a string corresponding to an angle specifying direction.
static double dSSPadding()
Get Additional padding around DSS Images of deep-sky objects.