void modCalcVlsr::slotFindObject() {
    QPointer<FindDialog> fd = new FindDialog( KStars::Instance() );
    if ( fd->exec() == QDialog::Accepted ) {
        SkyObject *o = fd->selectedObject();
        RA->showInHours( o->ra0() );
        Dec->showInDegrees( o->dec0() );
    }
    delete fd;
}
Beispiel #2
0
void modCalcAltAz::slotObject()
{
    FindDialog fd(KStars::Instance());
    if ( fd.exec() == QDialog::Accepted ) {
        SkyObject *o = fd.selectedObject();
        RA->showInHours( o->ra() );
        Dec->showInDegrees( o->dec() );
        slotCompute();
    }
}
Beispiel #3
0
SkyObject::SkyObject( SkyObject &o ) : SkyPoint( o ) {
	setType( o.type() );
	Magnitude = o.mag();
	setName(o.name());
	setName2(o.name2());
	setLongName(o.longname());
	ImageList = o.ImageList;
	ImageTitle = o.ImageTitle;
	InfoList = o.InfoList;
	InfoTitle = o.InfoTitle;
}
Beispiel #4
0
void modCalcGalCoord::slotObject()
{
    QPointer<FindDialog> fd = new FindDialog( this );
    if ( fd->exec() == QDialog::Accepted ) {
        SkyObject *o = fd->targetObject();
        RA->showInHours( o->ra() );
        Dec->showInDegrees( o->dec() );
        slotComputeCoords();
    }
    delete fd;
}
Osp::Base::Object*
SkyBuilder::Run() {
	SkyIterator* skyIterator = SkyFactory::getStars();
	ArrayList* args = new ArrayList();
	args -> Add(*(new Integer(0)));
	args -> Add(*(new Integer(skyIterator -> GetSize())));
	Osp::App::Application::GetInstance() -> SendUserEvent(BUILD_PROGRESS_RANGE_SET, args);
	AppLog("Setting progress range from 0 to %d", skyIterator -> GetSize());
	int counter = 0;
	bool isVisible = false;
	Osp::Base::Collection::ArrayList* list;
	ConstellationComparer* comparer = new ConstellationComparer();
	list = new Osp::Base::Collection::ArrayList();
	while (skyIterator -> hasNext()) {
		SkyObject* skyObject = skyIterator -> getNext();
		isVisible = skyObject -> Draw();
		String constName = skyObject->getConstellation();
		constName.Trim();
		if (isVisible && (!list -> Contains(constName)) && constName.GetLength()>0) {
			String* str = new String(constName);
			list -> Add(*str);
		}
		counter++;
		if (counter%500 == 0) {
			args = new ArrayList();
			args -> Add(*(new Integer(counter)));
			Osp::App::Application::GetInstance() -> SendUserEvent(BUILD_PROGRESS_SET, args);
		}
	}
	args = new ArrayList();
	args -> Add(*(new Integer(skyIterator -> GetSize())));
	IEnumerator* e = list->GetEnumeratorN();
	while (e->MoveNext()==E_SUCCESS) {
		AppLog("List have %S", ((String*)e->GetCurrent())->GetPointer());
	}
	list -> Sort(*comparer);
	SkyCanvas::SetConstellations(list);
	delete comparer;
	Osp::App::Application::GetInstance() -> SendUserEvent(BUILD_PROGRESS_DONE, args);
	return null;
}
void ObservingList::slotNewSelection() {
    bool found = false;
    singleSelection = false;
    noSelection = false;
    showScope = false;
    ui->ImagePreview->clearPreview();
    ui->ImagePreview->setCursor( Qt::ArrowCursor );
    QModelIndexList selectedItems;
    QString newName;
    SkyObject *o;
    ui->SaveImage->setEnabled( false );
    ui->DeleteImage->setEnabled( false );

    QStandardItemModel *currentModel;
    QList<SkyObject*> currList;

    if ( sessionView ) {
        selectedItems = m_SortModelSession->mapSelectionToSource( ui->SessionView->selectionModel()->selection() ).indexes();
        currentModel = m_Session;
        currList = sessionList();
    } else {
        selectedItems = m_SortModel->mapSelectionToSource( ui->TableView->selectionModel()->selection() ).indexes();
        currentModel = m_Model;
        currList = obsList();
    }

    if ( selectedItems.size() == currentModel->columnCount() ) {
        newName = selectedItems[0].data().toString();
        singleSelection = true;
        //Find the selected object in the SessionList,
        //then break the loop.  Now SessionList.current()
        //points to the new selected object (until now it was the previous object)
        foreach ( o, currList ) {
            if ( o->translatedName() == newName ) {
                found = true;
                break;
            }
        }
    }
void KStars::setINDITargetName(const QString &objectName)
{
    INDI_D *dev;
    INDI_P *prop;
    INDI_E *el;

    if (!indidriver || !indimenu) {
        kDebug() << "setINDITarget: establishINDI() failed.";
        return;
    }

    SkyObject *target = data()->objectNamed( objectName );
    if (!target) return;

    dev = indimenu->findDevice(indimenu->getCurrentDevice());
    if (!dev)
        dev = indimenu->findDeviceByLabel(indimenu->getCurrentDevice());
    if (!dev) {
        kDebug() << "Device " << indimenu->getCurrentDevice() << " not found!";
        return;
    }

    prop = dev->findProp("EQUATORIAL_EOD_COORD");
    if (!prop) return;

    el = prop->findElement("RA");
    if( !el || !el->write_w)
        return;
    el->write_w->setText(QString::number(target->ra().Hours()));

    el  = prop->findElement("DEC");
    if( !el || !el->write_w)
        return;
    el->write_w->setText(QString::number(target->dec().Degrees()));

    prop->newText();
}
void modCalcAngDist::slotObjectButton() {
    QPointer<FindDialog> fd = new FindDialog( this );
    if ( fd->exec() == QDialog::Accepted ) {
        SkyObject *o = fd->selectedObject();
        if ( sender()->objectName() == QString("FirstObjectButton") ) {
            FirstRA->showInHours( o->ra() );
            FirstDec->showInDegrees( o->dec() );
            FirstPositionBox->setTitle( i18n("First position") + ": " + o->name() );
        } else {
            SecondRA->showInHours( o->ra() );
            SecondDec->showInDegrees( o->dec() );
            SecondPositionBox->setTitle( i18n("Second position") + ": " + o->name() );
        }

        slotValidatePositions();
    }
    delete fd;
}
Beispiel #9
0
QString KStars::getObjectDataXML( const QString &objectName ) {
    SkyObject *target = data()->objectNamed( objectName );
    if ( !target ) {
        return QString( "<xml></xml>" );
    }
    QString output;
    QXmlStreamWriter stream( &output );
    stream.setAutoFormatting( true );
    stream.writeStartDocument();
    stream.writeStartElement( "object" );
    stream.writeTextElement( "Name", target->name() );
    stream.writeTextElement( "Alt_Name", target->name2() );
    stream.writeTextElement( "Long_Name", target->longname() );
    stream.writeTextElement( "Constellation", KStarsData::Instance()->skyComposite()->getConstellationBoundary()->constellationName( target ) );
    stream.writeTextElement( "RA_HMS", target->ra().toHMSString() );
    stream.writeTextElement( "Dec_DMS", target->dec().toDMSString() );
    stream.writeTextElement( "RA_J2000_HMS", target->ra0().toHMSString() );
    stream.writeTextElement( "Dec_J2000_DMS", target->dec0().toDMSString() );
    stream.writeTextElement( "RA_Degrees", QString::number( target->ra().Degrees() ) );
    stream.writeTextElement( "Dec_Degrees", QString::number( target->dec().Degrees() ) );
    stream.writeTextElement( "RA_J2000_Degrees", QString::number( target->ra0().Degrees() ) );
    stream.writeTextElement( "Dec_J2000_Degrees", QString::number( target->dec0().Degrees() ) );
    stream.writeTextElement( "Type", target->typeName() );
    stream.writeTextElement( "Magnitude", QString::number( target->mag(), 'g', 2 ) );
    stream.writeTextElement( "Position_Angle", QString::number( target->pa(), 'g', 3 ) );
    StarObject *star = dynamic_cast< StarObject* >( target );
    DeepSkyObject *dso = dynamic_cast< DeepSkyObject* >( target );
    if ( star ) {
        stream.writeTextElement( "Spectral_Type",  star->sptype() );
        stream.writeTextElement( "Genetive_Name", star->gname() );
        stream.writeTextElement( "Greek_Letter", star->greekLetter() );
        stream.writeTextElement( "Proper_Motion", QString::number( star->pmMagnitude() ) );
        stream.writeTextElement( "Proper_Motion_RA", QString::number( star->pmRA() ) );
        stream.writeTextElement( "Proper_Motion_Dec", QString::number( star->pmDec() ) );
        stream.writeTextElement( "Parallax_mas", QString::number( star->parallax() ) );
        stream.writeTextElement( "Distance_pc", QString::number( star->distance() ) );
        stream.writeTextElement( "Henry_Draper", QString::number( star->getHDIndex() ) );
        stream.writeTextElement( "BV_Index", QString::number( star->getBVIndex() ) );
    }
    else if ( dso ) {
        stream.writeTextElement( "Catalog", dso->catalog() );
        stream.writeTextElement( "Major_Axis", QString::number( dso->a() ) );
        stream.writeTextElement( "Minor_Axis", QString::number( dso->a() * dso->e() ) );
    }
    stream.writeEndElement(); // object
    stream.writeEndDocument();
    return output;
}
Osp::Base::Object*
SkyBuilder::Run() {
	SkyIterator* skyIterator = SkyFactory::getStars();
	ArrayList* args = new ArrayList();
	args -> Add(*(new Integer(0)));
	args -> Add(*(new Integer(skyIterator -> GetSize())));
	Osp::App::Application::GetInstance() -> SendUserEvent(EVENT_BUILD_PROGRESS_RANGE_SET, args);
	int counter = 0;
	bool isVisible = false;
	Osp::Base::Collection::ArrayList* __constellationsList;
	Osp::Base::Collection::ArrayList* __starsList;
	ConstellationComparer* comparer = new ConstellationComparer();
	__constellationsList = new Osp::Base::Collection::ArrayList();
	__starsList = new Osp::Base::Collection::ArrayList();
	while (skyIterator -> hasNext()) {
		SkyObject* skyObject = skyIterator -> getNext();
		isVisible = skyObject -> Draw();
		String constName = skyObject->getConstellation();
		constName.Trim();
		if (isVisible && (!__constellationsList -> Contains(constName)) && constName.GetLength()>0) {
			String* str = new String(constName);
			__constellationsList -> Add(*str);
		}
		String skyObjectName = skyObject->getName();
		if(isVisible && skyObjectName!=null && (skyObjectName.Equals("ALP", false)||skyObjectName.Equals("BET", false)||skyObjectName.Equals("GAM", false))) {
			String starGreekLetter = skyObject -> getName();
			starGreekLetter.ToUpper();

			String* fullStarKey = new String();
			fullStarKey->Format(14, L"%S_%S_%f",
					starGreekLetter.GetPointer(),
					skyObject->getConstellation().GetPointer(),
					skyObject->getMagnitude());

			String* starKey = new String();
			starKey->Format(8, L"%S_%S",
								starGreekLetter.GetPointer(),
								skyObject->getConstellation().GetPointer());

			String starName;
			Osp::App::AppResource* appResource = Osp::App::Application::GetInstance()->GetAppResource();
			appResource->GetString(*starKey, starName);
			if(starName != null) {
			__starsList -> Add(*fullStarKey);
			}
		}
		counter++;
		if (counter%500 == 0) {
			args = new ArrayList();
			args -> Add(*(new Integer(counter)));
			Osp::App::Application::GetInstance() -> SendUserEvent(EVENT_BUILD_PROGRESS_SET, args);
		}
	}
	args = new ArrayList();
	args -> Add(*(new Integer(skyIterator -> GetSize())));
	IEnumerator* e = __constellationsList->GetEnumeratorN();
	__constellationsList -> Sort(*comparer);
	SkyCanvas::SetConstellations(__constellationsList);
	SkyCanvas::SetStars(__starsList);
	delete comparer;
	Osp::App::Application::GetInstance() -> SendUserEvent(EVENT_BUILD_PROGRESS_DONE, args);
	return null;
}