[Kstars-devel] KDE/kdeedu/kstars/kstars
Akarsh Simha
akarshsimha at gmail.com
Thu Jan 15 18:58:05 CET 2009
SVN commit 911589 by asimha:
Adding support for setting up a rectangular / elliptical FOV
indicator.
CCBUG: 132766
CCMAIL: kstars-devel at kde.org
M +18 -12 fovdialog.cpp
M +30 -27 newfov.ui
M +2 -1 widgets/fovwidget.cpp
--- trunk/KDE/kdeedu/kstars/kstars/fovdialog.cpp #911588:911589
@@ -139,10 +139,11 @@
void FOVDialog::slotNewFOV() {
NewFOV newfdlg( this );
- float fovsize = newfdlg.ui->FOVEdit->text().replace( KGlobal::locale()->decimalSymbol(), "." ).toDouble(); // TODO: Add front-end support for rectangular and elliptical FOVs
+ float fovsizeX = newfdlg.ui->FOVEditX->text().replace( KGlobal::locale()->decimalSymbol(), "." ).toDouble();
+ float fovsizeY = newfdlg.ui->FOVEditX->text().replace( KGlobal::locale()->decimalSymbol(), "." ).toDouble();
if ( newfdlg.exec() == QDialog::Accepted ) {
- FOV *newfov = new FOV( newfdlg.ui->FOVName->text(), fovsize, fovsize,
+ FOV *newfov = new FOV( newfdlg.ui->FOVName->text(), fovsizeX, fovsizeY,
newfdlg.ui->ShapeBox->currentIndex(), newfdlg.ui->ColorButton->color().name() );
FOVList.append( newfov );
@@ -161,14 +162,16 @@
return;
newfdlg.ui->FOVName->setText( f->name() );
- newfdlg.ui->FOVEdit->setText( QString::number( (double)( f->sizeX() ), 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) ); // TODO: Add front-end support for rectangular and elliptical FOVs
+ newfdlg.ui->FOVEditX->setText( QString::number( (double)( f->sizeX() ), 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
+ newfdlg.ui->FOVEditY->setText( QString::number( (double)( f->sizeY() ), 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
newfdlg.ui->ColorButton->setColor( QColor( f->color() ) );
newfdlg.ui->ShapeBox->setCurrentIndex( f->shape() );
newfdlg.slotUpdateFOV();
if ( newfdlg.exec() == QDialog::Accepted ) {
- double fovsize = newfdlg.ui->FOVEdit->text().replace( KGlobal::locale()->decimalSymbol(), "." ).toDouble(); // TODO: Add front-end support for rectangular and elliptical FOVs
- FOV *newfov = new FOV( newfdlg.ui->FOVName->text(), fovsize, fovsize,
+ double fovsizeX = newfdlg.ui->FOVEditX->text().replace( KGlobal::locale()->decimalSymbol(), "." ).toDouble();
+ double fovsizeY = newfdlg.ui->FOVEditY->text().replace( KGlobal::locale()->decimalSymbol(), "." ).toDouble();
+ FOV *newfov = new FOV( newfdlg.ui->FOVName->text(), fovsizeX, fovsizeY,
newfdlg.ui->ShapeBox->currentIndex(), newfdlg.ui->ColorButton->color().name() );
fov->FOVListBox->currentItem()->setText( newfdlg.ui->FOVName->text() );
@@ -210,7 +213,8 @@
setButtons( KDialog::Ok|KDialog::Cancel );
connect( ui->FOVName, SIGNAL( textChanged( const QString & ) ), SLOT( slotUpdateFOV() ) );
- connect( ui->FOVEdit, SIGNAL( textChanged( const QString & ) ), SLOT( slotUpdateFOV() ) );
+ connect( ui->FOVEditX, SIGNAL( textChanged( const QString & ) ), SLOT( slotUpdateFOV() ) );
+ connect( ui->FOVEditY, SIGNAL( textChanged( const QString & ) ), SLOT( slotUpdateFOV() ) );
connect( ui->ColorButton, SIGNAL( changed( const QColor & ) ), SLOT( slotUpdateFOV() ) );
connect( ui->ShapeBox, SIGNAL( activated( int ) ), SLOT( slotUpdateFOV() ) );
connect( ui->ComputeEyeFOV, SIGNAL( clicked() ), SLOT( slotComputeFOV() ) );
@@ -223,8 +227,9 @@
void NewFOV::slotUpdateFOV() {
bool sizeOk( false );
f.setName( ui->FOVName->text() );
- float size = ui->FOVEdit->text().replace( KGlobal::locale()->decimalSymbol(), "." ).toDouble( &sizeOk );
- if ( sizeOk ) f.setSize( size, size ); // TODO: Add front-end support for elliptical and rectangular FOVs
+ float sizeX = ui->FOVEditX->text().replace( KGlobal::locale()->decimalSymbol(), "." ).toDouble( &sizeOk );
+ float sizeY = ui->FOVEditY->text().replace( KGlobal::locale()->decimalSymbol(), "." ).toDouble( &sizeOk );
+ if ( sizeOk ) f.setSize( sizeX, sizeY );
f.setShape( ui->ShapeBox->currentIndex() );
f.setColor( ui->ColorButton->color().name() );
@@ -239,16 +244,17 @@
void NewFOV::slotComputeFOV() {
if ( sender() == ui->ComputeEyeFOV && ui->TLength1->value() > 0.0 )
- ui->FOVEdit->setText( QString::number( (double) ui->EyeFOV->value() * ui->EyeLength->value() / ui->TLength1->value(), 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
+ ui->FOVEditX->setText( QString::number( (double) ui->EyeFOV->value() * ui->EyeLength->value() / ui->TLength1->value(), 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
else if ( sender() == ui->ComputeCameraFOV && ui->TLength2->value() > 0.0 )
- ui->FOVEdit->setText( QString::number( (double) ui->ChipSize->value() * 3438.0 / ui->TLength2->value(), 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
+ ui->FOVEditX->setText( QString::number( (double) ui->ChipSize->value() * 3438.0 / ui->TLength2->value(), 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
else if ( sender() == ui->ComputeHPBW && ui->RTDiameter->value() > 0.0 && ui->WaveLength->value() > 0.0 ) {
- ui->FOVEdit->setText( QString::number( (double) 34.34 * 1.2 * ui->WaveLength->value() / ui->RTDiameter->value(), 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
+ ui->FOVEditX->setText( QString::number( (double) 34.34 * 1.2 * ui->WaveLength->value() / ui->RTDiameter->value(), 'f', 2 ).replace( '.', KGlobal::locale()->decimalSymbol() ) );
// Beam width for an antenna is usually a circle on the sky.
ui->ShapeBox->setCurrentIndex(4);
+ ui->FOVEditY->setText( ui->FOVEditX->text() );
slotUpdateFOV();
-
}
+ ui->FOVEditY->setText( ui->FOVEditX->text() );
}
unsigned int FOVDialog::currentItem() const { return fov->FOVListBox->currentRow(); }
--- trunk/KDE/kdeedu/kstars/kstars/newfov.ui #911588:911589
@@ -54,15 +54,10 @@
</item>
<item>
<widget class="KTabWidget" name="tabWidget2" >
+ <property name="currentIndex" >
+ <number>2</number>
+ </property>
<widget class="QWidget" name="tab" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>451</width>
- <height>189</height>
- </rect>
- </property>
<attribute name="title" >
<string>Eyepiece</string>
</attribute>
@@ -301,14 +296,6 @@
</layout>
</widget>
<widget class="QWidget" name="tab" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>840</width>
- <height>420</height>
- </rect>
- </property>
<attribute name="title" >
<string>Camera</string>
</attribute>
@@ -513,14 +500,6 @@
</layout>
</widget>
<widget class="QWidget" name="TabPage" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>840</width>
- <height>420</height>
- </rect>
- </property>
<attribute name="title" >
<string>Radiotelescope</string>
</attribute>
@@ -734,12 +713,12 @@
<item>
<widget class="QLabel" name="fieldoFviewLabel" >
<property name="text" >
- <string>Field of view (arcmin):</string>
+ <string>Field of view:</string>
</property>
</widget>
</item>
<item>
- <widget class="KLineEdit" name="FOVEdit" >
+ <widget class="KLineEdit" name="FOVEditX" >
<property name="toolTip" >
<string>Desired field-of-view size, in arcminutes</string>
</property>
@@ -750,6 +729,30 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>arcmin</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string> x </string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KLineEdit" name="FOVEditY" />
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string>arcmin</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
@@ -954,7 +957,7 @@
<tabstop>TLength2</tabstop>
<tabstop>ChipSize</tabstop>
<tabstop>ComputeCameraFOV</tabstop>
- <tabstop>FOVEdit</tabstop>
+ <tabstop>FOVEditX</tabstop>
<tabstop>ShapeBox</tabstop>
<tabstop>ColorButton</tabstop>
</tabstops>
--- trunk/KDE/kdeedu/kstars/kstars/widgets/fovwidget.cpp #911588:911589
@@ -40,7 +40,8 @@
if ( m_FOV ) {
if ( m_FOV->sizeX() > 0 || m_FOV->sizeY() > 0 ) {
- m_FOV->draw( p, (float)( 0.3*contentsRect().width() ), (float)( 0.3*contentsRect().width() ) );
+ float aspectratio = m_FOV->sizeY() / m_FOV->sizeX();
+ m_FOV->draw( p, (float)( 0.3*contentsRect().width() ), (float)( 0.3*contentsRect().width() * aspectratio ) );
QFont smallFont = p.font();
smallFont.setPointSize( p.font().pointSize() - 2 );
p.setFont( smallFont );
More information about the Kstars-devel
mailing list