[kstars] kstars: Using pixmaps to represent visible vs non-visible satellites. The pixmap does not scale with zoom level but that is intentional as we are not trying

Jasem Mutlaq mutlaqja at ikarustech.com
Thu Dec 1 15:47:59 UTC 2016


Git commit e84b029e0c75beba42a3f998216962ab94b94635 by Jasem Mutlaq.
Committed on 01/12/2016 at 15:45.
Pushed by mutlaqja into branch 'master'.

Using pixmaps to represent visible vs non-visible satellites. The pixmap does not scale with zoom level but that is intentional as we are not trying
to plot angular extent of the satellite, only that it's there.
CCMAIL:kstars-devel at kde.org

A  +62   -0    kstars/data/icons/breeze/default/kstars_satellites_invisible.svg
A  +62   -0    kstars/data/icons/breeze/default/kstars_satellites_visible.svg
M  +2    -0    kstars/data/kstars.qrc
M  +10   -4    kstars/skyqpainter.cpp

https://commits.kde.org/kstars/e84b029e0c75beba42a3f998216962ab94b94635

diff --git a/kstars/data/icons/breeze/default/kstars_satellites_invisible.svg b/kstars/data/icons/breeze/default/kstars_satellites_invisible.svg
new file mode 100644
index 0000000..e376dac
--- /dev/null
+++ b/kstars/data/icons/breeze/default/kstars_satellites_invisible.svg
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   viewBox="0 0 22 22"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="kstars_satellites_invisible.svg">
+  <metadata
+     id="metadata10">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1920"
+     inkscape:window-height="1023"
+     id="namedview8"
+     showgrid="false"
+     inkscape:zoom="10.727273"
+     inkscape:cx="11"
+     inkscape:cy="11"
+     inkscape:window-x="1920"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="svg2" />
+  <defs
+     id="defs3051">
+    <style
+       type="text/css"
+       id="current-color-scheme">
+      .ColorScheme-Text {
+        color:#4d4d4d;
+      }
+      </style>
+  </defs>
+  <path
+     style="fill:#f2f2f2;fill-opacity:1;stroke:none"
+     d="M 14 3 L 8.7363281 10.177734 A 4.5 4.5 0 0 1 9.1855469 10.333984 C 8.6642326 10.122856 8.0970333 10 7.5 10 C 6.3069911 10.0012 5.1632886 10.476121 4.3203125 11.320312 A 4.5 4.5 0 0 0 3.6933594 12.107422 L 5.7871094 14.201172 L 4.390625 16.105469 A 3.5 3.5 0 0 0 5.8964844 17.607422 L 7.7988281 16.212891 L 9.8945312 18.308594 A 4.5 4.5 0 0 0 10.679688 17.679688 C 11.523881 16.836711 11.998786 15.693009 12 14.5 C 12.000001 13.918791 11.88031 13.367411 11.679688 12.857422 A 4.5 4.5 0 0 1 11.824219 13.261719 L 19 8 L 14 3 z M 5.9140625 3.0859375 L 3.0859375 5.9160156 L 6.7578125 9.5859375 L 9.5859375 6.7578125 L 5.9140625 3.0859375 z M 14.117188 4.53125 L 17.46875 7.8828125 L 11.427734 12.314453 A 4.5 4.5 0 0 1 11.599609 12.662109 C 11.151345 11.664248 10.352692 10.863145 9.3574219 10.410156 A 4.5 4.5 0 0 1 9.6894531 10.570312 L 14.117188 4.53125 z M 7.5 11 C 9.4329966 11 11 12.567003 11 14.5 C 10.9988 15.427807 10.629304 16.317185 9.9726562 16.972656 L 5.0273438 12.027344 C 5.6828146 11.370696 6.5721925 11.001176 7.5 11 z M 15.242188 12.414062 L 12.414062 15.244141 L 16.085938 18.916016 L 18.914062 16.085938 L 15.242188 12.414062 z M 3.7480469 16.980469 L 3 18 L 4 19 L 5.0195312 18.251953 A 4.5 4.5 0 0 1 3.7480469 16.980469 z "
+     class="ColorScheme-Text"
+     id="path6" />
+</svg>
diff --git a/kstars/data/icons/breeze/default/kstars_satellites_visible.svg b/kstars/data/icons/breeze/default/kstars_satellites_visible.svg
new file mode 100644
index 0000000..a392d21
--- /dev/null
+++ b/kstars/data/icons/breeze/default/kstars_satellites_visible.svg
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   viewBox="0 0 22 22"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="kstars_satellites_visible.svg">
+  <metadata
+     id="metadata10">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1920"
+     inkscape:window-height="1023"
+     id="namedview8"
+     showgrid="false"
+     inkscape:zoom="10.727273"
+     inkscape:cx="11"
+     inkscape:cy="11"
+     inkscape:window-x="1920"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="svg2" />
+  <defs
+     id="defs3051">
+    <style
+       type="text/css"
+       id="current-color-scheme">
+      .ColorScheme-Text {
+        color:#4d4d4d;
+      }
+      </style>
+  </defs>
+  <path
+     style="fill:#ffcc00;fill-opacity:1;stroke:none"
+     d="M 14 3 L 8.7363281 10.177734 A 4.5 4.5 0 0 1 9.1855469 10.333984 C 8.6642326 10.122856 8.0970333 10 7.5 10 C 6.3069911 10.0012 5.1632886 10.476121 4.3203125 11.320312 A 4.5 4.5 0 0 0 3.6933594 12.107422 L 5.7871094 14.201172 L 4.390625 16.105469 A 3.5 3.5 0 0 0 5.8964844 17.607422 L 7.7988281 16.212891 L 9.8945312 18.308594 A 4.5 4.5 0 0 0 10.679688 17.679688 C 11.523881 16.836711 11.998786 15.693009 12 14.5 C 12.000001 13.918791 11.88031 13.367411 11.679688 12.857422 A 4.5 4.5 0 0 1 11.824219 13.261719 L 19 8 L 14 3 z M 5.9140625 3.0859375 L 3.0859375 5.9160156 L 6.7578125 9.5859375 L 9.5859375 6.7578125 L 5.9140625 3.0859375 z M 14.117188 4.53125 L 17.46875 7.8828125 L 11.427734 12.314453 A 4.5 4.5 0 0 1 11.599609 12.662109 C 11.151345 11.664248 10.352692 10.863145 9.3574219 10.410156 A 4.5 4.5 0 0 1 9.6894531 10.570312 L 14.117188 4.53125 z M 7.5 11 C 9.4329966 11 11 12.567003 11 14.5 C 10.9988 15.427807 10.629304 16.317185 9.9726562 16.972656 L 5.0273438 12.027344 C 5.6828146 11.370696 6.5721925 11.001176 7.5 11 z M 15.242188 12.414062 L 12.414062 15.244141 L 16.085938 18.916016 L 18.914062 16.085938 L 15.242188 12.414062 z M 3.7480469 16.980469 L 3 18 L 4 19 L 5.0195312 18.251953 A 4.5 4.5 0 0 1 3.7480469 16.980469 z "
+     class="ColorScheme-Text"
+     id="path6" />
+</svg>
diff --git a/kstars/data/kstars.qrc b/kstars/data/kstars.qrc
index 40dd14f..70d0946 100644
--- a/kstars/data/kstars.qrc
+++ b/kstars/data/kstars.qrc
@@ -126,6 +126,8 @@
         <file>icons/breeze/default/view-list-details.svg</file>
         <file>icons/breeze/default/view-list-icons.svg</file>
         <file>icons/breeze/default/go-jump-today.svg</file>
