summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Fedoskin <afedoskin3@gmail.com>2016-06-04 21:21:28 (GMT)
committerArtem Fedoskin <afedoskin3@gmail.com>2016-06-04 21:21:28 (GMT)
commit0a80604d28ac564c35b71efe20ef3d320a6609f6 (patch)
treede9eeb581563ac95bdd851cc7f5879d7ebf77abc
parent85314647ad62620e14b3e76e2e902bdc32bc46de (diff)
Fixed incorrect displaying of lines.
-rw-r--r--kstars/CMakeLists.txt2
-rw-r--r--kstars/kstarslite/skyitems/horizonitem.cpp3
-rw-r--r--kstars/kstarslite/skyitems/linesitem.cpp3
-rw-r--r--kstars/kstarslite/skyitems/skynodes/material/dashedshader.cpp0
-rw-r--r--kstars/kstarslite/skyitems/skynodes/material/dashedshader.h194
-rw-r--r--kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp52
-rw-r--r--kstars/kstarslite/skyitems/skynodes/nodes/linenode.h7
-rw-r--r--kstars/kstarslite/skyitems/skynodes/rootnodes/linesrootnode.cpp29
-rw-r--r--kstars/kstarslite/skyitems/skynodes/rootnodes/linesrootnode.h4
-rw-r--r--kstars/kstarslite/skyitems/skynodes/rootnodes/rootnode.cpp48
-rw-r--r--kstars/kstarslite/skyitems/skynodes/rootnodes/rootnode.h1
-rw-r--r--kstars/kstarslite/skyitems/skynodes/trixelnode.cpp11
-rw-r--r--kstars/skycomponents/horizontalcoordinategrid.cpp2
-rw-r--r--kstars/skycomponents/linelistindex.cpp5
-rw-r--r--kstars/skycomponents/linelistindex.h4
-rw-r--r--kstars/skymaplite.cpp35
16 files changed, 348 insertions, 52 deletions
diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt
index d665ebc..b8778ff 100644
--- a/kstars/CMakeLists.txt
+++ b/kstars/CMakeLists.txt
@@ -565,6 +565,8 @@ if(BUILD_KSTARS_LITE)
kstarslite/skyitems/skynodes/nodes/pointnode.cpp
kstarslite/skyitems/skynodes/nodes/polynode.cpp
kstarslite/skyitems/skynodes/nodes/linenode.cpp
+ #Material
+ kstarslite/skyitems/skynodes/material/dashedshader.cpp
#libtess
libtess/dict.c
libtess/geom.c
diff --git a/kstars/kstarslite/skyitems/horizonitem.cpp b/kstars/kstarslite/skyitems/horizonitem.cpp
index afcd794..be7a49a 100644
--- a/kstars/kstarslite/skyitems/horizonitem.cpp
+++ b/kstars/kstarslite/skyitems/horizonitem.cpp
@@ -26,8 +26,7 @@
HorizonItem::HorizonItem(QQuickItem* parent)
:SkyItem(parent), m_horizonComp(0)
{
- Options::setRunClock(false);
- Options::setShowGround(false);
+
}
QSGNode* HorizonItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) {
diff --git a/kstars/kstarslite/skyitems/linesitem.cpp b/kstars/kstarslite/skyitems/linesitem.cpp
index b9754b3..25c55b1 100644
--- a/kstars/kstarslite/skyitems/linesitem.cpp
+++ b/kstars/kstarslite/skyitems/linesitem.cpp
@@ -37,6 +37,9 @@ LinesItem::LinesItem(QQuickItem* parent)
Options::setShowEquatorialGrid(true);
Options::setShowHorizontalGrid(true);
Options::setHideGrids(false);
+
+ Options::setRunClock(false);
+ Options::setShowGround(true);
}
void LinesItem::addLinesComponent(LineListIndex *linesComp, QString color, int width, Qt::PenStyle style) {
diff --git a/kstars/kstarslite/skyitems/skynodes/material/dashedshader.cpp b/kstars/kstarslite/skyitems/skynodes/material/dashedshader.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/kstars/kstarslite/skyitems/skynodes/material/dashedshader.cpp
diff --git a/kstars/kstarslite/skyitems/skynodes/material/dashedshader.h b/kstars/kstarslite/skyitems/skynodes/material/dashedshader.h
new file mode 100644
index 0000000..e8d885d
--- /dev/null
+++ b/kstars/kstarslite/skyitems/skynodes/material/dashedshader.h
@@ -0,0 +1,194 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the demonstration applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qguiapplication.h>
+
+#include <qsgmaterial.h>
+#include <qsgnode.h>
+
+#include <qquickitem.h>
+#include <qquickview.h>
+
+#include <qsgsimplerectnode.h>
+
+#include <qsgsimplematerial.h>
+
+//! [1]
+struct State
+{
+ QColor color;
+
+ int compare(const State *other) const {
+ uint rgb = color.rgba();
+ uint otherRgb = other->color.rgba();
+
+ if (rgb == otherRgb) {
+ return 0;
+ } else if (rgb < otherRgb) {
+ return -1;
+ } else {
+ return 1;
+ }
+ }
+};
+//! [1]
+
+//! [2]
+class Shader : public QSGSimpleMaterialShader<State>
+{
+ QSG_DECLARE_SIMPLE_COMPARABLE_SHADER(Shader, State)
+//! [2] //! [3]
+public:
+
+ const char *vertexShader() const {
+ return
+ "attribute highp vec4 aVertex; \n"
+ "attribute highp vec2 aTexCoord; \n"
+ "uniform highp mat4 qt_Matrix; \n"
+ "uniform highp mat4 mvp_matrix; \n"
+ "varying highp vec2 texCoord; \n"
+ "void main() { \n"
+ " gl_Position = qt_Matrix * aVertex; \n"
+ " texCoord = aTexCoord; \n"
+ "}";
+ }
+
+ const char *fragmentShader() const {
+ return
+ "uniform lowp float qt_Opacity; \n"
+ "uniform lowp vec4 color; \n"
+ "varying highp vec2 texCoord; \n"
+ "void main () \n"
+ "{ \n"
+ //"if (cos(0.1*abs(distance(vec2(100.0,100.0).xy, texCoord.xy))) + 0.5 > 0.0) { \n"
+ "if(texCoord.x < 0.1 || texCoord.x > 0.2 && texCoord.x < 0.3) { \n"
+ " gl_FragColor = vec4(0.0,0.0,0.0,0.0) * qt_Opacity; \n"
+ " } else {\n"
+ " gl_FragColor = texCoord.y * texCoord.x * color * qt_Opacity; \n"
+ " }\n"
+ "}";
+ }
+//! [3] //! [4]
+ QList<QByteArray> attributes() const
+ {
+ return QList<QByteArray>() << "aVertex" << "aTexCoord";
+ }
+//! [4] //! [5]
+ void updateState(const State *state, const State *)
+ {
+ program()->setUniformValue(id_color, state->color);
+ }
+//! [5] //! [6]
+ void resolveUniforms()
+ {
+ id_color = program()->uniformLocation("color");
+ }
+
+private:
+ int id_color;
+//! [6]
+};
+
+
+//! [7]
+class ColorNode : public QSGGeometryNode
+{
+public:
+ ColorNode()
+ : m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
+ {
+ setGeometry(&m_geometry);
+
+ QSGSimpleMaterial<State> *material = Shader::createMaterial();
+ material->setFlag(QSGMaterial::Blending);
+ setMaterial(material);
+ setFlag(OwnsMaterial);
+ }
+
+ QSGGeometry m_geometry;
+};
+//! [7]
+
+
+//! [8]
+class Item : public QQuickItem
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+
+public:
+
+ Item()
+ {
+ setFlag(ItemHasContents, true);
+ }
+
+ void setColor(const QColor &color) {
+ if (m_color != color) {
+ m_color = color;
+ emit colorChanged();
+ update();
+ }
+ }
+ QColor color() const {
+ return m_color;
+ }
+
+signals:
+ void colorChanged();
+
+private:
+ QColor m_color;
+
+//! [8] //! [9]
+public:
+ QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *)
+ {
+ ColorNode *n = static_cast<ColorNode *>(node);
+ if (!node)
+ n = new ColorNode();
+
+ QSGGeometry::updateTexturedRectGeometry(n->geometry(), boundingRect(), QRectF(0, 0, 1, 1));
+ static_cast<QSGSimpleMaterial<State>*>(n->material())->state()->color = m_color;
+
+ n->markDirty(QSGNode::DirtyGeometry | QSGNode::DirtyMaterial);
+
+ return n;
+ }
+};
+
+
+//#include "simplematerial.moc"
+//! [11]
+
diff --git a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp
index 9966fe4..406856f 100644
--- a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp
@@ -18,43 +18,57 @@
#include <QSGFlatColorMaterial>
#include "skymaplite.h"
#include "projections/projector.h"
+#include <QLinkedList>
+//#include <forward_list>
LineNode::LineNode(LineList *lineList)
:m_lineList(lineList), m_material(new QSGFlatColorMaterial),
- m_geometry(new QSGGeometry (QSGGeometry::defaultAttributes_Point2D(),0))
+ m_geometry(new QSGGeometry (QSGGeometry::defaultAttributes_Point2D(),0)),
+ m_geometryNode(new QSGGeometryNode)
{
- setGeometry(m_geometry);
+ appendChildNode(m_geometryNode);
+ m_geometryNode->setGeometry(m_geometry);
setFlag(QSGNode::OwnsGeometry);
- setOpaqueMaterial(m_material);
+ m_geometryNode->setOpaqueMaterial(m_material);
setFlag(QSGNode::OwnsMaterial);
}
void LineNode::setColor(QColor color) {
m_material->setColor(color);
- markDirty(QSGNode::DirtyMaterial);
+ m_geometryNode->markDirty(QSGNode::DirtyMaterial);
}
void LineNode::setWidth(int width) {
m_geometry->setLineWidth(width);
- markDirty(QSGNode::DirtyGeometry);
+ m_geometryNode->markDirty(QSGNode::DirtyGeometry);
+}
+
+void LineNode::setDrawStyle(Qt::PenStyle style) {
+ m_drawStyle = style;
+}
+
+void LineNode::hide() {
+ setOpacity(0);
+ markDirty(QSGNode::DirtyOpacity);
}
void LineNode::updateGeometry() {
+ setOpacity(1);
SkyList *points = m_lineList->points();
m_geometry->setDrawingMode(GL_LINES);
- bool isVisible, isVisibleLast;
-
const Projector *m_proj = SkyMapLite::Instance()->projector();
+ bool isVisible, isVisibleLast;
+
QPointF oLast = m_proj->toScreen( points->first(), true, &isVisibleLast );
// & with the result of checkVisibility to clip away things below horizon
isVisibleLast &= m_proj->checkVisibility( points->first() );
QPointF oThis, oThis2;
- QVector<QPointF> newPoints;
+ QLinkedList<QPointF> newPoints;
for ( int j = 1 ; j < points->size() ; j++ ) {
SkyPoint* pThis = points->at( j );
@@ -67,14 +81,13 @@ void LineNode::updateGeometry() {
}*/
if ( !doSkip ) {
- if ( isVisible && isVisibleLast ) {
- newPoints.append(oLast);
- newPoints.append(oThis);
+ if ( (isVisible) ) {
+ newPoints.append(oLast);
+ newPoints.append(oThis);
//if ( label )
- // label->updateLabelCandidates( oThis.x(), oThis.y(), list, j );
+ // label->updateLabelCandidates( oThis.x(), oThis.y(), list, j );
}
}
-
oLast = oThis2;
isVisibleLast = isVisible;
}
@@ -84,9 +97,14 @@ void LineNode::updateGeometry() {
QSGGeometry::Point2D * vertex = m_geometry->vertexDataAsPoint2D();
- for (int i = 0; i < newPoints.size(); ++i) {
- vertex[i].x = newPoints[i].x();
- vertex[i].y = newPoints[i].y();
+ 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++;
}
- markDirty(QSGNode::DirtyGeometry);
+
+ m_geometryNode->markDirty(QSGNode::DirtyGeometry);
}
diff --git a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.h b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.h
index 67f90f6..8b70b60 100644
--- a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.h
+++ b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.h
@@ -32,7 +32,7 @@ class QSGFlatColorMaterial;
*@version 1.0
*/
-class LineNode : public QSGGeometryNode {
+class LineNode : public QSGOpacityNode {
public:
/**
* @short Constructor
@@ -48,11 +48,16 @@ public:
void setColor(QColor color);
void setWidth(int width);
void updateGeometry();
+ inline LineList *lineList() { return m_lineList; }
+ void hide();
+ void setDrawStyle(Qt::PenStyle drawStyle);
private:
+ QSGGeometryNode *m_geometryNode;
LineList *m_lineList;
QSGGeometry *m_geometry;
QSGFlatColorMaterial *m_material;
+ Qt::PenStyle m_drawStyle;
};
#endif
diff --git a/kstars/kstarslite/skyitems/skynodes/rootnodes/linesrootnode.cpp b/kstars/kstarslite/skyitems/skynodes/rootnodes/linesrootnode.cpp
index 3d05562..00537bb 100644
--- a/kstars/kstarslite/skyitems/skynodes/rootnodes/linesrootnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/rootnodes/linesrootnode.cpp
@@ -12,7 +12,7 @@ LinesRootNode::LinesRootNode()
}
-void LinesRootNode::addLinesComponent(LineListIndex * linesComp, QString color, int width, Qt::PenStyle style) {
+void LinesRootNode::addLinesComponent(LineListIndex * linesComp, QString color, int width, Qt::PenStyle style, z) {
QSGOpacityNode *node = new QSGOpacityNode;
appendChildNode(node);
@@ -21,16 +21,17 @@ void LinesRootNode::addLinesComponent(LineListIndex * linesComp, QString color,
m_widths.append(width);
m_styles.append(style);
+
LineListHash *trixels = linesComp->lineIndex();
QHash< Trixel, LineListList *>::const_iterator i = trixels->begin();
while( i != trixels->end()) {
+
TrixelNode *trixel = new TrixelNode(i.key(), i.value());
node->appendChildNode(trixel);
//QString color = //m_colors[m_colors.size()-1];
//int width = m_widths[m_widths.size()-1]; // TODO do something with this
trixel->setStyle(color, width);
-
++i;
}
}
@@ -38,13 +39,33 @@ void LinesRootNode::addLinesComponent(LineListIndex * linesComp, QString color,
void LinesRootNode::update() {
QMap< QSGOpacityNode *, 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());
+ }*/
+
+ //qDebug() << visTrixels;
+
QSGOpacityNode * node = i.key();
- bool val = i.value()->selected();
if(i.value()->selected()) {
node->setOpacity(1);
for(int c = 0; c < node->childCount(); ++c) {
TrixelNode * trixel = static_cast<TrixelNode *>(node->childAtIndex(c));
- trixel->update();
+ //if(visTrixels.contains(c)) {
+ trixel->update();
+ /* } else {
+ trixel->hide();
+ }*/
}
} else {
node->setOpacity(0);
diff --git a/kstars/kstarslite/skyitems/skynodes/rootnodes/linesrootnode.h b/kstars/kstarslite/skyitems/skynodes/rootnodes/linesrootnode.h
index f1ed6e3..54a8a8c 100644
--- a/kstars/kstarslite/skyitems/skynodes/rootnodes/linesrootnode.h
+++ b/kstars/kstarslite/skyitems/skynodes/rootnodes/linesrootnode.h
@@ -17,7 +17,7 @@
#ifndef LINESROOTNODE_H_
#define LINESROOTNODE_H_
#include "linelistindex.h"
-#include <QSGNode>
+#include "rootnode.h"
/** @class LinesRootNode
*
@@ -32,7 +32,7 @@
class LinesRootNode : public QSGNode { //Clipping under construction
public:
LinesRootNode();
- void addLinesComponent(LineListIndex * linesList, QString color, int width, Qt::PenStyle style);
+ void addLinesComponent(LineListIndex * linesList, QString color, int width, Qt::PenStyle style, int z);
void update();
private:
QMap<QSGOpacityNode *, LineListIndex *> m_lineIndexes;
diff --git a/kstars/kstarslite/skyitems/skynodes/rootnodes/rootnode.cpp b/kstars/kstarslite/skyitems/skynodes/rootnodes/rootnode.cpp
index 24b2ebe..e8ea24a 100644
--- a/kstars/kstarslite/skyitems/skynodes/rootnodes/rootnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/rootnodes/rootnode.cpp
@@ -12,7 +12,7 @@ RootNode::RootNode()
{
genCachedTextures();
updateClipPoly();
- //setIsRectangular(false);
+ // setIsRectangular(false);
}
void RootNode::genCachedTextures() {
@@ -59,33 +59,33 @@ void RootNode::removeAllSkyNodes() {
}
void RootNode::updateClipPoly() {
- /* QPolygonF newClip = m_skyMapLite->projector()->clipPoly();
+ /*QPolygonF newClip = m_skyMapLite->projector()->clipPoly();
if(m_clipPoly != newClip) {
m_clipPoly = newClip;
- 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]);
- }
+ }
+ 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 = 0;
- if(!m_clipGeometry) {
- m_clipGeometry = new QSGGeometry (QSGGeometry::defaultAttributes_Point2D (),
- size);
- m_clipGeometry->setDrawingMode(GL_TRIANGLES);
- setGeometry(m_clipGeometry);
- } else {
- m_clipGeometry->allocate(size);
- }
+ const int size = triangles.size();
+ if(!m_clipGeometry) {
+ m_clipGeometry = new QSGGeometry (QSGGeometry::defaultAttributes_Point2D (),
+ size);
+ m_clipGeometry->setDrawingMode(GL_TRIANGLES);
+ setGeometry(m_clipGeometry);
+ } 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();
- }
- m_clipNode->markDirty(QSGNode::DirtyGeometry);*/
+ 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();
+ }
+ m_clipNode->markDirty(QSGNode::DirtyGeometry);*/
}
diff --git a/kstars/kstarslite/skyitems/skynodes/rootnodes/rootnode.h b/kstars/kstarslite/skyitems/skynodes/rootnodes/rootnode.h
index b66909b..ea37f6c 100644
--- a/kstars/kstarslite/skyitems/skynodes/rootnodes/rootnode.h
+++ b/kstars/kstarslite/skyitems/skynodes/rootnodes/rootnode.h
@@ -18,6 +18,7 @@
#define ROOTNODE_H_
#include <QSGClipNode>
#include <QPolygonF>
+#include <QSGClipNode>
class QSGSimpleTextureNode;
class QImage;
diff --git a/kstars/kstarslite/skyitems/skynodes/trixelnode.cpp b/kstars/kstarslite/skyitems/skynodes/trixelnode.cpp
index 33736e8..10cd3be 100644
--- a/kstars/kstarslite/skyitems/skynodes/trixelnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/trixelnode.cpp
@@ -22,6 +22,7 @@
#include "skyobject.h"
#include "nodes/linenode.h"
#include "Options.h"
+#include "skymesh.h"
#include <QSGOpacityNode>
TrixelNode::TrixelNode(Trixel trixelId, LineListList *linesList)
@@ -44,8 +45,16 @@ void TrixelNode::setStyle(QString color, int width) {
void TrixelNode::update() {
m_opacity->setOpacity(1);
- for(int i = 0; i < childCount(); ++i) {
+ DrawID drawID = SkyMesh::Instance()->drawID();
+ //UpdateID updateID = KStarsData::Instance()->updateID();
+ for(int i = 0; i < m_opacity->childCount(); ++i) {
LineNode * lines = static_cast<LineNode *>(m_opacity->childAtIndex(i));
+ LineList * lineList = lines->lineList();
+ if ( lineList->drawID == drawID ) {
+ lines->hide();
+ continue;
+ }
+ lineList->drawID = drawID;
lines->updateGeometry();
}
}
diff --git a/kstars/skycomponents/horizontalcoordinategrid.cpp b/kstars/skycomponents/horizontalcoordinategrid.cpp
index dde72b1..60ac727 100644
--- a/kstars/skycomponents/horizontalcoordinategrid.cpp
+++ b/kstars/skycomponents/horizontalcoordinategrid.cpp
@@ -98,7 +98,7 @@ HorizontalCoordinateGrid::HorizontalCoordinateGrid( SkyComposite *parent )
}
}
#ifdef KSTARS_LITE
- SkyMapLite::Instance()->getLinesItem()->addLinesComponent( this, "HorizontalGridColor", 2, Qt::DotLine );
+ SkyMapLite::Instance()->getLinesItem()->addLinesComponent( this, "HorizontalGridColor", 1, Qt::DotLine );
#endif
summary();
}
diff --git a/kstars/skycomponents/linelistindex.cpp b/kstars/skycomponents/linelistindex.cpp
index a7d7c85..fbbe857 100644
--- a/kstars/skycomponents/linelistindex.cpp
+++ b/kstars/skycomponents/linelistindex.cpp
@@ -184,6 +184,11 @@ void LineListIndex::draw( SkyPainter *skyp )
preDraw( skyp );
drawLines( skyp );
}
+#ifdef KSTARS_LITE
+MeshIterator LineListIndex::visibleTrixels() {
+ return MeshIterator( skyMesh(), drawBuffer() );
+}
+#endif
// This is a callback used int drawLinesInt() and drawLinesFloat()
SkipList* LineListIndex::skipList( LineList *lineList )
diff --git a/kstars/skycomponents/linelistindex.h b/kstars/skycomponents/linelistindex.h
index dce6dc0..faa66c3 100644
--- a/kstars/skycomponents/linelistindex.h
+++ b/kstars/skycomponents/linelistindex.h
@@ -64,6 +64,10 @@ public:
* @short KStars Lite needs direct access to m_lineIndex for drawing the lines
*/
inline LineListHash* lineIndex() const { return m_lineIndex; }
+
+ /** @short returns MeshIterator for currently visible trixels */
+ MeshIterator visibleTrixels();
+
#endif
protected:
/** @short this is called from within the draw routines when the updateID
diff --git a/kstars/skymaplite.cpp b/kstars/skymaplite.cpp
index 07445d2..5908ea7 100644
--- a/kstars/skymaplite.cpp
+++ b/kstars/skymaplite.cpp
@@ -28,6 +28,7 @@
#include "solarsystemsinglecomponent.h"
#include "Options.h"
+#include "skymesh.h"
//SkyItems
#include "kstarslite/skyitems/planetsitem.h"
@@ -393,6 +394,40 @@ void SkyMapLite::setZoomFactor(double factor) {
void SkyMapLite::forceUpdate() {
setupProjector();
+ // We delay one draw cycle before re-indexing
+ // we MUST ensure CLines do not get re-indexed while we use DRAW_BUF
+ // so we do it here.
+ //m_CLines->reindex( &m_reindexNum );
+ // This queues re-indexing for the next draw cycle
+ //m_reindexNum = KSNumbers( data->updateNum()->julianDay() );
+
+ // This ensures that the JIT updates are synchronized for the entire draw
+ // cycle so the sky moves as a single sheet. May not be needed.
+ data->syncUpdateIDs();
+
+ SkyMesh *m_skyMesh = SkyMesh::Instance(3);
+ if(m_skyMesh) {
+ // prepare the aperture
+ // FIXME_FOV: We may want to rejigger this to allow
+ // wide-angle views --hdevalence
+ double radius = m_proj->fov();
+ if ( radius > 180.0 )
+ radius = 180.0;
+
+
+ if ( m_skyMesh->inDraw() ) {
+ printf("Warning: aborting concurrent SkyMapComposite::draw()\n");
+ return;
+ }
+
+ //m_skyMesh->inDraw( true );
+ m_skyMesh->aperture( &Focus, radius + 1.0, DRAW_BUF ); // divide by 2 for testing
+
+ // create the no-precess aperture if needed
+ if ( Options::showEquatorialGrid() || Options::showHorizontalGrid() || Options::showCBounds() || Options::showEquator() ) {
+ m_skyMesh->index( &Focus, radius + 1.0, NO_PRECESS_BUF );
+ }
+ }
//TODO: Move this check somewhere else (create a separate function)
if(Options::showSolarSystem()) {
if(!m_planetsItem->property("visible").toBool()) {