[Kstars-devel] comet with tail .. eye-candy patch

Vipul Kumar Singh vipulkrsingh at gmail.com
Wed Apr 1 22:35:44 CEST 2009


Hi every one this is a small patch that will replace existing comets with a
picture of comet with tail.
what it does:
    - it replaces all comets with a picture that shows a comet with tail
    - the picture starts showing up very small and is scaled wit increasing
zoom level.

And is does NOT
     - use any technical calculation about the size of comet image
displayed.
   - the comet tail doesnt point away from sun // still cant figure out how
to do that


a patch file is included and an image file is included. image should be put
in data folder.
patch :

Property changes on: kstars/kstars/skyobjects/saturnmoons.cpp

___________________________________________________________________
Added: svn:executable

   + *



Property changes on: kstars/kstars/skyobjects/saturnmoons.h
___________________________________________________________________
Added: svn:executable
   + *

Index: kstars/kstars/data/CMakeLists.txt
===================================================================
--- kstars/kstars/data/CMakeLists.txt (revision 946942)
+++ kstars/kstars/data/CMakeLists.txt (working copy)
@@ -58,6 +58,7 @@
  asteroids.dat comets.dat
  sun.png mercury.png venus.png mars.png jupiter.png saturn.png
  uranus.png neptune.png pluto.png
+ cometWithTail.png
  moon00.png moon01.png moon02.png moon03.png moon04.png moon05.png
  moon06.png moon07.png moon08.png moon09.png moon10.png moon11.png
  moon12.png moon13.png moon14.png moon15.png moon16.png moon17.png
Index: kstars/kstars/skycomponents/cometscomponent.cpp
===================================================================
--- kstars/kstars/skycomponents/cometscomponent.cpp (revision 946942)
+++ kstars/kstars/skycomponents/cometscomponent.cpp (working copy)
@@ -21,6 +21,7 @@
 #include <QFile>
 #include <QPen>
 #include <QPainter>
+#include <QPicture>
 #include <kglobal.h>

 #include "Options.h"
@@ -110,17 +111,33 @@
         //if ( ( o.x() >= 0. && o.x() <= Width && o.y() >= 0. && o.y() <=
Height ) )

         float size = com->angSize() * map->scale() * dms::PI *
Options::zoomFactor()/10800.0;
- if ( size < 1.0 ) {
-            psky.drawPoint( o );
-        } else {
-            float x1 = o.x() - 0.5*size;
-            float y1 = o.y() - 0.5*size;

-            psky.drawEllipse( QRectF( x1, y1, size, size ) );
+      //  if ( size < 0.01 ) {
+      //      psky.drawPoint( o );
+      //  } else {
+
+        /// load image to be displayed in place of comet
+        QImage Image,Image0;
+        QString image_file;
+        image_file=QString("cometWithTail.png");
+        QFile imFile;
+
+        if ( KSUtils::openDataFile( imFile, image_file ) ) {
+            imFile.close();
+            Image0.load( imFile.fileName() );
+            Image = Image0.convertToFormat( QImage::Format_ARGB32 );
+            Image0 = Image;
         }

         float tailsize = com->getTailAngSize().Degrees() * map->scale() *
dms::PI * Options::zoomFactor()/10800.0;

+        // resize the image according to current zoom level
+            int width=Image.width(); // width of orignal image
+            Image0=Image.scaledToWidth(width*dms::PI *
Options::zoomFactor()/1000000.0 );
+            float x1 = o.x() - 0.5*Image0.width();
+            float y1 = o.y() - 0.5*Image0.height();
+            psky.drawImage( QPointF(x1, y1), Image0);
+      //  }
         if ( hideLabels || com->rsun() >= rsunLabelLimit ) continue;
         SkyLabeler::AddLabel( o, com, SkyLabeler::COMET_LABEL );
     }

Property changes on: kstars/kstars/skycomponents/saturnmoonscomponent.h
___________________________________________________________________
Added: svn:executable
   + *


Property changes on: kstars/kstars/skycomponents/saturnmoonscomponent.cpp
___________________________________________________________________
Added: svn:executable
   + *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kstars-devel/attachments/20090402/5bd28d70/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cometWithTail.png
Type: image/png
Size: 35006 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kstars-devel/attachments/20090402/5bd28d70/attachment-0001.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: application/octet-stream
Size: 3266 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kstars-devel/attachments/20090402/5bd28d70/attachment-0001.dll 


More information about the Kstars-devel mailing list