本文整理汇总了C++中KStarsData类的典型用法代码示例。如果您正苦于以下问题:C++ KStarsData类的具体用法?C++ KStarsData怎么用?C++ KStarsData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KStarsData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LineListIndex
Ecliptic::Ecliptic(SkyComposite *parent ) :
LineListIndex( parent, i18n("Ecliptic") ),
m_label( name() )
{
KStarsData *data = KStarsData::Instance();
KSNumbers num( data->ut().djd() );
dms elat(0.0), elng(0.0);
const double eps = 0.1;
const double minRa = 0.0;
const double maxRa = 23.0;
const double dRa = 2.0;
const double dRa2 = 2. / 5.;
for(double ra = minRa; ra < maxRa; ra += dRa ) {
LineList* lineList = new LineList();
for(double ra2 = ra; ra2 <= ra + dRa + eps; ra2 += dRa2 ) {
elng.setH( ra2 );
SkyPoint* o = new SkyPoint();
o->setFromEcliptic( num.obliquity(), elng, elat );
o->setRA0( o->ra().Hours() );
o->setDec0( o->dec().Degrees() );
o->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
lineList->append( o );
}
appendLine( lineList );
}
}
示例2: QFrame
modCalcAltAz::modCalcAltAz(QWidget *parentSplit)
: QFrame(parentSplit)
{
setupUi(this);
KStarsData *data = KStarsData::Instance();
RA->setDegType(false);
//Initialize Date/Time and Location data
geoPlace = data->geo();
LocationButton->setText( geoPlace->fullName() );
//Make sure slotDateTime() gets called, so that LST will be set
connect(DateTime, SIGNAL(dateTimeChanged(const QDateTime&)), this, SLOT(slotDateTimeChanged(const QDateTime&)));
DateTime->setDateTime( data->lt().dateTime() );
connect(NowButton, SIGNAL(clicked()), this, SLOT(slotNow()));
connect(LocationButton, SIGNAL(clicked()), this, SLOT(slotLocation()));
connect(ObjectButton, SIGNAL(clicked()), this, SLOT(slotObject()));
connect(RA, SIGNAL(editingFinished()), this, SLOT(slotCompute()));
connect(Dec, SIGNAL(editingFinished()), this, SLOT(slotCompute()));
connect(Az, SIGNAL(editingFinished()), this, SLOT(slotCompute()));
connect(Alt, SIGNAL(editingFinished()), this, SLOT(slotCompute()));
show();
}
示例3: drawCompassLabels
void Ecliptic::drawCompassLabels() {
const Projector* proj = SkyMap::Instance()->projector();
KStarsData* data = KStarsData::Instance();
SkyLabeler* skyLabeler = SkyLabeler::Instance();
// Set proper color for labels
QColor color( data->colorScheme()->colorNamed( "CompassColor" ) );
skyLabeler->setPen( QPen( QBrush(color), 1, Qt::SolidLine) );
KSNumbers num( data->ut().djd() );
dms elat(0.0), elng(0.0);
QString label;
for( int ra = 0; ra < 23; ra += 6 ) {
elng.setH( ra );
SkyPoint o;
o.setFromEcliptic( num.obliquity(), elng, elat );
o.setRA0( o.ra() );
o.setDec0( o.dec() );
o.EquatorialToHorizontal( data->lst(), data->geo()->lat() );
bool visible;
QPointF cpoint = proj->toScreen( &o, false, &visible );
if( visible && proj->checkVisibility( &o ) ) {
label.setNum( o.ra().reduce().Degrees() );
skyLabeler->drawGuideLabel( cpoint, label, 0.0 );
}
}
}
示例4: CoordinateGrid
EquatorialCoordinateGrid::EquatorialCoordinateGrid( SkyComposite *parent )
: CoordinateGrid( parent, i18n("Equatorial Coordinate Grid" ) )
{
KStarsData *data = KStarsData::Instance();
intro();
double eps = 0.1;
double minRa = 0.0;
double maxRa = 23.0;
double dRa = 2.0;
double minDec = -80.0;
double maxDec = 90.0;
double dDec = 20.0;
double dDec2 = 4.0;
double dRa2 = 0.2;
double max, dec, dec2, ra, ra2;
LineList* lineList;
for ( ra = minRa; ra < maxRa; ra += dRa ) {
for ( dec = -90.0; dec < maxDec - eps; dec += dDec ) {
lineList = new LineList();
max = dec + dDec;
if ( max > 90.0 ) max = 90.0;
for ( dec2 = dec; dec2 <= max + eps; dec2 += dDec2 ) {
SkyPoint* p = new SkyPoint( ra, dec2 );
p->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
lineList->append( p );
}
appendLine( lineList );
}
}
for ( dec = minDec; dec < maxDec + eps; dec += dDec ) {
// Do not paint the line on the equator
if ( dec < 0.1 && dec > -0.1 )
continue;
// Adjust point density
int nPoints = int(round( fabs(cos(dec* dms::PI / 180.0)) * dRa / dRa2 ));
if ( nPoints < 5 )
nPoints = 5;
double dRa3 = dRa / nPoints;
for ( ra = minRa; ra < maxRa + eps; ra += dRa ) {
lineList = new LineList();
for ( ra2 = ra; ra2 <= ra + dRa + eps; ra2 += dRa3 ) {
SkyPoint* p = new SkyPoint( ra2, dec );
p->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
lineList->append( p );
}
appendLine( lineList );
}
}
summary();
}
示例5: update
void HorizonComponent::update( KSNumbers * )
{
if ( ! selected() )
return;
KStarsData *data = KStarsData::Instance();
foreach ( SkyPoint *p, pointList() ) {
p->HorizontalToEquatorial( data->lst(), data->geo()->lat() );
}
示例6: initGeo
void modCalcDayLength::initGeo(void)
{
KStarsData *data = KStarsData::Instance();
geoPlace = data->geo();
geoBatch = data->geo();
Location->setText( geoPlace->fullName() );
LocationBatch->setText( geoBatch->fullName() );
}
示例7: update
// Don't precess the location of the names
void ConstellationNamesComponent::update( KSNumbers* )
{
if ( ! selected() )
return;
KStarsData *data = KStarsData::Instance();
foreach(SkyObject* o, m_ObjectList)
o->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
}
示例8: JITupdate
// Don't precess the points, just account for the Earth's rotation
void NoPrecessIndex::JITupdate( LineList* lineList )
{
KStarsData *data = KStarsData::Instance();
lineList->updateID = data->updateID();
SkyList* points = lineList->points();
for (int i = 0; i < points->size(); i++ ) {
points->at( i )->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
}
}
示例9: update
void ListComponent::update( KSNumbers *num )
{
if ( ! selected() )
return;
KStarsData *data = KStarsData::Instance();
foreach ( SkyObject *o, m_ObjectList ) {
if( num )
o->updateCoords( num );
o->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
}
}
示例10: update
void SolarSystemComposite::update( KSNumbers *num )
{
// if ( ! selected() ) return;
KStarsData *data = KStarsData::Instance();
m_Sun->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
m_Moon->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
m_JupiterMoons->update( num );
foreach ( SkyComponent *comp, components() ) {
comp->update( num );
}
示例11: KSNumbers
//Reimplement draw function so that we have control over the order of
//elements, and we can add object labels
//
//The order in which components are drawn naturally determines the
//z-ordering (the layering) of the components. Objects which
//should appear "behind" others should be drawn first.
void SkyMapComposite::draw( SkyPainter *skyp )
{
SkyMap *map = SkyMap::Instance();
KStarsData *data = KStarsData::Instance();
// We delay one draw cycle before re-indexing
// we MUST ensure CLines do not get re-indexed while we use DRAW_BUF
// so we do it here.
m_CLines->reindex( &m_reindexNum );
// This queues re-indexing for the next draw cycle
m_reindexNum = KSNumbers( data->updateNum()->julianDay() );
// This ensures that the JIT updates are synchronized for the entire draw
// cycle so the sky moves as a single sheet. May not be needed.
data->syncUpdateIDs();
// prepare the aperture
// FIXME_FOV: We may want to rejigger this to allow
// wide-angle views --hdevalence
float radius = map->projector()->fov();
if ( radius > 180.0 )
radius = 180.0;
if ( m_skyMesh->inDraw() ) {
printf("Warning: aborting concurrent SkyMapComposite::draw()\n");
return;
}
m_skyMesh->inDraw( true );
SkyPoint* focus = map->focus();
m_skyMesh->aperture( focus, radius + 1.0, DRAW_BUF ); // divide by 2 for testing
// create the no-precess aperture if needed
if ( Options::showEquatorialGrid() || Options::showHorizontalGrid() || Options::showCBounds() || Options::showEquator() ) {
m_skyMesh->index( focus, radius + 1.0, NO_PRECESS_BUF );
}
// clear marks from old labels and prep fonts
m_skyLabeler->reset( map );
m_skyLabeler->useStdFont();
// info boxes have highest label priority
// FIXME: REGRESSION. Labeler now know nothing about infoboxes
// map->infoBoxes()->reserveBoxes( psky );
if( KStars::Instance() ) {
const QList<SkyObject*> obsList = KStarsData::Instance()->observingList()->sessionList();
if( Options::obsListText() )
foreach( SkyObject* obj, obsList ) {
SkyLabeler::AddLabel( obj, SkyLabeler::RUDE_LABEL );
}
}
示例12: setPosition
void SkyObjItem::setPosition(SkyObject* so)
{
KStarsData *data = KStarsData::Instance();
KStarsDateTime ut = data->geo()->LTtoUT(KStarsDateTime(KDateTime::currentLocalDateTime()));
SkyPoint sp = so->recomputeCoords(ut, data->geo());
//check altitude of object at this time.
sp.EquatorialToHorizontal(data->lst(), data->geo()->lat());
double rounded_altitude = (int)(sp.alt().Degrees()/5.0)*5.0;
m_Position = i18n("Now visible: About %1 degrees above the %2 horizon", rounded_altitude, KSUtils::toDirectionString( sp.az() ) );
}
示例13: showCurrentTimeAndLocation
void modCalcSidTime::showCurrentTimeAndLocation()
{
KStarsData* data = KStarsData::Instance();
LT->setTime( data->lt().time() );
Date->setDate( data->lt().date() );
geo = data->geo();
LocationButton->setText( geo->fullName() );
geoBatch = data->geo();
LocationButtonBatch->setText( geoBatch->fullName() );
slotConvertST( LT->time() );
}
示例14: draw
void Ecliptic::draw( SkyPainter *skyp )
{
if ( ! selected() ) return;
KStarsData *data = KStarsData::Instance();
QColor color( data->colorScheme()->colorNamed( "EclColor" ) );
skyp->setPen( QPen( QBrush( color ), 1, Qt::SolidLine ) );
m_label.reset();
drawLines( skyp );
SkyLabeler::Instance()->setPen( QPen( QBrush( color ), 1, Qt::SolidLine ) );
m_label.draw();
drawCompassLabels();
}
示例15: updateCoords
void KSPlanetBase::updateCoords( const KSNumbers *num, bool includePlanets, const dms *lat, const dms *LST, bool )
{
KStarsData *kd = KStarsData::Instance();
if ( includePlanets ) {
kd->skyComposite()->earth()->findPosition( num ); //since we don't pass lat & LST, localizeCoords will be skipped
if ( lat && LST ) {
findPosition( num, lat, LST, kd->skyComposite()->earth() );
//Don't add to the trail this time
if( hasTrail() )
Trail.takeLast();
} else {
findGeocentricPosition( num, kd->skyComposite()->earth() );
}
}
}