Sorry, forget to attach it.

On Tue, May 27, 2014 at 11:24 AM, Marco Diego Aurélio Mesquita
<[email protected]> wrote:
> Hi devs,
>
> I'm an amateur astronomer and aspiring Stellarium developer. As such,
> I really miss the possibility to know the surface brightness of an
> object from Stellarium.
>
> Surface brightness is a very good metric to know how easily visible an
> object is. As of now, Stellarium does not display such info.
>
> The attached patch implements the display of surface brightness for
> extended objects. Its math pretty straightforward and comes from [1].
> It was created from Stellarium 0.12.4 source code.
>
> Please review it.
>
> [1] http://en.wikipedia.org/wiki/Surface_brightness
Somente em stellarium-0.12.4/: builds
diff -ur stellarium-clean/stellarium-0.12.4/data/default_config.ini 
stellarium-0.12.4/data/default_config.ini
--- stellarium-clean/stellarium-0.12.4/data/default_config.ini  2013-09-07 
12:50:48.000000000 -0300
+++ stellarium-0.12.4/data/default_config.ini   2014-05-27 09:17:02.695589862 
-0300
@@ -100,6 +100,7 @@
 flag_show_radecj2000                = false
 flag_show_radecofdate               = false
 flag_show_size                      = false
+flag_show_surfacebrightness         = true
 
 [gui]
 flag_show_flip_buttons              = false
Somente em stellarium-0.12.4/data: default_config.ini~
diff -ur stellarium-clean/stellarium-0.12.4/src/core/modules/Nebula.cpp 
stellarium-0.12.4/src/core/modules/Nebula.cpp
--- stellarium-clean/stellarium-0.12.4/src/core/modules/Nebula.cpp      
2013-08-04 03:20:27.000000000 -0300
+++ stellarium-0.12.4/src/core/modules/Nebula.cpp       2014-05-27 
09:25:41.719602933 -0300
@@ -123,6 +123,9 @@
        if (flags&Extra1)
                oss << q_("Type: <b>%1</b>").arg(getTypeString()) << "<br>";
 
+    bool isExtended = angularSize > 0;
+    double angularSizeInDegrees = angularSize*M_PI/180.;
+
        if (mag < 50 && flags&Magnitude)
        {
            if (core->getSkyDrawer()->getFlagHasAtmosphere())
@@ -130,11 +133,24 @@
                                                                                
QString::number(getVMagnitude(core, true), 'f', 2)) << "<br>";
            else
                oss << q_("Magnitude: <b>%1</b>").arg(getVMagnitude(core, 
false), 0, 'f', 2) << "<br>";
+
+        if (isExtended && flags&SurfaceBrightness) {
+            double angularSizeInArcsec = 3600.0 * angularSizeInDegrees;
+            double surfaceArea = M_PI*angularSizeInArcsec*angularSizeInArcsec;
+            double surfaceBrightness = getVMagnitude(core, false) + 
2.5*log(surfaceArea);
+            double extinctSurfaceBrightness = getVMagnitude(core, true) + 
2.5*log(surfaceArea);
+            if (core->getSkyDrawer()->getFlagHasAtmosphere())
+               oss << q_("Surface Brightness: <b>%1</b> (extincted to: 
<b>%2</b>)").arg(QString::number(surfaceBrightness, 'f', 2),
+                                                                               
QString::number(extinctSurfaceBrightness, 'f', 2)) << "<br>";
+            else
+               oss << q_("Surface Brightness: 
<b>%1</b>").arg(surfaceBrightness, 0, 'f', 2) << "<br>";
+        }
+
        }
        oss << getPositionInfoString(core, flags);
 