+        <file>icons/breeze/default/kstars_satellites_invisible.svg</file>
+        <file>icons/breeze/default/kstars_satellites_visible.svg</file>
     </qresource>
     <qresource prefix="/kconfig">
         <file>kstars.knsrc</file>
diff --git a/kstars/skyqpainter.cpp b/kstars/skyqpainter.cpp
index 3df31b6..b09a122 100644
--- a/kstars/skyqpainter.cpp
+++ b/kstars/skyqpainter.cpp
@@ -73,6 +73,8 @@ namespace {
     //
     // These pixmaps are never deallocated. Not really good...
     QPixmap* imageCache[nSPclasses][nStarSizes] = {{0}};
+
+    QPixmap  *visibleSatPixmap=0, *invisibleSatPixmap=0;
 }
 
 int SkyQPainter::starColorMode = 0;
@@ -225,6 +227,9 @@ void SkyQPainter::initStarImages()
         }
     }
     starColorMode = Options::starColorMode();
+
+    visibleSatPixmap = new QPixmap(":/icons/breeze/default/kstars_satellites_visible.svg");
+    invisibleSatPixmap = new QPixmap(":/icons/breeze/default/kstars_satellites_invisible.svg");
 }
 
 void SkyQPainter::drawSkyLine(SkyPoint* a, SkyPoint* b)
@@ -815,14 +820,15 @@ bool SkyQPainter::drawSatellite( Satellite* sat )
     else
     {
         if ( sat->isVisible() )
-            setPen( KStarsData::Instance()->colorScheme()->colorNamed( "VisibleSatColor" ) );
+            drawPixmap(QPoint( pos.x() - 15, pos.y() - 11 ), *visibleSatPixmap);
         else
-            setPen( KStarsData::Instance()->colorScheme()->colorNamed( "SatColor" ) );
+            drawPixmap(QPoint( pos.x() - 15, pos.y() - 11 ), *invisibleSatPixmap);
 
-        drawLine( QPoint( pos.x() - 0.5, pos.y() - 0.5 ), QPoint( pos.x() + 0.5, pos.y() - 0.5 ) );
+        //drawPixmap(pos, *genericSatPixmap);
+        /*drawLine( QPoint( pos.x() - 0.5, pos.y() - 0.5 ), QPoint( pos.x() + 0.5, pos.y() - 0.5 ) );
         drawLine( QPoint( pos.x() + 0.5, pos.y() - 0.5 ), QPoint( pos.x() + 0.5, pos.y() + 0.5 ) );
         drawLine( QPoint( pos.x() + 0.5, pos.y() + 0.5 ), QPoint( pos.x() - 0.5, pos.y() + 0.5 ) );
-        drawLine( QPoint( pos.x() - 0.5, pos.y() + 0.5 ), QPoint( pos.x() - 0.5, pos.y() - 0.5 ) );
+        drawLine( QPoint( pos.x() - 0.5, pos.y() + 0.5 ), QPoint( pos.x() - 0.5, pos.y() - 0.5 ) );*/
     }
 
     return true;


More information about the Kstars-devel mailing list