summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Fedoskin <afedoskin3@gmail.com>2016-06-12 18:30:49 (GMT)
committerArtem Fedoskin <afedoskin3@gmail.com>2016-06-12 18:33:25 (GMT)
commit13562153080dbd1a5b9d0a54129a20d64cac0152 (patch)
treedf2ec47ed095189776c86bc9e716ab2ba7d912a1
parent3d9a01bb1fc1f3aaa2741166a4f85d6f8e1aba04 (diff)
Added constellation names (ConstellationNamesItem) to SkyMapLite.
HorizonItem, EquatorItem and EclipticItem now have compass labels.
-rw-r--r--kstars/CMakeLists.txt5
-rw-r--r--kstars/kstarslite/skyitems/constellationnamesitem.cpp84
-rw-r--r--kstars/kstarslite/skyitems/constellationnamesitem.h17
-rw-r--r--kstars/kstarslite/skyitems/horizonitem.cpp65
-rw-r--r--kstars/kstarslite/skyitems/horizonitem.h4
-rw-r--r--kstars/kstarslite/skyitems/labelsitem.cpp54
-rw-r--r--kstars/kstarslite/skyitems/labelsitem.h9
-rw-r--r--kstars/kstarslite/skyitems/lines/eclipticitem.cpp95
-rw-r--r--kstars/kstarslite/skyitems/lines/eclipticitem.h34
-rw-r--r--kstars/kstarslite/skyitems/lines/equatoritem.cpp92
-rw-r--r--kstars/kstarslite/skyitems/lines/equatoritem.h36
-rw-r--r--kstars/kstarslite/skyitems/lines/linesitem.cpp (renamed from kstars/kstarslite/skyitems/linesitem.cpp)12
-rw-r--r--kstars/kstarslite/skyitems/lines/linesitem.h (renamed from kstars/kstarslite/skyitems/linesitem.h)2
-rw-r--r--kstars/kstarslite/skyitems/rootnode.cpp20
-rw-r--r--kstars/kstarslite/skyitems/rootnode.h14
-rw-r--r--kstars/kstarslite/skyitems/skynodes/guidelabelnode.cpp104
-rw-r--r--kstars/kstarslite/skyitems/skynodes/guidelabelnode.h23
-rw-r--r--kstars/kstarslite/skyitems/skynodes/horizonnode.cpp2
-rw-r--r--kstars/kstarslite/skyitems/skynodes/labelnode.cpp20
-rw-r--r--kstars/kstarslite/skyitems/skynodes/labelnode.h6
-rw-r--r--kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp65
-rw-r--r--kstars/kstarslite/skyitems/skynodes/nodes/linenode.h6
-rw-r--r--kstars/kstarslite/skyitems/skynodes/skynode.cpp2
-rw-r--r--kstars/kstarslite/skyitems/skynodes/trixelnode.cpp5
-rw-r--r--kstars/kstarslite/skyitems/skynodes/trixelnode.h2
-rw-r--r--kstars/main.cpp27
-rw-r--r--kstars/skycomponents/skylabeler.cpp6
-rw-r--r--kstars/skycomponents/skymapcomposite.h2
28 files changed, 659 insertions, 154 deletions
diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt
index 89f0bb3..65a838d 100644
--- a/kstars/CMakeLists.txt
+++ b/kstars/CMakeLists.txt
@@ -552,9 +552,12 @@ if(BUILD_KSTARS_LITE)
kstarslite/skyitems/asteroidsitem.cpp
kstarslite/skyitems/cometsitem.cpp
kstarslite/skyitems/horizonitem.cpp
- kstarslite/skyitems/linesitem.cpp
kstarslite/skyitems/labelsitem.cpp
kstarslite/skyitems/constellationnamesitem.cpp
+ #Lines
+ kstarslite/skyitems/lines/linesitem.cpp
+ kstarslite/skyitems/lines/equatoritem.cpp
+ kstarslite/skyitems/lines/eclipticitem.cpp
#SkyNodes
kstarslite/skyitems/skynodes/planetnode.cpp
kstarslite/skyitems/skynodes/skynode.cpp
diff --git a/kstars/kstarslite/skyitems/constellationnamesitem.cpp b/kstars/kstarslite/skyitems/constellationnamesitem.cpp
index ba4abf5..d609665 100644
--- a/kstars/kstarslite/skyitems/constellationnamesitem.cpp
+++ b/kstars/kstarslite/skyitems/constellationnamesitem.cpp
@@ -15,47 +15,93 @@
***************************************************************************/
#include "constellationnamesitem.h"
#include "constellationnamescomponent.h"
+#include "skymaplite.h"
+#include "projections/projector.h"
-ConstellationNamesItem::ConstellationNamesItem(const QList<SkyObject*>& namesList, RootNode* parent)
- :SkyItem(LabelsItem::label_t::CONSTEL_NAME_LABEL, parent), m_namesList(namesList)
+#include "rootnode.h"
+#include "labelsitem.h"
+#include "skynodes/labelnode.h"
+
+#include "Options.h"
+
+ConstellationName::ConstellationName(SkyObject *skyObj)
+ :obj(skyObj), latin(0), secondary(0)
{
+
+}
+
+void ConstellationName::hide() {
+ if(latin) latin->hide();
+ if(secondary) secondary->hide();
+}
+
+ConstellationNamesItem::ConstellationNamesItem(ConstellationNamesComponent *constComp, RootNode* parent)
+ :SkyItem(LabelsItem::label_t::CONSTEL_NAME_LABEL, parent), m_constelNamesComp(constComp)
+{
+ recreateList();
}
void ConstellationNamesItem::update() {
- /*if ( ! selected() )
+ if ( ! m_constelNamesComp->selected() )
+ return;
+ if( !m_constelNamesComp->selected() ) {
+ hide();
+ rootNode()->labelsItem()->hideLabels(labelType());
return;
+ }
+
+ show();
- const Projector *proj = SkyMap::Instance()->projector();
- SkyLabeler* skyLabeler = SkyLabeler::Instance();
- skyLabeler->useStdFont();
- skyLabeler->setPen( QColor( KStarsData::Instance()->colorScheme()->colorNamed( "CNameColor" ) ) );
+ const Projector *proj = SkyMapLite::Instance()->projector();
- QString name;
- foreach(SkyObject *p, m_ObjectList) {
- if( ! proj->checkVisibility( p ) )
+ foreach(ConstellationName *constName, m_names) {
+ SkyObject *p = constName->obj;
+ if( ! proj->checkVisibility( p ) ) {
+ constName->hide();
continue;
+ }
bool visible = false;
QPointF o = proj->toScreen( p, false, &visible );
- if( !visible || !proj->onScreen( o ) )
+ if( !visible || !proj->onScreen( o ) ) {
+ constName->hide();
continue;
+ }
+
+ QString name;
- if( Options::useLatinConstellNames() || Options::useLocalConstellNames() )
+ if( Options::useLatinConstellNames() || Options::useLocalConstellNames() ) {
name = p->name();
- else
+
+ if(!constName->latin) {
+ constName->latin = rootNode()->labelsItem()->addLabel(name,labelType());
+ }
+
+ o.setX( o.x() - 5.0 * name.length() );
+
+ constName->latin->setLabelPos(o);
+ if(constName->secondary) constName->secondary->hide();
+ } else {
name = p->name2();
- o.setX( o.x() - 5.0 * name.length() );
- skyLabeler->drawGuideLabel( o, name, 0.0 );
+ if(!constName->secondary) {
+ constName->secondary = rootNode()->labelsItem()->addLabel(name,labelType());
+ }
+
+ o.setX( o.x() - 5.0 * name.length() );
+
+ constName->secondary->setLabelPos(o);
+ if(constName->latin) constName->latin->hide();
+ }
}
- skyLabeler->resetFont();*/
+ //skyLabeler->resetFont();
}
void ConstellationNamesItem::recreateList() {
removeAllChildNodes();
- /*foreach(SkyObject *comet, m_namesList) {
- appendChildNode(new PointSourceNode(com, rootNode(),labelType()));
- }*/
+ foreach(SkyObject *skyObj, m_constelNamesComp->objectList()) {
+ m_names.append(new ConstellationName(skyObj));
+ }
}
diff --git a/kstars/kstarslite/skyitems/constellationnamesitem.h b/kstars/kstarslite/skyitems/constellationnamesitem.h
index 90099b0..351b108 100644
--- a/kstars/kstarslite/skyitems/constellationnamesitem.h
+++ b/kstars/kstarslite/skyitems/constellationnamesitem.h
@@ -32,6 +32,16 @@ class ConstellationNamesComponent;
*@version 1.0
*/
+struct ConstellationName {
+ ConstellationName(SkyObject *skyObj);
+
+ SkyObject *obj;
+ LabelNode *latin;
+ LabelNode *secondary;
+
+ void hide();
+};
+
class ConstellationNamesItem : public SkyItem {
public:
@@ -41,15 +51,14 @@ public:
* @param parent a pointer to SkyItem's parent node
*/
- explicit ConstellationNamesItem(const QList<SkyObject*>& namesList, RootNode *rootNode = 0);
+ explicit ConstellationNamesItem(ConstellationNamesComponent *constComp, RootNode *rootNode = 0);
virtual void update();
- void hide();
- void show();
void recreateList();
private:
- const QList<SkyObject*>& m_namesList;
+ ConstellationNamesComponent *m_constelNamesComp;
+ QVector<ConstellationName *> m_names;
};
#endif
diff --git a/kstars/kstarslite/skyitems/horizonitem.cpp b/kstars/kstarslite/skyitems/horizonitem.cpp
index 1a127dd..23c3f4d 100644
--- a/kstars/kstarslite/skyitems/horizonitem.cpp
+++ b/kstars/kstarslite/skyitems/horizonitem.cpp
@@ -19,13 +19,50 @@
#include "horizoncomponent.h"
#include "skynodes/horizonnode.h"
#include "labelsitem.h"
+#include "skynodes/labelnode.h"
+
+#include "rootnode.h"
+#include "labelsitem.h"
+#include "Options.h"
HorizonItem::HorizonItem(HorizonComponent * hComp, RootNode *rootNode)
- :SkyItem(LabelsItem::label_t::RUDE_LABEL, rootNode), m_horizonComp(hComp)
+ :SkyItem(LabelsItem::label_t::HORIZON_LABEL, rootNode), m_horizonComp(hComp)
{
appendChildNode(new HorizonNode(m_horizonComp->pointList()));
+
+ double az = -0.01;
+ static QString name[8];
+ name[0] = i18nc( "Northeast", "NE" );
+ name[1] = i18nc( "East", "E" );
+ name[2] = i18nc( "Southeast", "SE" );
+ name[3] = i18nc( "South", "S" );
+ name[4] = i18nc( "Southwest", "SW" );
+ name[5] = i18nc( "West", "W" );
+ name[6] = i18nc( "Northwest", "NW" );
+ name[7] = i18nc( "North", "N" );
+
+ for ( int i = 0; i < 8; i++ ) {
+ SkyPoint *c = new SkyPoint;
+
+ az += 45.0;
+ c->setAz( az );
+ c->setAlt( 0.0 );
+ LabelNode *compass = rootNode->labelsItem()->addLabel(name[i],labelType());
+
+ m_compassLabels.insert(c,compass);
+
+ }
}
+void HorizonItem::hideLabels() {
+ QMap<SkyPoint *,LabelNode *>::iterator i = m_compassLabels.begin();
+
+ while ( i != m_compassLabels.end() ) {
+ LabelNode * compass = (*i);
+ compass->hide();
+ i++;
+ }
+}
void HorizonItem::update() {
if(!childCount()) {
@@ -37,9 +74,35 @@ void HorizonItem::update() {
while(n != 0) {
SkyNode *hNode = static_cast<SkyNode *>(n);
if(m_horizonComp->selected()) {
+
+ QPointF cpoint;
+ bool visible;
+
+ const Projector *proj = SkyMapLite::Instance()->projector();
+ KStarsData *data = KStarsData::Instance();
+
+ QMap<SkyPoint *,LabelNode *>::iterator i = m_compassLabels.begin();
+
+ while ( i != m_compassLabels.end() ) {
+ SkyPoint *c = i.key();
+ if ( !Options::useAltAz() ) {
+ c->HorizontalToEquatorial( data->lst(), data->geo()->lat() );
+ }
+
+ LabelNode * compass = (*i);
+ cpoint = proj->toScreen( c, false, &visible );
+ if ( visible && proj->onScreen(cpoint) ) {
+ compass->setLabelPos(cpoint);
+ } else {
+ compass->hide();
+ }
+ i++;
+ }
+
hNode->update();
} else {
hNode->hide();
+ hideLabels();
}
n = n->nextSibling();
}
diff --git a/kstars/kstarslite/skyitems/horizonitem.h b/kstars/kstarslite/skyitems/horizonitem.h
index aa348a1..9f75ccf 100644
--- a/kstars/kstarslite/skyitems/horizonitem.h
+++ b/kstars/kstarslite/skyitems/horizonitem.h
@@ -19,15 +19,19 @@
#include "skyitem.h"
class HorizonComponent;
+class GuideLabelNode;
class HorizonItem : public SkyItem {
public:
HorizonItem(HorizonComponent * hComp, RootNode *rootNode);
inline void setHorizonComp(HorizonComponent * hComp) { m_horizonComp = hComp; }
+ void hideLabels();
+
virtual void update();
private:
HorizonComponent *m_horizonComp;
+ QMap<SkyPoint *, LabelNode *> m_compassLabels;
};
#endif
diff --git a/kstars/kstarslite/skyitems/labelsitem.cpp b/kstars/kstarslite/skyitems/labelsitem.cpp
index 4f26324..318627a 100644
--- a/kstars/kstarslite/skyitems/labelsitem.cpp
+++ b/kstars/kstarslite/skyitems/labelsitem.cpp
@@ -19,6 +19,7 @@
#include "labelsitem.h"
#include "skylabeler.h"
#include "skynodes/labelnode.h"
+#include "skynodes/guidelabelnode.h"
#include "cometsitem.h"
#include "rootnode.h"
@@ -69,6 +70,18 @@ LabelsItem::LabelsItem(RootNode *rootNode)
LabelTypeNode *num_label = new LabelTypeNode;
appendChildNode(num_label);
labelsLists.insert(label_t::NUM_LABEL_TYPES, num_label);
+
+ LabelTypeNode *horizon_label = new LabelTypeNode;
+ appendChildNode(horizon_label);
+ labelsLists.insert(label_t::HORIZON_LABEL, horizon_label);
+
+ LabelTypeNode *equator = new LabelTypeNode;
+ appendChildNode(equator);
+ labelsLists.insert(label_t::EQUATOR_LABEL, equator);
+
+ LabelTypeNode *ecliptic = new LabelTypeNode;
+ appendChildNode(ecliptic);
+ labelsLists.insert(label_t::ECLIPTIC_LABEL, ecliptic);
}
LabelNode *LabelsItem::addLabel(SkyObject *skyObject, label_t type) {
@@ -77,13 +90,31 @@ LabelNode *LabelsItem::addLabel(SkyObject *skyObject, label_t type) {
return label;
}
+LabelNode *LabelsItem::addLabel(QString name, label_t type) {
+ LabelNode *label = new LabelNode(name, type);
+ labelsLists.value(type)->appendChildNode(label);
+ return label;
+}
+
+GuideLabelNode *LabelsItem::addGuideLabel(QString name, label_t type) {
+ GuideLabelNode *label = new GuideLabelNode(name, type);
+ labelsLists.value(type)->appendChildNode(label);
+ return label;
+}
+
void LabelsItem::update() {
SkyLabeler * skyLabeler = SkyLabeler::Instance();
skyLabeler->reset();
updateChildLabels(label_t::PLANET_LABEL);
- updateChildLabels(label_t::SATURN_MOON_LABEL);
updateChildLabels(label_t::JUPITER_MOON_LABEL);
+
+ updateChildLabels(label_t::HORIZON_LABEL);
+ updateChildLabels(label_t::EQUATOR_LABEL);
+ updateChildLabels(label_t::ECLIPTIC_LABEL);
+
+
+ updateChildLabels(label_t::SATURN_MOON_LABEL);
updateChildLabels(label_t::ASTEROID_LABEL);
if(rootNode()->cometsItem()->visible()) {
@@ -91,6 +122,8 @@ void LabelsItem::update() {
} else {
hideLabels(label_t::COMET_LABEL);
}
+
+ updateChildLabels(label_t::CONSTEL_NAME_LABEL);
}
void LabelsItem::hideLabels(label_t type) {
@@ -115,10 +148,26 @@ void LabelsItem::updateChildLabels(label_t type) {
node->markDirty(QSGNode::DirtyOpacity);
QSGNode *n = node->firstChild();
+ /*if( type == label_t::HORIZON_LABEL
+ || type == label_t::ECLIPTIC_LABEL || type == label_t::EQUATOR_LABEL) {
+ while( n != 0) {
+ GuideLabelNode *label = static_cast<GuideLabelNode *>(n);
+ if(label->visible()) {
+ //if(SkyLabeler::Instance()->markRegion(label->left,label->right,label->top,label->bot)) {
+ QString name = label->name();
+ if(SkyLabeler::Instance()->markText(label->labelPos, name)) {
+ label->update();
+ } else {
+ label->hide();
+ }
+ }
+ n = n->nextSibling();
+ }
+ } else {*/
while( n != 0) {
LabelNode *label = static_cast<LabelNode *>(n);
if(label->visible()) {
- if(SkyLabeler::Instance()->markText(label->labelPos, label->skyObject()->name())) {
+ if(SkyLabeler::Instance()->markText(label->labelPos, label->name())) {
label->update();
} else {
label->hide();
@@ -126,4 +175,5 @@ void LabelsItem::updateChildLabels(label_t type) {
}
n = n->nextSibling();
}
+
}
diff --git a/kstars/kstarslite/skyitems/labelsitem.h b/kstars/kstarslite/skyitems/labelsitem.h
index 74befea..57ba27b 100644
--- a/kstars/kstarslite/skyitems/labelsitem.h
+++ b/kstars/kstarslite/skyitems/labelsitem.h
@@ -25,6 +25,7 @@ typedef QSGOpacityNode LabelTypeNode;
class KSAsteroid;
class LineListIndex;
class LabelNode;
+class GuideLabelNode;
class SkyObject;
class RootNode;
@@ -45,9 +46,15 @@ public:
SATELLITE_LABEL,
RUDE_LABEL, ///Rude labels block other labels FIXME: find a better solution
NUM_LABEL_TYPES,
+ HORIZON_LABEL,
+ EQUATOR_LABEL,
+ ECLIPTIC_LABEL
};
- LabelNode *addLabel(SkyObject *skyObject, label_t);
+ LabelNode *addLabel(SkyObject *skyObject, label_t type);
+ LabelNode *addLabel(QString name, label_t type);
+
+ GuideLabelNode *addGuideLabel(QString name, label_t type);
void update();
void updateChildLabels(label_t type);
QSGOpacityNode *getLabelNode(label_t type) { return labelsLists.value(type); }
diff --git a/kstars/kstarslite/skyitems/lines/eclipticitem.cpp b/kstars/kstarslite/skyitems/lines/eclipticitem.cpp
new file mode 100644
index 0000000..eab335e
--- /dev/null
+++ b/kstars/kstarslite/skyitems/lines/eclipticitem.cpp
@@ -0,0 +1,95 @@
+/** *************************************************************************
+ EclipticItem.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 "eclipticitem.h"
+
+#include "../rootnode.h"
+#include "../labelsitem.h"
+#include "ecliptic.h"
+#include "../skynodes/labelnode.h"
+#include "../skynodes/trixelnode.h"
+
+EclipticItem::EclipticItem(Ecliptic *eclipticComp, RootNode *rootNode)
+ :SkyItem(LabelsItem::label_t::ECLIPTIC_LABEL, rootNode), m_eclipticComp(eclipticComp)
+{
+ LineListHash *trixels = eclipticComp->lineIndex();
+
+ QHash< Trixel, LineListList *>::const_iterator i = trixels->begin();
+ while( i != trixels->end()) {
+
+ TrixelNode *trixel = new TrixelNode(i.key(), i.value(), "EclColor", 1, Qt::SolidLine );
+ appendChildNode(trixel);
+ ++i;
+ }
+
+ KStarsData *data = KStarsData::Instance();
+
+ KSNumbers num( data->ut().djd() );
+ dms elat(0.0), elng(0.0);
+ QString label;
+ for( int ra = 0; ra < 23; ra += 6 ) {
+ elng.setH( ra );
+ SkyPoint *o = new SkyPoint;
+ o->setFromEcliptic( num.obliquity(), elng, elat );
+ o->setRA0( o->ra() );
+ o->setDec0( o->dec() );
+ o->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
+
+ label.setNum( o->ra().reduce().Degrees() );
+
+ LabelNode *compass = rootNode->labelsItem()->addLabel(label, labelType());
+ m_compassLabels.insert(o, compass);
+ }
+}
+
+void EclipticItem::update() {
+ if(m_eclipticComp->selected()) {
+ show();
+ QSGNode *n = firstChild();
+ while(n != 0) {
+ TrixelNode * trixel = static_cast<TrixelNode *>(n);
+ n = n->nextSibling();
+ trixel->update();
+ }
+
+ const Projector *proj = SkyMapLite::Instance()->projector();
+ KStarsData *data = KStarsData::Instance();
+ //SkyLabeler* skyLabeler = SkyLabeler::Instance();
+
+ QMap<SkyPoint *,LabelNode *>::iterator i = m_compassLabels.begin();
+
+ while ( i != m_compassLabels.end() ) {
+ SkyPoint *c = i.key();
+ c->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
+
+ LabelNode * compass = (*i);
+
+ bool visible;
+ QPointF cpoint = proj->toScreen( c, false, &visible );
+ if ( visible && proj->checkVisibility( c ) ) {
+ compass->setLabelPos(cpoint);
+ } else {
+ compass->hide();
+ }
+ i++;
+ }
+
+ } else {
+ hide();
+ rootNode()->labelsItem()->hideLabels(labelType());
+ }
+}
+
diff --git a/kstars/kstarslite/skyitems/lines/eclipticitem.h b/kstars/kstarslite/skyitems/lines/eclipticitem.h
new file mode 100644
index 0000000..0b8ff65
--- /dev/null
+++ b/kstars/kstarslite/skyitems/lines/eclipticitem.h
@@ -0,0 +1,34 @@
+/** *************************************************************************
+ asteroidsitem.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 ECLIPTICITEM_H_
+#define ECLIPTICITEM_H_
+
+#include "../skyitem.h"
+
+class Ecliptic;
+
+class EclipticItem : public SkyItem {
+public:
+
+ EclipticItem(Ecliptic *eclipticComp, RootNode *rootNode);
+
+ virtual void update();
+private:
+ Ecliptic *m_eclipticComp;
+ QMap<SkyPoint *, LabelNode *> m_compassLabels;
+};
+#endif
+
diff --git a/kstars/kstarslite/skyitems/lines/equatoritem.cpp b/kstars/kstarslite/skyitems/lines/equatoritem.cpp
new file mode 100644
index 0000000..d237630
--- /dev/null
+++ b/kstars/kstarslite/skyitems/lines/equatoritem.cpp
@@ -0,0 +1,92 @@
+/** *************************************************************************
+ EquatorItem.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 "Options.h"
+#include "projections/projector.h"
+#include <QSGNode>
+
+#include "equatoritem.h"
+
+#include "../skynodes/trixelnode.h"
+#include "../rootnode.h"
+#include "../labelsitem.h"
+
+#include "../skynodes/labelnode.h"
+
+EquatorItem::EquatorItem(Equator *equatorComp, RootNode *rootNode)
+ :SkyItem(LabelsItem::label_t::EQUATOR_LABEL, rootNode), m_equatorComp(equatorComp)
+{
+ LineListHash *trixels = equatorComp->lineIndex();
+
+ QHash< Trixel, LineListList *>::const_iterator i = trixels->begin();
+ while( i != trixels->end()) {
+
+ TrixelNode *trixel = new TrixelNode(i.key(), i.value(), "EqColor", 1, Qt::SolidLine );
+ appendChildNode(trixel);
+ ++i;
+ }
+
+
+ for( int ra = 0; ra < 23; ra += 2 ) {
+ SkyPoint *o = new SkyPoint( ra, 0.0 );
+
+ QString label;
+ label.setNum( o->ra().hour() );
+
+ LabelNode *compass = rootNode->labelsItem()->addLabel(label, labelType());
+ m_compassLabels.insert(o, compass);
+ }
+}
+
+void EquatorItem::update() {
+ if(m_equatorComp->selected()) {
+ show();
+ QSGNode *n = firstChild();
+ while(n != 0) {
+ TrixelNode * trixel = static_cast<TrixelNode *>(n);
+ n = n->nextSibling();
+ trixel->update();
+ }
+
+ const Projector *proj = SkyMapLite::Instance()->projector();
+ KStarsData *data = KStarsData::Instance();
+ //SkyLabeler* skyLabeler = SkyLabeler::Instance();
+
+ QMap<SkyPoint *,LabelNode *>::iterator i = m_compassLabels.begin();
+ KSNumbers num( data->ut().djd() );
+ while ( i != m_compassLabels.end() ) {
+ SkyPoint *c = i.key();
+ c->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
+
+ LabelNode * compass = (*i);
+
+ bool visible;
+ QPointF cpoint = proj->toScreen( c, false, &visible );
+ if ( visible && proj->checkVisibility( c ) ) {
+ compass->setLabelPos(cpoint);
+ } else {
+ compass->hide();
+ }
+ i++;
+ }
+
+ } else {
+ hide();
+ rootNode()->labelsItem()->hideLabels(labelType());
+ }
+}
+
+/**/
diff --git a/kstars/kstarslite/skyitems/lines/equatoritem.h b/kstars/kstarslite/skyitems/lines/equatoritem.h
new file mode 100644
index 0000000..1131a6e
--- /dev/null
+++ b/kstars/kstarslite/skyitems/lines/equatoritem.h
@@ -0,0 +1,36 @@
+/** *************************************************************************
+ asteroidsitem.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 EQUATORITEM_H_
+#define EQUATORITEM_H_
+
+#include "../skyitem.h"
+#include "equator.h"
+
+class KSAsteroid;
+class LineListIndex;
+
+class EquatorItem : public SkyItem {
+public:
+
+ EquatorItem(Equator *equatorComp, RootNode *rootNode);
+
+ virtual void update();
+private:
+ Equator *m_equatorComp;
+ QMap<SkyPoint *, LabelNode *> m_compassLabels;
+};
+#endif
+
diff --git a/kstars/kstarslite/skyitems/linesitem.cpp b/kstars/kstarslite/skyitems/lines/linesitem.cpp
index ef37878..e2134d9 100644
--- a/kstars/kstarslite/skyitems/linesitem.cpp
+++ b/kstars/kstarslite/skyitems/lines/linesitem.cpp
@@ -18,11 +18,11 @@
#include "projections/projector.h"
#include <QSGNode>
-#include "skynodes/trixelnode.h"
+#include "../skynodes/trixelnode.h"
#include "linesitem.h"
#include "linelist.h"
#include "linelistindex.h"
-#include "skynodes/nodes/linenode.h"
+#include "../skynodes/nodes/linenode.h"
LinesItem::LinesItem(RootNode *rootNode)
:SkyItem(LabelsItem::label_t::RUDE_LABEL, rootNode)
@@ -41,9 +41,9 @@ LinesItem::LinesItem(RootNode *rootNode)
Options::setShowCometNames(true);
Options::setShowAsteroidNames(true);
Options::setShowAsteroids(true);
+ Options::setShowCNames(true);
- Options::setAsteroidLabelDensity(10000);
- Options::setMagLimitAsteroid(-10);
+ Options::setAutoSelectGrid(true);
Options::setHideCBounds(true);
Options::setHideCLines(false);
@@ -63,9 +63,9 @@ void LinesItem::addLinesComponent(LineListIndex *linesComp, QString color, int w
QHash< Trixel, LineListList *>::const_iterator i = trixels->begin();
while( i != trixels->end()) {
- TrixelNode *trixel = new TrixelNode(i.key(), i.value());
+ TrixelNode *trixel = new TrixelNode(i.key(), i.value(), color, width, style);
node->appendChildNode(trixel);
- trixel->setStyle(color, width, style);
+ //trixel->setStyle(color, width, style);
++i;
}
}
diff --git a/kstars/kstarslite/skyitems/linesitem.h b/kstars/kstarslite/skyitems/lines/linesitem.h
index c7b6286..3099b94 100644
--- a/kstars/kstarslite/skyitems/linesitem.h
+++ b/kstars/kstarslite/skyitems/lines/linesitem.h
@@ -16,7 +16,7 @@
#ifndef LINESITEM_H_
#define LINESITEM_H_
-#include "skyitem.h"
+#include "../skyitem.h"
class KSAsteroid;
class LineListIndex;
diff --git a/kstars/kstarslite/skyitems/rootnode.cpp b/kstars/kstarslite/skyitems/rootnode.cpp
index b5436e5..09c47fe 100644
--- a/kstars/kstarslite/skyitems/rootnode.cpp
+++ b/kstars/kstarslite/skyitems/rootnode.cpp
@@ -22,8 +22,13 @@
#include "kstarslite/skyitems/asteroidsitem.h"
#include "kstarslite/skyitems/cometsitem.h"
#include "kstarslite/skyitems/horizonitem.h"
-#include "kstarslite/skyitems/linesitem.h"
+#include "kstarslite/skyitems/lines/linesitem.h"
#include "kstarslite/skyitems/labelsitem.h"
+#include "kstarslite/skyitems/constellationnamesitem.h"
+
+//Lines
+#include "kstarslite/skyitems/lines/equatoritem.h"
+#include "kstarslite/skyitems/lines/eclipticitem.h"
RootNode::RootNode()
:m_skyMapLite(SkyMapLite::Instance()),
@@ -41,9 +46,11 @@ RootNode::RootNode()
m_linesItem = new LinesItem(this);
m_linesItem->addLinesComponent( m_skyComposite->equatorialCoordGrid(), "EquatorialGridColor", 1, Qt::DotLine );
- m_linesItem->addLinesComponent( m_skyComposite->horizontalCoordGrid(), "HorizontalGridColor", 1, Qt::DotLine );
+ m_linesItem->addLinesComponent( m_skyComposite->horizontalCoordGrid(), "HorizontalGridColor", 2, Qt::DotLine );
- m_linesItem->addLinesComponent( m_skyComposite->equator(), "EqColor", 1, Qt::SolidLine );
+ //m_linesItem->addLinesComponent( m_skyComposite->equator(), "EqColor", 1, Qt::SolidLine );
+ m_equator = new EquatorItem(m_skyComposite->equator(),this);
+ m_ecliptic = new EclipticItem(m_skyComposite->ecliptic(),this);
m_linesItem->addLinesComponent( m_skyComposite->ecliptic(), "EclColor", 1, Qt::SolidLine );
m_linesItem->addLinesComponent( m_skyComposite->constellationBoundary(), "CBoundColor", 1, Qt::SolidLine );
@@ -53,6 +60,8 @@ RootNode::RootNode()
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_horizonItem = new HorizonItem(m_skyComposite->horizon(), this);
setIsRectangular(false);
@@ -142,8 +151,13 @@ void RootNode::update() {
if(m_cometsItem) m_cometsItem->hide();
}
+ m_constelNamesItem->update();
+
m_horizonItem->update();
+ m_equator->update();
+ m_ecliptic->update();
+
m_linesItem->update();
m_labelsItem->update();
}
diff --git a/kstars/kstarslite/skyitems/rootnode.h b/kstars/kstarslite/skyitems/rootnode.h
index 62ee48e..48d5d49 100644
--- a/kstars/kstarslite/skyitems/rootnode.h
+++ b/kstars/kstarslite/skyitems/rootnode.h
@@ -26,10 +26,14 @@ class PlanetsItem;
class AsteroidsItem;
class CometsItem;
-class HorizonItem;
-class LinesItem;
+class ConstellationNamesItem;
class LabelsItem;
+class LinesItem;
+class HorizonItem;
+class EquatorItem;
+class EclipticItem;
+
class SkyMapComposite;
class SolarSystemComposite;
@@ -82,9 +86,13 @@ private:
AsteroidsItem *m_asteroidsItem;
CometsItem *m_cometsItem;
+ ConstellationNamesItem *m_constelNamesItem;
+ LabelsItem *m_labelsItem;
+
HorizonItem *m_horizonItem;
LinesItem *m_linesItem;
- LabelsItem *m_labelsItem;
+ EquatorItem *m_equator;
+ EclipticItem *m_ecliptic;
SkyMapComposite *m_skyComposite;
SolarSystemComposite *m_solarSystem;
diff --git a/kstars/kstarslite/skyitems/skynodes/guidelabelnode.cpp b/kstars/kstarslite/skyitems/skynodes/guidelabelnode.cpp
index da4f86d..69a9227 100644
--- a/kstars/kstarslite/skyitems/skynodes/guidelabelnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/guidelabelnode.cpp
@@ -21,19 +21,24 @@
#include "skymaplite.h"
#include "guidelabelnode.h"
-GuideLabelNode::GuideLabelNode(SkyObject * skyObject, LabelsItem::label_t type)
- :SkyNode(skyObject), m_textTexture(new QSGSimpleTextureNode)
+GuideLabelNode::GuideLabelNode(QString name, LabelsItem::label_t type)
+ :m_textTexture(new QSGSimpleTextureNode), m_name(name)
{
+ appendChildNode(&debugRect);
+ debugRect.setColor(QColor("green"));
QColor color;
switch(type) {
case LabelsItem::label_t::CONSTEL_NAME_LABEL:
color = KStarsData::Instance()->colorScheme()->colorNamed( "CNameColor" );
break;
+ case LabelsItem::label_t::HORIZON_LABEL:
+ color = KStarsData::Instance()->colorScheme()->colorNamed( "CompassColor" );
+ break;
default:
color = KStarsData::Instance()->colorScheme()->colorNamed( "UserLabelColor" );
}
- m_textTexture->setTexture(SkyMapLite::Instance()->textToTexture(skyObject->name(), color));
+ m_textTexture->setTexture(SkyMapLite::Instance()->textToTexture(name, color));
m_opacity->appendChildNode(m_textTexture);
m_textSize = m_textTexture->texture()->textureSize();
@@ -43,68 +48,65 @@ GuideLabelNode::GuideLabelNode(SkyObject * skyObject, LabelsItem::label_t type)
void GuideLabelNode::changePos(QPointF pos) {
- /* QFontMetricsF fontMetrics = SkyLabeler::Instance()->fontMetrics();
- // Create bounding rectangle by rotating the (height x width) rectangle
- qreal h = fontMetrics.height();
- qreal w = fontMetrics.width( text );
-
- float angle = 0.0;
- qreal s = 0;//sin( angle * dms::PI / 180.0 );
- qreal c = 1;//cos( angle * dms::PI / 180.0 );
-
- qreal w2 = w / 2.0;
-
- qreal top, bot, left, right;
-
- // These numbers really do depend on the sign of the angle like this
- if ( angle >= 0.0 ) {
- top = o.y() - s * w2;
- bot = o.y() + c * h + s * w2;
- left = o.x() - c * w2 - s * h;
- right = o.x() + c * w2;
- }
- else {
- top = o.y() + s * w2;
- bot = o.y() + c * h - s * w2;
- left = o.x() - c * w2;
- right = o.x() + c * w2 - s * h;
- }
-
- // return false if label would overlap existing label
- if ( ! markRegion( left, right, top, bot) )
- return false;
-
- // for debugging the bounding rectangle:
- //psky.drawLine( QPointF( left, top ), QPointF( right, top ) );
- //psky.drawLine( QPointF( right, top ), QPointF( right, bot ) );
- //psky.drawLine( QPointF( right, bot ), QPointF( left, bot ) );
- //psky.drawLine( QPointF( left, bot ), QPointF( left, top ) );
-
// otherwise draw the label and return true
- m_p.save();
- m_p.translate( o );
-
- m_p.rotate( angle ); //rotate the coordinate system
- m_p.drawText( QPointF( -w2, h ), text );
- m_p.restore(); //reset coordinate system
+ //m_p.rotate( angle ); //rotate the coordinate system
+ //m_p.drawText( QPointF( -w2, h ), text );
+ //m_p.restore(); //reset coordinate system
- return true;
+ //return true;*/
//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());
+ //m.translate(m_translatePos.x(), m_translatePos.y());
+ m.rotate(m_angle, 0, 0, 1);
+
setMatrix(m);
- markDirty(QSGNode::DirtyMatrix);*/
+ markDirty(QSGNode::DirtyMatrix);
}
-void GuideLabelNode::setLabelPos(QPointF pos) {
+void GuideLabelNode::setLabelPos(QPointF pos, float angle) {
show();
//We need to subtract the height of texture from final y to follow the way QPainter draws the text
- labelPos = QPointF(pos.x() + m_skyObject->labelOffset(), pos.y() + m_skyObject->labelOffset() - m_textSize.height());
+ m_angle = angle;
+ m_translatePos = pos;
+
+ //QFontMetricsF fontMetrics = SkyLabeler::Instance()->fontMetrics();
+ // Create bounding rectangle by rotating the (height x width) rectangle
+ qreal h = m_textSize.height();//fontMetrics.height();
+ qreal w = m_textSize.width();//fontMetrics.width( m_name );
+
+ qreal s = sin( angle * dms::PI / 180.0 );
+ qreal c = cos( angle * dms::PI / 180.0 );
+
+ qreal w2 = w / 2.0;
+
+ // These numbers really do depend on the sign of the angle like this
+ if ( angle >= 0.0 ) {
+ top = pos.y() - s * w2;
+ bot = pos.y() + c * h + s * w2;
+ left = pos.x() - c * w2 - s * h;
+ right = pos.x() + c * w2;
+ }
+ else {
+ top = pos.y() + s * w2;
+ bot = pos.y() + c * h - s * w2;
+ left = pos.x() - c * w2;
+ right = pos.x() + c * w2 - s * h;
+ }
+
+ //We need to translate matrix with the value of pos point
+
+ labelPos = QPointF(pos.x()-w2, pos.y() + h);
+
+ /*debugRect.setRect(QRectF(QPointF(left,top),QPointF(right,bot)));
+ debugRect.markDirty(QSGNode::DirtyGeometry);*/
+
+ // return false if label would overlap existing label
+// if ( ! markRegion( left, right, top, bot) )
}
void GuideLabelNode::update() {
diff --git a/kstars/kstarslite/skyitems/skynodes/guidelabelnode.h b/kstars/kstarslite/skyitems/skynodes/guidelabelnode.h
index 94ef9ad..f747e99 100644
--- a/kstars/kstarslite/skyitems/skynodes/guidelabelnode.h
+++ b/kstars/kstarslite/skyitems/skynodes/guidelabelnode.h
@@ -13,11 +13,12 @@
* (at your option) any later version. *
* *
***************************************************************************/
-#ifndef LABELNODE_H_
-#define LABELNODE_H_
+#ifndef GUIDELABELNODE_H_
+#define GUIDELABELNODE_H_
#include "skynode.h"
#include "../labelsitem.h"
+#include <QSGSimpleRectNode>
class PlanetItemNode;
class SkyMapLite;
@@ -45,27 +46,39 @@ public:
* @param spType spectral class of PointNode
* @param size initial size of PointNode
*/
- GuideLabelNode(SkyObject * skyObject, LabelsItem::label_t type);
+ GuideLabelNode(QString name, LabelsItem::label_t type);
/**
* @short changePos changes the position m_point
* @param pos new position
*/
virtual void changePos(QPointF pos) override;
-
/**
* @short setLabelPos sets the position of label with the given offset from SkyObject's position and
* makes the label visible if it was hidden
* @param pos position of label
*/
- void setLabelPos(QPointF pos);
+ void setLabelPos(QPointF pos, float angle);
void update();
+
+ inline const QString name() const { return m_name; }
+
QPointF labelPos;
+ qreal left;
+ qreal right;
+ qreal top;
+ qreal bot;
+
private:
QSGSimpleTextureNode *m_textTexture;
QSize m_textSize;
+ float m_angle;
+ QSGSimpleRectNode debugRect;
+ const QString m_name;
+
+ QPointF m_translatePos;
};
#endif
diff --git a/kstars/kstarslite/skyitems/skynodes/horizonnode.cpp b/kstars/kstarslite/skyitems/skynodes/horizonnode.cpp
index 94b0938..20ee3da 100644
--- a/kstars/kstarslite/skyitems/skynodes/horizonnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/horizonnode.cpp
@@ -4,7 +4,7 @@
#include "ksutils.h"
HorizonNode::HorizonNode(QList<SkyPoint*>& pointList)
- :SkyNode(),m_pointList(pointList), m_polygonNode(new PolyNode)
+ :m_pointList(pointList), m_polygonNode(new PolyNode)
{
appendChildNode(m_polygonNode);
}
diff --git a/kstars/kstarslite/skyitems/skynodes/labelnode.cpp b/kstars/kstarslite/skyitems/skynodes/labelnode.cpp
index 2a799d4..6bc1614 100644
--- a/kstars/kstarslite/skyitems/skynodes/labelnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/labelnode.cpp
@@ -22,8 +22,18 @@
#include "labelnode.h"
LabelNode::LabelNode(SkyObject * skyObject, LabelsItem::label_t type)
- :SkyNode(skyObject), m_textTexture(new QSGSimpleTextureNode)
+ :SkyNode(skyObject), m_name(skyObject->name()), m_textTexture(new QSGSimpleTextureNode)
{
+ createTexture(type);
+}
+
+LabelNode::LabelNode(QString name, LabelsItem::label_t type)
+ :m_name(name), m_textTexture(new QSGSimpleTextureNode)
+{
+ createTexture(type);
+}
+
+void LabelNode::createTexture(LabelsItem::label_t type) {
QColor color;
switch(type) {
case LabelsItem::label_t::PLANET_LABEL:
@@ -36,11 +46,14 @@ LabelNode::LabelNode(SkyObject * skyObject, LabelsItem::label_t type)
case LabelsItem::label_t::ASTEROID_LABEL:
color = QColor("gray");
break;
+ case LabelsItem::label_t::CONSTEL_NAME_LABEL:
+ color = KStarsData::Instance()->colorScheme()->colorNamed( "CNameColor" );
+ break;
default:
color = KStarsData::Instance()->colorScheme()->colorNamed( "UserLabelColor" );
}
- m_textTexture->setTexture(SkyMapLite::Instance()->textToTexture(skyObject->name(), color));
+ m_textTexture->setTexture(SkyMapLite::Instance()->textToTexture(m_name, color));
m_opacity->appendChildNode(m_textTexture);
m_textSize = m_textTexture->texture()->textureSize();
@@ -63,7 +76,8 @@ void LabelNode::changePos(QPointF pos) {
void LabelNode::setLabelPos(QPointF pos) {
show();
//We need to subtract the height of texture from final y to follow the way QPainter draws the text
- labelPos = QPointF(pos.x() + m_skyObject->labelOffset(), pos.y() + m_skyObject->labelOffset() - m_textSize.height());
+ if(m_skyObject) labelPos = QPointF(pos.x() + m_skyObject->labelOffset(), pos.y() + m_skyObject->labelOffset() - m_textSize.height());
+ else labelPos = QPointF(pos.x()-(m_textSize.width()/2.0), pos.y());//QPointF(pos.x()-(m_textSize.width()/2.0), pos.y() + m_textSize.height());
}
void LabelNode::update() {
diff --git a/kstars/kstarslite/skyitems/skynodes/labelnode.h b/kstars/kstarslite/skyitems/skynodes/labelnode.h
index 89c5233..d126c65 100644
--- a/kstars/kstarslite/skyitems/skynodes/labelnode.h
+++ b/kstars/kstarslite/skyitems/skynodes/labelnode.h
@@ -46,6 +46,7 @@ public:
* @param size initial size of PointNode
*/
LabelNode(SkyObject * skyObject, LabelsItem::label_t type);
+ LabelNode(QString name, LabelsItem::label_t type);
/**
* @short changePos changes the position m_point
@@ -60,12 +61,17 @@ public:
*/
void setLabelPos(QPointF pos);
+ inline QString name() { return m_name; }
+
+ void createTexture(LabelsItem::label_t type);
+
void update();
QPointF labelPos;
private:
QSGSimpleTextureNode *m_textTexture;
QSize m_textSize;
+ QString m_name;
};
#endif
diff --git a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp
index e80933f..00ac120 100644
--- a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp
@@ -16,26 +16,42 @@
#include "linenode.h"
#include <QSGFlatColorMaterial>
+#include <QSGVertexColorMaterial>
#include "skymaplite.h"
#include "projections/projector.h"
#include <QLinkedList>
-LineNode::LineNode(LineList *lineList)
- :m_lineList(lineList), m_material(new QSGFlatColorMaterial),
- m_geometry(new QSGGeometry (QSGGeometry::defaultAttributes_Point2D(),0)),
- m_geometryNode(new QSGGeometryNode)
+LineNode::LineNode(LineList *lineList, QColor color, int width, Qt::PenStyle drawStyle)
+ :m_lineList(lineList), m_geometryNode(new QSGGeometryNode), m_color(color), m_drawStyle(drawStyle)
+
{
+ if(m_drawStyle == Qt::DotLine) {
+ m_material = new QSGVertexColorMaterial;
+ m_geometry = new QSGGeometry(QSGGeometry::defaultAttributes_ColoredPoint2D(),0);
+ m_geometryNode->setMaterial(m_material);
+ } else {
+ m_material = new QSGFlatColorMaterial;
+ static_cast<QSGFlatColorMaterial *>(m_material)->setColor(color);
+ markDirty(QSGNode::DirtyMaterial);
+
+ m_geometry = new QSGGeometry (QSGGeometry::defaultAttributes_Point2D(),0);
+ m_geometryNode->setOpaqueMaterial(m_material);
+ }
+
+ setWidth(width);
+
appendChildNode(m_geometryNode);
m_geometryNode->setGeometry(m_geometry);
- setFlag(QSGNode::OwnsGeometry);
- m_geometryNode->setOpaqueMaterial(m_material);
+ setFlag(QSGNode::OwnsGeometry);
setFlag(QSGNode::OwnsMaterial);
}
void LineNode::setColor(QColor color) {
- m_material->setColor(color);
+ //m_material->setColor(color);
+ m_color = color;
+
m_geometryNode->markDirty(QSGNode::DirtyMaterial);
}
@@ -93,8 +109,8 @@ void LineNode::updateGeometry() {
if ( !doSkip ) {
if ( (isVisible) ) {
- newPoints.append(oLast);
- newPoints.append(oThis);
+ newPoints.append(oLast);
+ newPoints.append(oThis);
//if ( label )
// label->updateLabelCandidates( oThis.x(), oThis.y(), list, j );
}
@@ -106,15 +122,30 @@ void LineNode::updateGeometry() {
int size = newPoints.size();
m_geometry->allocate(size);
- QSGGeometry::Point2D * vertex = m_geometry->vertexDataAsPoint2D();
+ if(m_drawStyle == Qt::DotLine) {
+
+ QSGGeometry::ColoredPoint2D *vertex = m_geometry->vertexDataAsColoredPoint2D();
+ QLinkedList<QPointF>::const_iterator i = newPoints.constBegin();
+ int c = 0;
+ int dot = 0;
+ while ( i != newPoints.constEnd()) {
+ //vertex[c].set((*i).x(), (*i).y(), m_color.red(), m_color.blue(), m_color.green(), 255);
+ vertex[c].set((*i).x(), (*i).y(), m_color.red(), m_color.green(), m_color.blue(), 0);
+ c++;
+ i++;
+ }
+ } else {
- QLinkedList<QPointF>::const_iterator i = newPoints.constBegin();
- int c = 0;
- while ( i != newPoints.constEnd()) {
- vertex[c].x = (*i).x();
- vertex[c].y = (*i).y();
- c++;
- i++;
+ QSGGeometry::Point2D * vertex = m_geometry->vertexDataAsPoint2D();
+
+ QLinkedList<QPointF>::const_iterator i = newPoints.constBegin();
+ int c = 0;
+ while ( i != newPoints.constEnd()) {
+ vertex[c].x = (*i).x();
+ vertex[c].y = (*i).y();
+ c++;
+ i++;
+ }
}
m_geometryNode->markDirty(QSGNode::DirtyGeometry);
diff --git a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.h b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.h
index 727ffe1..a0375f0 100644
--- a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.h
+++ b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.h
@@ -17,6 +17,7 @@
#define LINENODE_H_
#include <QSGGeometryNode>
#include "linelist.h"
+#include <QColor>
class PlanetItemNode;
class SkyMapLite;
@@ -40,7 +41,7 @@ public:
* @param parentNode pointer to the top parent node, which holds texture cache
* @param size initial size of LineNode
*/
- LineNode(LineList *lineList);
+ LineNode(LineList *lineList, QColor color, int width, Qt::PenStyle drawStyle);
/**
* @short setSize update size of LineNode with the given parameter
* @param size new size of LineNode
@@ -61,8 +62,9 @@ private:
QSGGeometryNode *m_geometryNode;
LineList *m_lineList;
QSGGeometry *m_geometry;
- QSGFlatColorMaterial *m_material;
+ QSGMaterial *m_material;
Qt::PenStyle m_drawStyle;
+ QColor m_color;
};
#endif
diff --git a/kstars/kstarslite/skyitems/skynodes/skynode.cpp b/kstars/kstarslite/skyitems/skynodes/skynode.cpp
index c8db9c6..a4474ad 100644
--- a/kstars/kstarslite/skyitems/skynodes/skynode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/skynode.cpp
@@ -26,7 +26,7 @@ SkyNode::SkyNode(SkyObject * skyObject)
SkyNode::SkyNode()
:m_skyObject(nullptr), m_opacity(new QSGOpacityNode)
{
-
+ appendChildNode(m_opacity);
}
void SkyNode::update(bool drawLabel) {
diff --git a/kstars/kstarslite/skyitems/skynodes/trixelnode.cpp b/kstars/kstarslite/skyitems/skynodes/trixelnode.cpp
index d79b811..88c788a 100644
--- a/kstars/kstarslite/skyitems/skynodes/trixelnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/trixelnode.cpp
@@ -25,12 +25,13 @@
#include "skymesh.h"
#include <QSGOpacityNode>
-TrixelNode::TrixelNode(Trixel trixelId, LineListList *linesList)
+TrixelNode::TrixelNode(Trixel trixelId, LineListList *linesList, QString color, int width, Qt::PenStyle style)
:SkyNode(), trixel(trixelId), m_linesLists(linesList), m_opacity(new QSGOpacityNode)
{
appendChildNode(m_opacity);
+ QColor c = KStarsData::Instance()->colorScheme()->colorNamed(color);
for(int i = 0; i < m_linesLists->size(); ++i) {
- LineNode * ln = new LineNode(m_linesLists->at(i));
+ LineNode * ln = new LineNode(m_linesLists->at(i), c, width, style);
m_opacity->appendChildNode(ln);
}
}
diff --git a/kstars/kstarslite/skyitems/skynodes/trixelnode.h b/kstars/kstarslite/skyitems/skynodes/trixelnode.h
index 73fe910..9c4e151 100644
--- a/kstars/kstarslite/skyitems/skynodes/trixelnode.h
+++ b/kstars/kstarslite/skyitems/skynodes/trixelnode.h
@@ -45,7 +45,7 @@ public:
* @param spType spectral class of PointNode
* @param size initial size of PointNode
*/
- TrixelNode(Trixel trixel, LineListList *lineIndex);
+ TrixelNode(Trixel trixel, LineListList *lineIndex, QString color, int width, Qt::PenStyle style);
void setStyle(QString color, int width, Qt::PenStyle style);
diff --git a/kstars/main.cpp b/kstars/main.cpp
index 9cf400a..7650cd3 100644
--- a/kstars/main.cpp
+++ b/kstars/main.cpp
@@ -225,7 +225,6 @@ int main(int argc, char *argv[])
}
#else
-#ifdef ANDROID
Options::setAngularRulerColor("#ffffff");
Options::setArtificialHorizonColor("#c82828");
Options::setBoxBGColor("#223344");
@@ -266,16 +265,8 @@ int main(int argc, char *argv[])
Options::setUserLabelColor("#ffffff");
Options::setVisibleSatColor("#00ff00");
- //[DownloadDialog Settings]
- //Options::setHeight 768("440");
- //Options::setWidth 1366("700");
-
- //[GUI]
- Options::setPositionFocusBox(QPoint(1155,0));
- Options::setPositionGeoBox(QPoint(0,586));
- Options::setRunStartupWizard("false");
- Options::setWindowHeight(701);
- Options::setWindowWidth(1366);
+ Options::setShowEquatorialGrid(true);
+ Options::setShowHorizontalGrid(true);
//[Location]
Options::setCityName("Saarbr├╝cken");
@@ -296,19 +287,7 @@ int main(int argc, char *argv[])
Options::setShowSatellites("true");
//[View]
- Options::setAutoSelectGrid("false");
//Options::setFOVNames("
- Options::setFocusDec(67.135635748539812);
- Options::setFocusRA(9.0349369959032693);
- Options::setRunClock(true);
- Options::setShowCLines(false);
- Options::setShowCNames(false);
- Options::setShowEquatorialGrid(false);
- Options::setShowGround(false);
- Options::setShowPlanetImages(true);
- Options::setShowSupernovae(true);
- Options::setStarDensity(2);
- Options::setZoomFactor(250);
//[WISettings]
//Options::setScopeListWidget("4294967295");
@@ -316,8 +295,6 @@ int main(int argc, char *argv[])
//[Xplanet]
Options::setXplanetBackgroundColorValue("#000000");
Options::setXplanetColor("#ff0000");
-#endif
- Options::setShowGround(false);
#endif
diff --git a/kstars/skycomponents/skylabeler.cpp b/kstars/skycomponents/skylabeler.cpp
index f75a693..5b75952 100644
--- a/kstars/skycomponents/skylabeler.cpp
+++ b/kstars/skycomponents/skylabeler.cpp
@@ -215,7 +215,6 @@ void SkyLabeler::reset( SkyMap* skyMap )
// ----- Set up Projector ---
m_proj = skyMap->projector();
-#ifdef KSTARS_LITE
// ----- Set up Painter -----
if( m_p.isActive() )
m_p.end();
@@ -231,7 +230,6 @@ void SkyLabeler::reset( SkyMap* skyMap )
m_skyFont = m_p.font();
m_fontMetrics = QFontMetrics( m_skyFont );
m_minDeltaX = (int) m_fontMetrics.width("MMMMM");
-#endif
// ----- Set up Zoom Dependent Offset -----
m_offset = SkyLabeler::ZoomOffset();
@@ -284,15 +282,13 @@ void SkyLabeler::reset()
// ----- Set up Projector ---
m_proj = skyMap->projector();
- // ----- Set up Painter -----
-
m_stdFont = QFont( skyMap->skyFont() );
setZoomFont();
m_skyFont = skyMap->skyFont() ;
m_fontMetrics = QFontMetrics( m_skyFont );
m_minDeltaX = (int) m_fontMetrics.width("MMMMM");
// ----- Set up Zoom Dependent Offset -----
- m_offset = SkyLabeler::ZoomOffset();
+ m_offset = ZoomOffset();
// ----- Prepare Virtual Screen -----
m_yScale = (m_fontMetrics.height() + 1.0);
diff --git a/kstars/skycomponents/skymapcomposite.h b/kstars/skycomponents/skymapcomposite.h
index af76821..748a1e6 100644
--- a/kstars/skycomponents/skymapcomposite.h
+++ b/kstars/skycomponents/skymapcomposite.h
@@ -186,6 +186,8 @@ public:
inline SolarSystemComposite* solarSystemComposite() { return m_SolarSystem; }
+ inline ConstellationNamesComponent* constellationNamesComponent() { return m_CNames; }
+
//Accessors for StarComponent
SkyObject* findStarByGenetiveName( const QString name );