-       if (angularSize>0 && flags&Size)
-               oss << q_("Size: 
%1").arg(StelUtils::radToDmsStr(angularSize*M_PI/180.)) << "<br>";
+       if (isExtended && flags&Size)
+        oss << q_("Size: 
%1").arg(StelUtils::radToDmsStr(angularSizeInDegrees)) << "<br>";
 
        postProcessInfoString(str, flags);
 
Somente em stellarium-0.12.4/src/core/modules: Nebula.cpp~
diff -ur stellarium-clean/stellarium-0.12.4/src/core/StelObject.hpp 
stellarium-0.12.4/src/core/StelObject.hpp
--- stellarium-clean/stellarium-0.12.4/src/core/StelObject.hpp  2013-04-21 
04:23:20.000000000 -0300
+++ stellarium-0.12.4/src/core/StelObject.hpp   2014-05-27 08:46:50.023544213 
-0300
@@ -56,7 +56,8 @@
                PlainText     = 0x00000800, //!< Strip HTML tags from output
                HourAngle     = 0x00001000,  //!< The hour angle + DE (of date)
                AbsoluteMagnitude = 0x00002000,  //!< The absolute magnitude
-               GalCoordJ2000 = 0x00004000      //!< The galactic position 
(J2000 ref) GZ: HEY STOP! GalCoords are DEFINED in B1950 coordinates! What we 
have here is a transformation matrix preconfigured to do precession 
J2000->B1950 and Equ.B1950->Gal. But "GalCoord for J2000" does not make sense.
+               GalCoordJ2000 = 0x00004000,     //!< The galactic position 
(J2000 ref) GZ: HEY STOP! GalCoords are DEFINED in B1950 coordinates! What we 
have here is a transformation matrix preconfigured to do precession 
J2000->B1950 and Equ.B1950->Gal. But "GalCoord for J2000" does not make sense.
+        SurfaceBrightness = 0x00008000 //!< Surface brightness of the object
        };
        typedef QFlags<InfoStringGroupFlags> InfoStringGroup;
        Q_FLAGS(InfoStringGroup)
Somente em stellarium-0.12.4/src/core: StelObject.hpp~
diff -ur stellarium-clean/stellarium-0.12.4/src/gui/ConfigurationDialog.cpp 
stellarium-0.12.4/src/gui/ConfigurationDialog.cpp
--- stellarium-clean/stellarium-0.12.4/src/gui/ConfigurationDialog.cpp  
2013-09-13 07:51:45.000000000 -0300
+++ stellarium-0.12.4/src/gui/ConfigurationDialog.cpp   2014-05-27 
09:54:47.115646888 -0300
@@ -396,6 +396,8 @@
                flags |= StelObject::CatalogNumber;
        if (ui->checkBoxVisualMag->isChecked())
                flags |= StelObject::Magnitude;
+    if (ui->checkBoxSurfaceBrightness->isChecked())
+               flags |= StelObject::SurfaceBrightness;
        if (ui->checkBoxAbsoluteMag->isChecked())
                flags |= StelObject::AbsoluteMagnitude;
        if (ui->checkBoxRaDecJ2000->isChecked())
@@ -583,6 +585,8 @@
                               (bool) (flags & StelObject::CatalogNumber));
                conf->setValue("flag_show_magnitude",
                               (bool) (flags & StelObject::Magnitude));
+        conf->setValue("flag_show_surfacebrightness",
+                              (bool) (flags & StelObject::SurfaceBrightness));
                conf->setValue("flag_show_absolutemagnitude",
                               (bool) (flags & StelObject::AbsoluteMagnitude));
                conf->setValue("flag_show_radecj2000",
@@ -1075,6 +1079,7 @@
        ui->checkBoxName->setChecked(flags & StelObject::Name);
        ui->checkBoxCatalogNumbers->setChecked(flags & 
StelObject::CatalogNumber);
        ui->checkBoxVisualMag->setChecked(flags & StelObject::Magnitude);
+    ui->checkBoxSurfaceBrightness->setChecked(flags & 
StelObject::SurfaceBrightness);
        ui->checkBoxAbsoluteMag->setChecked(flags & 
StelObject::AbsoluteMagnitude);
        ui->checkBoxRaDecJ2000->setChecked(flags & StelObject::RaDecJ2000);
        ui->checkBoxRaDecOfDate->setChecked(flags & StelObject::RaDecOfDate);
Somente em stellarium-0.12.4/src/gui: ConfigurationDialog.cpp~
diff -ur stellarium-clean/stellarium-0.12.4/src/gui/configurationDialog.ui 
stellarium-0.12.4/src/gui/configurationDialog.ui
--- stellarium-clean/stellarium-0.12.4/src/gui/configurationDialog.ui   
2013-08-04 03:20:27.000000000 -0300
+++ stellarium-0.12.4/src/gui/configurationDialog.ui    2014-05-27 
09:47:35.195636011 -0300
@@ -405,6 +405,16 @@
                </attribute>
               </widget>
              </item>
+             <item row="0" column="2">
+              <widget class="QCheckBox" name="checkBoxSurfaceBrightness">
+               <property name="text">
+                <string>Surface brightness</string>
+               </property>
+               <attribute name="buttonGroup">
+                <string notr="true">buttonGroupDisplayedFields</string>
+               </attribute>
+              </widget>
+             </item>
              <item row="1" column="1">
               <widget class="QCheckBox" name="checkBoxAbsoluteMag">
                <property name="text">
Somente em stellarium-0.12.4/src/gui: configurationDialog.ui~
diff -ur stellarium-clean/stellarium-0.12.4/src/gui/SkyGui.cpp 
stellarium-0.12.4/src/gui/SkyGui.cpp
--- stellarium-clean/stellarium-0.12.4/src/gui/SkyGui.cpp       2013-08-04 
03:20:27.000000000 -0300
+++ stellarium-0.12.4/src/gui/SkyGui.cpp        2014-05-27 09:16:15.523588674 
-0300
@@ -82,6 +82,8 @@
                        infoTextFilters |= StelObject::Extra2;
                if (conf->value("flag_show_extra3", false).toBool())
                        infoTextFilters |= StelObject::Extra3;
+        if (conf->value("flag_show_surfacebrightness", false).toBool())
+                       infoTextFilters |= StelObject::SurfaceBrightness;
                conf->endGroup();
        }
        else
Somente em stellarium-0.12.4/src/gui: SkyGui.cpp~
------------------------------------------------------------------------------
The best possible search technologies are now affordable for all companies.
Download your FREE open source Enterprise Search Engine today!
Our experts will assist you in its installation for $59/mo, no commitment.
Test it for FREE on our Cloud platform anytime!
http://pubads.g.doubleclick.net/gampad/clk?id=145328191&iu=/4140/ostg.clktrk
_______________________________________________
Stellarium-pubdevel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stellarium-pubdevel

Reply via email to