summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Fedoskin <afedoskin3@gmail.com>2016-06-26 22:32:54 (GMT)
committerArtem Fedoskin <afedoskin3@gmail.com>2016-06-26 22:32:54 (GMT)
commitdcf4bfd9b35e6947a2c6d6502f53fb4782e518ae (patch)
tree830c8d4de211ad7a1bd74515fa68a9b02fd79c17
parent0f3f56f6170bded67786b61a73240acd1aafa345 (diff)
Added support for Constellation Art, Satellites and Supernovae. Fixed
some minor bugs. Added on-demand loading for Stars and DSOs.
-rw-r--r--kstars/CMakeLists.txt7
-rw-r--r--kstars/kstarslite/skyitems/constellationartitem.cpp46
-rw-r--r--kstars/kstarslite/skyitems/constellationartitem.h52
-rw-r--r--kstars/kstarslite/skyitems/deepstaritem.cpp114
-rw-r--r--kstars/kstarslite/skyitems/lines/eclipticitem.cpp7
-rw-r--r--kstars/kstarslite/skyitems/lines/equatoritem.cpp7
-rw-r--r--kstars/kstarslite/skyitems/lines/linesitem.cpp7
-rw-r--r--kstars/kstarslite/skyitems/lines/milkywayitem.cpp115
-rw-r--r--kstars/kstarslite/skyitems/lines/milkywayitem.h22
-rw-r--r--kstars/kstarslite/skyitems/rootnode.cpp74
-rw-r--r--kstars/kstarslite/skyitems/rootnode.h8
-rw-r--r--kstars/kstarslite/skyitems/satellitesitem.cpp73
-rw-r--r--kstars/kstarslite/skyitems/satellitesitem.h56
-rw-r--r--kstars/kstarslite/skyitems/skynodes/constellationartnode.cpp87
-rw-r--r--kstars/kstarslite/skyitems/skynodes/constellationartnode.h64
-rw-r--r--kstars/kstarslite/skyitems/skynodes/dsosymbolnode.cpp90
-rw-r--r--kstars/kstarslite/skyitems/skynodes/dsosymbolnode.h2
-rw-r--r--kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp13
-rw-r--r--kstars/kstarslite/skyitems/skynodes/nodes/linenode.h4
-rw-r--r--kstars/kstarslite/skyitems/skynodes/planetnode.cpp2
-rw-r--r--kstars/kstarslite/skyitems/skynodes/pointsourcenode.cpp32
-rw-r--r--kstars/kstarslite/skyitems/skynodes/pointsourcenode.h3
-rw-r--r--kstars/kstarslite/skyitems/skynodes/satellitenode.cpp120
-rw-r--r--kstars/kstarslite/skyitems/skynodes/satellitenode.h59
-rw-r--r--kstars/kstarslite/skyitems/skynodes/skynode.h3
-rw-r--r--kstars/kstarslite/skyitems/skynodes/skypolygonnode.cpp122
-rw-r--r--kstars/kstarslite/skyitems/skynodes/skypolygonnode.h44
-rw-r--r--kstars/kstarslite/skyitems/skynodes/supernovanode.cpp93
-rw-r--r--kstars/kstarslite/skyitems/skynodes/supernovanode.h55
-rw-r--r--kstars/kstarslite/skyitems/skyopacitynode.cpp2
-rw-r--r--kstars/kstarslite/skyitems/skyopacitynode.h2
-rw-r--r--kstars/kstarslite/skyitems/supernovaeitem.cpp58
-rw-r--r--kstars/kstarslite/skyitems/supernovaeitem.h56
-rw-r--r--kstars/main.cpp10
-rw-r--r--kstars/projections/projector.cpp44
-rw-r--r--kstars/skycomponents/linelistindex.h6
-rw-r--r--kstars/skycomponents/milkyway.h2
-rw-r--r--kstars/skycomponents/noprecessindex.h3
-rw-r--r--kstars/skycomponents/satellitescomponent.cpp1
-rw-r--r--kstars/skycomponents/skymapcomposite.h4
-rw-r--r--kstars/skymaplite.cpp9
-rw-r--r--kstars/skyobjects/satellitegroup.cpp1
42 files changed, 1267 insertions, 312 deletions
diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt
index 320cbe5..ab7a7b2 100644
--- a/kstars/CMakeLists.txt
+++ b/kstars/CMakeLists.txt
@@ -559,6 +559,9 @@ if(BUILD_KSTARS_LITE)
kstarslite/skyitems/staritem.cpp
kstarslite/skyitems/deepstaritem.cpp
kstarslite/skyitems/deepskyitem.cpp
+ kstarslite/skyitems/constellationartitem.cpp
+ kstarslite/skyitems/satellitesitem.cpp
+ kstarslite/skyitems/supernovaeitem.cpp
#Line
kstarslite/skyitems/lines/linesitem.cpp
kstarslite/skyitems/lines/equatoritem.cpp
@@ -575,6 +578,10 @@ if(BUILD_KSTARS_LITE)
kstarslite/skyitems/skynodes/skytexturenode.cpp
kstarslite/skyitems/skynodes/deepskynode.cpp
kstarslite/skyitems/skynodes/dsosymbolnode.cpp
+ kstarslite/skyitems/skynodes/skypolygonnode.cpp
+ kstarslite/skyitems/skynodes/constellationartnode.cpp
+ kstarslite/skyitems/skynodes/satellitenode.cpp
+ kstarslite/skyitems/skynodes/supernovanode.cpp
#Nodes
kstarslite/skyitems/skynodes/nodes/pointnode.cpp
kstarslite/skyitems/skynodes/nodes/polynode.cpp
diff --git a/kstars/kstarslite/skyitems/constellationartitem.cpp b/kstars/kstarslite/skyitems/constellationartitem.cpp
new file mode 100644
index 0000000..c162561
--- /dev/null
+++ b/kstars/kstarslite/skyitems/constellationartitem.cpp
@@ -0,0 +1,46 @@
+/** *************************************************************************
+ planetsitem.cpp - K Desktop Planetarium
+ -------------------
+ begin : 02/05/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "constellationartitem.h"
+#include "projections/projector.h"
+#include "constellationartcomponent.h"
+#include "skynodes/constellationartnode.h"
+
+ConstellationArtItem::ConstellationArtItem(ConstellationArtComponent *artComp, RootNode *rootNode)
+ :SkyItem(LabelsItem::label_t::NO_LABEL, rootNode), m_artComp(artComp)
+{
+ QList<ConstellationsArt *>list = m_artComp->m_ConstList;
+ for(int i = 0; i < list.size(); ++i) {
+ ConstellationArtNode *constArt = new ConstellationArtNode(list.at(i));
+ appendChildNode(constArt);
+ }
+}
+
+void ConstellationArtItem::update() {
+ if(Options::showConstellationArt() && SkyMapLite::IsSlewing() == false)
+ {
+ show();
+ //Traverse all children nodes of RootNode
+ QSGNode *n = firstChild();
+ while(n != 0) {
+ ConstellationArtNode *artNode = static_cast<ConstellationArtNode *>(n);
+ artNode->update();
+ n = n->nextSibling();
+ }
+ } else {
+ hide();
+ }
+}
diff --git a/kstars/kstarslite/skyitems/constellationartitem.h b/kstars/kstarslite/skyitems/constellationartitem.h
new file mode 100644
index 0000000..96f9e4e
--- /dev/null
+++ b/kstars/kstarslite/skyitems/constellationartitem.h
@@ -0,0 +1,52 @@
+/** *************************************************************************
+ planetsitem.h - K Desktop Planetarium
+ -------------------
+ begin : 02/05/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef CONSTELLATIONARTITEM_H_
+#define CONSTELLATIONARTITEM_H_
+
+#include "skyitem.h"
+
+class RootNode;
+class ConstellationArtComponent;
+ /**
+ * @class PlanetsItem
+ * This class handles planets and their moons in SkyMapLite
+ *
+ * @author Artem Fedoskin
+ * @version 1.0
+ */
+
+class ConstellationArtItem : public SkyItem {
+public:
+ /**
+ * @short Constructor. Takes lists of pointers to planets(SolarSystemSingleComponent) and their
+ * moons (PlanetMoonsComponent) to instantiate PlanetMoonsNodes for each of the planet.
+ *
+ * @param planets list of pointers to planets
+ * @param moons list of pointers to moons
+ * @param rootNode parent RootNode that instantiates this object
+ */
+ ConstellationArtItem(ConstellationArtComponent *artComp,RootNode *rootNode = 0);
+
+ /**
+ * @short calls update() of all child PlanetMoonsNodes
+ * @note see PlanetMoonsNodes::update()
+ */
+ void update() override;
+
+private:
+ ConstellationArtComponent *m_artComp;
+};
+#endif
diff --git a/kstars/kstarslite/skyitems/deepstaritem.cpp b/kstars/kstarslite/skyitems/deepstaritem.cpp
index e7a8140..4f5fe51 100644
--- a/kstars/kstarslite/skyitems/deepstaritem.cpp
+++ b/kstars/kstarslite/skyitems/deepstaritem.cpp
@@ -67,120 +67,6 @@ DeepStarItem::DeepStarItem(DeepStarComponent *deepStarComp, RootNode *rootNode)
}
void DeepStarItem::update() {
-#ifndef KSTARS_LITE
- //adjust maglimit for ZoomLevel
- // double lgmin = log10(MINZOOM);
- // double lgmax = log10(MAXZOOM);
- // double lgz = log10(Options::zoomFactor());
- // TODO: Enable hiding of faint stars
-
- float maglim = StarComponent::zoomMagnitudeLimit();
-
- if( maglim < triggerMag )
- return;
-
- m_zoomMagLimit = maglim;
-
- m_skyMesh->inDraw( true );
-
- SkyPoint* focus = map->focus();
- m_skyMesh->aperture( focus, radius + 1.0, DRAW_BUF ); // divide by 2 for testing
-
- MeshIterator region(m_skyMesh, DRAW_BUF);
-
- magLim = maglim;
-
- // If we are to hide the fainter stars (eg: while slewing), we set the magnitude limit to hideStarsMag.
- if( hideFaintStars && maglim > hideStarsMag )
- maglim = hideStarsMag;
-
- StarBlockFactory *m_StarBlockFactory = StarBlockFactory::Instance();
- // m_StarBlockFactory->drawID = m_skyMesh->drawID();
- // qDebug() << "Mesh size = " << m_skyMesh->size() << "; drawID = " << m_skyMesh->drawID();
- QTime t;
- int nTrixels = 0;
-
- t_dynamicLoad = 0;
- t_updateCache = 0;
- t_drawUnnamed = 0;
-
- visibleStarCount = 0;
-
- t.start();
-
- // Mark used blocks in the LRU Cache. Not required for static stars
- if( !staticStars ) {
- while( region.hasNext() ) {
- Trixel currentRegion = region.next();
- for( int i = 0; i < m_starBlockList.at( currentRegion )->getBlockCount(); ++i ) {
- StarBlock *prevBlock = ( ( i >= 1 ) ? m_starBlockList.at( currentRegion )->block( i - 1 ) : NULL );
- StarBlock *block = m_starBlockList.at( currentRegion )->block( i );
-
- if( i == 0 && !m_StarBlockFactory->markFirst( block ) )
- qDebug() << "markFirst failed in trixel" << currentRegion;
- if( i > 0 && !m_StarBlockFactory->markNext( prevBlock, block ) )
- qDebug() << "markNext failed in trixel" << currentRegion << "while marking block" << i;
- if( i < m_starBlockList.at( currentRegion )->getBlockCount()
- && m_starBlockList.at( currentRegion )->block( i )->getFaintMag() < maglim )
- break;
-
- }
- }
- t_updateCache = t.restart();
- region.reset();
- }
-
- while ( region.hasNext() ) {
- ++nTrixels;
- Trixel currentRegion = region.next();
-
- // NOTE: We are guessing that the last 1.5/16 magnitudes in the catalog are just additions and the star catalog
- // is actually supposed to reach out continuously enough only to mag m_FaintMagnitude * ( 1 - 1.5/16 )
- // TODO: Is there a better way? We may have to change the magnitude tolerance if the catalog changes
- // Static stars need not execute fillToMag
-
- if( !staticStars && !m_starBlockList.at( currentRegion )->fillToMag( maglim ) && maglim <= m_FaintMagnitude * ( 1 - 1.5/16 ) ) {
- qDebug() << "SBL::fillToMag( " << maglim << " ) failed for trixel "
- << currentRegion << " !"<< endl;
- }
-
- t_dynamicLoad += t.restart();
-
- // qDebug() << "Drawing SBL for trixel " << currentRegion << ", SBL has "
- // << m_starBlockList[ currentRegion ]->getBlockCount() << " blocks" << endl;
-
- for( int i = 0; i < m_starBlockList.at( currentRegion )->getBlockCount(); ++i ) {
- StarBlock *block = m_starBlockList.at( currentRegion )->block( i );
- // qDebug() << "---> Drawing stars from block " << i << " of trixel " <<
- // currentRegion << ". SB has " << block->getStarCount() << " stars" << endl;
- for( int j = 0; j < block->getStarCount(); j++ ) {
-
- StarObject *curStar = block->star( j );
-
- // qDebug() << "We claim that he's from trixel " << currentRegion
- //<< ", and indexStar says he's from " << m_skyMesh->indexStar( curStar );
-
- if ( curStar->updateID != updateID )
- curStar->JITupdate();
-
- float mag = curStar->mag();
-
- if ( mag > maglim )
- break;
-
- if( skyp->drawPointSource(curStar, mag, curStar->spchar() ) )
- visibleStarCount++;
- }
- }
-
- // DEBUG: Uncomment to identify problems with Star Block Factory / preservation of Magnitude Order in the LRU Cache
- // verifySBLIntegrity();
- t_drawUnnamed += t.restart();
-
- }
- m_skyMesh->inDraw( false );
-#endif
-
if(m_staticStars) { // dynamic stars under construction
SkyMapLite *map = SkyMapLite::Instance();
KStarsData* data = KStarsData::Instance();
diff --git a/kstars/kstarslite/skyitems/lines/eclipticitem.cpp b/kstars/kstarslite/skyitems/lines/eclipticitem.cpp
index f0fb257..c93bab9 100644
--- a/kstars/kstarslite/skyitems/lines/eclipticitem.cpp
+++ b/kstars/kstarslite/skyitems/lines/eclipticitem.cpp
@@ -37,7 +37,7 @@ EclipticItem::EclipticItem(Ecliptic *eclipticComp, RootNode *rootNode)
QColor schemeColor = KStarsData::Instance()->colorScheme()->colorNamed("EclColor");
for(int c = 0; c < linesList->size(); ++c) {
- LineNode * ln = new LineNode(linesList->at(c), schemeColor, 1, Qt::SolidLine);
+ LineNode * ln = new LineNode(linesList->at(c), 0, schemeColor, 1, Qt::SolidLine);
trixel->appendChildNode(ln);
}
}
@@ -70,7 +70,7 @@ void EclipticItem::update() {
QSGNode *n = firstChild();
DrawID drawID = SkyMesh::Instance()->drawID();
- //UpdateID updateID = KStarsData::Instance()->updateID();
+ UpdateID updateID = KStarsData::Instance()->updateID();
while(n != 0) {
TrixelNode * trixel = static_cast<TrixelNode *>(n);
@@ -87,6 +87,9 @@ void EclipticItem::update() {
lines->hide();
continue;
}
+ if ( lineList->updateID != updateID )
+ m_eclipticComp->JITupdate( lineList );
+
lineList->drawID = drawID;
lines->updateGeometry();
}
diff --git a/kstars/kstarslite/skyitems/lines/equatoritem.cpp b/kstars/kstarslite/skyitems/lines/equatoritem.cpp
index f099c73..52faef1 100644
--- a/kstars/kstarslite/skyitems/lines/equatoritem.cpp
+++ b/kstars/kstarslite/skyitems/lines/equatoritem.cpp
@@ -41,7 +41,7 @@ EquatorItem::EquatorItem(Equator *equatorComp, RootNode *rootNode)
QColor schemeColor = KStarsData::Instance()->colorScheme()->colorNamed("EqColor");
for(int c = 0; c < linesList->size(); ++c) {
- LineNode * ln = new LineNode(linesList->at(c), schemeColor, 1, Qt::SolidLine);
+ LineNode * ln = new LineNode(linesList->at(c), 0, schemeColor, 1, Qt::SolidLine);
trixel->appendChildNode(ln);
}
}
@@ -66,7 +66,7 @@ void EquatorItem::update() {
QSGNode *n = firstChild();
DrawID drawID = SkyMesh::Instance()->drawID();
- //UpdateID updateID = KStarsData::Instance()->updateID();
+ UpdateID updateID = KStarsData::Instance()->updateID();
while(n != 0) {
TrixelNode * trixel = static_cast<TrixelNode *>(n);
@@ -83,6 +83,9 @@ void EquatorItem::update() {
lines->hide();
continue;
}
+ if ( lineList->updateID != updateID )
+ m_equatorComp->JITupdate( lineList );
+
lineList->drawID = drawID;
lines->updateGeometry();
}
diff --git a/kstars/kstarslite/skyitems/lines/linesitem.cpp b/kstars/kstarslite/skyitems/lines/linesitem.cpp
index baec4dd..cbfccbb 100644
--- a/kstars/kstarslite/skyitems/lines/linesitem.cpp
+++ b/kstars/kstarslite/skyitems/lines/linesitem.cpp
@@ -48,7 +48,7 @@ void LinesItem::addLinesComponent(LineListIndex *linesComp, QString color, int w
for(int c = 0; c < linesList->size(); ++c) {
//LineNode * ln = new LineNode(linesList->at(c), schemeColor, width, style);
/*trixel->appendChildNode(ln);*/
- trixel->appendChildNode(new LineNode(linesList->at(c), schemeColor, width, style));
+ trixel->appendChildNode(new LineNode(linesList->at(c), 0, schemeColor, width, style));
}
}
++i;
@@ -74,7 +74,7 @@ void LinesItem::update() {
}*/
DrawID drawID = SkyMesh::Instance()->drawID();
- //UpdateID updateID = KStarsData::Instance()->updateID();
+ UpdateID updateID = KStarsData::Instance()->updateID();
LineIndexNode * node = i.key();
if(i.value()->selected()) {
@@ -99,6 +99,9 @@ void LinesItem::update() {
lines->hide();
continue;
}
+ if ( lineList->updateID != updateID )
+ i.value()->JITupdate( lineList );
+
lineList->drawID = drawID;
lines->updateGeometry();
}
diff --git a/kstars/kstarslite/skyitems/lines/milkywayitem.cpp b/kstars/kstarslite/skyitems/lines/milkywayitem.cpp
index baec4dd..fa9c316 100644
--- a/kstars/kstarslite/skyitems/lines/milkywayitem.cpp
+++ b/kstars/kstarslite/skyitems/lines/milkywayitem.cpp
@@ -1,7 +1,7 @@
/** *************************************************************************
- linesitem.cpp - K Desktop Planetarium
+ milkywayitem.cpp - K Desktop Planetarium
-------------------
- begin : 1/06/2016
+ begin : 23/06/2016
copyright : (C) 2016 by Artem Fedoskin
email : afedoskin3@gmail.com
***************************************************************************/
@@ -18,23 +18,22 @@
#include "projections/projector.h"
#include <QSGNode>
-#include "linesitem.h"
+#include "milkywayitem.h"
+#include "milkyway.h"
#include "linelist.h"
#include "linelistindex.h"
#include "../skynodes/nodes/linenode.h"
+#include "../skynodes/skypolygonnode.h"
-LinesItem::LinesItem(RootNode *rootNode)
- :SkyItem(LabelsItem::label_t::NO_LABEL, rootNode)
+MilkyWayItem::MilkyWayItem(MilkyWay *mwComp, RootNode *rootNode)
+ :SkyItem(LabelsItem::label_t::NO_LABEL, rootNode), m_MWComp(mwComp), m_filled(Options::fillMilkyWay())
{
-
+ initialize();
}
-void LinesItem::addLinesComponent(LineListIndex *linesComp, QString color, int width, Qt::PenStyle style) {
- LineIndexNode *node = new LineIndexNode;
- appendChildNode(node);
-
- m_lineIndexes.insert(node, linesComp);
- LineListHash *trixels = linesComp->lineIndex();
+void MilkyWayItem::initialize() {
+ LineListHash *trixels = m_MWComp->polyIndex();
+ while(QSGNode *n = firstChild()) { removeChildNode(n); delete n; }
QHash< Trixel, LineListList *>::const_iterator i = trixels->begin();
while( i != trixels->end()) {
@@ -42,75 +41,83 @@ void LinesItem::addLinesComponent(LineListIndex *linesComp, QString color, int w
if(linesList->size()) {
TrixelNode *trixel = new TrixelNode;
- node->appendChildNode(trixel);
+ appendChildNode(trixel);
- QColor schemeColor = KStarsData::Instance()->colorScheme()->colorNamed(color);
+ QColor schemeColor = KStarsData::Instance()->colorScheme()->colorNamed("MWColor");
for(int c = 0; c < linesList->size(); ++c) {
- //LineNode * ln = new LineNode(linesList->at(c), schemeColor, width, style);
- /*trixel->appendChildNode(ln);*/
- trixel->appendChildNode(new LineNode(linesList->at(c), schemeColor, width, style));
+ LineList *list = linesList->at(c);
+ if(m_filled) {
+ SkyPolygonNode *poly = new SkyPolygonNode(list);
+ schemeColor.setAlpha(0.7*255);
+ poly->setColor(schemeColor);
+ trixel->appendChildNode(poly);
+ } else {
+ LineNode * ln = new LineNode(list, m_MWComp->skipList(list), schemeColor, 3, Qt::SolidLine);
+ trixel->appendChildNode(ln);
+ }
}
}
++i;
}
}
-void LinesItem::update() {
- QMap< LineIndexNode *, LineListIndex *>::const_iterator i = m_lineIndexes.begin();
- while( i != m_lineIndexes.end()) {
- //QVector<Trixel> visTrixels;
- SkyMesh * mesh = SkyMesh::Instance();
- SkyMapLite *map = SkyMapLite::Instance();
- double radius = map->projector()->fov();
- if ( radius > 180.0 )
- radius = 180.0;
- if(mesh) {
- //mesh->aperture(map->focus(), radius);
- }
-
- /*MeshIterator region (mesh,DRAW_BUF);
- while ( region.hasNext() ) {
- visTrixels.append(region.next());
- }*/
+void MilkyWayItem::update() {
+ if(m_MWComp->selected()) {
+ show();
+ QSGNode *n = firstChild();
DrawID drawID = SkyMesh::Instance()->drawID();
- //UpdateID updateID = KStarsData::Instance()->updateID();
+ UpdateID updateID = KStarsData::Instance()->updateID();
- LineIndexNode * node = i.key();
- if(i.value()->selected()) {
- node->show();
+ if(Options::fillMilkyWay() != m_filled) {
+ m_filled = Options::fillMilkyWay();
+ initialize();
+ }
- QSGNode *n = node->firstChild();
- while(n != 0) {
- TrixelNode * trixel = static_cast<TrixelNode *>(n);
- trixel->show();
+ while(n != 0) {
+ TrixelNode * trixel = static_cast<TrixelNode *>(n);
+ trixel->show();
+ n = n->nextSibling();
- n = n->nextSibling();
+ QSGNode *l = trixel->firstChild();
+ while(l != 0) {
+ if(m_filled) {
+ SkyPolygonNode *polygon = static_cast<SkyPolygonNode *>(l);
+ LineList * lineList = polygon->lineList();
- //if(visTrixels.contains(c)) {
+ if ( lineList->drawID == drawID ) {
+ polygon->hide();
+ l = l->nextSibling();
+ continue;
+ }
+ lineList->drawID = drawID;
+ if ( lineList->updateID != updateID )
+ m_MWComp->JITupdate( lineList );
- QSGNode *l = trixel->firstChild();
- while(l != 0) {
+ polygon->update();
+ } else {
LineNode * lines = static_cast<LineNode *>(l);
- l = l->nextSibling();
LineList * lineList = lines->lineList();
if ( lineList->drawID == drawID ) {
lines->hide();
+ l = l->nextSibling();
continue;
}
lineList->drawID = drawID;
+ if ( lineList->updateID != updateID )
+ m_MWComp->JITupdate( lineList );
+
lines->updateGeometry();
}
-
- /* } else {
- trixel->hide();
- }*/
+ l = l->nextSibling();
}
- } else {
- node->hide();
}
- ++i;
+ } else {
+ hide();
}
}
+
+
+
diff --git a/kstars/kstarslite/skyitems/lines/milkywayitem.h b/kstars/kstarslite/skyitems/lines/milkywayitem.h
index c8d84b7..e3066f2 100644
--- a/kstars/kstarslite/skyitems/lines/milkywayitem.h
+++ b/kstars/kstarslite/skyitems/lines/milkywayitem.h
@@ -1,7 +1,7 @@
/** *************************************************************************
- linesitem.h - K Desktop Planetarium
+ milkywayitem.h - K Desktop Planetarium
-------------------
- begin : 1/06/2016
+ begin : 23/06/2016
copyright : (C) 2016 by Artem Fedoskin
email : afedoskin3@gmail.com
***************************************************************************/
@@ -21,8 +21,9 @@
#include "../typedeflite.h"
class LineListIndex;
+class MilkyWay;
- /** @class LinesItem
+ /** @class MilkyWay
*
* Class that handles lines (Constellation lines and boundaries and both coordinate grids) in
* SkyMapLite.
@@ -41,16 +42,9 @@ public:
* @short Constructor.
* @param rootNode parent RootNode that instantiated this object
*/
- MilkyWayItem(RootNode *rootNode);
+ MilkyWayItem(MilkyWay *mwComp, RootNode *rootNode);
- /**
- * @short adds LinesListIndex that is needed to be displayed to m_lineIndexes
- * @param linesComp LineListIndex derived object
- * @param color desired color of lines specified as name of entry in ColorScheme
- * @param width thickness of lines
- * @param style desired style (currently supports only Qt::SolidLine)
- */
- void addLinesComponent(LineListIndex *linesComp, QString color, int width, Qt::PenStyle style);
+ void initialize();
/**
* @short updates all trixels that are associated with LineListIndex or hide them if selected()
@@ -59,8 +53,8 @@ public:
virtual void update();
private:
- QMap<LineIndexNode *, LineListIndex *> m_lineIndexes;
- //QMap<QSGOpacityNode *, QVector<TrixelNode *> > m_trixelNodes;
+ bool m_filled; //True if the polygon has to be filled
+ MilkyWay *m_MWComp;
};
#endif
diff --git a/kstars/kstarslite/skyitems/rootnode.cpp b/kstars/kstarslite/skyitems/rootnode.cpp
index 55f6899..e90259a 100644
--- a/kstars/kstarslite/skyitems/rootnode.cpp
+++ b/kstars/kstarslite/skyitems/rootnode.cpp
@@ -28,10 +28,14 @@
#include "kstarslite/skyitems/lines/linesitem.h"
#include "kstarslite/skyitems/labelsitem.h"
#include "kstarslite/skyitems/constellationnamesitem.h"
+#include "kstarslite/skyitems/constellationartitem.h"
+#include "kstarslite/skyitems/satellitesitem.h"
+#include "kstarslite/skyitems/supernovaeitem.h"
//Lines
#include "kstarslite/skyitems/lines/equatoritem.h"
#include "kstarslite/skyitems/lines/eclipticitem.h"
+#include "kstarslite/skyitems/lines/milkywayitem.h"
RootNode::RootNode()
:m_skyMapLite(SkyMapLite::Instance()),
@@ -45,30 +49,42 @@ RootNode::RootNode()
// LabelsItem needs to be created first so that other items could insert their labels in labelsList
m_labelsItem = new LabelsItem();
+ m_MWItem = new MilkyWayItem(m_skyComposite->milkyWay(), this);
+
m_linesItem = new LinesItem(this);
m_linesItem->addLinesComponent( m_skyComposite->equatorialCoordGrid(), "EquatorialGridColor", 1, Qt::DotLine );
m_linesItem->addLinesComponent( m_skyComposite->horizontalCoordGrid(), "HorizontalGridColor", 2, Qt::DotLine );
- m_linesItem->addLinesComponent( m_skyComposite->constellationBoundary(), "CBoundColor", 1, Qt::SolidLine );
- m_linesItem->addLinesComponent( m_skyComposite->constellationLines(), "CLineColor", 1, Qt::SolidLine );
+ if ( m_skyComposite->currentCulture() == "Western" )
+ {
+ m_linesItem->addLinesComponent( m_skyComposite->constellationBoundary(), "CBoundColor", 1, Qt::SolidLine );
+ }
- m_starItem = new StarItem(StarComponent::Instance(), this);
+ m_artItem = new ConstellationArtItem(m_skyComposite->constellationArt(), this);
- m_solarSystem = m_skyComposite->solarSystemComposite();
+ m_linesItem->addLinesComponent( m_skyComposite->constellationLines(), "CLineColor", 1, Qt::SolidLine );
m_equator = new EquatorItem(m_skyComposite->equator(),this);
m_ecliptic = new EclipticItem(m_skyComposite->ecliptic(),this);
+ m_dsoItem = new DeepSkyItem( m_skyComposite->deepSkyComponent(), this );
+ m_starItem = new StarItem(StarComponent::Instance(), this);
+
+ m_solarSystem = m_skyComposite->solarSystemComposite();
+
m_planetsItem = new PlanetsItem(m_solarSystem->planets(), m_solarSystem->planetMoonsComponent(), this);
m_asteroidsItem = new AsteroidsItem(m_solarSystem->asteroids(), this);
m_cometsItem = new CometsItem(m_solarSystem->comets(), this);
m_constelNamesItem = new ConstellationNamesItem(m_skyComposite->constellationNamesComponent(), this);
- m_dsoItem = new DeepSkyItem( m_skyComposite->deepSkyComponent(), this );
+
+ m_satItem = new SatellitesItem( m_skyComposite->satellites(), this);
+ m_snovaItem = new SupernovaeItem(m_skyComposite->supernovaeComponent(), this);
m_horizonItem = new HorizonItem(m_skyComposite->horizon(), this);
+
setIsRectangular(false);
updateClipPoly();
@@ -164,29 +180,21 @@ void RootNode::updateClipPoly() {
} else {
return; //We don't need to triangulate polygon and update geometry if polygon wasn't changed
}
- QVector<QPointF> triangles;
- for(int i = 1; i < m_clipPoly.size() - 1; ++i) {
- triangles.append(m_clipPoly[0]);
- triangles.append(m_clipPoly[i]);
- triangles.append(m_clipPoly[i+1]);
- }
-
- const int size = triangles.size();
+ const int size = m_clipPoly.size();
if(!m_clipGeometry) {
m_clipGeometry = new QSGGeometry (QSGGeometry::defaultAttributes_Point2D (),
size);
- m_clipGeometry->setDrawingMode(GL_TRIANGLES);
+ m_clipGeometry->setDrawingMode(GL_TRIANGLE_FAN);
setGeometry(m_clipGeometry);
setFlag(QSGNode::OwnsGeometry);
- } else {
m_clipGeometry->allocate(size);
}
QSGGeometry::Point2D * vertex = m_clipGeometry->vertexDataAsPoint2D ();
for (int i = 0; i < size; i++) {
- vertex[i].x = triangles[i].x();
- vertex[i].y = triangles[i].y();
+ vertex[i].x = m_clipPoly[i].x();
+ vertex[i].y = m_clipPoly[i].y();
}
markDirty(QSGNode::DirtyGeometry);
}
@@ -194,6 +202,18 @@ void RootNode::updateClipPoly() {
void RootNode::update() {
updateClipPoly();
+ m_MWItem->update();
+
+ m_artItem->update();
+
+ m_linesItem->update();
+
+ m_equator->update();
+ m_ecliptic->update();
+
+ m_dsoItem->update();
+ m_starItem->update();
+
//TODO: Move this check somewhere else (create a separate function)
if(Options::showSolarSystem()) {
m_planetsItem->update();
@@ -212,22 +232,22 @@ void RootNode::update() {
}
} else {
m_planetsItem->hide();
- if(m_asteroidsItem) delete m_asteroidsItem;
- if(m_cometsItem) delete m_cometsItem;
+ if(m_asteroidsItem) {
+ delete m_asteroidsItem;
+ m_asteroidsItem = 0;
+ }
+ if(m_cometsItem) {
+ delete m_cometsItem;
+ m_cometsItem = 0;
+ }
}
m_constelNamesItem->update();
- m_starItem->update();
- m_dsoItem->update();
-
- m_equator->update();
- m_ecliptic->update();
-
- m_linesItem->update();
+ m_satItem->update();
+ m_snovaItem->update();
m_horizonItem->update();
-
m_labelsItem->update();
}
diff --git a/kstars/kstarslite/skyitems/rootnode.h b/kstars/kstarslite/skyitems/rootnode.h
index 296ff46..487c0f9 100644
--- a/kstars/kstarslite/skyitems/rootnode.h
+++ b/kstars/kstarslite/skyitems/rootnode.h
@@ -30,11 +30,15 @@ class CometsItem;
class ConstellationNamesItem;
class LabelsItem;
+class ConstellationArtItem;
+class SatellitesItem;
+class SupernovaeItem;
class LinesItem;
class HorizonItem;
class EquatorItem;
class EclipticItem;
+class MilkyWayItem;
class SkyMapComposite;
class SolarSystemComposite;
@@ -101,11 +105,15 @@ private:
ConstellationNamesItem *m_constelNamesItem;
LabelsItem *m_labelsItem;
+ ConstellationArtItem *m_artItem;
+ SatellitesItem *m_satItem;
+ SupernovaeItem *m_snovaItem;
HorizonItem *m_horizonItem;
LinesItem *m_linesItem;
EquatorItem *m_equator;
EclipticItem *m_ecliptic;
+ MilkyWayItem *m_MWItem;
SkyMapComposite *m_skyComposite;
SolarSystemComposite *m_solarSystem;
diff --git a/kstars/kstarslite/skyitems/satellitesitem.cpp b/kstars/kstarslite/skyitems/satellitesitem.cpp
new file mode 100644
index 0000000..f5cdf77
--- /dev/null
+++ b/kstars/kstarslite/skyitems/satellitesitem.cpp
@@ -0,0 +1,73 @@
+/** *************************************************************************
+ satellitesitem.cpp - K Desktop Planetarium
+ -------------------
+ begin : 16/05/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "satellitesitem.h"
+#include "satellitescomponent.h"
+
+#include "Options.h"
+#include "projections/projector.h"
+#include "kscomet.h"
+
+#include "rootnode.h"
+#include "labelsitem.h"
+#include "skylabeler.h"
+
+#include "skynodes/satellitenode.h"
+
+SatellitesItem::SatellitesItem(SatellitesComponent *satComp, RootNode *rootNode)
+ :SkyItem(LabelsItem::label_t::SATELLITE_LABEL, rootNode), m_satComp(satComp)
+{
+ QList<SatelliteGroup*> list = m_satComp->groups();
+ //recreateList();
+ for(int i = 0; i < list.size(); ++i) {
+ SatelliteGroup *group = list.at(i);
+ for(int c = 0; c < group->size(); ++c) {
+ appendChildNode(new SatelliteNode(group->at(c), rootNode));
+ }
+ }
+}
+
+void SatellitesItem::update() {
+ if( ! m_satComp->selected() ) {
+ hide();
+ return;
+ }
+
+ QSGNode *n = firstChild();
+
+ while(n != 0) {
+ SatelliteNode *satNode = static_cast<SatelliteNode *>(n);
+ Satellite *sat = satNode->sat();
+ if ( sat->selected() ) {
+ if ( Options::showVisibleSatellites() ) {
+ if ( sat->isVisible() ) {
+ satNode->update();
+ } else {
+ satNode->hide();
+ }
+ } else {
+ satNode->update();
+ }
+ } else {
+ satNode->hide();
+ }
+ n = n->nextSibling();
+ }
+}
+
+void SatellitesItem::recreateList() {
+
+}
diff --git a/kstars/kstarslite/skyitems/satellitesitem.h b/kstars/kstarslite/skyitems/satellitesitem.h
new file mode 100644
index 0000000..8ca6f2e
--- /dev/null
+++ b/kstars/kstarslite/skyitems/satellitesitem.h
@@ -0,0 +1,56 @@
+/** *************************************************************************
+ satellitesitem.h - K Desktop Planetarium
+ -------------------
+ begin : 16/05/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef SATELLITESITEM_H_
+#define SATELLITESITEM_H_
+
+#include "skyitem.h"
+
+class KSComet;
+class SkyObject;
+class SatellitesComponent;
+
+ /**
+ * @class CometsItem
+ * This class handles comets in SkyMapLite
+ *
+ * @author Artem Fedoskin
+ * @version 1.0
+ */
+
+class SatellitesItem : public SkyItem {
+public:
+ /**
+ * @short Constructor
+ * @param cometsList const reference to list of comets
+ * @param rootNode parent RootNode that instantiates this object
+ */
+ SatellitesItem(SatellitesComponent *satComp, RootNode *rootNode = 0);
+
+ /**
+ * @short recreates the node tree (deletes old nodes and appends new ones according to
+ * m_cometsList)
+ */
+ void recreateList();
+
+ /**
+ * @short Determines the visibility of the object and its label and hides/updates them accordingly
+ */
+ virtual void update() override;
+
+private:
+ SatellitesComponent *m_satComp;
+};
+#endif
diff --git a/kstars/kstarslite/skyitems/skynodes/constellationartnode.cpp b/kstars/kstarslite/skyitems/skynodes/constellationartnode.cpp
new file mode 100644
index 0000000..d2c29be
--- /dev/null
+++ b/kstars/kstarslite/skyitems/skynodes/constellationartnode.cpp
@@ -0,0 +1,87 @@
+/** *************************************************************************
+ pointsourcenode.cpp - K Desktop Planetarium
+ -------------------
+ begin : 16/05/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "skyobject.h"
+#include "Options.h"
+
+#include <QQuickWindow>
+#include <QSGSimpleTextureNode>
+
+#include "constellationartnode.h"
+#include "constellationsart.h"
+#include "nodes/pointnode.h"
+
+#include "../rootnode.h"
+#include "../labelsitem.h"
+#include "labelnode.h"
+
+ConstellationArtNode::ConstellationArtNode(ConstellationsArt *obj)
+ :SkyNode(obj), m_art(obj), m_texture(new QSGSimpleTextureNode)
+{
+ m_texture->setTexture(SkyMapLite::Instance()->window()->createTextureFromImage(m_art->image(), QQuickWindow::TextureCanUseAtlas));
+ m_opacity->appendChildNode(m_texture);
+ update();
+}
+
+void ConstellationArtNode::update() {
+ double zoom = Options::zoomFactor();
+
+ const Projector *m_proj = SkyMapLite::Instance()->projector();
+ if( !m_proj->checkVisibility(m_art) ){
+ hide();
+ return;
+ }
+
+ bool visible = false;
+ m_art->EquatorialToHorizontal(KStarsData::Instance()->lst(), KStarsData::Instance()->geo()->lat());
+ QPointF constellationmidpoint = m_proj->toScreen(m_art, true, &visible);
+
+ if ( !visible || !m_proj->onScreen(constellationmidpoint)) {
+ hide();
+ return;
+ }
+
+ m_opacity->setOpacity(0.7);
+
+ //qDebug() << "o->pa() " << obj->pa();
+ float positionangle = m_proj->findPA(m_art, constellationmidpoint.x(), constellationmidpoint.y());
+ //qDebug() << " final PA " << positionangle;
+
+
+ float w = m_art->getWidth()*60*dms::PI*zoom/10800;
+ float h = m_art->getHeight()*60*dms::PI*zoom/10800;
+
+ m_texture->setRect(0,0,w,h);
+
+ changePos(constellationmidpoint, positionangle);
+}
+
+void ConstellationArtNode::changePos(QPointF pos, double positionangle) {
+ QSizeF size = m_texture->rect().size();
+ QMatrix4x4 m (1,0,0,pos.x(),
+ 0,1,0,pos.y(),
+ 0,0,1,0,
+ 0,0,0,1);
+ m.rotate(positionangle, 0, 0, 1);
+ m.translate(-0.5*size.width(), -0.5*size.height());
+
+ setMatrix(m);
+ markDirty(QSGNode::DirtyMatrix);
+}
+
+void ConstellationArtNode::hide() {
+ //m_point->hide();
+ SkyNode::hide();
+}
diff --git a/kstars/kstarslite/skyitems/skynodes/constellationartnode.h b/kstars/kstarslite/skyitems/skynodes/constellationartnode.h
new file mode 100644
index 0000000..36c440e
--- /dev/null
+++ b/kstars/kstarslite/skyitems/skynodes/constellationartnode.h
@@ -0,0 +1,64 @@
+/** *************************************************************************
+ pointsourcenode.h - K Desktop Planetarium
+ -------------------
+ begin : 16/05/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef POINTSOURCENODE_H_
+#define POINTSOURCENODE_H_
+#include "skynode.h"
+#include "../labelsitem.h"
+
+class PlanetItemNode;
+class SkyMapLite;
+class PointNode;
+class LabelNode;
+class ConstellationsArt;
+class QSGSimpleTextureNode;
+
+/** @class PointSourceNode
+ *
+ * A SkyNode derived class used for displaying PointNode with coordinates provided by SkyObject.
+ *
+ *@short A SkyNode derived class that represents stars and objects that are drawn as stars
+ *@author Artem Fedoskin
+ *@version 1.0
+ */
+
+class RootNode;
+
+class ConstellationArtNode : public SkyNode {
+public:
+ /**
+ * @short Constructor
+ * @param skyObject pointer to SkyObject that has to be displayed on SkyMapLite
+ * @param parentNode pointer to the top parent node, which holds texture cache
+ * @param spType spectral class of PointNode
+ * @param size initial size of PointNode
+ */
+ ConstellationArtNode(ConstellationsArt *obj);
+ /**
+ * @short changePos changes the position m_point
+ * @param pos new position
+ */
+ void changePos(QPointF pos, double positionangle);
+
+ virtual void update() override;
+ virtual void hide() override;
+private:
+ RootNode *m_rootNode;
+ ConstellationsArt *m_art;
+ QSGSimpleTextureNode *m_texture;
+};
+
+#endif
+
diff --git a/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.cpp b/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.cpp
index cd94703..15aa86e 100644
--- a/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.cpp
@@ -340,49 +340,55 @@ void GalaxyClusterSymbol::updateSymbol(float x, float y, float e, float size) {
}
DSOSymbolNode::DSOSymbolNode(DeepSkyObject * skyObject, QColor color)
- :m_dso(skyObject), m_symbol(0), m_rotate(false) //We don't rotate the symbol by default
+ :m_dso(skyObject), m_symbol(0), m_rotate(false), m_color(color) //We don't rotate the symbol by default
{
- int type = m_dso->type();
- switch ( type ) {
- case 0:
- case 1:
- //catalog star
- m_symbol = new StarSymbol(color);
- break;
- case 3: //Open cluster; draw circle of points
- case 13: // Asterism
- m_symbol = new AsterismSymbol(color);
- break;
- case 4: //Globular Cluster
- m_symbol = new GlobularClusterSymbol(color);
- m_rotate = true;
- break;
- case 5: //Gaseous Nebula
- case 15: // Dark Nebula
- m_symbol = new DarkNebulaSymbol(color);
- m_rotate = true;
- break;
- case 6: //Planetary Nebula
- m_symbol = new PlanetaryNebulaSymbol(color);
- m_rotate = true;
- break;
- case 7: //Supernova remnant
- m_symbol = new SupernovaRemnantSymbol(color);
- m_rotate = true;
- break;
- case 8: //Galaxy
- case 16: // Quasar
- m_symbol = new GalaxySymbol(color);
- m_rotate = true;
- break;
- case 14: // Galaxy cluster - draw a circle of + marks
- m_symbol = new GalaxyClusterSymbol(color);
- m_rotate = true;
- break;
- default:
- break;
+
+}
+
+void DSOSymbolNode::initSymbol() {
+ if(!m_symbol) {
+ int type = m_dso->type();
+ switch ( type ) {
+ case 0:
+ case 1:
+ //catalog star
+ m_symbol = new StarSymbol(m_color);
+ break;
+ case 3: //Open cluster; draw circle of points
+ case 13: // Asterism
+ m_symbol = new AsterismSymbol(m_color);
+ break;
+ case 4: //Globular Cluster
+ m_symbol = new GlobularClusterSymbol(m_color);
+ m_rotate = true;
+ break;
+ case 5: //Gaseous Nebula
+ case 15: // Dark Nebula
+ m_symbol = new DarkNebulaSymbol(m_color);
+ m_rotate = true;
+ break;
+ case 6: //Planetary Nebula
+ m_symbol = new PlanetaryNebulaSymbol(m_color);
+ m_rotate = true;
+ break;
+ case 7: //Supernova remnant
+ m_symbol = new SupernovaRemnantSymbol(m_color);
+ m_rotate = true;
+ break;
+ case 8: //Galaxy
+ case 16: // Quasar
+ m_symbol = new GalaxySymbol(m_color);
+ m_rotate = true;
+ break;
+ case 14: // Galaxy cluster - draw a circle of + marks
+ m_symbol = new GalaxyClusterSymbol(m_color);
+ m_rotate = true;
+ break;
+ default:
+ break;
+ }
+ if(m_symbol) addChildNode(m_symbol);
}
- if(m_symbol) addChildNode(m_symbol);
}
void DSOSymbolNode::changePos(float size, const QPointF &pos, float positionangle) {
@@ -402,6 +408,8 @@ void DSOSymbolNode::changePos(float size, const QPointF &pos, float positionangl
void DSOSymbolNode::update(float size, const QPointF &pos, float positionangle) {
show();
+ initSymbol();
+
if(m_symbol) {
m_symbol->updateSymbol(pos.x(), pos.y(), m_dso->e(), size);
}
diff --git a/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.h b/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.h
index e2b3b87..333da46 100644
--- a/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.h
+++ b/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.h
@@ -149,7 +149,9 @@ public:
DSOSymbolNode(DeepSkyObject *skyObject, QColor color = QColor());
void changePos(float size, const QPointF &pos, float positionangle);
void update(float size, const QPointF &pos, float positionangle);
+ void initSymbol();
private:
+ QColor m_color;
//TODO deal setter for this when stars will be introduced
DeepSkyObject *m_dso;
SymbolNode *m_symbol;
diff --git a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp
index ff7e4c3..3b7dce7 100644
--- a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp
@@ -19,11 +19,12 @@
#include "skymaplite.h"
#include "projections/projector.h"
+#include "skiplist.h"
#include <QLinkedList>
-LineNode::LineNode(LineList *lineList, QColor color, int width, Qt::PenStyle drawStyle)
- :m_lineList(lineList), m_geometryNode(new QSGGeometryNode), m_color(color), m_drawStyle(drawStyle),
- m_material(new QSGFlatColorMaterial)
+LineNode::LineNode(LineList *lineList, SkipList *skipList, QColor color, int width, Qt::PenStyle drawStyle)
+ :m_lineList(lineList), m_skipList(skipList), m_geometryNode(new QSGGeometryNode),
+ m_color(color), m_drawStyle(drawStyle), m_material(new QSGFlatColorMaterial)
{
m_geometryNode->setOpaqueMaterial(m_material);
//m_geometryNode->setFlag(QSGNode::OwnsMaterial);
@@ -86,9 +87,9 @@ void LineNode::updateGeometry() {
// & with the result of checkVisibility to clip away things below horizon
isVisible &= m_proj->checkVisibility(pThis);
bool doSkip = false;
- /*if( skipList ) {
- doSkip = skipList->skip(j);
- }*/
+ if( m_skipList ) {
+ doSkip = m_skipList->skip(j);
+ }
if ( !doSkip ) {
if ( (isVisible) ) {
diff --git a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.h b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.h
index d286f71..b2f73aa 100644
--- a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.h
+++ b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.h
@@ -22,6 +22,7 @@
class QSGFlatColorMaterial;
class SkyMapLite;
+class SkipList;
/** @class LineNode
*
@@ -41,7 +42,7 @@ public:
* @param parentNode pointer to the top parent node, which holds texture cache
* @param size initial size of LineNode
*/
- LineNode(LineList *lineList, QColor color, int width, Qt::PenStyle drawStyle);
+ LineNode(LineList *lineList, SkipList *skipList, QColor color, int width, Qt::PenStyle drawStyle);
virtual ~LineNode();
/**
* @short setSize update size of LineNode with the given parameter
@@ -59,6 +60,7 @@ public:
private:
QSGGeometryNode *m_geometryNode;
LineList *m_lineList;
+ SkipList *m_skipList;
QSGGeometry *m_geometry;
QSGFlatColorMaterial *m_material;
diff --git a/kstars/kstarslite/skyitems/skynodes/planetnode.cpp b/kstars/kstarslite/skyitems/skynodes/planetnode.cpp
index a2a921e..5698d11 100644
--- a/kstars/kstarslite/skyitems/skynodes/planetnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/planetnode.cpp
@@ -102,8 +102,8 @@ void PlanetNode::update() {
size = int(size*exp(1.5*size));
setPlanetPicSize(size);
- changePos(pos);
showPlanetPic();
+ changePos(pos);
} else { //Otherwise, draw a simple circle. Do we need it?
//drawEllipse( pos, size, size );
}
diff --git a/kstars/kstarslite/skyitems/skynodes/pointsourcenode.cpp b/kstars/kstarslite/skyitems/skynodes/pointsourcenode.cpp
index f6e2de6..7fa281b 100644
--- a/kstars/kstarslite/skyitems/skynodes/pointsourcenode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/pointsourcenode.cpp
@@ -27,17 +27,11 @@
PointSourceNode::PointSourceNode(SkyObject * skyObject, RootNode * parentNode,
LabelsItem::label_t labelType, char spType, float size, short trixel)
- :SkyNode(skyObject), m_point(0), // has to be changed when stars will be introduced
- m_label(0), m_labelType(labelType), m_rootNode(parentNode), m_trixel(trixel)
+ :SkyNode(skyObject), m_label(0), m_labelType(labelType), m_rootNode(parentNode),
+ m_trixel(trixel), m_point(0), m_size(size), m_spType(spType)
{
- m_point = new PointNode(parentNode,spType,starWidth(size));
- //appendChildNode(m_opacity);
- m_opacity->appendChildNode(m_point);
-}
-/*PointSourceNode::~PointSourceNode() {
- m_rootNode->labelsItem()->deleteLabel(m_label);
-}*/
+}
float PointSourceNode::starWidth(float mag) const
{
@@ -45,7 +39,7 @@ float PointSourceNode::starWidth(float mag) const
const double maxSize = 10.0;
double lgmin = log10(MINZOOM);
-// double lgmax = log10(MAXZOOM);
+ // double lgmax = log10(MAXZOOM);
double lgz = log10(Options::zoomFactor());
float sizeFactor = maxSize + (lgz - lgmin);
@@ -59,6 +53,16 @@ float PointSourceNode::starWidth(float mag) const
return size;
}
+void PointSourceNode::initPoint() {
+ if(!m_point) {
+ m_point = new PointNode(m_rootNode,m_spType,starWidth(m_size));
+ //appendChildNode(m_opacity);
+ m_opacity->appendChildNode(m_point);
+ }
+ show();
+ m_point->setSize(starWidth(m_skyObject->mag()));
+}
+
void PointSourceNode::changePos(QPointF pos) {
QSizeF size = m_point->size();
QMatrix4x4 m (1,0,0,pos.x(),
@@ -80,14 +84,8 @@ void PointSourceNode::update() {
bool visible = false;
pos = projector()->toScreen(m_skyObject,true,&visible);
if( visible && projector()->onScreen(pos) ) { // FIXME: onScreen here should use canvas size rather than SkyMap size, especially while printing in portrait mode!
- if(m_labelType == LabelsItem::label_t::DEEP_SKY_LABEL){
- m_point->setSize(14);//starWidth(m_skyObject->mag()));
- } else {
- m_point->setSize(starWidth(m_skyObject->mag()));
- }
+ initPoint();
changePos(pos);
- show();
- //m_point->show();
if(m_drawLabel && m_labelType != LabelsItem::label_t::NO_LABEL) {
if(!m_label) { //This way labels will be created only when they are needed
diff --git a/kstars/kstarslite/skyitems/skynodes/pointsourcenode.h b/kstars/kstarslite/skyitems/skynodes/pointsourcenode.h
index a05289e..90ecc62 100644
--- a/kstars/kstarslite/skyitems/skynodes/pointsourcenode.h
+++ b/kstars/kstarslite/skyitems/skynodes/pointsourcenode.h
@@ -50,6 +50,7 @@ public:
/** @short Get the width of a star of magnitude mag */
float starWidth(float mag) const;
+ void initPoint();
/**
* @short changePos changes the position m_point
@@ -63,6 +64,8 @@ private:
PointNode * m_point;
//TODO deal setter for this when stars will be introduced
RootNode *m_rootNode;
+ char m_spType;
+ float m_size;
LabelNode *m_label;
LabelsItem::label_t m_labelType;
diff --git a/kstars/kstarslite/skyitems/skynodes/satellitenode.cpp b/kstars/kstarslite/skyitems/skynodes/satellitenode.cpp
new file mode 100644
index 0000000..fa658e9
--- /dev/null
+++ b/kstars/kstarslite/skyitems/skynodes/satellitenode.cpp
@@ -0,0 +1,120 @@
+/** *************************************************************************
+ satellitenode.h - K Desktop Planetarium
+ -------------------
+ begin : 25/06/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "satellitenode.h"
+#include "satellite.h"
+#include "nodes/polynode.h"
+#include "Options.h"
+#include "ksutils.h"
+#include "linelist.h"
+#include "nodes/pointnode.h"
+#include <QSGFlatColorMaterial>
+
+
+SatelliteNode::SatelliteNode(Satellite* sat, RootNode *rootNode)
+ :m_sat(sat), m_lines(0), m_point(0), m_rootNode(rootNode)
+{
+}
+
+void SatelliteNode::initLines() {
+ if(m_point) {
+ delete m_point;
+ m_point = 0;
+ }
+
+ if(!m_lines) {
+ m_lines = new QSGGeometryNode;
+ m_opacity->appendChildNode(m_lines);
+ m_geometry = new QSGGeometry (QSGGeometry::defaultAttributes_Point2D(),0);
+ m_lines->setGeometry(m_geometry);
+ m_lines->setFlag(QSGNode::OwnsGeometry);
+
+ m_material = new QSGFlatColorMaterial;
+ m_lines->setOpaqueMaterial(m_material);
+ m_lines->setFlag(QSGNode::OwnsMaterial);
+
+ m_geometry->allocate(8);
+ QSGGeometry::Point2D * vertex = m_geometry->vertexDataAsPoint2D();
+
+ vertex[0].set( -0.5, -0.5); vertex[1].set(0.5,-0.5);
+ vertex[2].set( 0.5, -0.5); vertex[3].set(0.5,0.5);
+ vertex[4].set( 0.5, 0.5); vertex[5].set(-0.5,0.5);
+ vertex[6].set( -0.5, 0.5); vertex[7].set(-0.5,-0.5);
+ }
+}
+
+void SatelliteNode::initPoint() {
+ if(m_lines) {
+ delete m_lines;
+ m_lines = 0;
+ }
+ if(!m_point) {
+ m_point = new PointNode(m_rootNode, 'B', 3.5);
+ m_opacity->appendChildNode(m_point);
+ }
+}
+
+void SatelliteNode::update() {
+ if(m_sat->selected()) {
+ KStarsData *data = KStarsData::Instance();
+ const Projector *m_proj = SkyMapLite::Instance()->projector();
+ QPointF pos;
+
+ bool visible = false;
+
+ m_sat->HorizontalToEquatorial( data->lst(), data->geo()->lat() );
+
+ pos = m_proj->toScreen( m_sat, true, &visible );
+
+ if( !visible || !m_proj->onScreen( pos ) ) {
+ hide();
+ return;
+ }
+ show();
+
+ if ( true ) {
+ initPoint();
+ } else {
+ QColor color;
+ initLines();
+ if ( m_sat->isVisible() )
+ color = data->colorScheme()->colorNamed( "VisibleSatColor" );
+ else
+ color = data->colorScheme()->colorNamed( "SatColor" );
+
+ m_material->setColor(color);
+ }
+
+ changePos(pos);
+ } else {
+ hide();
+ }
+
+ /*if ( Options::showSatellitesLabels() )
+ data->skyComposite()->satellites()->drawLabel( sat, pos );*/
+}
+
+void SatelliteNode::changePos(QPointF pos) {
+ //QSizeF size = m_point->size();
+ QMatrix4x4 m (1,0,0,pos.x(),
+ 0,1,0,pos.y(),
+ 0,0,1,0,
+ 0,0,0,1);
+ //m.translate(-0.5*size.width(), -0.5*size.height());
+
+ setMatrix(m);
+ markDirty(QSGNode::DirtyMatrix);
+}
diff --git a/kstars/kstarslite/skyitems/skynodes/satellitenode.h b/kstars/kstarslite/skyitems/skynodes/satellitenode.h
new file mode 100644
index 0000000..5c77e6a
--- /dev/null
+++ b/kstars/kstarslite/skyitems/skynodes/satellitenode.h
@@ -0,0 +1,59 @@
+/** *************************************************************************
+ satellitenode.h - K Desktop Planetarium
+ -------------------
+ begin : 25/06/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef SATELLITENODE_H_
+#define SATELLITENODE_H_
+#include "skynode.h"
+
+class PolyNode;
+class Satellite;
+class PointNode;
+class QSGFlatColorMaterial;
+
+/** @class SatelliteNode
+ *
+ *@version 1.0
+ */
+
+class SatelliteNode : public SkyNode {
+public:
+ SatelliteNode(Satellite* sat, RootNode *rootNode);
+
+ void update();
+ //virtual void hide() override;
+ void initLines();
+ void initPoint();
+
+ void changePos(QPointF pos);
+
+ inline Satellite *sat() { return m_sat; }
+
+private:
+ Satellite *m_sat;
+ RootNode *m_rootNode;
+
+ SkyOpacityNode *m_linesOpacity;
+ QSGGeometryNode *m_lines;
+
+ QSGFlatColorMaterial *m_material;
+ QSGGeometry *m_geometry;
+
+ PointNode *m_point;
+};
+
+
+#endif
+
+
diff --git a/kstars/kstarslite/skyitems/skynodes/skynode.h b/kstars/kstarslite/skyitems/skynodes/skynode.h
index 3155589..dcc9b2d 100644
--- a/kstars/kstarslite/skyitems/skynodes/skynode.h
+++ b/kstars/kstarslite/skyitems/skynodes/skynode.h
@@ -99,9 +99,10 @@ public:
* @return pointer to the object of type SkyObject
*/
SkyObject * skyObject() const { return m_skyObject; }
+ SkyOpacityNode *m_opacity;
+
protected:
SkyObject * m_skyObject;
- SkyOpacityNode *m_opacity;
bool m_drawLabel;
};
diff --git a/kstars/kstarslite/skyitems/skynodes/skypolygonnode.cpp b/kstars/kstarslite/skyitems/skynodes/skypolygonnode.cpp
new file mode 100644
index 0000000..7808f8f
--- /dev/null
+++ b/kstars/kstarslite/skyitems/skynodes/skypolygonnode.cpp
@@ -0,0 +1,122 @@
+/** *************************************************************************
+ skypolygonnode.cpp - K Desktop Planetarium
+ -------------------
+ begin : 23/06/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "skypolygonnode.h"
+#include "nodes/polynode.h"
+#include "Options.h"
+#include "ksutils.h"
+#include "linelist.h"
+
+SkyPolygonNode::SkyPolygonNode(LineList* list)
+ :m_list(list), m_polygonNode(new PolyNode)
+{
+ addChildNode(m_polygonNode);
+}
+
+void SkyPolygonNode::update(bool forceClip) {
+ if(!m_polygonNode->opacity()) {
+ m_polygonNode->show();
+ }
+
+ bool isVisible, isVisibleLast;
+ SkyList *points = m_list->points();
+ QPolygonF polygon;
+ const Projector *m_proj = SkyMapLite::Instance()->projector();
+
+ if (forceClip == false)
+ {
+ for ( int i = 0; i < points->size(); ++i )
+ {
+ polygon << m_proj->toScreen( points->at( i ), false, &isVisibleLast);
+ isVisible |= isVisibleLast;
+ }
+
+ // If 1+ points are visible, draw it
+ if ( polygon.size() && isVisible) {
+ m_polygonNode->updateGeometry(polygon,true);
+ } else {
+ m_polygonNode->hide();
+ }
+
+ return;
+ }
+
+
+ SkyPoint* pLast = points->last();
+ QPointF oLast = m_proj->toScreen( pLast, true, &isVisibleLast );
+ // & with the result of checkVisibility to clip away things below horizon
+ isVisibleLast &= m_proj->checkVisibility(pLast);
+
+ for ( int i = 0; i < points->size(); ++i ) {
+ SkyPoint* pThis = points->at( i );
+ QPointF oThis = m_proj->toScreen( pThis, true, &isVisible );
+ // & with the result of checkVisibility to clip away things below horizon
+ isVisible &= m_proj->checkVisibility(pThis);
+
+
+ if ( isVisible && isVisibleLast ) {
+ polygon << oThis;
+ } else if ( isVisibleLast ) {
+ QPointF oMid = m_proj->clipLine( pLast, pThis );
+ polygon << oMid;
+ } else if ( isVisible ) {
+ QPointF oMid = m_proj->clipLine( pThis, pLast );
+ polygon << oMid;
+ polygon << oThis;
+ }
+
+ pLast = pThis;
+ oLast = oThis;
+ isVisibleLast = isVisible;
+ }
+
+ if ( polygon.size() ) {
+ m_polygonNode->updateGeometry(polygon,true);
+ } else {
+ m_polygonNode->hide();
+ return;
+ }
+
+
+ /*QColor color = KStarsData::Instance()->colorScheme()->colorNamed( "HorzColor" );
+
+ m_polygonNode->setColor(color);
+ m_polygonNode->setLineWidth(2);
+
+ //QVector<Vector2f> ground = projector()->groundPoly(labelPoint, drawLabel);
+ QVector<Vector2f> ground = SkyMapLite::Instance()->projector()->groundPoly();
+ if( ground.size() ) {
+ QPolygonF groundPoly(ground.size());
+ for(int i = 0; i < ground.size(); ++i)
+ groundPoly[i] = KSUtils::vecToPoint(ground[i]);
+ if( Options::showGround() ) {
+ m_polygonNode->updateGeometry(groundPoly,true);
+ } else {
+ groundPoly.append( groundPoly.first() );
+ m_polygonNode->updateGeometry(groundPoly,false);
+ }
+ } else {
+ m_polygonNode->hide();
+ return;
+ }*/
+}
+
+void SkyPolygonNode::setColor(QColor color) {
+ m_polygonNode->setColor(color);
+}
+
+void SkyPolygonNode::hide() {
+ m_polygonNode->hide();
+}
diff --git a/kstars/kstarslite/skyitems/skynodes/skypolygonnode.h b/kstars/kstarslite/skyitems/skynodes/skypolygonnode.h
new file mode 100644
index 0000000..c7e0ce4
--- /dev/null
+++ b/kstars/kstarslite/skyitems/skynodes/skypolygonnode.h
@@ -0,0 +1,44 @@
+/** *************************************************************************
+ skypolygonnode.h - K Desktop Planetarium
+ -------------------
+ begin : 23/06/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef SKYPOLYGONNODE_H_
+#define SKYPOLYGONNODE_H_
+#include "skynode.h"
+
+class PolyNode;
+
+/** @class HorizonNode
+ *
+ *@version 1.0
+ */
+
+class SkyPolygonNode : public SkyNode {
+public:
+ SkyPolygonNode(LineList* list);
+
+ void update(bool forceClip = true);
+ virtual void hide() override;
+ LineList *lineList() { return m_list; }
+ void setColor(QColor color);
+
+private:
+ PolyNode *m_polygonNode;
+ LineList *m_list;
+};
+
+
+#endif
+
+
diff --git a/kstars/kstarslite/skyitems/skynodes/supernovanode.cpp b/kstars/kstarslite/skyitems/skynodes/supernovanode.cpp
new file mode 100644
index 0000000..fe21da9
--- /dev/null
+++ b/kstars/kstarslite/skyitems/skynodes/supernovanode.cpp
@@ -0,0 +1,93 @@
+/** *************************************************************************
+ supernovanode.h - K Desktop Planetarium
+ -------------------
+ begin : 26/06/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "supernovanode.h"
+#include "supernova.h"
+#include "nodes/polynode.h"
+#include "Options.h"
+#include "ksutils.h"
+#include "linelist.h"
+#include "nodes/pointnode.h"
+#include <QSGFlatColorMaterial>
+
+SupernovaNode::SupernovaNode(Supernova *snova)
+ :m_snova(snova)
+{
+
+}
+
+void SupernovaNode::init(QColor color) {
+ if(!m_lines) {
+ m_lines = new QSGGeometryNode;
+ addChildNode(m_lines);
+ m_geometry = new QSGGeometry (QSGGeometry::defaultAttributes_Point2D(),0);
+ m_lines->setGeometry(m_geometry);
+ m_lines->setFlag(QSGNode::OwnsGeometry);
+
+ m_material = new QSGFlatColorMaterial;
+ m_lines->setOpaqueMaterial(m_material);
+ m_lines->setFlag(QSGNode::OwnsMaterial);
+
+ m_geometry->allocate(4);
+ QSGGeometry::Point2D * vertex = m_geometry->vertexDataAsPoint2D();
+
+ vertex[0].set( -2.0, 0.0 ); vertex[1].set( 2.0, 0.0 );
+ vertex[2].set( 0.0, -2.0 ); vertex[3].set( 0.0,2.0 );
+ }
+ show();
+ if(m_material->color() != color) {
+ m_material->setColor(color);
+ m_lines->markDirty(QSGNode::DirtyMaterial);
+ }
+}
+
+void SupernovaNode::update() {
+ KStarsData *data = KStarsData::Instance();
+ const Projector *m_proj = SkyMapLite::Instance()->projector();
+ if( !m_proj->checkVisibility(m_snova) ) {
+ hide();
+ return;
+ }
+
+ bool visible = false;
+ QPointF pos = m_proj->toScreen(m_snova,true,&visible);
+ //qDebug()<<"sup->ra() = "<<(sup->ra()).toHMSString()<<"sup->dec() = "<<sup->dec().toDMSString();
+ //qDebug()<<"pos = "<<pos<<"m_proj->onScreen(pos) = "<<m_proj->onScreen(pos);
+ if( !visible || !m_proj->onScreen(pos) ) {
+ hide();
+ return;
+ }
+
+ QColor color = data->colorScheme()->colorNamed("SupernovaColor");
+ init(color);
+
+ changePos(pos);
+
+ //qDebug()<<"Here"<<endl;
+ return;
+}
+
+void SupernovaNode::changePos(QPointF pos) {
+ //QSizeF size = m_point->size();
+ QMatrix4x4 m (1,0,0,pos.x(),
+ 0,1,0,pos.y(),
+ 0,0,1,0,
+ 0,0,0,1);
+ //m.translate(-0.5*size.width(), -0.5*size.height());
+
+ setMatrix(m);
+ markDirty(QSGNode::DirtyMatrix);
+}
diff --git a/kstars/kstarslite/skyitems/skynodes/supernovanode.h b/kstars/kstarslite/skyitems/skynodes/supernovanode.h
new file mode 100644
index 0000000..eeae94f
--- /dev/null
+++ b/kstars/kstarslite/skyitems/skynodes/supernovanode.h
@@ -0,0 +1,55 @@
+/** *************************************************************************
+ supernovanode.h - K Desktop Planetarium
+ -------------------
+ begin : 26/06/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef SUPERNOVANODE_H_
+#define SUPERNOVANODE_H_
+#include "skynode.h"
+
+class PolyNode;
+class Supernova;
+class PointNode;
+class QSGFlatColorMaterial;
+
+/** @class SupernovaNode
+ *
+ *@version 1.0
+ */
+
+class SupernovaNode : public SkyNode {
+public:
+ SupernovaNode(Supernova *snova);
+
+ void update();
+
+ void init(QColor color);
+
+ void changePos(QPointF pos);
+
+ inline Supernova *snova() { return m_snova; }
+
+private:
+ Supernova *m_snova;
+
+ QSGGeometryNode *m_lines;
+
+ QSGFlatColorMaterial *m_material;
+ QSGGeometry *m_geometry;
+
+ PointNode *m_point;
+};
+
+#endif
+
+
diff --git a/kstars/kstarslite/skyitems/skyopacitynode.cpp b/kstars/kstarslite/skyitems/skyopacitynode.cpp
index 8582077..11edf25 100644
--- a/kstars/kstarslite/skyitems/skyopacitynode.cpp
+++ b/kstars/kstarslite/skyitems/skyopacitynode.cpp
@@ -28,7 +28,7 @@ void SkyOpacityNode::show() {
}
void SkyOpacityNode::hide() {
- if(opacity()) {
+ if(opacity() != 0) {
setOpacity(0);
markDirty(QSGNode::DirtyOpacity);
}
diff --git a/kstars/kstarslite/skyitems/skyopacitynode.h b/kstars/kstarslite/skyitems/skyopacitynode.h
index 3a4c7bb..efc3c6b 100644
--- a/kstars/kstarslite/skyitems/skyopacitynode.h
+++ b/kstars/kstarslite/skyitems/skyopacitynode.h
@@ -45,6 +45,8 @@ public:
* @return true if node is visible
*/
bool visible();
+private:
+ double m_opacityVal;
};
#endif
diff --git a/kstars/kstarslite/skyitems/supernovaeitem.cpp b/kstars/kstarslite/skyitems/supernovaeitem.cpp
new file mode 100644
index 0000000..8c0f796
--- /dev/null
+++ b/kstars/kstarslite/skyitems/supernovaeitem.cpp
@@ -0,0 +1,58 @@
+/** *************************************************************************
+ supernovaeitem.cpp - K Desktop Planetarium
+ -------------------
+ begin : 26/06/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "supernovaeitem.h"
+#include "satellitescomponent.h"
+
+#include "Options.h"
+#include "projections/projector.h"
+#include "kscomet.h"
+
+#include "rootnode.h"
+#include "labelsitem.h"
+#include "skylabeler.h"
+#include "supernovaecomponent.h"
+
+#include "skynodes/supernovanode.h"
+
+SupernovaeItem::SupernovaeItem(SupernovaeComponent *snovaComp, RootNode *rootNode)
+ :SkyItem(LabelsItem::label_t::SATELLITE_LABEL, rootNode), m_snovaComp(snovaComp)
+{
+ foreach ( SkyObject *so, m_snovaComp->objectList() ) {
+ Supernova *sup = (Supernova*) so;
+ appendChildNode(new SupernovaNode(sup));
+ }
+}
+
+void SupernovaeItem::update() {
+ if( ! m_snovaComp->selected() ) {
+ hide();
+ return;
+ }
+
+ QSGNode *n = firstChild();
+
+ while(n != 0) {
+ SupernovaNode *sNode = static_cast<SupernovaNode *>(n);
+ sNode->update();
+
+ n = n->nextSibling();
+ }
+}
+
+void SupernovaeItem::recreateList() {
+
+}
diff --git a/kstars/kstarslite/skyitems/supernovaeitem.h b/kstars/kstarslite/skyitems/supernovaeitem.h
new file mode 100644
index 0000000..d747de0
--- /dev/null
+++ b/kstars/kstarslite/skyitems/supernovaeitem.h
@@ -0,0 +1,56 @@
+/** *************************************************************************
+ supernovaeitem.h - K Desktop Planetarium
+ -------------------
+ begin : 26/06/2016
+ copyright : (C) 2016 by Artem Fedoskin
+ email : afedoskin3@gmail.com
+ ***************************************************************************/
+/** *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef SUPERNOVAEITEM_H_
+#define SUPERNOVAEITEM_H_
+
+#include "skyitem.h"
+
+class KSComet;
+class SkyObject;
+class SupernovaeComponent;
+
+ /**
+ * @class SupernovaItem
+ * This class handles comets in SkyMapLite
+ *
+ * @author Artem Fedoskin
+ * @version 1.0
+ */
+
+class SupernovaeItem : public SkyItem {
+public:
+ /**
+ * @short Constructor
+ * @param cometsList const reference to list of comets
+ * @param rootNode parent RootNode that instantiates this object
+ */
+ SupernovaeItem(SupernovaeComponent *snovaComp, RootNode *rootNode = 0);
+
+ /**
+ * @short recreates the node tree (deletes old nodes and appends new ones according to
+ * m_cometsList)
+ */
+ void recreateList();
+
+ /**
+ * @short Determines the visibility of the object and its label and hides/updates them accordingly
+ */
+ virtual void update() override;
+
+private:
+ SupernovaeComponent *m_snovaComp;
+};
+#endif
diff --git a/kstars/main.cpp b/kstars/main.cpp
index 9cbae25..d25c006 100644
--- a/kstars/main.cpp
+++ b/kstars/main.cpp
@@ -239,7 +239,7 @@ int main(int argc, char *argv[])
Options::setTimeZone(1);
Options::setRunClock(false);
- Options::setShowStarMagnitudes(false);
+ Options::setShowStarMagnitudes(true);
Options::setShowStarNames(true);
Options::setShowStars(true);
@@ -249,9 +249,13 @@ int main(int argc, char *argv[])
Options::setShowSolarSystem(true);
Options::setShowEcliptic(true);
Options::setShowEquator(true);
- Options::setShowEquatorialGrid(false);
+ Options::setShowEquatorialGrid(true);
Options::setShowHorizontalGrid(true);
- Options::setShowGround(false);
+ Options::setShowGround(true);
+ Options::setShowSupernovae(true);
+
+ Options::setShowMilkyWay(true);
+ Options::setShowConstellationArt(true);
//Labels
Options::setShowCometNames(true);
diff --git a/kstars/projections/projector.cpp b/kstars/projections/projector.cpp
index 75c75c5..d76dc47 100644
--- a/kstars/projections/projector.cpp
+++ b/kstars/projections/projector.cpp
@@ -26,15 +26,15 @@
#include "skycomponents/skylabeler.h"
namespace {
- void toXYZ(const SkyPoint* p, double *x, double *y, double *z) {
- double sinRa, sinDec, cosRa, cosDec;
-
- p->ra().SinCos( sinRa, cosRa );
- p->dec().SinCos( sinDec, cosDec );
- *x = cosDec * cosRa;
- *y = cosDec * sinRa;
- *z = sinDec;
- }
+void toXYZ(const SkyPoint* p, double *x, double *y, double *z) {
+ double sinRa, sinDec, cosRa, cosDec;
+
+ p->ra().SinCos( sinRa, cosRa );
+ p->dec().SinCos( sinDec, cosDec );
+ *x = cosDec * cosRa;
+ *y = cosDec * sinRa;
+ *z = sinDec;
+}
}
SkyPoint Projector::pointAt(double az)
@@ -76,7 +76,7 @@ void Projector::setViewParams(const ViewParams& p)
double currentFOV = m_fov;
//Find FOV in radians
m_fov = sqrt( m_vp.width*m_vp.width + m_vp.height*m_vp.height )
- / ( 2 * m_vp.zoomFactor * dms::DegToRad );
+ / ( 2 * m_vp.zoomFactor * dms::DegToRad );
//Set checkVisibility variables
double Ymax;
if ( m_vp.useAltAz ) {
@@ -278,7 +278,7 @@ QVector< Vector2f > Projector::groundPoly(SkyPoint* labelpoint, bool *drawLabel)
double daz = 90.;
if ( m_vp.useAltAz ) {
daz = 0.5*m_vp.width*57.3/m_vp.zoomFactor; //center to edge, in degrees
- if ( type() == Orthographic ) {
+ if ( type() == Orthographic ) {
daz = daz * 1.4;
}
daz = qMin(qreal(90.0), daz);
@@ -314,7 +314,12 @@ QVector< Vector2f > Projector::groundPoly(SkyPoint* labelpoint, bool *drawLabel)
return QVector<Vector2f>();
}
+#ifdef KSTARS_LITE
+ qreal rotation = SkyMapLite::Instance()->rotation();
+ if( allGround && rotation == 0.0) {
+#else
if( allGround ) {
+#endif
ground.clear();
ground.append( Vector2f( -10., -10. ) );
ground.append( Vector2f( m_vp.width +10., -10. ) );
@@ -328,7 +333,11 @@ QVector< Vector2f > Projector::groundPoly(SkyPoint* labelpoint, bool *drawLabel)
//In Gnomonic projection, or if sufficiently zoomed in, we can complete
//the ground polygon by simply adding offscreen points
//FIXME: not just gnomonic
- if ( daz < 25.0 || type() == Gnomonic) {
+#ifdef KSTARS_LITE
+ if ( (daz < 25.0 || type() == Gnomonic) && rotation == 0.0) {
+#else
+ if ( (daz < 25.0 || type() == Gnomonic)) {
+#endif
ground.append( Vector2f( m_vp.width + 10.f, ground.last().y() ) );
ground.append( Vector2f( m_vp.width + 10.f, m_vp.height + 10.f ) );
ground.append( Vector2f( -10.f, m_vp.height + 10.f ) );
@@ -476,18 +485,21 @@ Vector2f Projector::toScreenVec(const SkyPoint* o, bool oRefract, bool* onVisibl
qDebug() << "Y = " << Y << " and isfinite(Y) is" << std::isfinite(Y);
}
- Q_ASSERT( std::isfinite( Y ) && std::isfinite( dX ) );
+ //Q_ASSERT( std::isfinite( Y ) && std::isfinite( dX ) );
+ if(!std::isfinite( Y ) && !std::isfinite( dX )) {
+ return Vector2f(0,0);
+ }
dX = KSUtils::reduceAngle(dX, -dms::PI, dms::PI);
//Convert dX, Y coords to screen pixel coords, using GNU extension if available
- #if ( __GLIBC__ >= 2 && __GLIBC_MINOR__ >=1 )
+#if ( __GLIBC__ >= 2 && __GLIBC_MINOR__ >=1 )
sincos( dX, &sindX, &cosdX );
sincos( Y, &sinY, &cosY );
- #else
+#else
sindX = sin(dX); cosdX = cos(dX);
sinY = sin(Y); cosY = cos(Y);
- #endif
+#endif
//c is the cosine of the angular distance from the center
double c = m_sinY0*sinY + m_cosY0*cosY*cosdX;
diff --git a/kstars/skycomponents/linelistindex.h b/kstars/skycomponents/linelistindex.h
index faa66c3..7f16fcd 100644
--- a/kstars/skycomponents/linelistindex.h
+++ b/kstars/skycomponents/linelistindex.h
@@ -63,13 +63,14 @@ public:
/**
* @short KStars Lite needs direct access to m_lineIndex for drawing the lines
*/
- inline LineListHash* lineIndex() const { return m_lineIndex; }
+ inline LineListHash *lineIndex() const { return m_lineIndex; }
+ inline LineListHash *polyIndex() const { return m_polyIndex; }
/** @short returns MeshIterator for currently visible trixels */
MeshIterator visibleTrixels();
#endif
-protected:
+ //Moved to public because KStars Lite uses it
/** @short this is called from within the draw routines when the updateID
* of the lineList is stale. It is virtual because different subclasses
* have different update routines. NoPrecessIndex doesn't precess in
@@ -77,6 +78,7 @@ protected:
* not points. that doesn't precess the points.
*/
virtual void JITupdate( LineList* lineList );
+protected:
/** @short as the name says, recreates the lineIndex using the LineLists
* in the previous index. Since we are indexing everything at J2000
diff --git a/kstars/skycomponents/milkyway.h b/kstars/skycomponents/milkyway.h
index 2ebd2c9..7cc3e17 100644
--- a/kstars/skycomponents/milkyway.h
+++ b/kstars/skycomponents/milkyway.h
@@ -34,6 +34,8 @@
*/
class MilkyWay : public LineListIndex
{
+ friend class MilkyWayItem;
+
public:
/** @short Constructor
* @p parent pointer to the parent SkyComposite
diff --git a/kstars/skycomponents/noprecessindex.h b/kstars/skycomponents/noprecessindex.h
index e706230..362a0e8 100644
--- a/kstars/skycomponents/noprecessindex.h
+++ b/kstars/skycomponents/noprecessindex.h
@@ -31,11 +31,12 @@ public:
/** @short Constructor */
NoPrecessIndex( SkyComposite *parent, const QString& name );
-protected:
+ //Moved to public because KStars Lite uses it
/** @ short override JITupdate so we don't perform the precession
* correction, only rotation.
*/
virtual void JITupdate( LineList* lineList );
+protected:
/** @short we need to use the buffer that does not have the
* reverse-precession correction.
diff --git a/kstars/skycomponents/satellitescomponent.cpp b/kstars/skycomponents/satellitescomponent.cpp
index 68f6cca..efdc60e 100644
--- a/kstars/skycomponents/satellitescomponent.cpp
+++ b/kstars/skycomponents/satellitescomponent.cpp
@@ -44,7 +44,6 @@ SatellitesComponent::SatellitesComponent( SkyComposite *parent ) :
if ( ! fileReader.open( "satellites.dat" ) ) return;
emitProgressText( i18n("Loading satellites" ) );
-
while ( fileReader.hasMoreLines() ) {
line = fileReader.readLine();
diff --git a/kstars/skycomponents/skymapcomposite.h b/kstars/skycomponents/skymapcomposite.h
index 22fd365..dc435fa 100644
--- a/kstars/skycomponents/skymapcomposite.h
+++ b/kstars/skycomponents/skymapcomposite.h
@@ -184,12 +184,16 @@ public:
inline EquatorialCoordinateGrid* equatorialCoordGrid() { return m_EquatorialCoordinateGrid; }
inline HorizontalCoordinateGrid* horizontalCoordGrid() { return m_HorizontalCoordinateGrid; }
+ inline ConstellationArtComponent * constellationArt() { return m_ConstellationArt; }
+
inline SolarSystemComposite* solarSystemComposite() { return m_SolarSystem; }
inline ConstellationNamesComponent* constellationNamesComponent() { return m_CNames; }
inline DeepSkyComponent* deepSkyComponent() { return m_DeepSky; }
+ inline MilkyWay *milkyWay() { return m_MilkyWay; }
+
//Accessors for StarComponent
SkyObject* findStarByGenetiveName( const QString name );
virtual void emitProgressText( const QString &message );
diff --git a/kstars/skymaplite.cpp b/kstars/skymaplite.cpp
index f31547a..bd606e0 100644
--- a/kstars/skymaplite.cpp
+++ b/kstars/skymaplite.cpp
@@ -86,7 +86,8 @@ int SkyMapLite::starColorMode = 0;
SkyMapLite::SkyMapLite(QQuickItem* parent)
:QQuickItem(parent), m_proj(0), count(0), data(KStarsData::Instance()),
- nStarSizes(15), nSPclasses(7), pinch(false), m_loadingFinished(false), m_sizeMagLim(10.0)
+ nStarSizes(15), nSPclasses(7), pinch(false), m_loadingFinished(false), m_sizeMagLim(10.0),
+ m_rootNode(0)
{
setAcceptHoverEvents(true);
setAcceptedMouseButtons(Qt::AllButtons);
@@ -546,6 +547,7 @@ QSGTexture *SkyMapLite::textToTexture(QString text, QColor color, bool zoomFont)
int height = fm.height();
QImage label(width, height, QImage::Format_ARGB32_Premultiplied);
+
label.fill(Qt::transparent);
m_painter.begin(&label);
@@ -559,11 +561,6 @@ QSGTexture *SkyMapLite::textToTexture(QString text, QColor color, bool zoomFont)
QSGTexture *texture = window()->createTextureFromImage(label,
QQuickWindow::TextureCanUseAtlas);
-
- /*texture->setFiltering(QSGTexture::Linear);
- texture->setHorizontalWrapMode(QSGTexture::ClampToEdge);
- texture->setVerticalWrapMode(QSGTexture::ClampToEdge);*/
-
return texture;
}
diff --git a/kstars/skyobjects/satellitegroup.cpp b/kstars/skyobjects/satellitegroup.cpp
index cf4d636..4769ebc 100644
--- a/kstars/skyobjects/satellitegroup.cpp
+++ b/kstars/skyobjects/satellitegroup.cpp
@@ -35,6 +35,7 @@ SatelliteGroup::SatelliteGroup( QString name, QString tle_filename, QUrl update_
SatelliteGroup::~SatelliteGroup()
{
+
}
void SatelliteGroup::readTLE()