summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Fedoskin <afedoskin3@gmail.com>2016-09-17 12:44:12 (GMT)
committerArtem Fedoskin <afedoskin3@gmail.com>2016-09-17 12:44:12 (GMT)
commit353d5f865d35e3b36319bb9459662ae99eee73e4 (patch)
tree604dd43dd3d2e4e898f4e0906924c6ac1173ffff
parentb4b52965db3fcdbfd872eb30e14651156288fa98 (diff)
Added comments to all SkyItem derrived classes. Started to add comments
to SkyNode derrived classes. Added function for deleting all childNodes to TrixelNode
-rw-r--r--apk/res/drawable-xhdpi/splash.xml2
-rw-r--r--apk/res/drawable-xhdpi/splashicon.pngbin23830 -> 458659 bytes
-rw-r--r--apk/res/drawable-xhdpi/splashicossn.pngbin0 -> 23830 bytes
-rw-r--r--kstars/CMakeLists.txt1
-rw-r--r--kstars/auxiliary/colorscheme.cpp13
-rw-r--r--kstars/fitsviewer/fitsdatalite.cpp359
-rw-r--r--kstars/fitsviewer/fitsdatalite.h1
-rw-r--r--kstars/fitsviewer/fitsviewlite.cpp471
-rw-r--r--kstars/fitsviewer/fitsviewlite.h71
-rw-r--r--kstars/kstarsdata.cpp3
-rw-r--r--kstars/kstarslite.h15
-rw-r--r--kstars/kstarslite/dialogs/finddialoglite.cpp29
-rw-r--r--kstars/kstarslite/dialogs/finddialoglite.h20
-rw-r--r--kstars/kstarslite/dialogs/locationdialoglite.cpp70
-rw-r--r--kstars/kstarslite/dialogs/locationdialoglite.h20
-rw-r--r--kstars/kstarslite/imageprovider.h8
-rw-r--r--kstars/kstarslite/qml/dialogs/DetailsDialog.qml1
-rw-r--r--kstars/kstarslite/qml/dialogs/FindDialog.qml4
-rw-r--r--kstars/kstarslite/qml/dialogs/helpers/LocationEdit.qml34
-rw-r--r--kstars/kstarslite/qml/main.qml9
-rw-r--r--kstars/kstarslite/qml/modules/menus/ContextMenu.qml5
-rw-r--r--kstars/kstarslite/skyitems/asteroidsitem.h4
-rw-r--r--kstars/kstarslite/skyitems/constellationartitem.cpp2
-rw-r--r--kstars/kstarslite/skyitems/constellationartitem.h21
-rw-r--r--kstars/kstarslite/skyitems/constellationnamesitem.h14
-rw-r--r--kstars/kstarslite/skyitems/deepskyitem.cpp111
-rw-r--r--kstars/kstarslite/skyitems/deepskyitem.h49
-rw-r--r--kstars/kstarslite/skyitems/deepstaritem.cpp86
-rw-r--r--kstars/kstarslite/skyitems/deepstaritem.h13
-rw-r--r--kstars/kstarslite/skyitems/deepstaritem.h.autosave60
-rw-r--r--kstars/kstarslite/skyitems/fovitem.h18
-rw-r--r--kstars/kstarslite/skyitems/horizonitem.h4
-rw-r--r--kstars/kstarslite/skyitems/labelsitem.cpp34
-rw-r--r--kstars/kstarslite/skyitems/labelsitem.h25
-rw-r--r--kstars/kstarslite/skyitems/lines/linesitem.h1
-rw-r--r--kstars/kstarslite/skyitems/lines/milkywayitem.cpp2
-rw-r--r--kstars/kstarslite/skyitems/lines/milkywayitem.h24
-rw-r--r--kstars/kstarslite/skyitems/rootnode.cpp7
-rw-r--r--kstars/kstarslite/skyitems/rootnode.h13
-rw-r--r--kstars/kstarslite/skyitems/satellitesitem.cpp17
-rw-r--r--kstars/kstarslite/skyitems/satellitesitem.h10
-rw-r--r--kstars/kstarslite/skyitems/skynodes/constellationartnode.cpp4
-rw-r--r--kstars/kstarslite/skyitems/skynodes/constellationartnode.h24
-rw-r--r--kstars/kstarslite/skyitems/skynodes/crosshairnode.h22
-rw-r--r--kstars/kstarslite/skyitems/skynodes/deepskynode.cpp20
-rw-r--r--kstars/kstarslite/skyitems/skynodes/deepskynode.h43
-rw-r--r--kstars/kstarslite/skyitems/skynodes/dsosymbolnode.cpp10
-rw-r--r--kstars/kstarslite/skyitems/skynodes/dsosymbolnode.h53
-rw-r--r--kstars/kstarslite/skyitems/skynodes/fovsymbolnode.cpp6
-rw-r--r--kstars/kstarslite/skyitems/skynodes/fovsymbolnode.h33
-rw-r--r--kstars/kstarslite/skyitems/skynodes/guidelabelnode.h6
-rw-r--r--kstars/kstarslite/skyitems/skynodes/horizonnode.cpp2
-rw-r--r--kstars/kstarslite/skyitems/skynodes/horizonnode.h9
-rw-r--r--kstars/kstarslite/skyitems/skynodes/labelnode.cpp9
-rw-r--r--kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp4
-rw-r--r--kstars/kstarslite/skyitems/skynodes/pointsourcenode.cpp2
-rw-r--r--kstars/kstarslite/skyitems/skynodes/skynode.cpp4
-rw-r--r--kstars/kstarslite/skyitems/skynodes/skynode.h3
-rw-r--r--kstars/kstarslite/skyitems/skynodes/skypolygonnode.cpp25
-rw-r--r--kstars/kstarslite/skyitems/skynodes/skypolygonnode.h3
-rw-r--r--kstars/kstarslite/skyitems/skynodes/trixelnode.cpp17
-rw-r--r--kstars/kstarslite/skyitems/skynodes/trixelnode.h15
-rw-r--r--kstars/kstarslite/skyitems/staritem.cpp14
-rw-r--r--kstars/kstarslite/skyitems/staritem.h5
-rw-r--r--kstars/kstarslite/skyitems/supernovaeitem.cpp10
-rw-r--r--kstars/kstarslite/skyitems/supernovaeitem.h12
-rw-r--r--kstars/kstarslite/skyitems/syncedcatalogitem.cpp74
-rw-r--r--kstars/kstarslite/skyitems/syncedcatalogitem.h57
-rw-r--r--kstars/kstarslite/skyitems/telescopesymbolsitem.h15
-rw-r--r--kstars/kstarslite/skyitems/typedeflite.h2
-rw-r--r--kstars/kstarslite/skyobjectlite.h11
-rw-r--r--kstars/kstarslite/skypointlite.h7
-rw-r--r--kstars/projections/projector.cpp7
-rw-r--r--kstars/skycomponents/catalogcomponent.cpp32
-rw-r--r--kstars/skycomponents/catalogcomponent.h23
-rw-r--r--kstars/skycomponents/skylabeler.cpp6
-rw-r--r--kstars/skycomponents/skymapcomposite.cpp9
-rw-r--r--kstars/skymaplite.cpp30
-rw-r--r--kstars/skymaplite.h280
-rw-r--r--kstars/skymapliteevents.cpp9
-rw-r--r--kstars/skyobjects/skyobject.cpp8
-rw-r--r--kstars/tools/nameresolver.cpp47
82 files changed, 982 insertions, 1641 deletions
diff --git a/apk/res/drawable-xhdpi/splash.xml b/apk/res/drawable-xhdpi/splash.xml
index a1e5210..be89dee 100644
--- a/apk/res/drawable-xhdpi/splash.xml
+++ b/apk/res/drawable-xhdpi/splash.xml
@@ -6,6 +6,6 @@
</shape>
</item>
<item>
- <bitmap android:src="@drawable/splashicon" android:gravity="center" />
+ <bitmap android:src="@drawable/splashicon" android:gravity="fill_vertical|fill_horizontal" />
</item>
</layer-list>
diff --git a/apk/res/drawable-xhdpi/splashicon.png b/apk/res/drawable-xhdpi/splashicon.png
index 6a8fa57..fe3d6a3 100644
--- a/apk/res/drawable-xhdpi/splashicon.png
+++ b/apk/res/drawable-xhdpi/splashicon.png
Binary files differ
diff --git a/apk/res/drawable-xhdpi/splashicossn.png b/apk/res/drawable-xhdpi/splashicossn.png
new file mode 100644
index 0000000..6a8fa57
--- /dev/null
+++ b/apk/res/drawable-xhdpi/splashicossn.png
Binary files differ
diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt
index 827f4bf..bfd7a4e 100644
--- a/kstars/CMakeLists.txt
+++ b/kstars/CMakeLists.txt
@@ -665,6 +665,7 @@ if(BUILD_KSTARS_LITE)
kstarslite/skyitems/satellitesitem.cpp
kstarslite/skyitems/supernovaeitem.cpp
kstarslite/skyitems/fovitem.cpp
+ kstarslite/skyitems/syncedcatalogitem.cpp
#Line
kstarslite/skyitems/lines/linesitem.cpp
kstarslite/skyitems/lines/equatoritem.cpp
diff --git a/kstars/auxiliary/colorscheme.cpp b/kstars/auxiliary/colorscheme.cpp
index e15a472..c20a574 100644
--- a/kstars/auxiliary/colorscheme.cpp
+++ b/kstars/auxiliary/colorscheme.cpp
@@ -315,10 +315,7 @@ void ColorScheme::saveToConfig() {
void ColorScheme::setStarColorMode( int mode ) {
StarColorMode = mode;
Options::setStarColorMode( mode );
- //TODO Change textures after color mode was changed
-#ifdef KSTARS_LITE
- //SkyMapLite::Instance()->initStarImages();
-#else
+#ifndef KSTARS_LITE
SkyQPainter::initStarImages();
#endif
}
@@ -326,9 +323,7 @@ void ColorScheme::setStarColorMode( int mode ) {
void ColorScheme::setStarColorIntensity( int intens ) {
StarColorIntensity = intens;
Options::setStarColorIntensity( intens );
-#ifdef KSTARS_LITE
- //SkyMapLite::Instance()->initStarImages();
-#else
+#ifndef KSTARS_LITE
SkyQPainter::initStarImages();
#endif
}
@@ -338,9 +333,7 @@ void ColorScheme::setStarColorModeIntensity( int mode, int intens) {
StarColorIntensity = intens;
Options::setStarColorMode( mode );
Options::setStarColorIntensity( intens );
-#ifdef KSTARS_LITE
- //SkyMapLite::Instance()->initStarImages();
-#else
+#ifndef KSTARS_LITE
SkyQPainter::initStarImages();
#endif
}
diff --git a/kstars/fitsviewer/fitsdatalite.cpp b/kstars/fitsviewer/fitsdatalite.cpp
index 6ef5e4c..288e6cc 100644
--- a/kstars/fitsviewer/fitsdatalite.cpp
+++ b/kstars/fitsviewer/fitsdatalite.cpp
@@ -551,365 +551,6 @@ bool FITSDataLite::checkCollision(Edge* s1, Edge*s2)
return false;
}
-
-/*** Find center of stars and calculate Half Flux Radius */
-void FITSDataLite::findCentroid(const QRectF &boundary, int initStdDev, int minEdgeWidth)
-{
- //Not working yet because we don't use histogram
- /*double threshold=0,sum=0,avg=0,min=0;
- int starDiameter=0;
- int pixVal=0;
- int minimumEdgeCount = MINIMUM_EDGE_LIMIT;
-
- double JMIndex = histogram->getJMIndex();
- float dispersion_ratio=1.5;
-
- QList<Edge*> edges;
-
- if (JMIndex < DIFFUSE_THRESHOLD)
- {
- minEdgeWidth = JMIndex*35+1;
- minimumEdgeCount=minEdgeWidth-1;
- }
- else
- {
- minEdgeWidth =6;
- minimumEdgeCount=4;
- }
-
- while (initStdDev >= 1)
- {
- minEdgeWidth--;
- minimumEdgeCount--;
-
- minEdgeWidth = qMax(3, minEdgeWidth);
- minimumEdgeCount = qMax(3, minimumEdgeCount);
-
- if (JMIndex < DIFFUSE_THRESHOLD)
- {
- // Taking the average out seems to have better result for noisy images
- threshold = stats.max[0] - stats.mean[0] * ( (MINIMUM_STDVAR - initStdDev)*0.5 +1);
-
- min =stats.min[0];
- if (threshold-min < 0)
- {
- threshold=stats.mean[0]* ( (MINIMUM_STDVAR - initStdDev)*0.5 +1);
- min=0;
- }
-
- dispersion_ratio=1.4 - (MINIMUM_STDVAR - initStdDev)*0.08;
- }
- else
- {
- threshold = stats.mean[0]+stats.stddev[0]*initStdDev*(0.3 - (MINIMUM_STDVAR - initStdDev) * 0.05);
- min = stats.min[0];
- // Ratio between centeroid center and edge
- dispersion_ratio=1.8 - (MINIMUM_STDVAR - initStdDev)*0.2;
- }
-
- if (Options::fITSLogging())
- {
- qDebug() << "SNR: " << stats.SNR;
- qDebug() << "The threshold level is " << threshold << "(actual " << threshold-min << ") minimum edge width" << minEdgeWidth << " minimum edge limit " << minimumEdgeCount;
- }
-
- threshold -= min;
-
- int subX, subY, subW, subH;
-
- if (boundary.isNull())
- {
- if (mode == FITS_GUIDE)
- {
- subX = stats.width/10;
- subY = stats.height/10;
- subW = stats.width - subX;
- subH = stats.height - subY;
- }
- else
- {
- subX = 0;
- subY = 0;
- subW = stats.width;
- subH = stats.height;
- }
- }
- else
- {
- subX = boundary.x();
- subY = boundary.y();
- subW = subX + boundary.width();
- subH = subY + boundary.height();
- }
-
- // Detect "edges" that are above threshold
- for (int i=subY; i < subH; i++)
- {
- starDiameter = 0;
-
- for(int j=subX; j < subW; j++)
- {
- pixVal = image_buffer[j+(i*stats.width)] - min;
-
- // If pixel value > threshold, let's get its weighted average
- if ( pixVal >= threshold )
- {
- avg += j * pixVal;
- sum += pixVal;
- starDiameter++;
- }
- // Value < threshold but avg exists
- else if (sum > 0)
- {
- // We found a potential centroid edge
- if (starDiameter >= minEdgeWidth)
- {
- float center = avg/sum + 0.5;
- if (center > 0)
- {
- int i_center = floor(center);
-
- // Check if center is 10% or more brighter than edge, if not skip
- if ( ((image_buffer[i_center+(i*stats.width)]-min) / (image_buffer[i_center+(i*stats.width)-starDiameter/2]-min) >= dispersion_ratio) &&
- ((image_buffer[i_center+(i*stats.width)]-min) / (image_buffer[i_center+(i*stats.width)+starDiameter/2]-min) >= dispersion_ratio))
- {
- if (Options::fITSLogging())
- {
- qDebug() << "Edge center is " << image_buffer[i_center+(i*stats.width)]-min << " Edge is " << image_buffer[i_center+(i*stats.width)-starDiameter/2]-min
- << " and ratio is " << ((image_buffer[i_center+(i*stats.width)]-min) / (image_buffer[i_center+(i*stats.width)-starDiameter/2]-min))
- << " located at X: " << center << " Y: " << i+0.5;
- }
-
- Edge *newEdge = new Edge();
-
- newEdge->x = center;
- newEdge->y = i + 0.5;
- newEdge->scanned = 0;
- newEdge->val = image_buffer[i_center+(i*stats.width)] - min;
- newEdge->width = starDiameter;
- newEdge->HFR = 0;
- newEdge->sum = sum;
-
- edges.append(newEdge);
-
- }
- }
- }
-
- // Reset
- avg= sum = starDiameter=0;
- }
- }
- }
-
- if (Options::fITSLogging())
- qDebug() << "Total number of edges found is: " << edges.count();
-
- // In case of hot pixels
- if (edges.count() == 1 && initStdDev > 1)
- {
- initStdDev--;
- continue;
- }
-
- if (edges.count() >= MAX_EDGE_LIMIT)
- {
- if (Options::fITSLogging())
- qDebug() << "Too many edges, aborting... " << edges.count();
-
- qDeleteAll(edges);
- return;
- }
-
- if (edges.count() >= minimumEdgeCount)
- break;
-
- qDeleteAll(edges);
- edges.clear();
- initStdDev--;
- }
-
- int cen_count=0;
- int cen_x=0;
- int cen_y=0;
- int cen_v=0;
- int cen_w=0;
- int width_sum=0;
-
- // Let's sort edges, starting with widest
- qSort(edges.begin(), edges.end(), greaterThan);
-
- // Now, let's scan the edges and find the maximum centroid vertically
- for (int i=0; i < edges.count(); i++)
- {
- if (Options::fITSLogging())
- {
- qDebug() << "# " << i << " Edge at (" << edges[i]->x << "," << edges[i]->y << ") With a value of " << edges[i]->val << " and width of "
- << edges[i]->width << " pixels. with sum " << edges[i]->sum;
- }
-
- // If edge scanned already, skip
- if (edges[i]->scanned == 1)
- {
- if (Options::fITSLogging())
- qDebug() << "Skipping check for center " << i << " because it was already counted";
- continue;
- }
-
- if (Options::fITSLogging())
- qDebug() << "Invetigating edge # " << i << " now ...";
-
- // Get X, Y, and Val of edge
- cen_x = edges[i]->x;
- cen_y = edges[i]->y;
- cen_v = edges[i]->sum;
- cen_w = edges[i]->width;
-
- float avg_x = 0;
- float avg_y = 0;
-
- sum = 0;
- cen_count=0;
-
- // Now let's compare to other edges until we hit a maxima
- for (int j=0; j < edges.count();j++)
- {
- if (edges[j]->scanned)
- continue;
-
- if (checkCollision(edges[j], edges[i]))
- {
- if (edges[j]->sum >= cen_v)
- {
- cen_v = edges[j]->sum;
- cen_w = edges[j]->width;
- }
-
- edges[j]->scanned = 1;
- cen_count++;
-
- avg_x += edges[j]->x * edges[j]->val;
- avg_y += edges[j]->y * edges[j]->val;
- sum += edges[j]->val;
-
- continue;
- }
-
- }
-
- int cen_limit = (MINIMUM_ROWS_PER_CENTER - (MINIMUM_STDVAR - initStdDev));
-
- if (edges.count() < LOW_EDGE_CUTOFF_1)
- {
- if (edges.count() < LOW_EDGE_CUTOFF_2)
- cen_limit = 1;
- else
- cen_limit = 2;
- }
-
- if (Options::fITSLogging())
- qDebug() << "center_count: " << cen_count << " and initstdDev= " << initStdDev << " and limit is " << cen_limit;
-
- if (cen_limit < 1)
- continue;
-
- // If centroid count is within acceptable range
- //if (cen_limit >= 2 && cen_count >= cen_limit)
- if (cen_count >= cen_limit)
- {
- // We detected a centroid, let's init it
- Edge *rCenter = new Edge();
-
- rCenter->x = avg_x/sum;
- rCenter->y = avg_y/sum;
- width_sum += rCenter->width;
- rCenter->width = cen_w;
-
- if (Options::fITSLogging())
- qDebug() << "Found a real center with number with (" << rCenter->x << "," << rCenter->y << ")";
-
- // Calculate Total Flux From Center, Half Flux, Full Summation
- double TF=0;
- double HF=0;
- double FSum=0;
-
- cen_x = (int) floor(rCenter->x);
- cen_y = (int) floor(rCenter->y);
-
- if (cen_x < 0 || cen_x > stats.width || cen_y < 0 || cen_y > stats.height)
- continue;
-
-
- // Complete sum along the radius
- //for (int k=0; k < rCenter->width; k++)
- for (int k=rCenter->width/2; k >= -(rCenter->width/2) ; k--)
- {
- FSum += image_buffer[cen_x-k+(cen_y*stats.width)] - min;
- //qDebug() << image_buffer[cen_x-k+(cen_y*stats.width)] - min;
- }
-
- // Half flux
- HF = FSum / 2.0;
-
- // Total flux starting from center
- TF = image_buffer[cen_y * stats.width + cen_x] - min;
-
- int pixelCounter = 1;
-
- // Integrate flux along radius axis until we reach half flux
- for (int k=1; k < rCenter->width/2; k++)
- {
- if (TF >= HF)
- {
- if (Options::fITSLogging())
- qDebug() << "Stopping at TF " << TF << " after #" << k << " pixels.";
- break;
- }
-
- TF += image_buffer[cen_y * stats.width + cen_x + k] - min;
- TF += image_buffer[cen_y * stats.width + cen_x - k] - min;
-
- pixelCounter++;
- }
-
- // Calculate weighted Half Flux Radius
- rCenter->HFR = pixelCounter * (HF / TF);
- // Store full flux
- rCenter->val = FSum;
-
- if (Options::fITSLogging())
- qDebug() << "HFR for this center is " << rCenter->HFR << " pixels and the total flux is " << FSum;
-
- starCenters.append(rCenter);
- }
- }
-
- if (starCenters.count() > 1 && mode != FITS_FOCUS)
- {
- float width_avg = width_sum / starCenters.count();
-
- float lsum =0, sdev=0;
-
- foreach(Edge *center, starCenters)
- lsum += (center->width - width_avg) * (center->width - width_avg);
-
- sdev = (sqrt(lsum/(starCenters.count() - 1))) * 4;
-
- // Reject stars > 4 * stddev
- foreach(Edge *center, starCenters)
- if (center->width > sdev)
- starCenters.removeOne(center);
-
- //foreach(Edge *center, starCenters)
- //qDebug() << center->x << "," << center->y << "," << center->width << "," << center->val << endl;
-
- }
-
- // Release memory
- qDeleteAll(edges);
- */
-}
-
double FITSDataLite::getHFR(HFRType type)
{
// This method is less susceptible to noise
diff --git a/kstars/fitsviewer/fitsdatalite.h b/kstars/fitsviewer/fitsdatalite.h
index 1b08364..45ec2cf 100644
--- a/kstars/fitsviewer/fitsdatalite.h
+++ b/kstars/fitsviewer/fitsdatalite.h
@@ -119,7 +119,6 @@ public:
bool areStarsSearched() { return starsSearched; }
QList<Edge*> getStarCenters() { return starCenters;}
int findStars(const QRectF &boundary = QRectF(), bool force=false);
- void findCentroid(const QRectF &boundary = QRectF(), int initStdDev=MINIMUM_STDVAR, int minEdgeWidth=MINIMUM_PIXEL_RANGE);
void getCenterSelection(int *x, int *y);
// Half Flux Radius
diff --git a/kstars/fitsviewer/fitsviewlite.cpp b/kstars/fitsviewer/fitsviewlite.cpp
index 9b04c3d..30d347f 100644
--- a/kstars/fitsviewer/fitsviewlite.cpp
+++ b/kstars/fitsviewer/fitsviewlite.cpp
@@ -44,186 +44,6 @@
#define DECAY_CONSTANT -0.04
-//#define FITS_DEBUG
-/*
-FITSLabel::FITSLabel(FITSView *img, QWidget *parent) : QLabel(parent)
-{
- image = img;
-
-}
-
-void FITSLabel::setSize(double w, double h)
-{
- width = w;
- height = h;
- size = w*h;
-}
-
-FITSLabel::~FITSLabel() {}
-
-void FITSLabel::mouseMoveEvent(QMouseEvent *e)
-{
- double x,y;
- FITSDataLiteLite *image_data = image->getImageData();
-
- float *buffer = image_data->getImageBuffer();
-
- if (buffer == NULL)
- return;
-
- x = round(e->x() / (image->getCurrentZoom() / ZOOM_DEFAULT));
- y = round(e->y() / (image->getCurrentZoom() / ZOOM_DEFAULT));
-
- x = KSUtils::clamp(x, 1.0, width);
- y = KSUtils::clamp(y, 1.0, height);
-
- emit newStatus(QString("X:%1 Y:%2").arg( (int)x ).arg( (int)y ), FITS_POSITION);
-
- // Range is 0 to dim-1 when accessing array
- x -= 1;
- y -= 1;
-
- if (image_data->getBPP() == -32 || image_data->getBPP() == 32)
- emit newStatus(QLocale().toString(buffer[(int) (y * width + x)], 'f', 4), FITS_VALUE);
- else
- emit newStatus(QLocale().toString(buffer[(int) (y * width + x)], 'f', 2), FITS_VALUE);
-
-
- if (image_data->hasWCS())
- {
- int index = x + y * width;
-
- wcs_point * wcs_coord = image_data->getWCSCoord();
-
- if (wcs_coord)
- {
- if (index > size)
- return;
-
- ra.setD(wcs_coord[index].ra);
- dec.setD(wcs_coord[index].dec);
-
- emit newStatus(QString("%1 , %2").arg( ra.toHMSString()).arg(dec.toDMSString()), FITS_WCS);
- }
- }
-
- setCursor(Qt::CrossCursor);
-
- e->accept();
-}
-
-void FITSLabel::mousePressEvent(QMouseEvent *e)
-{
- double x,y;
-
- x = round(e->x() / (image->getCurrentZoom() / ZOOM_DEFAULT));
- y = round(e->y() / (image->getCurrentZoom() / ZOOM_DEFAULT));
-
- x = KSUtils::clamp(x, 1.0, width);
- y = KSUtils::clamp(y, 1.0, height);
-
-#ifdef HAVE_INDI
- FITSDataLiteLite *image_data = image->getImageData();
-
- if ( (e->buttons() & Qt::RightButton) && image_data->hasWCS())
- {
- QMenu fitspopup;
- QAction *trackAction = fitspopup.addAction(i18n("Center In Telescope"));
-
- if (fitspopup.exec(e->globalPos()) == trackAction)
- {
- int index = x + y * width;
-
- wcs_point * wcs_coord = image_data->getWCSCoord();
-
- if (wcs_coord)
- {
- if (index > size)
- return;
-
- centerTelescope(wcs_coord[index].ra/15.0, wcs_coord[index].dec);
-
- return;
- }
- }
- }
-#endif
-
- emit pointSelected(x, y);
-
- double HFR = image->getImageData()->getHFR(x, y);
-
- if (HFR > 0)
- QToolTip::showText(e->globalPos(), i18nc("Half Flux Radius", "HFR: %1", QString::number(HFR, 'g' , 3)), this);
-
-}
-
-void FITSLabel::mouseDoubleClickEvent(QMouseEvent *e)
-{
- double x,y;
-
- x = round(e->x() / (image->getCurrentZoom() / ZOOM_DEFAULT));
- y = round(e->y() / (image->getCurrentZoom() / ZOOM_DEFAULT));
-
- x = KSUtils::clamp(x, 1.0, width);
- y = KSUtils::clamp(y, 1.0, height);
-
- emit markerSelected(x, y);
-
- return;
-}
-
-void FITSLabel::centerTelescope(double raJ2000, double decJ2000)
-{
-#ifdef HAVE_INDI
-
- if (INDIListener::Instance()->size() == 0)
- {
- KMessageBox::sorry(0, i18n("KStars did not find any active telescopes."));
- return;
- }
-
- foreach(ISD::GDInterface *gd, INDIListener::Instance()->getDevices())
- {
- INDI::BaseDevice *bd = gd->getBaseDevice();
-
- if (gd->getType() != KSTARS_TELESCOPE)
- continue;
-
- if (bd == NULL)
- continue;
-
- if (bd->isConnected() == false)
- {
- KMessageBox::error(0, i18n("Telescope %1 is offline. Please connect and retry again.", gd->getDeviceName()));
- return;
- }
-
- ISD::GDSetCommand SlewCMD(INDI_SWITCH, "ON_COORD_SET", "TRACK", ISS_ON, this);
-
- SkyObject selectedObject;
-
- selectedObject.setRA0(raJ2000);
- selectedObject.setDec0(decJ2000);
-
- selectedObject.apparentCoord(J2000, KStarsData::Instance()->ut().djd());
-
- gd->setProperty(&SlewCMD);
- gd->runCommand(INDI_SEND_COORDS, &selectedObject);
-
- return;
- }
-
- KMessageBox::sorry(0, i18n("KStars did not find any active telescopes."));
-
-#else
-
- Q_UNUSED(raJ2000);
- Q_UNUSED(decJ2000);
-
-#endif
-}*/
-
FITSViewLite::FITSViewLite(FITSMode fitsMode, FITSScale filterType) :zoomFactor(1.2)
{
image_data = NULL;
@@ -239,15 +59,6 @@ FITSViewLite::FITSViewLite(FITSMode fitsMode, FITSScale filterType) :zoomFactor(
currentZoom = 0.0;
markStars = false;
- /*connect(image_frame, SIGNAL(newStatus(QString,FITSBar)), this, SIGNAL(newStatus(QString,FITSBar)));
- connect(image_frame, SIGNAL(pointSelected(int,int)), this, SLOT(processPointSelection(int,int)));
- connect(image_frame, SIGNAL(markerSelected(int,int)), this, SLOT(processMarkerSelection(int,int)));*/
-
- //if (fitsMode == FITS_GUIDE)
- //connect(image_frame, SIGNAL(pointSelected(int,int)), this, SLOT(processPointSelection(int,int)));
-
- // Default size
- //resize(INITIAL_W, INITIAL_H);
}
FITSViewLite::~FITSViewLite()
@@ -410,288 +221,6 @@ bool FITSViewLite::rescale()
//emit newStatus(QString("%1%").arg(currentZoom), FITS_ZOOM);
return false;
}
-/*
-void FITSViewLite::ZoomIn()
-{
-
- if (currentZoom < ZOOM_DEFAULT)
- currentZoom += ZOOM_LOW_INCR;
- else
- currentZoom += ZOOM_HIGH_INCR;
-
-
- emit actionUpdated("view_zoom_out", true);
- if (currentZoom >= ZOOM_MAX)
- {
- currentZoom = ZOOM_MAX;
- emit actionUpdated("view_zoom_in", false);
- }
-
- currentWidth = image_width * (currentZoom / ZOOM_DEFAULT);
- currentHeight = image_height * (currentZoom / ZOOM_DEFAULT);
-
- updateFrame();
-
- newStatus(QString("%1%").arg(currentZoom), FITS_ZOOM);
-
-}
-
-void FITSViewLite::ZoomOut()
-{
-
- if (currentZoom <= ZOOM_DEFAULT)
- currentZoom -= ZOOM_LOW_INCR;
- else
- currentZoom -= ZOOM_HIGH_INCR;
-
- if (currentZoom <= ZOOM_MIN)
- {
- currentZoom = ZOOM_MIN;
- emit actionUpdated("view_zoom_out", false);
- }
-
- emit actionUpdated("view_zoom_in", true);
-
- currentWidth = image_width * (currentZoom / ZOOM_DEFAULT);
- currentHeight = image_height * (currentZoom / ZOOM_DEFAULT);
-
- updateFrame();
-
- newStatus(QString("%1%").arg(currentZoom), FITS_ZOOM);
-}
-
-void FITSViewLite::updateFrame()
-{
-
- QPixmap displayPixmap;
- bool ok=false;
-
- if (display_image == NULL)
- return;
-
- if (currentZoom != ZOOM_DEFAULT)
- ok = displayPixmap.convertFromImage(display_image->scaled( (int) currentWidth, (int) currentHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation));
- else
- ok = displayPixmap.convertFromImage(*display_image);
-
-
- if (ok == false)
- return;
-
- QPainter painter(&displayPixmap);
-
- drawOverlay(&painter);
-
- image_frame->setPixmap(displayPixmap);
- image_frame->resize( (int) currentWidth, (int) currentHeight);
-}
-
-void FITSViewLite::ZoomDefault()
-{
- emit actionUpdated("view_zoom_out", true);
- emit actionUpdated("view_zoom_in", true);
-
-
- currentZoom = ZOOM_DEFAULT;
- currentWidth = image_width;
- currentHeight = image_height;
-
- updateFrame();
-
- newStatus(QString("%1%").arg(currentZoom), FITS_ZOOM);
-
- update();
-
-}
-
-void FITSViewLite::drawOverlay(QPainter *painter)
-{
- if (markStars)
- drawStarCentroid(painter);
-
- //if (mode == FITS_GUIDE)
- if (trackingBoxEnabled)
- drawTrackingBox(painter);
-
- if (markerCrosshair.isNull() == false)
- drawMarker(painter);
-}
-
-void FITSViewLite::updateMode(FITSMode fmode)
-{
- mode = fmode;
-}
-
-void FITSViewLite::drawMarker(QPainter *painter)
-{
- painter->setPen( QPen( QColor( KStarsData::Instance()->colorScheme()->colorNamed("TargetColor" ) ) ) );
- painter->setBrush( Qt::NoBrush );
- float pxperdegree = (currentZoom/ZOOM_DEFAULT)* (57.3/1.8);
-
- float s1 = 0.5*pxperdegree;
- float s2 = pxperdegree;
- float s3 = 2.0*pxperdegree;
-
- float x0 = markerCrosshair.x() * (currentZoom / ZOOM_DEFAULT);
- float y0 = markerCrosshair.y() * (currentZoom / ZOOM_DEFAULT);
- float x1 = x0 - 0.5*s1; float y1 = y0 - 0.5*s1;
- float x2 = x0 - 0.5*s2; float y2 = y0 - 0.5*s2;
- float x3 = x0 - 0.5*s3; float y3 = y0 - 0.5*s3;
-
- //Draw radial lines
- painter->drawLine( QPointF(x1, y0), QPointF(x3, y0) );
- painter->drawLine( QPointF(x0+s2, y0), QPointF(x0+0.5*s1, y0) );
- painter->drawLine( QPointF(x0, y1), QPointF(x0, y3) );
- painter->drawLine( QPointF(x0, y0+0.5*s1), QPointF(x0, y0+s2) );
- //Draw circles at 0.5 & 1 degrees
- painter->drawEllipse( QRectF(x1, y1, s1, s1) );
- painter->drawEllipse( QRectF(x2, y2, s2, s2) );
-}
-
-void FITSViewLite::drawStarCentroid(QPainter *painter)
-{
- painter->setPen(QPen(Qt::red, 2));
-
- int x1,y1, w;
-
- // image_data->getStarCenter();
-
- QList<Edge*> starCenters = image_data->getStarCenters();
-
- for (int i=0; i < starCenters.count() ; i++)
- {
- x1 = (starCenters[i]->x - starCenters[i]->width/2) * (currentZoom / ZOOM_DEFAULT);
- y1 = (starCenters[i]->y - starCenters[i]->width/2) * (currentZoom / ZOOM_DEFAULT);
- w = (starCenters[i]->width) * (currentZoom / ZOOM_DEFAULT);
-
- painter->drawEllipse(x1, y1, w, w);
- }
-}
-
-void FITSViewLite::drawTrackingBox(QPainter *painter)
-{
- painter->setPen(QPen(Qt::green, 2));
-
- if (trackingBox.isNull())
- return;
-
- int x1 = trackingBox.x() * (currentZoom / ZOOM_DEFAULT);
- int y1 = trackingBox.y() * (currentZoom / ZOOM_DEFAULT);
- int w = trackingBox.width() * (currentZoom / ZOOM_DEFAULT);
- int h = trackingBox.height() * (currentZoom / ZOOM_DEFAULT);
-
- painter->drawRect(x1, y1, w, h);
-}
-
-QPixmap & FITSViewLite::getTrackingBoxPixmap()
-{
- if (trackingBox.isNull())
- return trackingBoxPixmap;
-
- int x1 = trackingBox.x() * (currentZoom / ZOOM_DEFAULT);
- int y1 = trackingBox.y() * (currentZoom / ZOOM_DEFAULT);
- int w = trackingBox.width() * (currentZoom / ZOOM_DEFAULT);
- int h = trackingBox.height() * (currentZoom / ZOOM_DEFAULT);
-
- trackingBoxPixmap = image_frame->grab(QRect(x1, y1, w, h));
-
- return trackingBoxPixmap;
-}
-
-void FITSViewLite::setTrackingBox(const QRect & rect)
-{
- if (rect != trackingBox)
- {
- trackingBoxUpdated=true;
- trackingBox = rect;
- updateFrame();
- }
-}*/
-
-/*void FITSViewLite::toggleStars(bool enable)
-{
- markStars = enable;
-
- if (markStars == true)
- {
- QApplication::setOverrideCursor(Qt::WaitCursor);
- emit newStatus(i18n("Finding stars..."), FITS_MESSAGE);
- qApp->processEvents();
- int count = -1;
-
- /*if (trackingBoxEnabled)
- {
- count = image_data->findStars(trackingBox, trackingBoxUpdated);
- trackingBoxUpdated=false;
- }
- else
- count = image_data->findStars();
-
- if (count >= 0 && isVisible())
- emit newStatus(i18np("1 star detected.", "%1 stars detected.", count), FITS_MESSAGE);
- QApplication::restoreOverrideCursor();
- }
-}*
-
-/*void FITSViewLite::processPointSelection(int x, int y)
-{
- //if (mode != FITS_GUIDE)
- //return;
-
- image_data->getCenterSelection(&x, &y);
-
- //setGuideSquare(x,y);
- emit trackingStarSelected(x,y);
-}
-
-void FITSViewLite::processMarkerSelection(int x, int y)
-{
- markerCrosshair.setX(x);
- markerCrosshair.setY(y);
-
- updateFrame();
-}
-
-void FITSViewLite::setTrackingBoxEnabled(bool enable)
-{
- if (enable != trackingBoxEnabled)
- {
- trackingBoxEnabled = enable;
- updateFrame();
- }
-}
-int FITSViewLite::getGammaValue() const
-{
- return gammaValue;
-}
-
-void FITSViewLite::setGammaValue(int value)
-{
- if (value == gammaValue)
- return;
-
- gammaValue = value;
-
- calculateMaxPixel(minPixel, maxPixel);
-
- // If calculated maxPixel after gamma is different from image data max pixel, then we apply filter immediately.
- //image_data->applyFilter(FITS_LINEAR, NULL, minPixel, maxGammaPixel);
- qApp->processEvents();
- rescale(ZOOM_KEEP_LEVEL);
- qApp->processEvents();
- updateFrame();
-
-}
-
-void FITSViewLite::wheelEvent(QWheelEvent* event)
-{
- if (event->angleDelta().y() > 0)
- ZoomIn();
- else
- ZoomOut();
-
- event->accept();
-}*/
void FITSViewLite::calculateMaxPixel(double min, double max)
{
diff --git a/kstars/fitsviewer/fitsviewlite.h b/kstars/fitsviewer/fitsviewlite.h
index dc529ab..b369827 100644
--- a/kstars/fitsviewer/fitsviewlite.h
+++ b/kstars/fitsviewer/fitsviewlite.h
@@ -39,35 +39,6 @@
class FITSView;
-
-/*class FITSLabel : public QLabel
-{
- Q_OBJECT
-public:
- explicit FITSLabel(FITSView *img, QWidget *parent=NULL);
- virtual ~FITSLabel();
- void setSize(double w, double h);
- void centerTelescope(double raJ2000, double decJ2000);
-
-protected:
- virtual void mouseMoveEvent(QMouseEvent *e);
- virtual void mousePressEvent(QMouseEvent *e);
- virtual void mouseDoubleClickEvent(QMouseEvent *e);
-
-private:
- FITSView *image;
- dms ra;
- dms dec;
- double width,height,size;
-
-signals:
- void newStatus(const QString &msg, FITSBar id);
- void pointSelected(int x, int y);
- void markerSelected(int x, int y);
-
-
-};*/
-
class FITSViewLite : public QObject//: public QScrollArea
{
Q_OBJECT
@@ -91,38 +62,10 @@ public:
QImage * getImageFromFITS();
- // Tracking square
- /*void setTrackingBoxEnabled(bool enable);
- bool isTrackingBoxEnabled() { return trackingBoxEnabled; }
- QPixmap & getTrackingBoxPixmap();
- void setTrackingBox(const QRect & rect);
- const QRect & getTrackingBox() { return trackingBox; }*/
-
- // Overlay
- /*void drawOverlay(QPainter *);
- void drawStarCentroid(QPainter *);
- void drawTrackingBox(QPainter *);
- void drawMarker(QPainter *);
- void updateFrame();
-
- // Star Detection
- void toggleStars(bool enable);
-
- // FITS Mode
- void updateMode(FITSMode mode);
- FITSMode getMode() { return mode;}*/
-
int getGammaValue() const;
void setGammaValue(int value);
void setFilter(FITSScale newFilter) { filter = newFilter;}
-public slots:
- /*void ZoomIn();
- void ZoomOut();
- void ZoomDefault();
-
- void processPointSelection(int x, int y);
- void processMarkerSelection(int x, int y);*/
private:
double average();
@@ -155,20 +98,6 @@ private:
// Cross hair
QPointF markerCrosshair;
-
- // Tracking box
- /*bool trackingBoxEnabled;
- bool trackingBoxUpdated;
- QRect trackingBox;
- QPixmap trackingBoxPixmap;*/
-
-signals:
- /*void newStatus(const QString &msg, FITSBar id);
- void debayerToggled(bool);
- void actionUpdated(const QString &name, bool enable);
- void trackingStarSelected(int x, int y);*/
-
- //friend class FITSLabel;
};
#endif
diff --git a/kstars/kstarsdata.cpp b/kstars/kstarsdata.cpp
index 874affa..31a3d83 100644
--- a/kstars/kstarsdata.cpp
+++ b/kstars/kstarsdata.cpp
@@ -1048,6 +1048,9 @@ bool KStarsData::executeScript( const QString &scriptname, SkyMap *map ) {
} //end while
if ( cmdCount ) return true;
+#else
+ Q_UNUSED(map)
+ Q_UNUSED(scriptname)
#endif
return false;
}
diff --git a/kstars/kstarslite.h b/kstars/kstarslite.h
index 4678da9..9ae6df2 100644
--- a/kstars/kstarslite.h
+++ b/kstars/kstarslite.h
@@ -45,8 +45,9 @@ class QQuickItem;
/**
*@class KStarsLite
*@short This class loads QML files and connects SkyMapLite and KStarsData
- *Unlike KStars class it is not a main Window but a root object that contains the program clock and holds pointers on SkyMapLite and KStarsData objects.
- *KStarsLite is a singleton, use KStarsLite::createInstance() to create an instance and KStarsLite::Instance() to get a pointer to the instance
+ * Unlike KStars class it is not a main window (see KStarsLite::m_Engine) but a root object that contains the program clock and
+ * holds pointers to SkyMapLite and KStarsData objects.
+ * KStarsLite is a singleton, use KStarsLite::createInstance() to create an instance and KStarsLite::Instance() to get a pointer to the instance
*@author Artem Fedoskin
*@version 1.0
*/
@@ -91,17 +92,22 @@ public:
/** @return pointer to KStarsData object which contains application data. */
inline KStarsData* data() const { return m_KStarsData; }
+ /** @return pointer to ImageProvider that is used in QML to display image fetched from CCD **/
inline ImageProvider *imageProvider() const { return m_imgProvider; }
+ /** @return pointer to QQmlApplicationEngine that runs QML **/
inline QQmlApplicationEngine *qmlEngine() { return &m_Engine; }
/** @short used from QML to update positions of sky objects and update SkyMapLite */
Q_INVOKABLE void fullUpdate();
+ /** @short currently sets color scheme from config **/
void applyConfig( bool doApplyFocus = true );
+ /** @short set whether tutorial should be shown on next startup **/
void setRunTutorial(bool runTutorial);
+ /** @return true if tutorial should be shown **/
bool getRunTutorial();
#ifdef HAVE_INDI
@@ -170,6 +176,10 @@ signals:
void scaleChanged(float);
void runTutorialChanged();
+
+ /** Once this signal is emitted, notification with text msg will appear on the screen.
+ Use this signal to output messages to user (warnings, info etc.) **/
+ void notificationMessage(QString msg);
public Q_SLOTS:
/**
@@ -199,6 +209,7 @@ public Q_SLOTS:
/** action slot: advance one step backward in time */
void slotStepBackward();
+ /** @short start tracking clickedPoint or stop tracking if we are already tracking some object **/
void slotTrack();
private slots:
diff --git a/kstars/kstarslite/dialogs/finddialoglite.cpp b/kstars/kstarslite/dialogs/finddialoglite.cpp
index d7a0317..36d9000 100644
--- a/kstars/kstarslite/dialogs/finddialoglite.cpp
+++ b/kstars/kstarslite/dialogs/finddialoglite.cpp
@@ -69,6 +69,7 @@ FindDialogLite::~FindDialogLite() { }
void FindDialogLite::filterByType(uint typeIndex) {
KStarsData *data = KStarsData::Instance();
+ m_typeIndex = typeIndex;
switch ( typeIndex ) {
case 0: // All object types
@@ -133,6 +134,8 @@ void FindDialogLite::filterByType(uint typeIndex) {
}
void FindDialogLite::filterList(QString searchQuery) {
+ m_searchQuery = searchQuery;
+ setIsResolveEnabled(!isInList(searchQuery));
QString SearchText = processSearchText(searchQuery);
m_sortModel->setFilterFixedString( SearchText );
listFiltered = true;
@@ -169,18 +172,44 @@ QString FindDialogLite::processSearchText(QString text) {
return searchtext;
}
+bool FindDialogLite::isInList(QString searchQuery) {
+ if(searchQuery.isEmpty()) return false;
+ int size = m_sortModel->rowCount(m_sortModel->index(0,0));
+ QString stripped = searchQuery.remove(" ");
+ for(int i = 0; i < size; ++i) {
+ QString s = m_sortModel->data(m_sortModel->index(i,0), SkyObjectListModel::NameRole).toString();
+ if(s == searchQuery || s.remove(" ") == stripped) {
+ return true;
+ }
+ }
+ return false;
+}
+
void FindDialogLite::resolveInInternet(QString searchQuery) {
+ setIsResolveEnabled(false); //Disable "Search in Internet" button while we are searching for object
SkyObject *selObj = 0;
CatalogEntryData cedata;
cedata = NameResolver::resolveName( processSearchText(searchQuery) );
DeepSkyObject *dso = 0;
+
if( ! std::isnan( cedata.ra ) && ! std::isnan( cedata.dec ) ) {
dso = KStarsData::Instance()->skyComposite()->internetResolvedComponent()->addObject( cedata );
if( dso )
qDebug() << dso->ra0().toHMSString() << ";" << dso->dec0().toDMSString();
selObj = dso;
+
+ filterByType(m_typeIndex); //Reload objects list of current type
+ setIsResolveEnabled(!isInList(m_searchQuery));
}
if ( selObj == 0 ) {
emit notifyMessage(i18n( "No object named %1 found.", searchQuery ));
}
}
+
+void FindDialogLite::setIsResolveEnabled(bool isResolveEnabled) {
+ if(m_isResolveEnabled != isResolveEnabled) {
+ m_isResolveEnabled = isResolveEnabled;
+ emit isResolveEnabledChanged(isResolveEnabled);
+ }
+}
+
diff --git a/kstars/kstarslite/dialogs/finddialoglite.h b/kstars/kstarslite/dialogs/finddialoglite.h
index ed2f9f8..e708de9 100644
--- a/kstars/kstarslite/dialogs/finddialoglite.h
+++ b/kstars/kstarslite/dialogs/finddialoglite.h
@@ -32,6 +32,8 @@ class SkyObjectListModel;
class FindDialogLite : public QObject {
Q_OBJECT
Q_PROPERTY(QStringList filterModel READ getFilterModel NOTIFY filterModelChanged)
+ //true if m_searchQuery is already in sorted list of object names
+ Q_PROPERTY(bool isResolveEnabled READ getIsResolveEnabled WRITE setIsResolveEnabled NOTIFY isResolveEnabledChanged)
public:
explicit FindDialogLite();
@@ -51,9 +53,21 @@ public:
* @short searches for the object in internet (adopted to KStars Lite FindDialog::finishProcessing()
*/
Q_INVOKABLE void resolveInInternet(QString searchQuery);
+
+ /**
+ * @return true it at least one entry in fModel is an exact match with searchQuery
+ */
+ Q_INVOKABLE bool isInList(QString searchQuery);
+
+ /** Getter for queryInList **/
+ bool getIsResolveEnabled() { return m_isResolveEnabled; }
+
+ /** Setter for queryInList **/
+ void setIsResolveEnabled(bool isResolveEnabled);
signals:
void filterModelChanged();
void notifyMessage(QString message);
+ void isResolveEnabledChanged(bool);
public slots:
/**When Text is entered in the QLineEdit, filter the List of objects
@@ -72,6 +86,12 @@ private:
QSortFilterProxyModel* m_sortModel;
QTimer* timer;
bool listFiltered;
+
+ /** Current query that is used to sort fModel **/
+ QString m_searchQuery;
+ bool m_isResolveEnabled;
+
+ uint m_typeIndex;
};
#endif
diff --git a/kstars/kstarslite/dialogs/locationdialoglite.cpp b/kstars/kstarslite/dialogs/locationdialoglite.cpp
index 4e93da3..3794151 100644
--- a/kstars/kstarslite/dialogs/locationdialoglite.cpp
+++ b/kstars/kstarslite/dialogs/locationdialoglite.cpp
@@ -24,28 +24,6 @@
LocationDialogLite::LocationDialogLite()
:SelectedCity(nullptr), currentGeo(nullptr){
- // KStarsData* data = KStarsData::Instance();
-
- // SelectedCity = NULL;
-
- // setWindowTitle( i18n( "Set Geographic Location" ) );
-
- // QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
- // mainLayout->addWidget(buttonBox);
- // connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotOk()));
- // connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
-
- // for ( int i=0; i<25; ++i )
- // ld->TZBox->addItem( QLocale().toString( (double)(i-12) ) );
-
- // //Populate DSTRuleBox
- // foreach( const QString& key, data->getRulebook().keys() ) {
- // if( !key.isEmpty() )
- // ld->DSTRuleBox->addItem( key );
- // }
-
- // /*ld->DSTLabel->setText( "<a href=\"showrules\">" + i18n("DST Rule:") + "</a>" );
- // connect( ld->DSTLabel, SIGNAL( linkActivated(const QString &) ), this, SLOT( showTZRules() ) );*/
KStarsLite *kstars = KStarsLite::Instance();
kstars->qmlEngine()->rootContext()->setContextProperty("CitiesModel", &m_cityList);
@@ -54,7 +32,23 @@ LocationDialogLite::LocationDialogLite()
KStarsData* data = KStarsData::Instance();
connect(data, SIGNAL(geoChanged()), this, SLOT(updateCurrentLocation()));
+ setupGPS();
+}
+
+void LocationDialogLite::setupGPS() {
m_geoSrc = QGeoPositionInfoSource::createDefaultSource(this);
+
+ connect(m_geoSrc, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(processNewCoordinates(QGeoPositionInfo)));
+ connect(m_geoSrc, SIGNAL(updateTimeout()), this, SIGNAL(updateTimeoutGPS()));
+}
+
+void LocationDialogLite::processNewCoordinates(QGeoPositionInfo position) {
+// m_geoSrc->stopUpdates();
+ emit coordinatesChangedGPS(position);
+}
+
+void LocationDialogLite::getCoordinatesFromGPS() {
+ m_geoSrc->startUpdates();
}
void LocationDialogLite::initCityList() {
@@ -65,33 +59,12 @@ void LocationDialogLite::initCityList() {
QString name = loc->fullName();
cities.append( name );
filteredCityList.insert( name, loc );
-
- //If TZ is not an even integer value, add it to listbox
- /*if ( loc->TZ0() - int( loc->TZ0() ) && m_TZList.indexOf( QLocale().toString( loc->TZ0() ) ) != -1 ) {
- for ( int i=0; i < m_TZList.size(); ++i ) {
- if ( m_TZList[i].toDouble() > loc->TZ0() ) {
- ld->TZBox->addItem( QLocale().toString( loc->TZ0() ), i-1 );
- break;
- }
- }
- }*/
}
//Sort the list of Cities alphabetically...note that filteredCityList may now have a different ordering!
m_cityList.setStringList(cities);
m_cityList.sort(0);
- //ld->CountLabel->setText( i18np("One city matches search criteria","%1 cities match search criteria", ld->GeoBox->count()) );
-
- // attempt to highlight the current kstars location in the GeoBox
- /*ld->GeoBox->setCurrentItem( 0 );
- for( int i=0; i < ld->GeoBox->count(); i++ ) {
- if ( ld->GeoBox->item(i)->text() == data->geo()->fullName() ) {
- ld->GeoBox->setCurrentRow( i );
- break;
- }
- }*/
-
QStringList TZ;
for ( int i=0; i<25; ++i )
@@ -112,11 +85,6 @@ void LocationDialogLite::filterCity(QString city, QString province, QString coun
QStringList cities;
filteredCityList.clear();
- /*nameModified = false;
- dataModified = false;
- ld->AddCityButton->setEnabled( false );
- ld->UpdateButton->setEnabled( false );*/
-
foreach ( GeoLocation *loc, data->getGeoList() ) {
QString sc( loc->translatedName() );
QString ss( loc->translatedCountry() );
@@ -135,8 +103,6 @@ void LocationDialogLite::filterCity(QString city, QString province, QString coun
m_cityList.setStringList(cities);
m_cityList.sort(0);
setProperty("currLocIndex", m_cityList.stringList().indexOf(m_currentLocation));
-
- //ld->CountLabel->setText( i18np("One city matches search criteria","%1 cities match search criteria", ld->GeoBox->count()) );
}
bool LocationDialogLite::addCity(QString city, QString province, QString country, QString latitude, QString longitude, QString TimeZoneString, QString TZRule) {
@@ -455,8 +421,6 @@ dms LocationDialogLite::createDms (QString degree, bool deg, bool *ok )
return dmsAngle;
}
-
-
void LocationDialogLite::setCurrentLocation(QString loc) {
if(m_currentLocation != loc) {
m_currentLocation = loc;
@@ -468,5 +432,3 @@ void LocationDialogLite::updateCurrentLocation() {
currentGeo = KStarsData::Instance()->geo();
setCurrentLocation(currentGeo->fullName());
}
-
-
diff --git a/kstars/kstarslite/dialogs/locationdialoglite.h b/kstars/kstarslite/dialogs/locationdialoglite.h
index 1e4cb4b..92c2583 100644
--- a/kstars/kstarslite/dialogs/locationdialoglite.h
+++ b/kstars/kstarslite/dialogs/locationdialoglite.h
@@ -19,6 +19,7 @@
#include <QStringListModel>
#include <QSqlDatabase>
+#include <QGeoPositionInfo>
#include "skyobjects/skyobject.h"
@@ -80,15 +81,34 @@ public:
*/
dms createDms ( QString degree, bool deg, bool *ok );
+ /**
+ * @short setup everything needed to use GPS
+ */
+ void setupGPS();
+
+ /**
+ * Starts setting GPS fix. GPSCoordinatesChanged() signal will be emitted once coordinates are
+ * fetched.
+ */
+ Q_INVOKABLE void getCoordinatesFromGPS();
+
public slots:
void initCityList();
void updateCurrentLocation();
+
+ void processNewCoordinates(QGeoPositionInfo position);
+
signals:
void currentLocationChanged(QString);
void TZListChanged(QStringList);
void DSTRulesChanged(QStringList);
void currLocIndexChanged(int);
+ /** Emitted when GPS coordinates were successfully updated **/
+ void coordinatesChangedGPS(QGeoPositionInfo newPos);
+ /** Emitted when coordinates couldn't be fetched during 10 seconds **/
+ void updateTimeoutGPS();
+
private:
/**
* @short checks whether database with cities is already created. Creates a new otherwise
diff --git a/kstars/kstarslite/imageprovider.h b/kstars/kstarslite/imageprovider.h
index 7d11558..cd1c0d1 100644
--- a/kstars/kstarslite/imageprovider.h
+++ b/kstars/kstarslite/imageprovider.h
@@ -20,7 +20,7 @@
/**
* @class ImageProvider
- * This class makes it possible to use QImages in QML
+ * This class makes it possible to use QImages from C++ in QML
*
* @author Artem Fedoskin
* @version 1.0
@@ -29,7 +29,13 @@ class ImageProvider : public QQuickImageProvider
{
public:
ImageProvider();
+ /** @short Get image by id
+ * @return image of size requestedSize
+ **/
virtual QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize);
+ /**
+ * @short Add image to the list of images with the given id
+ */
void addImage(const QString &id, QImage image);
private:
QHash<QString, QImage> images;
diff --git a/kstars/kstarslite/qml/dialogs/DetailsDialog.qml b/kstars/kstarslite/qml/dialogs/DetailsDialog.qml
index 6d0c544..15efa00 100644
--- a/kstars/kstarslite/qml/dialogs/DetailsDialog.qml
+++ b/kstars/kstarslite/qml/dialogs/DetailsDialog.qml
@@ -393,7 +393,6 @@ KSPage {
}
}
-
Button {
id: addInfoLandscape
text: xi18n("Add Link")
diff --git a/kstars/kstarslite/qml/dialogs/FindDialog.qml b/kstars/kstarslite/qml/dialogs/FindDialog.qml
index 3f7a9c9..f0970d6 100644
--- a/kstars/kstarslite/qml/dialogs/FindDialog.qml
+++ b/kstars/kstarslite/qml/dialogs/FindDialog.qml
@@ -91,7 +91,9 @@ KSPage {
RowLayout {
Button {
- enabled: searchQuery.text.length > 0
+ id: searchInInternet
+ enabled: searchQuery.text.length > 0 && FindDialogLite.isResolveEnabled
+
text: "Search in internet"
onClicked: {
FindDialogLite.resolveInInternet(searchQuery.text)
diff --git a/kstars/kstarslite/qml/dialogs/helpers/LocationEdit.qml b/kstars/kstarslite/qml/dialogs/helpers/LocationEdit.qml
index aaf2fa5..986ab4d 100644
--- a/kstars/kstarslite/qml/dialogs/helpers/LocationEdit.qml
+++ b/kstars/kstarslite/qml/dialogs/helpers/LocationEdit.qml
@@ -52,12 +52,12 @@ KSPage {
var errorDesc = ""
if (sourceError == 2 || sourceError == 1) {
- errorDesc = xi18n("No location service (GPS, Wi-Fi etc.) is available. Please, switch on location service and retry")
+ errorDesc = xi18n("No location service (GPS, cellular service, etc.) is available.\nPlease, switch on location service and retry")
} else if (sourceError == 4) {
errorDesc = xi18n("Unknown error occured. Please contact application developer.")
}
- notification.showNotification("Location error: " + errorDesc)
+ notification.showNotification(errorDesc)
active = false
sourceError = positionSource.NoError
}
@@ -76,31 +76,19 @@ KSPage {
}
onPositionChanged: {
- if( (!positionSource.position.latitudeValid ||
- !positionSource.position.longitudeValid) ) {
- latField.text = ""
- longField.text = ""
- if(isLoaded) {
- notification.showNotification(xi18n("Couldn't get latitude and longitude from GPS"))
- }
- } else {
+ if(isLoaded) {
+ notification.showNotification(xi18n("Found your longitude and altitude"))
var lat = positionSource.position.coordinate.latitude
- var longitude = positionSource.position.coordinate.longitude
+ var lng = positionSource.position.coordinate.longitude
latField.text = lat
- longField.text = longitude
- notification.showNotification(xi18("Found your longitude and altitude"))
+ longField.text = lng
+ locationLoading.close()
}
-
- locationLoading.close()
}
-
preferredPositioningMethods: PositionSource.AllPositioningMethods
}
- /**
- closes the popup and clears all text fields
- */
-
+ //close the popup and clears all text fields
onVisibleChanged: {
if(!visible) {
cityField.clear()
@@ -240,7 +228,7 @@ KSPage {
enabled: isAvailable
onClicked: {
positionSource.stop()
- positionSource.update()
+ positionSource.start()
if(!positionSource.valid) {
positionSource.stop()
notification.showNotification(xi18("Positioning is not available on your device"))
@@ -304,8 +292,8 @@ KSPage {
}
} else {
if(!LocationDialogLite.editCity(geoName, cityField.text, provinceField.text, countryField.text,
- latField.text, longField.text, comboBoxTZ.currentText,
- comboBoxDST.currentText)) {
+ latField.text, longField.text, comboBoxTZ.currentText,
+ comboBoxDST.currentText)) {
notification.showNotification(xi18n("Failed to edit city"))
return
}
diff --git a/kstars/kstarslite/qml/main.qml b/kstars/kstarslite/qml/main.qml
index f1d8ade..2995f64 100644
--- a/kstars/kstarslite/qml/main.qml
+++ b/kstars/kstarslite/qml/main.qml
@@ -105,8 +105,15 @@ ApplicationWindow {
}
PassiveNotification {
- z: 10
+ z: 2
id: notification
+
+ Connections {
+ target: KStarsLite
+ onNotificationMessage: {
+ notification.showNotification(msg)
+ }
+ }
}
Units {
diff --git a/kstars/kstarslite/qml/modules/menus/ContextMenu.qml b/kstars/kstarslite/qml/modules/menus/ContextMenu.qml
index 1aabce9..251db3f 100644
--- a/kstars/kstarslite/qml/modules/menus/ContextMenu.qml
+++ b/kstars/kstarslite/qml/modules/menus/ContextMenu.qml
@@ -50,7 +50,10 @@ Menu {
KSMenuItem {
text: xi18n("Center and Track")
- onTriggered: SkyMapLite.slotCenter()
+ onTriggered: {
+ contextMenu.close()
+ SkyMapLite.slotCenter()
+ }
}
KSMenuItem {
diff --git a/kstars/kstarslite/skyitems/asteroidsitem.h b/kstars/kstarslite/skyitems/asteroidsitem.h
index ddf6003..ac67fd2 100644
--- a/kstars/kstarslite/skyitems/asteroidsitem.h
+++ b/kstars/kstarslite/skyitems/asteroidsitem.h
@@ -40,7 +40,7 @@ public:
AsteroidsItem(const QList<SkyObject*>& asteroidsList, RootNode *rootNode = 0);
/**
- * @short recreates the node tree (deletes old nodes and appends new ones according to
+ * @short recreates the node tree (deletes old nodes and appends new ones based on SkyObjects in
* m_asteroidsList)
*/
void recreateList();
@@ -48,8 +48,8 @@ public:
/**
* @short Determines the visibility of the object and its label and hides/updates them accordingly
*/
-
virtual void update() override;
+
private:
const QList<SkyObject*>& m_asteroidsList;
};
diff --git a/kstars/kstarslite/skyitems/constellationartitem.cpp b/kstars/kstarslite/skyitems/constellationartitem.cpp
index 5b10399..8937784 100644
--- a/kstars/kstarslite/skyitems/constellationartitem.cpp
+++ b/kstars/kstarslite/skyitems/constellationartitem.cpp
@@ -1,7 +1,7 @@
/** *************************************************************************
planetsitem.cpp - K Desktop Planetarium
-------------------
- begin : 02/05/2016
+ begin : 02/06/2016
copyright : (C) 2016 by Artem Fedoskin
email : afedoskin3@gmail.com
***************************************************************************/
diff --git a/kstars/kstarslite/skyitems/constellationartitem.h b/kstars/kstarslite/skyitems/constellationartitem.h
index 37f581f..6064d85 100644
--- a/kstars/kstarslite/skyitems/constellationartitem.h
+++ b/kstars/kstarslite/skyitems/constellationartitem.h
@@ -1,7 +1,7 @@
/** *************************************************************************
- planetsitem.h - K Desktop Planetarium
+ constellationartitem.h - K Desktop Planetarium
-------------------
- begin : 02/05/2016
+ begin : 02/06/2016
copyright : (C) 2016 by Artem Fedoskin
email : afedoskin3@gmail.com
***************************************************************************/
@@ -21,9 +21,9 @@
class RootNode;
class ConstellationArtComponent;
/**
- * @class PlanetsItem
- * This class handles planets and their moons in SkyMapLite
- *
+ * @class ConstellationArtItem
+ * This class handles constellation art in SkyMapLite. Each constellation image is represented by ConstellationArtNode.
+ * @see ConstellationArtNode
* @author Artem Fedoskin
* @version 1.0
*/
@@ -31,18 +31,13 @@ class ConstellationArtComponent;
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
+ * @param artComp - pointer to ConstellationArtComponent instance, that handles constellation art data
+ * @param rootNode - pointer to the root node
*/
ConstellationArtItem(ConstellationArtComponent *artComp,RootNode *rootNode = 0);
/**
- * @short calls update() of all child PlanetMoonsNodes
- * @note see PlanetMoonsNodes::update()
+ * @short calls update() of all child ConstellationArtNodes if constellation art is on. Otherwise calls deleteNodes()
*/
void update() override;
diff --git a/kstars/kstarslite/skyitems/constellationnamesitem.h b/kstars/kstarslite/skyitems/constellationnamesitem.h
index d433306..8d12abc 100644
--- a/kstars/kstarslite/skyitems/constellationnamesitem.h
+++ b/kstars/kstarslite/skyitems/constellationnamesitem.h
@@ -23,8 +23,8 @@
class ConstellationNamesComponent;
/**
- * @short The ConstellationName struct. It holds SkyObject (coordinate of label) and 2 labels (latin and
- * secondary names)
+ * @short The ConstellationName struct. It holds SkyObject (with coordinates of label) and 2 labels
+ * (latin and secondary names)
*/
struct ConstellationName {
@@ -42,7 +42,7 @@ struct ConstellationName {
/** @class ConstellationNamesItem
*
- * This class handles representation of ConstellationNamesComponent in SkyMapLite
+ * This class represents ConstellationNamesComponent in SkyMapLite.
* @author Artem Fedoskin
* @version 1.0
*/
@@ -58,16 +58,16 @@ public:
explicit ConstellationNamesItem(ConstellationNamesComponent *constComp, RootNode *rootNode = 0);
/**
- * Updates positions of labels of ConstellationName based on user settings and labels
- * visibility. If the user chose latin names then label with secondary name won't be created until
+ * Update positions ConstellationName labels based on user settings and labels visibility.
+ * If the user chose latin names then label with secondary name won't be created until
* settings are not changed.
*
- * @short updates positions of labels based on their visibility.
+ * @short updates positions of labels based on their visibility and user settings.
*/
virtual void update();
/**
- * @short deletes all labels and recreates m_names according to object list of m_constelNamesComp
+ * @short Delete all labels and recreate m_names according to object list of m_constelNamesComp
*/
void recreateList();
private:
diff --git a/kstars/kstarslite/skyitems/deepskyitem.cpp b/kstars/kstarslite/skyitems/deepskyitem.cpp
index 0a3273b..ad93e17 100644
--- a/kstars/kstarslite/skyitems/deepskyitem.cpp
+++ b/kstars/kstarslite/skyitems/deepskyitem.cpp
@@ -50,6 +50,22 @@ DSOTrixelNode::DSOTrixelNode(Trixel trixelID)
}
+void DSOTrixelNode::deleteAllChildNodes() {
+ QLinkedList<QPair<SkyObject *, SkyNode *>>::iterator i = m_nodes.begin();
+
+ while(i != m_nodes.end()) {
+ DeepSkyNode *node = static_cast<DeepSkyNode *>((*i).second);
+ if(node) {
+ node->parent()->removeChildNode(node);
+ delete node->symbol();
+ delete node;
+
+ *i = QPair<SkyObject *, SkyNode *>((*i).first, 0);
+ }
+ i++;
+ }
+}
+
DeepSkyItem::DeepSkyItem(DeepSkyComponent *dsoComp, RootNode *rootNode)
:SkyItem(LabelsItem::label_t::DEEP_SKY_LABEL, rootNode), m_dsoComp(dsoComp),
m_skyMesh(SkyMesh::Instance())
@@ -118,53 +134,25 @@ void DeepSkyItem::update() {
MeshIterator region( m_skyMesh, DRAW_BUF );
- int count = 0;
-
drawFlag = Options::showMessier() &&
! ( Options::hideOnSlew() && Options::hideMessier() && SkyMapLite::IsSlewing() );
updateDeepSkyNode(m_Messier, drawFlag, &region, Options::showMessierImages() );
- /*QSGNode *n = m_Messier->m_trixels->firstChild();
- while(n != 0) {
- count += n->childCount();
- n = n->nextSibling();
- }*/
-
drawFlag = Options::showNGC() &&
! ( Options::hideOnSlew() && Options::hideNGC() && SkyMapLite::IsSlewing() );
updateDeepSkyNode(m_NGC, drawFlag, &region );
- /*n = m_NGC->m_trixels->firstChild();
- while(n != 0) {
- count += n->childCount();
- n = n->nextSibling();
- }*/
-
drawFlag = Options::showIC() &&
! ( Options::hideOnSlew() && Options::hideIC() && SkyMapLite::IsSlewing() );
updateDeepSkyNode(m_IC, drawFlag, &region );
- /*n = m_IC->m_trixels->firstChild();
- while(n != 0) {
- count += n->childCount();
- n = n->nextSibling();
- }*/
-
drawFlag = Options::showOther() &&
! ( Options::hideOnSlew() && Options::hideOther() && SkyMapLite::IsSlewing() );
updateDeepSkyNode(m_other, drawFlag, &region );
-
- /*n = m_other->m_trixels->firstChild();
- while(n != 0) {
- count += n->childCount();
- n = n->nextSibling();
- }
-
- qDebug() << count << "DSO";*/
}
void DeepSkyItem::updateDeepSkyNode(DSOIndexNode *indexNode, bool drawObject, MeshIterator *region, bool drawImage)
@@ -185,14 +173,9 @@ void DeepSkyItem::updateDeepSkyNode(DSOIndexNode *indexNode, bool drawObject, Me
QColor schemeColor = data->colorScheme()->colorNamed(indexNode->schemeColor);
- //WARNING: CHECK COLOR
- /*skyp->setPen( data->colorScheme()->colorNamed( colorString ) );
- skyp->setBrush( Qt::NoBrush );*/
-
bool m_hideLabels = ( map->isSlewing() && Options::hideOnSlew() ) ||
! ( Options::showDeepSkyMagnitudes() || Options::showDeepSkyNames() );
-
double maglim = Options::magLimitDrawDeepSky();
bool showUnknownMagObjects = Options::showUnknownMagObjects();
@@ -207,45 +190,29 @@ void DeepSkyItem::updateDeepSkyNode(DSOIndexNode *indexNode, bool drawObject, Me
labelMagLim += ( Options::magLimitDrawDeepSky() - labelMagLim ) * ( lgz - lgmin) / (lgmax - lgmin );
if ( labelMagLim > Options::magLimitDrawDeepSky() ) labelMagLim = Options::magLimitDrawDeepSky();
- //DrawID drawID = m_skyMesh->drawID();
-
uint regionID = 0;
if(region->hasNext()) {
regionID = region->next();
}
- /*//Check that at least one trixel is shown
-
- if(regionID == -1) {
- hide();
- return;
- } else {
- show();
- }*/
-
DSOTrixelNode *trixel = static_cast<DSOTrixelNode *>(indexNode->m_trixels->firstChild());
double delLim = SkyMapLite::deleteLimit();
+ /*Unlike DeepStarItem and StarItem where all trixels are set, in DeepSkyItem number of trixels is different
+ across the catalogs. We are comparing trixelID and regionID to hide trixels that are not visible and skip
+ regionIDs that are not present in this catalog*/
while( trixel != 0 ) {
+ //Hide all trixels that has smaller trixelID than the next visible trixel
if(trixel->trixelID() < regionID) {
trixel->hide();
trixel->m_labels->hide();
if(trixel->hideCount() > delLim) {
- QLinkedList<QPair<SkyObject *, SkyNode *>>::iterator i = trixel->m_nodes.begin();
-
- while(i != trixel->m_nodes.end()) {
- DeepSkyNode *node = static_cast<DeepSkyNode *>((*i).second);
- if(node) {
- node->parent()->removeChildNode(node);
- node->destroy();
-
- *i = QPair<SkyObject *, SkyNode *>((*i).first, 0);
- }
- i++;
- }
+ trixel->deleteAllChildNodes();
}
} else if(trixel->trixelID() > regionID) {
+ /*Keep iterating over regionID if current trixel's trixelID is larger than regionID. If there are no more
+ visible regions then hide/delete remaining trixels*/
if (region->hasNext()) {
regionID = region->next();
} else {
@@ -254,26 +221,14 @@ void DeepSkyItem::updateDeepSkyNode(DSOIndexNode *indexNode, bool drawObject, Me
trixel->m_labels->hide();
if(trixel->hideCount() > delLim) {
- QLinkedList<QPair<SkyObject *, SkyNode *>>::iterator i = trixel->m_nodes.begin();
-
- while(i != trixel->m_nodes.end()) {
- DeepSkyNode *node = static_cast<DeepSkyNode *>((*i).second);
- if(node) {
- node->parent()->removeChildNode(node);
- node->destroy();
-
- *i = QPair<SkyObject *, SkyNode *>((*i).first, 0);
- }
- i++;
- }
+ trixel->deleteAllChildNodes();
}
-
trixel = static_cast<DSOTrixelNode *>(trixel->nextSibling());
}
break;
}
continue;
- } else {
+ } else { //Current trixelID is equal to regionID meaning that current trixel is visible
trixel->show();
trixel->m_labels->show();
@@ -281,11 +236,9 @@ void DeepSkyItem::updateDeepSkyNode(DSOIndexNode *indexNode, bool drawObject, Me
regionID = region->next();
}
- QLinkedList<QPair<SkyObject *, SkyNode *>> *nodes = &trixel->m_nodes;
-
- QLinkedList<QPair<SkyObject *, SkyNode *>>::iterator i = nodes->begin();
+ QLinkedList<QPair<SkyObject *, SkyNode *>>::iterator i = (&trixel->m_nodes)->begin();
- while(i != nodes->end()) {
+ while(i != (&trixel->m_nodes)->end()) {
DeepSkyObject *dsoObj = static_cast<DeepSkyObject *>((*i).first);
DeepSkyNode *dsoNode = static_cast<DeepSkyNode *>((*i).second);
@@ -311,10 +264,13 @@ void DeepSkyItem::updateDeepSkyNode(DSOIndexNode *indexNode, bool drawObject, Me
if ( !( m_hideLabels || mag > labelMagLim ) ) drawLabel = true;
if( dsoNode ) {
+ //Delete particular DSONode if its hideCount is larger than the limit
if( dsoNode->hideCount() > delLim ) {
- //qDebug() << dsoNode->hideCount() << "hideCount";
trixel->removeChildNode(dsoNode);
- dsoNode->destroy();
+
+ delete dsoNode->symbol();
+ delete dsoNode;
+
*i = QPair<SkyObject *, SkyNode *>((*i).first, 0);
} else {
if(sizeCriterion && magCriterion) {
@@ -332,10 +288,11 @@ void DeepSkyItem::updateDeepSkyNode(DSOIndexNode *indexNode, bool drawObject, Me
bool visible = false;
pos = projector->toScreen(dsoObj,true,&visible);
if( visible && projector->onScreen(pos) ) {
+ //Create new DeepSkyNode and its symbol if it is currently visible
DSOSymbolNode *dsoSymbol = new DSOSymbolNode(dsoObj, schemeColor);
trixel->m_symbols->appendChildNode(dsoSymbol);
- DeepSkyNode *dsoNode = new DeepSkyNode(dsoObj, dsoSymbol, trixel->trixelID(), indexNode->m_labelType);
+ DeepSkyNode *dsoNode = new DeepSkyNode(dsoObj, dsoSymbol, indexNode->m_labelType, trixel->trixelID());
trixel->appendChildNode(dsoNode);
*i = QPair<SkyObject *, SkyNode *>((*i).first, static_cast<SkyNode *>(dsoNode));
diff --git a/kstars/kstarslite/skyitems/deepskyitem.h b/kstars/kstarslite/skyitems/deepskyitem.h
index fb7ed03..7c87415 100644
--- a/kstars/kstarslite/skyitems/deepskyitem.h
+++ b/kstars/kstarslite/skyitems/deepskyitem.h
@@ -21,6 +21,11 @@
#include "deepskycomponent.h"
#include "skynodes/trixelnode.h"
+ /**
+ * @short This class represents DSOs from particular catalog. To create a node, first create a DSOTrixelNode,
+ * (if a node of this trixelID is not a child of m_trixels yet), append it to m_trixels and then append
+ * DeepSkyNode to DSOTrixelNode
+ */
class DSOIndexNode : public SkyOpacityNode {
public:
DSOIndexNode(DeepSkyIndex *index, LabelsItem::label_t labelType, QString colorString);
@@ -28,23 +33,40 @@ public:
DeepSkyIndex *m_index;
QSGNode *m_trixels;
+ /**
+ * @short m_labelType - holds label type of this catalog
+ */
LabelsItem::label_t m_labelType;
+ /**
+ * @short schemeColor - holds the color, with which nodes of this catalog should be drawn
+ */
QString schemeColor;
+ /**
+ * @short hides the catalog nodes and their labels
+ */
virtual void hide();
+ /**
+ * @short shows the catalog nodes and their labels
+ */
virtual void show();
};
-
+ /**
+ * @short The DSOTrixelNode class - represents trixel. Symbols should be appended to m_symbols, labels to
+ * m_labels and DeepSkyNodes directly to DSOTrixelNode
+ */
class DSOTrixelNode : public TrixelNode {
public:
DSOTrixelNode(Trixel trixelID);
TrixelNode *m_labels;
QSGNode *m_symbols;
+
+ virtual void deleteAllChildNodes();
};
- /** @class StarItem
+ /** @class DeepSkyItem
*
- *@short Class that handles Deep Sky Objects
+ *@short Class that handles representation of Deep Sky Objects.
*@author Artem Fedoskin
*@version 1.0
*/
@@ -57,16 +79,33 @@ class MeshIterator;
class DeepSkyItem : public SkyItem {
public:
/**
- * @short Constructor.
+ * @short Constructor. Instantiates DSOIndexNodes for catalogs
+ * @param dsoComp pointer to DeepSkyComponent that handles data
* @param rootNode parent RootNode that instantiated this object
*/
DeepSkyItem(DeepSkyComponent *dsoComp, RootNode *rootNode);
/**
- * @short updates all trixels that contain stars
+ * @short Call update on all DSOIndexNodes (catalogs)
+ *
*/
virtual void update();
+ /**
+ * @short update all nodes needed to represent DSO in the given DSOIndexNode
+ * In this function we perform some tricks to reduce memory consumption:
+ * 1. Each TrixelNode has hideCount() function that returns the number of updates, during which this TrixelNode
+ * was hidden. Whenever TrixelNode becomes visible this counter is set to 0 and is not being incremented.
+ * 2. Based on the zoom level we calculate the limit for hideCount. If hideCount() of particular TrixelNode is
+ * larger than the limit, we delete all nodes of this TrixelNode.
+ * 3. If DSOTrixelNode is visible, we iterate over its DeepSkyObjects and DeepSkyNodes. If hideCount of DeepSkyNode
+ * is larger than the limit we delete it. If DeepSkyObject is visible but no DeepSkyNode to represent this object
+ * is created, we instantiate a new one.
+ * @param node - DSOIndexNode(catalog) that should be updated
+ * @param drawObject - true if objects from this catalog should be drawn, false otherwise
+ * @param region - MeshIterator that should be used to iterate over visible trixels
+ * @param drawImage - true if images for objects should be drawn, false otherwise
+ */
void updateDeepSkyNode(DSOIndexNode *node, bool drawObject, MeshIterator *region,
bool drawImage = false);
diff --git a/kstars/kstarslite/skyitems/deepstaritem.cpp b/kstars/kstarslite/skyitems/deepstaritem.cpp
index c7d8f47..9359b21 100644
--- a/kstars/kstarslite/skyitems/deepstaritem.cpp
+++ b/kstars/kstarslite/skyitems/deepstaritem.cpp
@@ -36,9 +36,6 @@ DeepStarItem::DeepStarItem(DeepStarComponent *deepStarComp, RootNode *rootNode)
{
m_starBlockList = &m_deepStarComp->m_starBlockList;
- //Test
- Options::setShowStarMagnitudes(false);
- Options::setShowStarNames(true);
if(m_staticStars) {
for(int c = 0; c < m_starBlockList->size(); ++c) {
TrixelNode *trixel = new TrixelNode(m_starBlockList->at( c )->getTrixel());
@@ -110,8 +107,8 @@ void DeepStarItem::update() {
MeshIterator region(m_skyMesh, DRAW_BUF);
// If we are to hide the fainter stars (eg: while slewing), we set the magnitude limit to hideStarsMag.
- //if( hideFaintStars && maglim > hideStarsMag )
- //maglim = hideStarsMag;
+ if( hideFaintStars && maglim > hideStarsMag )
+ maglim = hideStarsMag;
StarBlockFactory *m_StarBlockFactory = StarBlockFactory::Instance();
// m_StarBlockFactory->drawID = m_skyMesh->drawID();
@@ -125,23 +122,24 @@ void DeepStarItem::update() {
// Mark used blocks in the LRU Cache. Not required for static stars
if( !m_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();
+ //Under construction
+// 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();
}
m_StarBlockFactory->drawID = m_skyMesh->drawID();
@@ -158,31 +156,7 @@ void DeepStarItem::update() {
while( trixel != 0 ) {
if(m_staticStars) {
-
- /*while(n != 0) {
- PointSourceNode *point = static_cast<PointSourceNode *>(n);
- n = n->nextSibling();
-
- StarObject *curStar = static_cast<StarObject *>(point->skyObject());
- float mag = curStar->mag();
-
- // break loop if maglim is reached
- if(!hide) {
- if ( mag > maglim ) hide = true;
- }
-
- if(!hide) {
- if ( curStar->updateID != KStarsData::Instance()->updateID() )
- curStar->JITupdate();
- //point->setSizeMagLim(m_zoomMagLimit);
- point->update();
- } else {
- point->hide();
- }
- }*/
-
const Projector *projector = SkyMapLite::Instance()->projector();
-
double delLim = SkyMapLite::deleteLimit();
if(trixelID != regionID) {
@@ -204,9 +178,7 @@ void DeepStarItem::update() {
}
trixel = static_cast<TrixelNode *>(trixel->nextSibling());
-
trixelID++;
-
continue;
} else {
@@ -216,11 +188,9 @@ void DeepStarItem::update() {
regionID = region.next();
}
- QLinkedList<QPair<SkyObject *, SkyNode *>> *nodes = &trixel->m_nodes;
-
- QLinkedList<QPair<SkyObject *, SkyNode *>>::iterator i = nodes->begin();
+ QLinkedList<QPair<SkyObject *, SkyNode *>>::iterator i = (&trixel->m_nodes)->begin();
- while(i != nodes->end()) {
+ while(i != (&trixel->m_nodes)->end()) {
bool hide = false;
bool hideSlew = false;
@@ -269,6 +239,7 @@ void DeepStarItem::update() {
}
}
} else if(false) {
+ //Dynamic stars are under construction
if( !m_staticStars && !m_starBlockList->at( regionID )->fillToMag( maglim ) && maglim <= m_deepStarComp->m_FaintMagnitude * ( 1 - 1.5/16 ) ) {
qDebug() << "SBL::fillToMag( " << maglim << " ) failed for trixel "
<< regionID << " !"<< endl;
@@ -311,21 +282,10 @@ void DeepStarItem::update() {
}
}
trixel = static_cast<TrixelNode *>(trixel->nextSibling());
-
trixelID++;
}
m_skyMesh->inDraw( false );
}
-
- /*int count = 0;
-
- QSGNode *n = firstChild();
- while(n != 0) {
- count += n->childCount();
- n = n->nextSibling();
- }
-
- qDebug() << count << "Nodes - DeepStars";*/
}
diff --git a/kstars/kstarslite/skyitems/deepstaritem.h b/kstars/kstarslite/skyitems/deepstaritem.h
index 653d14d..73aa0a2 100644
--- a/kstars/kstarslite/skyitems/deepstaritem.h
+++ b/kstars/kstarslite/skyitems/deepstaritem.h
@@ -21,7 +21,7 @@
/** @class DeepStarItem
*
- *@short Class that handles unnamed Stars
+ *@short This class handles representation of unnamed stars in SkyMapLite
*@author Artem Fedoskin
*@version 1.0
*/
@@ -34,12 +34,19 @@ class StarBlockList;
class DeepStarItem : public SkyItem {
public:
/**
- * @short Constructor.
- * @param rootNode parent RootNode that instantiated this object
+ * @short Constructor. Instantiates nodes for static stars
+ * @param deepStarComp - pointer to DeepStarComponent that handles data
+ * @param rootNode - parent RootNode that instantiated this object
*/
DeepStarItem(DeepStarComponent *deepStarComp, RootNode *rootNode);
/**
+ * @short Update positions of deep stars in SkyMapLite
+ * In this function we perform almost the same thing as in DeepSkyItem::updateDeepSkyNode() to reduce
+ * memory consumption.
+ * @see DeepSkyItem::updateDeepSkyNode()
+ */
+ /**
* @short updates all trixels that contain stars
*/
virtual void update();
diff --git a/kstars/kstarslite/skyitems/deepstaritem.h.autosave b/kstars/kstarslite/skyitems/deepstaritem.h.autosave
new file mode 100644
index 0000000..f748f0a
--- /dev/null
+++ b/kstars/kstarslite/skyitems/deepstaritem.h.autosave
@@ -0,0 +1,60 @@
+/** *************************************************************************
+ deepstaritem.h - K Desktop Planetarium
+ -------------------
+ begin : 17/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 DEEPSTARITEM_H_
+#define DEEPSTARITEM_H_
+
+#include "skyitem.h"
+#include "skyopacitynode.h"
+
+ /** @class DeepStarItem
+ *
+ *@short This class handles representation of unnamed stars in SkyMapLite
+ *@author Artem Fedoskin
+ *@version 1.0
+ */
+
+class DeepStarComponent;
+class SkyMesh;
+class StarBlockFactory;
+class StarBlockList;
+
+class DeepStarItem : public SkyItem {
+public:
+ /**
+ * @short Constructor. Instantiates nodes for static stars
+ * @param deepStarComp - pointer to DeepStarComponent that handles data
+ * @param rootNode - parent RootNode that instantiated this object
+ */
+ DeepStarItem(DeepStarComponent *deepStarComp, RootNode *rootNode);
+
+ /**
+ * @short Update positions of deep stars in SkyMapLite
+ * In this function we perform almost the same thing as in DeepSkyItem::updateDeepSkyNode() to reduce
+ * memory consumption.
+ * @see DeepSkyItem::updateDeepSkyNode()
+ */
+ virtual void update();
+
+private:
+ SkyMesh *m_skyMesh;
+ StarBlockFactory *m_StarBlockFactory;
+
+ DeepStarComponent *m_deepStarComp;
+ QVector< StarBlockList *> *m_starBlockList;
+ bool m_staticStars;
+};
+#endif
+
diff --git a/kstars/kstarslite/skyitems/fovitem.h b/kstars/kstarslite/skyitems/fovitem.h
index 9e660f2..a674039 100644
--- a/kstars/kstarslite/skyitems/fovitem.h
+++ b/kstars/kstarslite/skyitems/fovitem.h
@@ -19,7 +19,7 @@
#include "skyitem.h"
/**
* @class FOVItem
- * This class handles FOV symbols in SkyMapLite
+ * This class handles representation of FOV symbols in SkyMapLite
*
* @author Artem Fedoskin
* @version 1.0
@@ -27,6 +27,9 @@
class FOVItem : public SkyItem {
public:
+ /**
+ * @short types of FOV symbols
+ */
enum Shape { SQUARE,
CIRCLE,
CROSSHAIRS,
@@ -34,16 +37,23 @@ public:
SOLIDCIRCLE,
UNKNOWN };
+ /**
+ * @short Constructor. Initialize default FOV symbols
+ */
FOVItem(RootNode * rootNode);
/**
- * @short Adds symbol to QVariantMap in SkyMap and creates new FOVSymbolNode
+ * @short Add information about new symbol to SkyMapLite and create FOVSymbolNode
+ * SkyMapLite acts here as a bridge between FOVItem and QML. Here we call SkyMapLite::addFOVSymbol to add
+ * information about new FOVSymbol to SkyMapLite and later in update() we check if user switched this
+ * FOVSymbol on
*/
void addSymbol(const QString &name, float a, float b, float xoffset, float yoffset,
float rot, FOVItem::Shape shape, const QString &color);
+ /**
+ * @short Update FOVSymbol if user switched it on
+ */
virtual void update() override;
-
-private:
};
#endif
diff --git a/kstars/kstarslite/skyitems/horizonitem.h b/kstars/kstarslite/skyitems/horizonitem.h
index c974b84..5ac5190 100644
--- a/kstars/kstarslite/skyitems/horizonitem.h
+++ b/kstars/kstarslite/skyitems/horizonitem.h
@@ -21,7 +21,7 @@
class HorizonComponent;
class GuideLabelNode;
- /** @class SkyMapLite
+ /** @class HorizonItem
* Handles representation of HorizonComponent in SkyMapLite (lines, filled polygon and compass
* labels).
*
@@ -45,7 +45,7 @@ public:
inline void setHorizonComp(HorizonComponent * hComp) { m_horizonComp = hComp; }
/**
- * @short calls update() of HorizonNode and updates/hides compass labels based on their visibility
+ * @short Call update() of HorizonNode and update/hide compass labels based on their visibility
*/
virtual void update();
private:
diff --git a/kstars/kstarslite/skyitems/labelsitem.cpp b/kstars/kstarslite/skyitems/labelsitem.cpp
index 02341e2..7396cb8 100644
--- a/kstars/kstarslite/skyitems/labelsitem.cpp
+++ b/kstars/kstarslite/skyitems/labelsitem.cpp
@@ -43,6 +43,10 @@ LabelsItem::LabelsItem()
m_labelsLists.insert(label_t::STAR_LABEL, stars);
+ LabelTypeNode *catalog_stars = new LabelTypeNode;
+ appendChildNode(catalog_stars);
+ m_labelsLists.insert(label_t::CATALOG_STAR_LABEL, catalog_stars);
+
LabelTypeNode *asteroids = new LabelTypeNode;
appendChildNode(asteroids);
m_labelsLists.insert(label_t::ASTEROID_LABEL, asteroids);
@@ -83,6 +87,10 @@ LabelsItem::LabelsItem()
deep_sky->appendChildNode(dso_other);
m_labelsLists.insert(label_t::DSO_OTHER_LABEL, dso_other);
+ LabelTypeNode *catalog_dso = new LabelTypeNode;
+ appendChildNode(catalog_dso);
+ m_labelsLists.insert(label_t::CATALOG_DSO_LABEL, catalog_dso);
+
LabelTypeNode *constellation = new LabelTypeNode;
appendChildNode(constellation);
m_labelsLists.insert(label_t::CONSTEL_NAME_LABEL, constellation);
@@ -186,8 +194,10 @@ void LabelsItem::update() {
updateChildLabels(label_t::DSO_NGC_LABEL);
updateChildLabels(label_t::DSO_IC_LABEL);
updateChildLabels(label_t::DSO_OTHER_LABEL);
+ updateChildLabels(label_t::CATALOG_DSO_LABEL);
updateChildLabels(label_t::STAR_LABEL);
+ updateChildLabels(label_t::CATALOG_STAR_LABEL);
}
void LabelsItem::hideLabels(label_t labelType) {
@@ -265,36 +275,13 @@ void LabelsItem::deleteLabel(LabelNode *label) {
void LabelsItem::updateChildLabels(label_t labelType) {
LabelTypeNode *node = m_labelsLists[labelType];
if(node->visible()) {
-
QSGNode *n = node->firstChild();
- /*if( labelType == label_t::HORIZON_LABEL
- || labelType == label_t::ECLIPTIC_LABEL || labelType == 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) {
- /*
- * int max = int( m_zoomMagLimit * 10.0 );
- if ( max < 0 ) max = 0;
- if ( max > MAX_LINENUMBER_MAG ) max = MAX_LINENUMBER_MAG;
- */
if(labelType == STAR_LABEL || labelType == DSO_NGC_LABEL || labelType == DSO_MESSIER_LABEL
|| labelType == DSO_IC_LABEL || labelType == DSO_OTHER_LABEL) {
TrixelNode *trixel = static_cast<TrixelNode *>(n);
if(trixel->visible()) {
QSGNode *l = trixel->firstChild();
-
while(l != 0) {
LabelNode *label = static_cast<LabelNode *>(l);
l = l->nextSibling();
@@ -308,7 +295,6 @@ void LabelsItem::updateChildLabels(label_t labelType) {
}
} else {
LabelNode *label = static_cast<LabelNode *>(n);
- //n = n->nextSibling();
if(label->visible()) {
if(label->zoomFont()) skyLabeler->resetFont();
diff --git a/kstars/kstarslite/skyitems/labelsitem.h b/kstars/kstarslite/skyitems/labelsitem.h
index 9a6d2c6..1ea6bfe 100644
--- a/kstars/kstarslite/skyitems/labelsitem.h
+++ b/kstars/kstarslite/skyitems/labelsitem.h
@@ -30,18 +30,20 @@ class TrixelNode;
class SkyObject;
+typedef SkyOpacityNode LabelTypeNode;
+
/**
* @class LabelsItem
*
* This class is in charge of labels in SkyMapLite. Labels can be instantiated by calling addLabel with
* either SkyObject or plain QString as a name. There are two types of label nodes available - LabelNode
- * that can't be rotated and GuideLabelNode that supports rotation (but it not used now anywhere).
+ * that can't be rotated and GuideLabelNode that supports rotation (but it is not used anywhere yet).
*
* To prevent labels from overlapping this class uses SkyLabeler. We check LabelNode for overlapping by
- * calling SkyLabeler::markText() (SkyLabeler::markRegion() for GuideLabelNode) update().
+ * calling SkyLabeler::markText() (SkyLabeler::markRegion() for GuideLabelNode) and update().
*
* Each of SkyItems that uses labels has its own label type in enum label_t (copied from SkyLabeler but
- * was a bit extended). Labels of particular type are reparented to LabelTypeNode(QSGOpacityNode) so
+ * was extended). Labels of particular type are reparented to LabelTypeNode(QSGOpacityNode) so
* to hide all labels of some type you just need to set opacity of LabelTypeNode that corresponds to
* this type to 0.
*
@@ -53,7 +55,7 @@ class SkyObject;
*
* @note font size is set in SkyLabeler::SkyLabeler() by initializing m_stdFont with default font
*
- * @short handles labels in SkyMapLite
+ * @short Handles labels in SkyMapLite
* @author Artem Fedoskin
* @version 1.0
*/
@@ -91,11 +93,13 @@ public:
EQUATOR_LABEL,
ECLIPTIC_LABEL,
TELESCOPE_SYMBOL,
+ CATALOG_STAR_LABEL,
+ CATALOG_DSO_LABEL,
NO_LABEL //used in LinesItem
};
/**
- * creates LabelNode with given skyObject and appends it to LabelTypeNode that corresponds
+ * Create LabelNode with given skyObject and append it to LabelTypeNode that corresponds
* to type
* @param skyObject for which the label is created
* @param labelType type of LabelTypeNode to which this label has to be reparented
@@ -103,8 +107,10 @@ public:
*/
LabelNode *addLabel(SkyObject *skyObject, label_t labelType);
- /** creates LabelNode and appends it to corresponding TrixelNode so that all labels
+ /** Create LabelNode and append it to corresponding TrixelNode so that all labels
* can be hidden whenever Trixel is not displayed. Use for sky objects that are indexed by SkyMesh
+ * @param skyObject for which the label is created
+ * @param labelType type of LabelTypeNode to which this label has to be reparented
* @param trixel id of trixel
**/
LabelNode *addLabel(SkyObject *skyObject, label_t labelType, Trixel trixel);
@@ -131,6 +137,7 @@ public:
/**
* @short updates child labels of LabelTypeNode that corresponds to type in m_labelsLists
+ * Labels for stars and DSOs we update labels only if corresponding TrixelNode is visible.
* @param labelType type of LabelTypeNode (see m_labelsLists)
*/
@@ -179,16 +186,12 @@ public:
/**
* @return pointer to RootNode that instantiated this object
*/
-
RootNode *rootNode() { return m_rootNode; }
private:
QMap<label_t, LabelTypeNode *> m_labelsLists;
- /**
- * @short because this class is not derived from SkyItem it has to store pointer to RootNode
- */
-
+ /** @short because this class is not derived from SkyItem it has to store pointer to RootNode */
RootNode *m_rootNode;
SkyLabeler *skyLabeler;
};
diff --git a/kstars/kstarslite/skyitems/lines/linesitem.h b/kstars/kstarslite/skyitems/lines/linesitem.h
index 8102102..27dc1be 100644
--- a/kstars/kstarslite/skyitems/lines/linesitem.h
+++ b/kstars/kstarslite/skyitems/lines/linesitem.h
@@ -67,7 +67,6 @@ public:
virtual void update();
private:
QMap<LineIndexNode *, LineListIndex *> m_lineIndexes;
- //QMap<QSGOpacityNode *, QVector<TrixelNode *> > m_trixelNodes;
};
#endif
diff --git a/kstars/kstarslite/skyitems/lines/milkywayitem.cpp b/kstars/kstarslite/skyitems/lines/milkywayitem.cpp
index e26b9d5..5a4b6d7 100644
--- a/kstars/kstarslite/skyitems/lines/milkywayitem.cpp
+++ b/kstars/kstarslite/skyitems/lines/milkywayitem.cpp
@@ -27,7 +27,7 @@
#include "../skynodes/trixelnode.h"
MilkyWayItem::MilkyWayItem(MilkyWay *mwComp, RootNode *rootNode)
- :SkyItem(LabelsItem::label_t::NO_LABEL, rootNode), m_MWComp(mwComp), m_filled(Options::fillMilkyWay())
+ :SkyItem(LabelsItem::label_t::NO_LABEL, rootNode), m_filled(Options::fillMilkyWay()), m_MWComp(mwComp)
{
initialize();
}
diff --git a/kstars/kstarslite/skyitems/lines/milkywayitem.h b/kstars/kstarslite/skyitems/lines/milkywayitem.h
index 71a4732..1973238 100644
--- a/kstars/kstarslite/skyitems/lines/milkywayitem.h
+++ b/kstars/kstarslite/skyitems/lines/milkywayitem.h
@@ -24,32 +24,30 @@ class MilkyWay;
/** @class MilkyWay
*
- * Class that handles lines (Constellation lines and boundaries and both coordinate grids) in
- * SkyMapLite.
- *
- * To display lines component use addLinesComponent.
- *
- *@note see RootNode::RootNode() for example of adding lines
- *@short Class that handles most of the lines in SkyMapLite
- *@author Artem Fedoskin
- *@version 1.0
+ * @short Class that handles drawing of MilkyWay (both filled and non-filled)
+ * @author Artem Fedoskin
+ * @version 1.0
*/
class MilkyWayItem : public SkyItem {
public:
/**
* @short Constructor.
- * @param rootNode parent RootNode that instantiated this object
+ * @param mwComp - pointer to MilkyWay that handles data
+ * @param rootNode - parent RootNode that instantiated this object
*/
MilkyWayItem(MilkyWay *mwComp, RootNode *rootNode);
+ /**
+ * @short If m_filled is true SkyPolygonNodes(filled) will be initialized. Otherwise MilkyWay will be
+ * drawn with LineNodes(non-filled)
+ */
void initialize();
/**
- * @short updates all trixels that are associated with LineListIndex or hide them if selected()
- * of this LineListIndex returns false
+ * @short Update position of all nodes that represent MilkyWay
+ * If m_filled is not equal to Options::fillMilkyWay() we reinitialize all nodes by calling initialize()
*/
-
virtual void update();
private:
bool m_filled; //True if the polygon has to be filled
diff --git a/kstars/kstarslite/skyitems/rootnode.cpp b/kstars/kstarslite/skyitems/rootnode.cpp
index 4020837..1c9eb3e 100644
--- a/kstars/kstarslite/skyitems/rootnode.cpp
+++ b/kstars/kstarslite/skyitems/rootnode.cpp
@@ -31,6 +31,7 @@
#include "kstarslite/skyitems/constellationartitem.h"
#include "kstarslite/skyitems/satellitesitem.h"
#include "kstarslite/skyitems/supernovaeitem.h"
+#include "kstarslite/skyitems/syncedcatalogitem.h"
//Lines
#include "kstarslite/skyitems/lines/equatoritem.h"
@@ -93,6 +94,9 @@ RootNode::RootNode()
m_FOVItem = new FOVItem(this);
+ m_internedResolvedCatalogItem = new SyncedCatalogItem(m_skyComposite->internetResolvedComponent(), this);
+ m_manualAdditionsCatalogItem = new SyncedCatalogItem(m_skyComposite->manualAdditionsComponent(), this);
+
#ifdef HAVE_INDI
m_telescopeSymbols = new TelescopeSymbolsItem(this);
#endif
@@ -260,6 +264,9 @@ void RootNode::update(bool clearTextures) {
m_snovaItem->update();
m_horizonItem->update();
+ m_internedResolvedCatalogItem->update();
+ m_manualAdditionsCatalogItem->update();
+
#ifdef HAVE_INDI
m_telescopeSymbols->update();
#endif
diff --git a/kstars/kstarslite/skyitems/rootnode.h b/kstars/kstarslite/skyitems/rootnode.h
index ce68719..cd2e4c1 100644
--- a/kstars/kstarslite/skyitems/rootnode.h
+++ b/kstars/kstarslite/skyitems/rootnode.h
@@ -45,6 +45,8 @@ class MilkyWayItem;
class SkyMapComposite;
class SolarSystemComposite;
+class SyncedCatalogItem;
+
class FOVItem;
#ifdef HAVE_INDI
@@ -56,9 +58,9 @@ class TelescopeSymbolsItem;
* A QSGClipNode derived class used as a container for holding pointers to nodes and for clipping.
* Upon construction RootNode generates all textures that are used by PointNode.
*
- *@short A container for nodes that holds collection of textures for stars and provides clipping
- *@author Artem Fedoskin
- *@version 1.0
+ * @short A container for nodes that holds collection of textures for stars and provides clipping
+ * @author Artem Fedoskin
+ * @version 1.0
*/
class RootNode : public QSGClipNode {
@@ -85,7 +87,7 @@ public:
*/
void update(bool clearTextures = false);
- //Debug
+ /** Debug functions **/
void testLeakDelete();
void testLeakAdd();
@@ -123,6 +125,9 @@ private:
SatellitesItem *m_satItem;
SupernovaeItem *m_snovaItem;
+ SyncedCatalogItem *m_internedResolvedCatalogItem;
+ SyncedCatalogItem *m_manualAdditionsCatalogItem;
+
HorizonItem *m_horizonItem;
LinesItem *m_linesItem;
EquatorItem *m_equator;
diff --git a/kstars/kstarslite/skyitems/satellitesitem.cpp b/kstars/kstarslite/skyitems/satellitesitem.cpp
index f5cdf77..ef993b5 100644
--- a/kstars/kstarslite/skyitems/satellitesitem.cpp
+++ b/kstars/kstarslite/skyitems/satellitesitem.cpp
@@ -30,14 +30,7 @@
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));
- }
- }
+ recreateList();
}
void SatellitesItem::update() {
@@ -69,5 +62,11 @@ void SatellitesItem::update() {
}
void SatellitesItem::recreateList() {
-
+ QList<SatelliteGroup*> list = m_satComp->groups();
+ 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()));
+ }
+ }
}
diff --git a/kstars/kstarslite/skyitems/satellitesitem.h b/kstars/kstarslite/skyitems/satellitesitem.h
index 8ca6f2e..2328595 100644
--- a/kstars/kstarslite/skyitems/satellitesitem.h
+++ b/kstars/kstarslite/skyitems/satellitesitem.h
@@ -23,8 +23,8 @@ class SkyObject;
class SatellitesComponent;
/**
- * @class CometsItem
- * This class handles comets in SkyMapLite
+ * @class SatellitesItem
+ * This class handles representation of satellites in SkyMapLite
*
* @author Artem Fedoskin
* @version 1.0
@@ -34,19 +34,19 @@ class SatellitesItem : public SkyItem {
public:
/**
* @short Constructor
- * @param cometsList const reference to list of comets
+ * @param satComp - pointer to SatellitesComponent that handles data
* @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)
+ * SatelliteGroups from SatellitesComponent::groups())
*/
void recreateList();
/**
- * @short Determines the visibility of the object and its label and hides/updates them accordingly
+ * @short Update positions and visibility of satellites
*/
virtual void update() override;
diff --git a/kstars/kstarslite/skyitems/skynodes/constellationartnode.cpp b/kstars/kstarslite/skyitems/skynodes/constellationartnode.cpp
index f350d97..9a3a12f 100644
--- a/kstars/kstarslite/skyitems/skynodes/constellationartnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/constellationartnode.cpp
@@ -1,7 +1,7 @@
/** *************************************************************************
- pointsourcenode.cpp - K Desktop Planetarium
+ constellationartnode.cpp - K Desktop Planetarium
-------------------
- begin : 16/05/2016
+ begin : 02/06/2016
copyright : (C) 2016 by Artem Fedoskin
email : afedoskin3@gmail.com
***************************************************************************/
diff --git a/kstars/kstarslite/skyitems/skynodes/constellationartnode.h b/kstars/kstarslite/skyitems/skynodes/constellationartnode.h
index 36c440e..d4e241a 100644
--- a/kstars/kstarslite/skyitems/skynodes/constellationartnode.h
+++ b/kstars/kstarslite/skyitems/skynodes/constellationartnode.h
@@ -1,7 +1,7 @@
/** *************************************************************************
- pointsourcenode.h - K Desktop Planetarium
+ constellationartnode.h - K Desktop Planetarium
-------------------
- begin : 16/05/2016
+ begin : 02/06/2016
copyright : (C) 2016 by Artem Fedoskin
email : afedoskin3@gmail.com
***************************************************************************/
@@ -13,8 +13,8 @@
* (at your option) any later version. *
* *
***************************************************************************/
-#ifndef POINTSOURCENODE_H_
-#define POINTSOURCENODE_H_
+#ifndef CONSTELLATIONARTNODE_H
+#define CONSTELLATIONARTNODE_H
#include "skynode.h"
#include "../labelsitem.h"
@@ -25,11 +25,9 @@ class LabelNode;
class ConstellationsArt;
class QSGSimpleTextureNode;
-/** @class PointSourceNode
+/** @class ConstellationArtNode
*
- * 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
+ *@short A SkyNode derived class that represents ConstellationsArt object.
*@author Artem Fedoskin
*@version 1.0
*/
@@ -40,15 +38,13 @@ 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
+ * @param obj - a pointer to ConstellationsArt object that is represented by this node
*/
ConstellationArtNode(ConstellationsArt *obj);
/**
- * @short changePos changes the position m_point
- * @param pos new position
+ * @short changePos change the position of this node
+ * @param pos - new position
+ * @param positionangle - an angle of ConstellationsArt image rotation
*/
void changePos(QPointF pos, double positionangle);
diff --git a/kstars/kstarslite/skyitems/skynodes/crosshairnode.h b/kstars/kstarslite/skyitems/skynodes/crosshairnode.h
index 3cb3fe4..909a158 100644
--- a/kstars/kstarslite/skyitems/skynodes/crosshairnode.h
+++ b/kstars/kstarslite/skyitems/skynodes/crosshairnode.h
@@ -17,10 +17,11 @@
#define CROSSHAIRNODE_H_
#include "skynode.h"
-/** @class CrossHairNode
- *
- *@version 1.0
- */
+ /** @class CrossHairNode
+ *
+ * @short Represents crosshair of telescope in SkyMapLite
+ * @version 1.0
+ */
class EllipseNode;
class LineNode;
@@ -29,11 +30,22 @@ class QSGFlatColorMaterial;
class CrosshairNode : public SkyNode {
public:
+ /**
+ * @short Constructor. Initializes lines, ellipses and labels.
+ * @param baseDevice - pointer to telescope
+ */
CrosshairNode(INDI::BaseDevice *baseDevice, RootNode *rootNode);
+
+ /** Destructor. **/
~CrosshairNode();
+
+ /** @short Update position and visibility of crosshair based on the Alt, Az (or Ra and Dec)
+ of telescope **/
virtual void update() override;
- void setColor(QColor color);
virtual void hide() override;
+
+ /** @short Set color of crosshair **/
+ void setColor(QColor color);
private:
EllipseNode *el1;
EllipseNode *el2;
diff --git a/kstars/kstarslite/skyitems/skynodes/deepskynode.cpp b/kstars/kstarslite/skyitems/skynodes/deepskynode.cpp
index 1556862..b985cda 100644
--- a/kstars/kstarslite/skyitems/skynodes/deepskynode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/deepskynode.cpp
@@ -1,7 +1,7 @@
/** *************************************************************************
deepskynode.cpp - K Desktop Planetarium
-------------------
- begin : 20/05/2016
+ begin : 18/06/2016
copyright : (C) 2016 by Artem Fedoskin
email : afedoskin3@gmail.com
***************************************************************************/
@@ -28,22 +28,16 @@
#include "../labelsitem.h"
#include "labelnode.h"
-DeepSkyNode::DeepSkyNode(DeepSkyObject * skyObject, DSOSymbolNode *symbol, Trixel trixel,
- LabelsItem::label_t labelType)
+DeepSkyNode::DeepSkyNode(DeepSkyObject * skyObject, DSOSymbolNode *symbol, LabelsItem::label_t labelType,
+ short trixel)
:m_dso(skyObject),m_objImg(0), m_symbol(symbol), m_trixel(trixel), m_labelType(labelType),
m_label(0)
{
m_symbol->hide();
}
-void DeepSkyNode::destroy() {
- QSGNode *parent = m_symbol->parent();
- parent->removeChildNode(m_symbol);
-
+DeepSkyNode::~DeepSkyNode() {
if(m_label) SkyMapLite::rootNode()->labelsItem()->deleteLabel(m_label);
-
- delete m_symbol;
- delete this;
}
void DeepSkyNode::changePos(QPointF pos) {
@@ -123,7 +117,11 @@ void DeepSkyNode::update(bool drawImage, bool drawLabel, QPointF pos) {
// Draw label
if(drawLabel) {
if(!m_label) {
- m_label = SkyMapLite::rootNode()->labelsItem()->addLabel(m_dso, m_labelType, m_trixel);
+ if(m_trixel != -1) {
+ m_label = SkyMapLite::rootNode()->labelsItem()->addLabel(m_dso, m_labelType, m_trixel);
+ } else {
+ m_label = SkyMapLite::rootNode()->labelsItem()->addLabel(m_dso, m_labelType);
+ }
}
m_label->setLabelPos(pos);
} else if(m_label) {
diff --git a/kstars/kstarslite/skyitems/skynodes/deepskynode.h b/kstars/kstarslite/skyitems/skynodes/deepskynode.h
index 68f3247..6c9cee7 100644
--- a/kstars/kstarslite/skyitems/skynodes/deepskynode.h
+++ b/kstars/kstarslite/skyitems/skynodes/deepskynode.h
@@ -1,7 +1,7 @@
/** *************************************************************************
deepskynode.h - K Desktop Planetarium
-------------------
- begin : 20/05/2016
+ begin : 18/06/2016
copyright : (C) 2016 by Artem Fedoskin
email : afedoskin3@gmail.com
***************************************************************************/
@@ -27,11 +27,12 @@ class DSOSymbolNode;
/** @class DeepSkyNode
*
- * A SkyNode derived class used for displaying PointNode with coordinates provided by SkyObject.
+ * @short A SkyNode derived class used for displaying DeepSkyObjects.
*
- *@short A SkyNode derived class that represents stars and objects that are drawn as stars
- *@author Artem Fedoskin
- *@version 1.0
+ * Keep in mind that DSO symbol is handled by DSOSymbolNode that has different parent from this node
+ * but DeepSkyNode calls update routines of DSOSymbolNode.
+ * @author Artem Fedoskin
+ * @version 1.0
*/
class RootNode;
@@ -39,22 +40,34 @@ class RootNode;
class DeepSkyNode : 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
+ * @short Constructor.
+ * @param skyObject - DSOs that is represented by this node
+ * @param symbol - DSOSymbolNode of this DSO
+ * @param trixel - trixelID, with which this node is indexed
*/
- DeepSkyNode(DeepSkyObject *skyObject, DSOSymbolNode *symbol, Trixel trixel, LabelsItem::label_t labelType);
+ DeepSkyNode(DeepSkyObject *skyObject, DSOSymbolNode *symbol, LabelsItem::label_t labelType, short trixel = -1);
/**
- * @short changePos changes the position m_point
+ * @short Destructor. Call delete routines of label
+ */
+ virtual ~DeepSkyNode();
+
+ /**
+ * @short changePos changes the position of this node and rotate it according to m_angle
* @param pos new position
*/
void changePos(QPointF pos);
- void destroy();
-
+ /**
+ * @short Update position and visibility of this node
+ * @param drawImage - true if image (if exists) should be drawn
+ * @param drawLabel - true if label should be drawn
+ * @param pos - new position of the object. If default parameter is passed, the visibility and
+ * position of node is calculated.
+ * There is one case when we pass this parameter - in DeepSkyItem::updateDeepSkyNode() when
+ * we check whether DeepSkyObject is visible or no and instantiate it accordingly. There is no
+ * need to calculate the position again and we pass it as a parameter.
+ */
void update(bool drawImage, bool drawLabel, QPointF pos = QPointF(-1,-1));
virtual void hide() override;
@@ -66,6 +79,8 @@ public:
void setColor(QColor color, TrixelNode *symbolTrixel);
DeepSkyObject *dsObject() { return m_dso; }
+ DSOSymbolNode *symbol() { return m_symbol; }
+
private:
QSGSimpleTextureNode *m_objImg;
Trixel m_trixel; //Trixel to which this object belongs. Used only in stars. By default -1 for all
diff --git a/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.cpp b/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.cpp
index 4b6fb62..48a0ed2 100644
--- a/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.cpp
@@ -385,13 +385,10 @@ void DSOSymbolNode::initSymbol() {
break;
}
if(m_symbol) addChildNode(m_symbol);
- else {
- qDebug() << "SHIT!";
- }
}
}
-void DSOSymbolNode::changePos(float size, const QPointF &pos, float positionangle) {
+void DSOSymbolNode::changePos(const QPointF &pos, float positionangle) {
QMatrix4x4 m (1,0,0,pos.x(),
0,1,0,pos.y(),
0,0,1,0,
@@ -400,7 +397,6 @@ void DSOSymbolNode::changePos(float size, const QPointF &pos, float positionangl
if(m_rotate) {
m.rotate(positionangle, 0, 0, 1);
}
- //m.translate(-0.5*size, -0.5*size);
setMatrix(m);
markDirty(QSGNode::DirtyMatrix);
@@ -413,10 +409,8 @@ void DSOSymbolNode::update(float size, const QPointF &pos, float positionangle)
if(m_symbol) {
m_symbol->updateSymbol(pos.x(), pos.y(), m_dso->e(), size);
show();
- changePos(size, pos, positionangle);
+ changePos(pos, positionangle);
} else {
- /*//Just a precaution in
- hide();*/
qDebug() << "Symbol for object " << m_dso->name() << " wasn't created. Check DSOSymbolNode::initSymbol()";
}
}
diff --git a/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.h b/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.h
index dc684f1..b3d7ab4 100644
--- a/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.h
+++ b/kstars/kstarslite/skyitems/skynodes/dsosymbolnode.h
@@ -1,7 +1,7 @@
/** *************************************************************************
dsosymbolnode.h - K Desktop Planetarium
-------------------
- begin : 20/05/2016
+ begin : 18/06/2016
copyright : (C) 2016 by Artem Fedoskin
email : afedoskin3@gmail.com
***************************************************************************/
@@ -26,19 +26,19 @@ class QSGSimpleTextureNode;
class EllipseNode;
class LineNode;
-/** @class DSOSymbolNode
- *
- * 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;
+/**
+ * @short A base class for all symbol nodes.
+ *
+ */
class SymbolNode : public QSGNode {
public:
+ /**
+ * @short Update size and the symbol itself. Each SymbolNode should override this function,
+ * and call SymbolNode::updateSymbol() in the beginning of overriden updateSymbol to
+ * initialize values that are used across all symbols.
+ */
virtual void updateSymbol(float x, float y, float e, float size);
protected:
SymbolNode() { }
@@ -137,18 +137,39 @@ public:
QSGGeometryNode *lines;
};
+/** @class DSOSymbolNode
+ *
+ *@short A SkyNode derived class used for Deep Sky symbols in SkyMapLite
+ *@author Artem Fedoskin
+ *@version 1.0
+ */
+
class DSOSymbolNode : 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
+ * @short Constructor.
+ * @param skyObject - DeepSkyObject, for which this symbol should be created
+ * @param color of the symbol
*/
DSOSymbolNode(DeepSkyObject *skyObject, QColor color = QColor());
- void changePos(float size, const QPointF &pos, float positionangle);
+
+ /**
+ * @short Changes position and rotation angloe of the symbol
+ * @param pos - new position
+ * @param positionangle - rotation angle
+ */
+ void changePos(const QPointF &pos, float positionangle);
+ /**
+ * @short Update size and position of the symbol
+ * @param size - new size of symbol
+ * @param pos - new position
+ * @param positionangle - new rotation angle
+ */
void update(float size, const QPointF &pos, float positionangle);
+
+ /**
+ * @short Create SymbolNode based on the type of m_dso
+ */
void initSymbol();
QColor getColor() { return m_color; }
private:
diff --git a/kstars/kstarslite/skyitems/skynodes/fovsymbolnode.cpp b/kstars/kstarslite/skyitems/skynodes/fovsymbolnode.cpp
index 1afd8cc..ff9d65b 100644
--- a/kstars/kstarslite/skyitems/skynodes/fovsymbolnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/fovsymbolnode.cpp
@@ -49,11 +49,11 @@ FOVSymbolNode::FOVSymbolNode(const QString &name, float a, float b, float xoffse
case FOVItem::BULLSEYE:
m_symbol = new BullsEyeFOV();
break;
- case FOVItem::SOLIDCIRCLE: {
+ case FOVItem::SOLIDCIRCLE:
m_symbol = new SolidCircleFOV();
break;
- }
- default: ;
+ default:
+ break;
}
if(m_symbol) addChildNode(m_symbol);
diff --git a/kstars/kstarslite/skyitems/skynodes/fovsymbolnode.h b/kstars/kstarslite/skyitems/skynodes/fovsymbolnode.h
index e8d33b9..a913f23 100644
--- a/kstars/kstarslite/skyitems/skynodes/fovsymbolnode.h
+++ b/kstars/kstarslite/skyitems/skynodes/fovsymbolnode.h
@@ -36,17 +36,19 @@ class RectNode;
class FOVSymbolBase : public QSGTransformNode {
public:
/**
- * @brief updateSymbol updates geometry (position, size) of elements of this FOV symbol
+ * @short updates geometry (position, size) of elements of this FOV symbol
*/
virtual void updateSymbol(QColor color, float pixelSizeX, float pixelSizeY ) =0;
+
+ /** @short return type of this FOV symbol **/
FOVItem::Shape type() { return m_shape; }
protected:
/**
* @param shape of the symbol. Each subclass sets its own type. Returned in type()
*/
FOVSymbolBase(FOVItem::Shape shape);
-/* QImage m_image; //Not supported yet
- bool m_imageDisplay;*/
+ /* QImage m_image; //Not supported yet
+ bool m_imageDisplay;*/
FOVItem::Shape m_shape;
};
@@ -95,22 +97,25 @@ private:
EllipseNode *el;
};
-/** @class FOVSymbolNode
- *
- * A SkyNode derived class used for displaying FOV symbol. FOVSymbolNade handles creation of FOVSymbolBase
- * and its update.
- *
- *@short A SkyNode derived class that is used for displaying FOV symbol
- *@author Artem Fedoskin
- *@version 1.0
- */
+ /** @class FOVSymbolNode
+ *
+ * A SkyNode derived class used for displaying FOV symbol. FOVSymbolNade handles creation of FOVSymbolBase
+ * and its update.
+ *
+ *@short A SkyNode derived class that is used for displaying FOV symbol
+ *@author Artem Fedoskin
+ *@version 1.0
+ */
class FOVSymbolNode : public SkyNode {
public:
+ /**
+ * @short Constructor. Initialize m_symbol according to shape
+ * @param name - name of the FOV symbol (used to switch it on/off through SkyMapLite from QML)
+ */
FOVSymbolNode(const QString &name, float a, float b, float xoffset, float yoffset, float rot, FOVItem::Shape shape = FOVItem::SQUARE, const QString &color = "#FFFFFF");
/**
- * @brief updates
- * @param zoomFactor
+ * @short Update this FOV symbol according to the zoomFactor
*/
void update(float zoomFactor);
diff --git a/kstars/kstarslite/skyitems/skynodes/guidelabelnode.h b/kstars/kstarslite/skyitems/skynodes/guidelabelnode.h
index f747e99..eea5a12 100644
--- a/kstars/kstarslite/skyitems/skynodes/guidelabelnode.h
+++ b/kstars/kstarslite/skyitems/skynodes/guidelabelnode.h
@@ -26,11 +26,9 @@ class PointNode;
class QSGSimpleTextureNode;
class SkyLabeler;
-/** @class LabelNode
+/** @class GuideLabelNode
+ * Currnently this class is not used anywhere.
*
- * 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
*/
diff --git a/kstars/kstarslite/skyitems/skynodes/horizonnode.cpp b/kstars/kstarslite/skyitems/skynodes/horizonnode.cpp
index 10a22dc..3bf96d8 100644
--- a/kstars/kstarslite/skyitems/skynodes/horizonnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/horizonnode.cpp
@@ -19,7 +19,6 @@ void HorizonNode::update() {
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());
@@ -36,7 +35,6 @@ void HorizonNode::update() {
return;
}
m_polygonNode->markDirty(QSGNode::DirtyGeometry);
-
}
void HorizonNode::hide() {
diff --git a/kstars/kstarslite/skyitems/skynodes/horizonnode.h b/kstars/kstarslite/skyitems/skynodes/horizonnode.h
index db540cf..92bb613 100644
--- a/kstars/kstarslite/skyitems/skynodes/horizonnode.h
+++ b/kstars/kstarslite/skyitems/skynodes/horizonnode.h
@@ -20,14 +20,21 @@
class PolyNode;
/** @class HorizonNode
+ * @short This node is a parent of nodes that comprise horizon and both filled and non-filled ground
*
- *@version 1.0
+ * @version 1.0
+ * @author Artem Fedoskin
*/
class HorizonNode : public SkyNode {
public:
+ /**
+ * @short Constructor.
+ * @param pointList - list of points that comprise horizon
+ */
HorizonNode(QList<SkyPoint*>& pointList);
+ /** @short Update child nodes based on user settings (filled/non-filled ground) and their visibility **/
virtual void update() override;
virtual void hide() override;
diff --git a/kstars/kstarslite/skyitems/skynodes/labelnode.cpp b/kstars/kstarslite/skyitems/skynodes/labelnode.cpp
index 635e7cd..cb11efd 100644
--- a/kstars/kstarslite/skyitems/skynodes/labelnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/labelnode.cpp
@@ -24,14 +24,13 @@
LabelNode::LabelNode(SkyObject * skyObject, LabelsItem::label_t type)
:SkyNode(skyObject), m_name(skyObject->labelString()), m_textTexture(new QSGSimpleTextureNode),
- m_zoomFont(false), m_labelType(type), m_fontSize(0)
+ m_labelType(type), m_fontSize(0), m_zoomFont(false)
{
initialize();
}
LabelNode::LabelNode(QString name, LabelsItem::label_t type)
- :m_name(name), m_textTexture(new QSGSimpleTextureNode), m_labelType(type), m_zoomFont(false),
- m_fontSize(0)
+ :m_name(name), m_textTexture(new QSGSimpleTextureNode), m_labelType(type), m_fontSize(0), m_zoomFont(false)
{
initialize();
}
@@ -58,6 +57,7 @@ void LabelNode::initialize() {
case LabelsItem::label_t::DSO_NGC_LABEL:
case LabelsItem::label_t::DSO_IC_LABEL:
case LabelsItem::label_t::DSO_OTHER_LABEL:
+ case LabelsItem::label_t::CATALOG_DSO_LABEL:
m_schemeColor = "DSNameColor";
m_zoomFont = true;
break;
@@ -69,9 +69,9 @@ void LabelNode::initialize() {
m_schemeColor = "CNameColor";
break;
case LabelsItem::label_t::STAR_LABEL:
+ case LabelsItem::label_t::CATALOG_STAR_LABEL:
m_schemeColor = "SNameColor";
break;
-
default:
m_schemeColor = "UserLabelColor";
break;
@@ -141,6 +141,5 @@ void LabelNode::update() {
if((m_zoomFont && m_fontSize != SkyLabeler::Instance()->skyFont().pointSize()) || m_color != newColor) {
createTexture(newColor);
}
-
changePos(labelPos);
}
diff --git a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp
index d648087..0462092 100644
--- a/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/nodes/linenode.cpp
@@ -23,8 +23,8 @@
#include <QLinkedList>
LineNode::LineNode(LineList *lineList, SkipList *skipList, QColor color, int width, Qt::PenStyle drawStyle)
- :m_lineList(lineList), m_skipList(skipList), m_geometryNode(new QSGGeometryNode),
- m_drawStyle(drawStyle), m_material(new QSGFlatColorMaterial)
+ :m_geometryNode(new QSGGeometryNode), m_lineList(lineList), m_skipList(skipList),
+ m_material(new QSGFlatColorMaterial), m_drawStyle(drawStyle)
{
m_geometryNode->setOpaqueMaterial(m_material);
//m_geometryNode->setFlag(QSGNode::OwnsMaterial);
diff --git a/kstars/kstarslite/skyitems/skynodes/pointsourcenode.cpp b/kstars/kstarslite/skyitems/skynodes/pointsourcenode.cpp
index 2516a19..8907046 100644
--- a/kstars/kstarslite/skyitems/skynodes/pointsourcenode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/pointsourcenode.cpp
@@ -54,7 +54,7 @@ float PointSourceNode::starWidth(float mag) const
}
PointSourceNode::~PointSourceNode() {
- if(m_label && m_labelType == LabelsItem::label_t::STAR_LABEL) {
+ if(m_label && (m_labelType == LabelsItem::label_t::STAR_LABEL || m_labelType == LabelsItem::label_t::CATALOG_STAR_LABEL)) {
m_rootNode->labelsItem()->deleteLabel(m_label);
}
}
diff --git a/kstars/kstarslite/skyitems/skynodes/skynode.cpp b/kstars/kstarslite/skyitems/skynodes/skynode.cpp
index c61a9e5..b16adc9 100644
--- a/kstars/kstarslite/skyitems/skynodes/skynode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/skynode.cpp
@@ -18,13 +18,13 @@
#include "skynode.h"
SkyNode::SkyNode(SkyObject * skyObject)
- :m_skyObject(skyObject), m_opacity(new SkyOpacityNode), m_drawLabel(false), m_hideCount(0)
+ :m_opacity(new SkyOpacityNode), m_skyObject(skyObject), m_drawLabel(false), m_hideCount(0)
{
appendChildNode(m_opacity);
}
SkyNode::SkyNode()
- :m_skyObject(nullptr), m_opacity(new SkyOpacityNode), m_drawLabel(false)
+ :m_opacity(new SkyOpacityNode), m_skyObject(nullptr), m_drawLabel(false)
{
appendChildNode(m_opacity);
}
diff --git a/kstars/kstarslite/skyitems/skynodes/skynode.h b/kstars/kstarslite/skyitems/skynodes/skynode.h
index 8b9b95e..9e1727a 100644
--- a/kstars/kstarslite/skyitems/skynodes/skynode.h
+++ b/kstars/kstarslite/skyitems/skynodes/skynode.h
@@ -105,9 +105,8 @@ public:
protected:
SkyObject * m_skyObject;
- int m_hideCount;
-
bool m_drawLabel;
+ int m_hideCount;
};
diff --git a/kstars/kstarslite/skyitems/skynodes/skypolygonnode.cpp b/kstars/kstarslite/skyitems/skynodes/skypolygonnode.cpp
index 00e0d30..ca35a01 100644
--- a/kstars/kstarslite/skyitems/skynodes/skypolygonnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/skypolygonnode.cpp
@@ -22,7 +22,7 @@
SkyPolygonNode::SkyPolygonNode(LineList* list)
:m_list(list), m_polygonNode(new PolyNode)
{
- //addChildNode(m_polygonNode);
+ addChildNode(m_polygonNode);
}
void SkyPolygonNode::update(bool forceClip) {
@@ -88,29 +88,6 @@ void SkyPolygonNode::update(bool forceClip) {
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) {
diff --git a/kstars/kstarslite/skyitems/skynodes/skypolygonnode.h b/kstars/kstarslite/skyitems/skynodes/skypolygonnode.h
index c7e0ce4..5f57936 100644
--- a/kstars/kstarslite/skyitems/skynodes/skypolygonnode.h
+++ b/kstars/kstarslite/skyitems/skynodes/skypolygonnode.h
@@ -32,10 +32,9 @@ public:
virtual void hide() override;
LineList *lineList() { return m_list; }
void setColor(QColor color);
-
private:
- PolyNode *m_polygonNode;
LineList *m_list;
+ PolyNode *m_polygonNode;
};
diff --git a/kstars/kstarslite/skyitems/skynodes/trixelnode.cpp b/kstars/kstarslite/skyitems/skynodes/trixelnode.cpp
index 26e63e3..66fe780 100644
--- a/kstars/kstarslite/skyitems/skynodes/trixelnode.cpp
+++ b/kstars/kstarslite/skyitems/skynodes/trixelnode.cpp
@@ -17,10 +17,27 @@
#include "skymaplite.h"
#include "trixelnode.h"
#include <QSGSimpleTextureNode>
+#include "skynode.h"
TrixelNode::TrixelNode(Trixel trixel)
:m_trixel(trixel)
{
+
+}
+
+void TrixelNode::deleteAllChildNodes() {
+ QLinkedList<QPair<SkyObject *, SkyNode *>>::iterator i = m_nodes.begin();
+
+ while(i != m_nodes.end()) {
+ SkyNode *node = (*i).second;
+ if(node) {
+ removeChildNode(node);
+ delete node;
+
+ *i = QPair<SkyObject *, SkyNode *>((*i).first, 0);
+ }
+ i++;
+ }
}
void TrixelNode::hide() {
diff --git a/kstars/kstarslite/skyitems/skynodes/trixelnode.h b/kstars/kstarslite/skyitems/skynodes/trixelnode.h
index 95ec593..4cb4d36 100644
--- a/kstars/kstarslite/skyitems/skynodes/trixelnode.h
+++ b/kstars/kstarslite/skyitems/skynodes/trixelnode.h
@@ -22,11 +22,20 @@
class SkyObject;
class SkyNode;
+/**
+ * @short Convenience class that represents trixel in SkyMapLite. It should be used as a parent for
+ * nodes that represent SkyObjects indexed by HTMesh
+ */
class TrixelNode : public SkyOpacityNode {
public:
+ /** Constructor. **/
TrixelNode(Trixel trixel);
+ /** m_hideCount is a counter of how much updates of SkyMapLite this trixel remained
+ hidden. Used to reduce memory consumption**/
inline int hideCount() { return m_hideCount; }
+
+ /** Whenever the corresponding trixel is visible, m_hideCount is reset */
inline void resetHideCount() { m_hideCount = 0; }
void virtual hide() override;
@@ -34,8 +43,14 @@ public:
inline Trixel trixelID() { return m_trixel; }
+ /**
+ * @short m_nodes - holds SkyNodes with corresponding SkyObjects
+ */
QLinkedList<QPair<SkyObject *, SkyNode *>> m_nodes;
+ /** @short Delete all childNodes and remove nodes from pairs in m_nodes **/
+ virtual void deleteAllChildNodes();
+
private:
Trixel m_trixel;
int m_hideCount;
diff --git a/kstars/kstarslite/skyitems/staritem.cpp b/kstars/kstarslite/skyitems/staritem.cpp
index fe29955..18c5069 100644
--- a/kstars/kstarslite/skyitems/staritem.cpp
+++ b/kstars/kstarslite/skyitems/staritem.cpp
@@ -190,18 +190,7 @@ void StarItem::update() {
label->hide();
if(trixel->hideCount() > delLim) {
- QLinkedList<QPair<SkyObject *, SkyNode *>>::iterator i = trixel->m_nodes.begin();
-
- while(i != trixel->m_nodes.end()) {
- SkyNode *node = (*i).second;
- if(node) {
- trixel->removeChildNode(node);
- delete node;
-
- *i = QPair<SkyObject *, SkyNode *>((*i).first, 0);
- }
- i++;
- }
+ trixel->deleteAllChildNodes();
}
} else {
trixel->show();
@@ -282,7 +271,6 @@ void StarItem::update() {
deepStars->update();
}
-
QSGNode *n = m_stars->firstChild();
while(n != 0) {
n = n->nextSibling();
diff --git a/kstars/kstarslite/skyitems/staritem.h b/kstars/kstarslite/skyitems/staritem.h
index a32383e..d512ba4 100644
--- a/kstars/kstarslite/skyitems/staritem.h
+++ b/kstars/kstarslite/skyitems/staritem.h
@@ -39,7 +39,10 @@ public:
StarItem(StarComponent *starComp, RootNode *rootNode);
/**
- * @short updates all trixels that contain stars
+ * @short Update positions of nodes that represent stars
+ * In this function we perform almost the same thing as in DeepSkyItem::updateDeepSkyNode() to reduce
+ * memory consumption.
+ * @see DeepSkyItem::updateDeepSkyNode()
*/
virtual void update();
diff --git a/kstars/kstarslite/skyitems/supernovaeitem.cpp b/kstars/kstarslite/skyitems/supernovaeitem.cpp
index c1fafd9..e10159c 100644
--- a/kstars/kstarslite/skyitems/supernovaeitem.cpp
+++ b/kstars/kstarslite/skyitems/supernovaeitem.cpp
@@ -31,10 +31,7 @@
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));
- }
+ recreateList();
}
void SupernovaeItem::update() {
@@ -55,5 +52,8 @@ void SupernovaeItem::update() {
}
void SupernovaeItem::recreateList() {
-
+ foreach ( SkyObject *so, m_snovaComp->objectList() ) {
+ Supernova *sup = (Supernova*) so;
+ appendChildNode(new SupernovaNode(sup));
+ }
}
diff --git a/kstars/kstarslite/skyitems/supernovaeitem.h b/kstars/kstarslite/skyitems/supernovaeitem.h
index d747de0..a48ea98 100644
--- a/kstars/kstarslite/skyitems/supernovaeitem.h
+++ b/kstars/kstarslite/skyitems/supernovaeitem.h
@@ -23,8 +23,8 @@ class SkyObject;
class SupernovaeComponent;
/**
- * @class SupernovaItem
- * This class handles comets in SkyMapLite
+ * @class SupernovaeItem
+ * This class handles supernovae in SkyMapLite
*
* @author Artem Fedoskin
* @version 1.0
@@ -34,19 +34,19 @@ class SupernovaeItem : public SkyItem {
public:
/**
* @short Constructor
- * @param cometsList const reference to list of comets
+ * @param snovaComp - pointer to SupernovaeComponent that handles data
* @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)
+ * @short Recreate the node tree (delete old nodes and append new ones according to
+ * SupernovaeItem::objectList())
*/
void recreateList();
/**
- * @short Determines the visibility of the object and its label and hides/updates them accordingly
+ * @short Update positions and visibility of supernovae
*/
virtual void update() override;
diff --git a/kstars/kstarslite/skyitems/syncedcatalogitem.cpp b/kstars/kstarslite/skyitems/syncedcatalogitem.cpp
new file mode 100644
index 0000000..7b5d957
--- /dev/null
+++ b/kstars/kstarslite/skyitems/syncedcatalogitem.cpp
@@ -0,0 +1,74 @@
+#include "syncedcatalogitem.h"
+#include "syncedcatalogcomponent.h"
+
+#include "skynodes/pointsourcenode.h"
+#include "skynodes/deepskynode.h"
+#include "skynodes/dsosymbolnode.h"
+
+SyncedCatalogItem::SyncedCatalogItem(SyncedCatalogComponent *parent, RootNode *rootNode)
+ :SkyItem(LabelsItem::label_t::NO_LABEL, rootNode), m_parent(parent), //It has NO_LABEL type because it handles two types of labels (CATALOG_STAR_LABEL and CATALOG_DSO_LABEL)
+ stars(new QSGNode), dsoSymbols(new QSGNode), dsoNodes(new QSGNode)
+{
+ appendChildNode(stars);
+ appendChildNode(dsoSymbols);
+ appendChildNode(dsoNodes);
+}
+
+void SyncedCatalogItem::update() {
+ if ( !m_parent->selected() ) {
+ hide();
+ return;
+ }
+ QColor catColor = m_parent->catColor();
+
+ // If an object was added/deleted to catalog or we are initializing it recreate all nodes
+ if(m_ObjectList != m_parent->objectList()) {
+ //Update coordinates of newly added objects
+ m_parent->update( 0 );
+
+ QSGNode *n;
+ //Clear all nodes
+ while( (n = stars->firstChild()) ) { stars->removeChildNode(n); delete n; }
+ while( (n = dsoSymbols->firstChild()) ) { dsoSymbols->removeChildNode(n); delete n; }
+ while( (n = dsoNodes->firstChild()) ) { dsoNodes->removeChildNode(n); delete n; }
+
+ m_ObjectList = m_parent->objectList();
+
+ //Draw Custom Catalog objects
+ // FIXME: Improve using HTM!
+ foreach ( SkyObject *obj, m_ObjectList ) {
+ if ( obj->type()==0 ) {
+ StarObject *starObj = static_cast<StarObject*>(obj);
+ PointSourceNode *point = new PointSourceNode(starObj, rootNode(), LabelsItem::label_t::CATALOG_STAR_LABEL, starObj->spchar(), starObj->mag());
+ stars->appendChildNode(point);
+ } else {
+ DeepSkyObject *dsoObj = static_cast<DeepSkyObject*>(obj);
+ DSOSymbolNode *dsoSymbol = new DSOSymbolNode(dsoObj, catColor);
+ dsoSymbols->appendChildNode(dsoSymbol);
+
+ DeepSkyNode *dsoNode = new DeepSkyNode(dsoObj, dsoSymbol, LabelsItem::label_t::CATALOG_DSO_LABEL);
+ dsoNodes->appendChildNode(dsoNode);
+ }
+ }
+ }
+
+ // Check if the coordinates have been updated
+ if( m_parent->getUpdateID() != KStarsData::Instance()->updateID() )
+ m_parent->update( 0 );
+
+ //Update stars
+ QSGNode *n = stars->firstChild();
+ while(n) {
+ PointSourceNode *p = static_cast<PointSourceNode *>(n);
+ p->update();
+ n = n->nextSibling();
+ }
+
+ //Update DSOs
+ n = dsoNodes->firstChild();
+ while(n) {
+ DeepSkyNode *p = static_cast<DeepSkyNode *>(n);
+ p->update(true, false); //We don't draw labels for DSOs
+ n = n->nextSibling();
+ }
+}
diff --git a/kstars/kstarslite/skyitems/syncedcatalogitem.h b/kstars/kstarslite/skyitems/syncedcatalogitem.h
new file mode 100644
index 0000000..d4aa533
--- /dev/null
+++ b/kstars/kstarslite/skyitems/syncedcatalogitem.h
@@ -0,0 +1,57 @@
+/** *************************************************************************
+ syncedcatalogitem.h - K Desktop Planetarium
+ -------------------
+ begin : 03/09/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 SYNCEDCATALOGITEM_H_
+#define SYNCEDCATALOGITEM_H_
+
+ /**
+ * @class SyncedCatalogItem
+ * This class handles representation of objects from SyncedCatalogComponent in SkyMapLite
+ *
+ * @author Artem Fedoskin
+ * @version 1.0
+ */
+
+#include "skyitem.h"
+
+class SkyObject;
+class SyncedCatalogComponent;
+
+class SyncedCatalogItem : public SkyItem {
+public:
+ /**
+ * @short Constructor
+ * @param parent - pointer to SyncedCatalogComponent that handles data
+ * @param rootNode parent RootNode that instantiates this object
+ */
+ SyncedCatalogItem(SyncedCatalogComponent *parent, RootNode *rootNode);
+
+ /**
+ * @short Update positions and visibility of objects from this catalog.
+ * To check whether we need to create or delete nodes we compare m_ObjectList and
+ * SyncedCatalogComponent::objectList(). If objectList was changed we recreate the whole node tree to sync
+ * it with objectList.
+ */
+ virtual void update() override;
+
+private:
+ SyncedCatalogComponent *m_parent;
+ QList<SkyObject *> m_ObjectList;
+
+ QSGNode *stars;
+ QSGNode *dsoSymbols;
+ QSGNode *dsoNodes;
+};
+#endif
diff --git a/kstars/kstarslite/skyitems/telescopesymbolsitem.h b/kstars/kstarslite/skyitems/telescopesymbolsitem.h
index 1b3f0da..7e1f1e0 100644
--- a/kstars/kstarslite/skyitems/telescopesymbolsitem.h
+++ b/kstars/kstarslite/skyitems/telescopesymbolsitem.h
@@ -29,7 +29,7 @@ class ClientManagerLite;
/**
* @class TelescopeSymbolsItem
- * This class handles telescope symbols in SkyMapLite
+ * This class handles representation of telescope symbols in SkyMapLite
*
* @author Artem Fedoskin
* @version 1.0
@@ -39,13 +39,24 @@ class TelescopeSymbolsItem : public SkyItem {
public:
/**
* @short Constructor
- * @param asteroidsList const reference to list of asteroids
* @param rootNode parent RootNode that instantiates PlanetsItem
*/
TelescopeSymbolsItem(RootNode *rootNode);
+ /**
+ * @short Updates position and visibility of CrosshairNodes that represent telescope symbols
+ * If client is no more connected to host or device CrosshairNode is deleted.
+ */
virtual void update() override;
+
+ /**
+ * @short Add telescope symbol for device bd
+ */
void addTelescope(INDI::BaseDevice *bd);
+
+ /**
+ * @short Remove telescope symbol of device bd
+ */
void removeTelescope(INDI::BaseDevice *bd);
private:
diff --git a/kstars/kstarslite/skyitems/typedeflite.h b/kstars/kstarslite/skyitems/typedeflite.h
index adfb27c..96ef7ef 100644
--- a/kstars/kstarslite/skyitems/typedeflite.h
+++ b/kstars/kstarslite/skyitems/typedeflite.h
@@ -7,6 +7,6 @@
class SkyOpacityNode;
-typedef SkyOpacityNode LabelTypeNode;
+
#endif
diff --git a/kstars/kstarslite/skyobjectlite.h b/kstars/kstarslite/skyobjectlite.h
index 860ea5f..40b7bc7 100644
--- a/kstars/kstarslite/skyobjectlite.h
+++ b/kstars/kstarslite/skyobjectlite.h
@@ -21,8 +21,8 @@
#include <QObject>
/**
-* @class SkyPointLite
-* Wrapper for SkyPoint to allow access of some of its properties from QML
+* @class SkyObjectLite
+* Wrapper for SkyObject to allow access of some of its properties from QML
*
* @author Artem Fedoskin
* @version 1.0
@@ -32,9 +32,16 @@ class SkyObjectLite : public SkyPointLite {
Q_OBJECT
Q_PROPERTY(QString translatedName READ getTranslatedName NOTIFY translatedNameChanged)
public:
+ /** Constructor **/
SkyObjectLite();
+
+ /** @short sets SkyObject that is needed to be wrapped **/
void setObject(SkyObject *object);
+
+ /** @return translated name of currently wrapped SkyObject **/
Q_INVOKABLE QString getTranslatedName();
+
+ /** @return SkyObject that is being wrapped **/
SkyObject *getObject() const { return object; }
signals:
void translatedNameChanged(QString translatedName);
diff --git a/kstars/kstarslite/skypointlite.h b/kstars/kstarslite/skypointlite.h
index e5df1ae..ba52ad2 100644
--- a/kstars/kstarslite/skypointlite.h
+++ b/kstars/kstarslite/skypointlite.h
@@ -32,12 +32,13 @@ class SkyObject;
class SkyPointLite : public QObject {
Q_OBJECT
public:
+ /** Constructor **/
SkyPointLite();
+ /** @short sets SkyPoint that is needed to be wrapped **/
void setPoint(SkyPoint *point);
- /**
- * @return SkyPoint that is being wrapped
- */
+
+ /** @return SkyPoint that is being wrapped **/
Q_INVOKABLE SkyPoint *getPoint() { return point; }
private:
diff --git a/kstars/projections/projector.cpp b/kstars/projections/projector.cpp
index 0ad729c..f8e053d 100644
--- a/kstars/projections/projector.cpp
+++ b/kstars/projections/projector.cpp
@@ -277,7 +277,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() == SkyMap::Orthographic ) {
+ if ( type() == Projector::Orthographic ) {
daz = daz * 1.4;
}
daz = qMin(qreal(90.0), daz);
@@ -327,7 +327,7 @@ 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() == SkyMap::Gnomonic) {
+ if ( daz < 25.0 || type() == Projector::Gnomonic) {
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 ) );
@@ -473,7 +473,8 @@ Vector2f Projector::toScreenVec(const SkyPoint* o, bool oRefract, bool* onVisibl
}
qDebug() << "dX = " << dX << " and isfinite(dX) is" << std::isfinite(dX);
qDebug() << "Y = " << Y << " and isfinite(Y) is" << std::isfinite(Y);
- Q_ASSERT( false );
+ return Vector2f(0,0);
+ //Q_ASSERT( false );
}
dX = KSUtils::reduceAngle(dX, -dms::PI, dms::PI);
diff --git a/kstars/skycomponents/catalogcomponent.cpp b/kstars/skycomponents/catalogcomponent.cpp
index 964612b..7fa7bbb 100644
--- a/kstars/skycomponents/catalogcomponent.cpp
+++ b/kstars/skycomponents/catalogcomponent.cpp
@@ -67,7 +67,7 @@ void CatalogComponent::_loadData( bool includeCatalogDesignation ) {
names,
this,
includeCatalogDesignation);
- for (int iter = 0; iter < names.size(); iter++) {
+ for (int iter = 0; iter < names.size(); ++iter) {
if (names.at(iter).first <= SkyObject::TYPE_UNKNOWN) {
//FIXME JM 2016-06-02: inefficient and costly check
// Need better way around this
@@ -75,6 +75,36 @@ void CatalogComponent::_loadData( bool includeCatalogDesignation ) {
objectNames(names.at(iter).first).append(names.at(iter).second);
}
}
+#ifdef KSTARS_LITE
+ //FIXME - get rid of objectNames completely. For now only KStars Lite uses objectLists
+ for(int iter = 0; iter < m_ObjectList.size(); ++iter) {
+ SkyObject *obj = m_ObjectList[iter];
+ if(obj->type() <= SkyObject::TYPE_UNKNOWN) {
+ QVector<QPair<QString, const SkyObject *>>&objects = objectLists(obj->type());
+ bool dupName = false;
+ bool dupLongname = false;
+
+ QString name = obj->name();
+ QString longname = obj->longname();
+
+ //FIXME - find a better way to check for duplicates
+ for(int i = 0; i < objects.size(); ++i) {
+ if(name == objects.at(i).first)
+ dupName = true;
+ if(longname == objects.at(i).first)
+ dupLongname = true;
+ }
+
+ if(!dupName) {
+ objectLists(obj->type()).append(QPair<QString, const SkyObject *>(name, obj));
+ }
+
+ if(!longname.isEmpty() && !dupLongname && name != longname) {
+ objectLists(obj->type()).append(QPair<QString, const SkyObject *>(longname, obj));
+ }
+ }
+ }
+#endif
// Remove Duplicates
foreach(QStringList list, objectNames())
diff --git a/kstars/skycomponents/catalogcomponent.h b/kstars/skycomponents/catalogcomponent.h
index 1af73e2..4531d56 100644
--- a/kstars/skycomponents/catalogcomponent.h
+++ b/kstars/skycomponents/catalogcomponent.h
@@ -68,6 +68,9 @@ public:
/** @return the unit of the flux measurements in the catalog, if any */
inline QString fluxUnit() const { return m_catFluxUnit; }
+ /** @return color, which should be used for drawing objects in this catalog **/
+ inline QString catColor() { return m_catColor; }
+
/**
*@return true if visibility Option is set for this catalog
*@note this is complicated for custom catalogs, because
@@ -77,6 +80,18 @@ public:
*/
inline bool getVisibility() { return (Options::showCatalog()[m_ccIndex] > 0) ? true : false; }
+ /**
+ * @see SyncedCatalogItem
+ */
+ quint32 getUpdateID() { return updateID; }
+
+ /**
+ * @brief Returns true if this catalog is to be drawn
+ * Overridden from SkyComponent::selected
+ * @return bool
+ **/
+ virtual bool selected();
+
protected:
/** @short Load data into custom catalog */
@@ -87,14 +102,6 @@ protected:
// FIXME: There seems to be no way to remove catalogs from the program. -- asimha
- /**
- * @brief Returns true if this catalog is to be drawn
- * Overridden from SkyComponent::selected
- * @return bool
- **/
- virtual bool selected();
-
-
QString m_catName, m_catPrefix, m_catColor, m_catFluxFreq, m_catFluxUnit;
float m_catEpoch;
bool m_Showerrs;
diff --git a/kstars/skycomponents/skylabeler.cpp b/kstars/skycomponents/skylabeler.cpp
index 44de221..de5ad7a 100644
--- a/kstars/skycomponents/skylabeler.cpp
+++ b/kstars/skycomponents/skylabeler.cpp
@@ -370,6 +370,9 @@ void SkyLabeler::reset()
void SkyLabeler::draw(QPainter& p)
{
+#ifdef KSTARS_LITE
+ Q_UNUSED(p)
+#else
//FIXME: need a better soln. Apparently starting a painter
//clears the picture.
// But it's not like that's something that should be in the docs, right?
@@ -377,7 +380,8 @@ void SkyLabeler::draw(QPainter& p)
if( m_p.isActive() ) { m_p.end(); }
m_picture.play(&p); //can't replay while it's being painted on
//this is also undocumented btw.
- //m_p.begin(&m_picture);
+ m_p.begin(&m_picture);
+#endif
}
// We use Run Length Encoding to hold the information instead of an array of
diff --git a/kstars/skycomponents/skymapcomposite.cpp b/kstars/skycomponents/skymapcomposite.cpp
index 1111fd3..442e352 100644
--- a/kstars/skycomponents/skymapcomposite.cpp
+++ b/kstars/skycomponents/skymapcomposite.cpp
@@ -106,6 +106,15 @@ SkyMapComposite::SkyMapComposite(SkyComposite *parent ) :
addComponent( m_manualAdditionsComponent = new SyncedCatalogComponent( this, m_manualAdditionsCat, true, 0 ), 6 );
m_CustomCatalogs = new SkyComposite( this );
QStringList allcatalogs = Options::showCatalogNames();
+
+ if(!allcatalogs.contains(m_internetResolvedCat)) {
+ allcatalogs.append(m_internetResolvedCat);
+ }
+ if(!allcatalogs.contains(m_manualAdditionsCat)) {
+ allcatalogs.append(m_manualAdditionsCat);
+ }
+ Options::setShowCatalogNames(allcatalogs);
+
for ( int i=0; i < allcatalogs.size(); ++ i ) {
if( allcatalogs.at(i) == m_internetResolvedCat || allcatalogs.at(i) == m_manualAdditionsCat ) // This is a special catalog
continue;
diff --git a/kstars/skymaplite.cpp b/kstars/skymaplite.cpp
index b2582d1..3fb9441 100644
--- a/kstars/skymaplite.cpp
+++ b/kstars/skymaplite.cpp
@@ -95,15 +95,12 @@ SkyMapLite *SkyMapLite::pinstance = 0;
RootNode *SkyMapLite::m_rootNode = nullptr;
-int SkyMapLite::m_updatesCount = 0;
-int SkyMapLite::m_updatesCountTemp = 0;
-
int SkyMapLite::starColorMode = 0;
SkyMapLite::SkyMapLite()
:m_proj(0), count(0), data(KStarsData::Instance()),
nStarSizes(15), nSPclasses(7), pinch(false), m_loadingFinished(false), m_sizeMagLim(10.0),
- clearTextures(false), isInitialized(false)
+ isInitialized(false), clearTextures(false)
{
setAcceptHoverEvents(true);
setAcceptedMouseButtons(Qt::AllButtons);
@@ -126,10 +123,7 @@ SkyMapLite::SkyMapLite()
qmlRegisterType<SkyObjectLite>("KStarsLite",1,0,"SkyObjectLite");
qmlRegisterType<SkyPointLite>("KStarsLite",1,0,"SkyPointLite");
- m_timer.setInterval(1000);
- m_timer.start();
-
- connect(&m_timer, SIGNAL(timeout()), this, SLOT(setUpdateCounter()));
+ m_tapBeganTimer.setSingleShot(true);
setupProjector();
@@ -145,34 +139,22 @@ SkyMapLite::SkyMapLite()
connect(clientMng, &ClientManagerLite::telescopeAdded, [this](TelescopeLite *newTelescope){ this->m_newTelescopes.append(newTelescope->getDevice()); });
connect(clientMng, &ClientManagerLite::telescopeRemoved, [this](TelescopeLite *newTelescope){ this->m_delTelescopes.append(newTelescope->getDevice()); });
#endif
-
-}
-
-void SkyMapLite::setUpdateCounter() {
- m_updatesCount = m_updatesCountTemp;
- m_updatesCountTemp = 0;
}
-//void SkyMapLite::addTelescope(TelescopeLite *) {
-
-//}
-
-//void SkyMapLite::removeDevice(QString device) {
-
-//}
-
QSGNode* SkyMapLite::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) {
Q_UNUSED(updatePaintNodeData);
RootNode *n = static_cast<RootNode*>(oldNode);
- qDeleteAll(m_deleteNodes);
- m_deleteNodes.clear();
+ /* This code deletes all nodes that are representing dynamic stars and not needed anymore (under construction) */
+ //qDeleteAll(m_deleteNodes);
+ //m_deleteNodes.clear();
if(m_loadingFinished && isInitialized) {
if(!n) {
n = new RootNode();
m_rootNode = n;
}
+ /** Add or delete telescope crosshairs **/
#ifdef HAVE_INDI
if(m_newTelescopes.count() > 0) {
foreach(INDI::BaseDevice *telescope, m_newTelescopes) {
diff --git a/kstars/skymaplite.h b/kstars/skymaplite.h
index fb19834..7cb549b 100644
--- a/kstars/skymaplite.h
+++ b/kstars/skymaplite.h
@@ -75,32 +75,40 @@ class QSGTexture;
class SkyMapLite : public QQuickItem {
Q_OBJECT
+ /** magnitude limit. Used in QML **/
Q_PROPERTY(double magLim READ getMagLim WRITE setMagLim NOTIFY magLimChanged)
+ /** wrappers for clickedPoint and clickedObject. Used to set clicked object and point from QML **/
Q_PROPERTY(SkyPointLite *clickedPointLite READ getClickedPointLite NOTIFY pointLiteChanged)
Q_PROPERTY(SkyObjectLite *clickedObjectLite READ getClickedObjectLite NOTIFY objectLiteChanged)
+ /** list of FOVSymbols that are currently available **/
Q_PROPERTY(QStringList FOVSymbols READ getFOVSymbols NOTIFY symbolsFOVChanged)
+ /** true if SkyMapLite is being panned **/
Q_PROPERTY(bool slewing READ getSlewing WRITE setSlewing NOTIFY slewingChanged)
protected:
- /**
- *Constructor.
- */
+ /** Constructor. **/
explicit SkyMapLite();
+ /** Updates SkyMapLite by calling RootNode::update(), which in turn initiates update of all child nodes. **/
virtual QSGNode* updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData);
+ /** pointer to RootNode. Use it to universally access RootNode
+ * @warning RootNode should be used solely during updatePaintNode! See Qt Quick Scene Graph documentation.
+ **/
static RootNode *m_rootNode;
public:
+ /** Creates instance of SkyMapLite (delete the old one if any) **/
static SkyMapLite* createInstance();
+ /** Bind size to parent's size and initialize star images **/
void initialize(QQuickItem *parent);
static SkyMapLite* Instance() { return pinstance; }
static bool IsSlewing() { return pinstance->isSlewing(); }
- /** Destructor (empty) */
+ /** Destructor. Clear star images.*/
~SkyMapLite();
/**
@@ -109,143 +117,130 @@ public:
*/
void deleteSkyNode(SkyNode *skyNode);
- /** @short Retrieve the Focus point; the position on the sky at the
- *center of the skymap.
- *@return a pointer to the central focus point of the sky map
- */
-
- /** @return the angular field of view of the sky map, in degrees.
- *@note it must use either the height or the width of the window to calculate the
- *FOV angle. It chooses whichever is larger.
- */
- //float fov();
-
/** @short Update the focus position according to current options. */
void updateFocus();
/** @short Retrieve the Focus point; the position on the sky at the
- *center of the skymap.
- *@return a pointer to the central focus point of the sky map
- */
+ *center of the skymap.
+ *@return a pointer to the central focus point of the sky map
+ */
SkyPoint* focus() { return &Focus; }
/** @short retrieve the Destination position.
- *
- *The Destination is the point on the sky to which the focus will
- *be moved.
- *
- *@return a pointer to the destination point of the sky map
- */
+ *
+ *The Destination is the point on the sky to which the focus will be moved.
+ *@return a pointer to the destination point of the sky map
+ */
SkyPoint* destination() { return &Destination; }
/** @short retrieve the FocusPoint position.
- *
- *The FocusPoint stores the position on the sky that is to be
- *focused next. This is not exactly the same as the Destination
- *point, because when the Destination is set, it will begin slewing
- *immediately.
- *
- *@return a pointer to the sky point which is to be focused next.
- */
+ *
+ *The FocusPoint stores the position on the sky that is to be
+ *focused next. This is not exactly the same as the Destination
+ *point, because when the Destination is set, it will begin slewing
+ *immediately.
+ *
+ *@return a pointer to the sky point which is to be focused next.
+ */
SkyPoint* focusPoint() { return &FocusPoint; }
/** @short sets the central focus point of the sky map.
- *@param f a pointer to the SkyPoint the map should be centered on
- */
+ *@param f a pointer to the SkyPoint the map should be centered on
+ */
void setFocus( SkyPoint *f );
/** @short sets the focus point of the skymap, using ra/dec coordinates
- *
- *@note This function behaves essentially like the above function.
- *It differs only in the data types of its arguments.
- *
- *@param ra the new right ascension
- *@param dec the new declination
- */
+ *
+ *@note This function behaves essentially like the above function.
+ *It differs only in the data types of its arguments.
+ *
+ *@param ra the new right ascension
+ *@param dec the new declination
+ */
void setFocus( const dms &ra, const dms &dec );
/** @short sets the focus point of the sky map, using its alt/az coordinates
- *@param alt the new altitude
- *@param az the new azimuth
- */
+ *@param alt the new altitude
+ *@param az the new azimuth
+ */
void setFocusAltAz( const dms &alt, const dms & az);
/** @short sets the destination point of the sky map.
- *@note setDestination() emits the destinationChanged() SIGNAL,
- *which triggers the SLOT function SkyMap::slewFocus(). This
- *function iteratively steps the Focus point toward Destination,
- *repainting the sky at each step (if Options::useAnimatedSlewing()==true).
- *@param f a pointer to the SkyPoint the map should slew to
- */
+ *@note setDestination() emits the destinationChanged() SIGNAL,
+ *which triggers the SLOT function SkyMap::slewFocus(). This
+ *function iteratively steps the Focus point toward Destination,
+ *repainting the sky at each step (if Options::useAnimatedSlewing()==true).
+ *@param f a pointer to the SkyPoint the map should slew to
+ */
void setDestination( const SkyPoint& f );
/** @short sets the destination point of the skymap, using ra/dec coordinates.
- *
- *@note This function behaves essentially like the above function.
- *It differs only in the data types of its arguments.
- *
- *@param ra the new right ascension
- *@param dec the new declination
- */
+ *
+ *@note This function behaves essentially like the above function.
+ *It differs only in the data types of its arguments.
+ *
+ *@param ra the new right ascension
+ *@param dec the new declination
+ */
void setDestination( const dms &ra, const dms &dec );
/** @short sets the destination point of the sky map, using its alt/az coordinates.
- *@param alt the new altitude
- *@param az the new azimuth
- */
+ *@param alt the new altitude
+ *@param az the new azimuth
+ */
void setDestinationAltAz( const dms &alt, const dms & az);
/** @short set the FocusPoint; the position that is to be the next Destination.
- *@param f a pointer to the FocusPoint SkyPoint.
- */
+ *@param f a pointer to the FocusPoint SkyPoint.
+ */
void setFocusPoint( SkyPoint *f ) { if ( f ) FocusPoint = *f; }
/** @short Retrieve the ClickedPoint position.
- *
- *When the user clicks on a point in the sky map, the sky coordinates of the mouse
- *cursor are stored in the private member ClickedPoint. This function retrieves
- *a pointer to ClickedPoint.
- *@return a pointer to ClickedPoint, the sky coordinates where the user clicked.
- */
+ *
+ *When the user clicks on a point in the sky map, the sky coordinates of the mouse
+ *cursor are stored in the private member ClickedPoint. This function retrieves
+ *a pointer to ClickedPoint.
+ *@return a pointer to ClickedPoint, the sky coordinates where the user clicked.
+ */
SkyPoint* clickedPoint() { return &ClickedPoint; }
/** @short Set the ClickedPoint to the skypoint given as an argument.
- *@param f pointer to the new ClickedPoint.
- */
+ *@param f pointer to the new ClickedPoint.
+ */
void setClickedPoint( SkyPoint *f );
/** @short Retrieve the object nearest to a mouse click event.
- *
- *If the user clicks on the sky map, a pointer to the nearest SkyObject is stored in
- *the private member ClickedObject. This function returns the ClickedObject pointer,
- *or NULL if there is no CLickedObject.
- *@return a pointer to the object nearest to a user mouse click.
- */
+ *
+ *If the user clicks on the sky map, a pointer to the nearest SkyObject is stored in
+ *the private member ClickedObject. This function returns the ClickedObject pointer,
+ *or NULL if there is no CLickedObject.
+ *@return a pointer to the object nearest to a user mouse click.
+ */
SkyObject* clickedObject() const { return ClickedObject; }
/** @short Set the ClickedObject pointer to the argument.
- *@param o pointer to the SkyObject to be assigned as the ClickedObject
- */
+ *@param o pointer to the SkyObject to be assigned as the ClickedObject
+ */
void setClickedObject( SkyObject *o );
/** @short Retrieve the object which is centered in the sky map.
- *
- *If the user centers the sky map on an object (by double-clicking or using the
- *Find Object dialog), a pointer to the "focused" object is stored in
- *the private member FocusObject. This function returns a pointer to the
- *FocusObject, or NULL if there is not FocusObject.
- *@return a pointer to the object at the center of the sky map.
- */
+ *
+ *If the user centers the sky map on an object (by double-clicking or using the
+ *Find Object dialog), a pointer to the "focused" object is stored in
+ *the private member FocusObject. This function returns a pointer to the
+ *FocusObject, or NULL if there is not FocusObject.
+ *@return a pointer to the object at the center of the sky map.
+ */
SkyObject* focusObject() const { return FocusObject; }
/** @short Set the FocusObject pointer to the argument.
- *@param o pointer to the SkyObject to be assigned as the FocusObject
- */
+ *@param o pointer to the SkyObject to be assigned as the FocusObject
+ */
void setFocusObject( SkyObject *o );
/** @ Set zoom factor.
- *@param factor zoom factor
- */
+ *@param factor zoom factor
+ */
void setZoomFactor(double factor);
/** @short Call to set up the projector before update of SkyItems positions begins. */
@@ -267,7 +262,6 @@ public:
* @return QSGTexture with text
* @note font size is set in SkyLabeler::SkyLabeler() by initializing m_stdFont with default font
*/
-
QSGTexture *textToTexture(QString text, QColor color = QColor(255,255,255), bool zoomFont = false);
/**
@@ -281,21 +275,19 @@ public:
*/
QSGTexture* getCachedTexture(int size, char spType);
- /** Called when SkyMapComposite finished loading all SkyComponents */
+ /** @short called when SkyMapComposite finished loading all SkyComponents */
inline void loadingFinished() { m_loadingFinished = true; }
+ /** @return true if the map is in slewing mode or clock is active **/
bool isSlewing() const;
+ /** @return current magnitude limit **/
inline double getMagLim() { return m_magLim; }
+ /** @short set magnitude limit **/
void setMagLim(double magLim);
- // NOTE: This method is draw-backend independent.
- /** @short update the geometry of the angle ruler. */
- //void updateAngleRuler();
-
- /*@*@short Convenience function for shutting off tracking mode. Just calls KStars::slotTrack().
- */
+ /** @short Convenience function for shutting off tracking mode. Just calls KStars::slotTrack() **/
void stopTracking();
/** Get the current projector.
@@ -318,8 +310,6 @@ public:
static inline void setRootNode(RootNode *root) { m_rootNode = root; }
- static inline int updatesCount() { return m_updatesCount; }
-
/** return limit of hides for the node to delete it **/
static double deleteLimit();
@@ -374,20 +364,6 @@ public:
*/
void setSlewing(bool newSlewing);
- /*void setPreviewLegend(bool preview) { m_previewLegend = preview; }
-
- void setLegend(const Legend &legend) { m_legend = legend; }
-
- bool isInObjectPointingMode() const { return m_objPointingMode; }
-
- void setObjectPointingMode(bool enabled) { m_objPointingMode = enabled; }
-
- void setFovCaptureMode(bool enabled) { m_fovCaptureMode = enabled; }
-
- bool isInFovCaptureMode() const { return m_fovCaptureMode; }
-
- SkyPoint getCenterPoint();*/
-
public slots:
/** Called whenever wrappers' width or height are changed. Probably will be used to
* update positions of items.
@@ -409,18 +385,6 @@ public slots:
*/
void slotUpdateSky( bool now );
- /** Toggle visibility of geo infobox */
- //void slotToggleGeoBox(bool);
-
- /** Toggle visibility of focus infobox */
- //void slotToggleFocusBox(bool);
-
- /** Toggle visibility of time infobox */
- //void slotToggleTimeBox(bool);
-
- /** Toggle visibility of all infoboxes */
- //void slotToggleInfoboxes(bool);
-
/** Step the Focus point toward the Destination point. Do this iteratively, redrawing the Sky
* Map after each step, until the Focus point is within 1 step of the Destination point.
* For the final step, snap directly to Destination, and redraw the map.
@@ -439,39 +403,11 @@ public slots:
*/
void slotCenter();
- /** @short Popup menu function: Display 1st-Generation DSS image with the Image Viewer.
- * @note the URL is generated using the coordinates of ClickedPoint.
- */
- //void slotDSS();
-
- /** @short Popup menu function: Display Sloan Digital Sky Survey image with the Image Viewer.
- * @note the URL is generated using the coordinates of ClickedPoint.
- */
- //void slotSDSS();
-
- /** @short Popup menu function: Show webpage about ClickedObject
- * (only available for some objects).
- */
- //void slotInfo();
-
- /** @short Popup menu function: Show image of ClickedObject
- * (only available for some objects).
- */
- //void slotImage();
-
- /** @short Popup menu function: Show the Detailed Information window for ClickedObject. */
- //void slotDetail();
-
/** Checks whether the timestep exceeds a threshold value. If so, sets
* ClockSlewing=true and sets the SimClock to ManualMode.
*/
void slotClockSlewing();
- // void slotBeginStarHop(); // TODO: Add docs
-
- /** Render eyepiece view */
- //void slotEyepieceView();
-
/** Zoom in one step. */
void slotZoomIn();
@@ -486,11 +422,6 @@ public slots:
*/
void slotSelectObject(SkyObject *skyObj);
- /** Object pointing for Printing Wizard done */
- //void slotObjectSelected();
-
- //void slotCancelLegendPreviewMode();
-
/**
* @short slotGyroMove called when m_gyroSensor got new reading. Moves focus of SkyMapLite according
* to coordinates received from gyroscope
@@ -591,11 +522,6 @@ protected:
*/
virtual void touchEvent( QTouchEvent *e);
- /** If the skymap will be resized, the sky must be new computed. So this
- * function calls explicitly new computing of the skymap.
- */
- //virtual void resizeEvent( QResizeEvent * );
-
private slots:
/** @short display tooltip for object under cursor. It's called by m_HoverTimer.
* if mouse didn't moved for last HOVER_INTERVAL milliseconds.
@@ -604,16 +530,6 @@ private slots:
/** Set the shape of mouse cursor to a cross with 4 arrows. */
void setMouseMoveCursor();
-
- /** resets updates counter **/
- void setUpdateCounter();
-
-// /** adds telescope to TelescopeSymbolsItem **/
-// void addTelescope(TelescopeLite *);
-
-// /** deletes all device-related SkyItems or SkyNodes **/
-// void removeDevice(QString device);
-
private:
/** @short Sets the shape of the default mouse cursor to a cross. */
@@ -713,26 +629,20 @@ private:
static SkyMapLite *pinstance;
QQuickItem *m_SkyMapLiteWrapper;
- QTimer m_timer;
- static int m_updatesCount; // To count the number of updates per second
- static int m_updatesCountTemp;
-
- //Holds SkyNodes that need to be deleted
+ ///Holds SkyNodes that need to be deleted
QLinkedList<SkyNode *> m_deleteNodes;
float m_sizeMagLim; //Used in PointSourceNode
double m_magLim; //Mag limit for all objects
- // Used to notify zoom-dependent labels about font size change
+ /// Used to notify zoom-dependent labels about font size change
bool m_fontSizeChanged;
- // Used for drawing labels
+ /// Used for drawing labels
QPainter m_painter;
- //Sensors
- /*QTapSensor *m_tapSensor;
- QMagnetometer *m_magnetometer;
- QCompass *m_compass;
- QRotationSensor *m_rotation;*/
+ /** This timer is triggered every time user touches the screen with one finger. If touch was released
+ within 500 milliseconds than it is a tap, otherwise we pan. **/
+ QTimer m_tapBeganTimer;
static int starColorMode;
diff --git a/kstars/skymapliteevents.cpp b/kstars/skymapliteevents.cpp
index 34a45c4..f8a92bb 100644
--- a/kstars/skymapliteevents.cpp
+++ b/kstars/skymapliteevents.cpp
@@ -343,16 +343,19 @@ void SkyMapLite::touchEvent( QTouchEvent *e) {
if( !tapBegan && (e->touchPointStates() & Qt::TouchPointPressed) ) {
//We set tapBegan to true whenever user tapped on the screen
tapBegan = true;
+ m_tapBeganTimer.start(100);
} else if((e->touchPointStates() & Qt::TouchPointMoved) || getSlewing()) {
//Set tapBegan to false because user doesn't tap but either pans or pinches to zoom
+ if(m_tapBeganTimer.remainingTime() > 0) {
+ return;
+ } else {
+ m_tapBeganTimer.stop();
+ }
tapBegan = false;
QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonPress, point,
Qt::LeftButton, Qt::LeftButton, Qt::ControlModifier);
-
mouseMoveEvent(event);
-
-
delete event;
//If user didn't pan and pinch to zoom tapBegan will be true
diff --git a/kstars/skyobjects/skyobject.cpp b/kstars/skyobjects/skyobject.cpp
index 167a7b2..c064d47 100644
--- a/kstars/skyobjects/skyobject.cpp
+++ b/kstars/skyobjects/skyobject.cpp
@@ -88,14 +88,18 @@ SkyObject* SkyObject::clone() const
SkyObject::~SkyObject() {}
void SkyObject::showPopupMenu( KSPopupMenu *pmenu, const QPoint &pos ) {
-#ifndef KSTARS_LITE
+#ifdef KSTARS_LITE
+ Q_UNUSED(pos)
+#else
initPopupMenu( pmenu );
pmenu->popup( pos );
#endif
}
void SkyObject::initPopupMenu( KSPopupMenu *pmenu ) {
-#ifndef KSTARS_LITE
+#ifdef KSTARS_LITE
+ Q_UNUSED(pmenu)
+#else
pmenu->createEmptyMenu( this );
#endif
}
diff --git a/kstars/tools/nameresolver.cpp b/kstars/tools/nameresolver.cpp
index 6016db0..1cccb8a 100644
--- a/kstars/tools/nameresolver.cpp
+++ b/kstars/tools/nameresolver.cpp
@@ -23,6 +23,8 @@
/* KDE Includes */
#ifndef KSTARS_LITE
#include <kio/filecopyjob.h>
+#else
+#include "kstarslite.h"
#endif
/* Qt Includes */
@@ -40,9 +42,13 @@ class CatalogEntryData NameResolver::resolveName( const QString &name ) {
class CatalogEntryData data;
data.long_name = name;
-
if( !NameResolverInternals::sesameResolver( data, name ) ) {
- qDebug() << "Error: sesameResolver failed. Could not resolve name on CDS Sesame!";
+ QString msg = xi18n("Error: sesameResolver failed. Could not resolve name on CDS Sesame!");
+ qDebug() << msg;
+
+#ifdef KSTARS_LITE
+ KStarsLite::Instance()->notificationMessage(msg);
+#endif
return data; // default data structure with no information
}
// More to be done here if the resolved name is SIMBAD
@@ -54,7 +60,13 @@ bool NameResolver::NameResolverInternals::sesameResolver( class CatalogEntryData
QUrl resolverUrl = QUrl( QString( "http://cdsweb.u-strasbg.fr/cgi-bin/nph-sesame/-oxpFI/SNV?%1" ).arg( name ) );
- qDebug() << "Attempting to resolve object " << name << "using CDS Sesame.";
+ QString msg = xi18n("Attempting to resolve object %1 using CDS Sesame.", name);
+ qDebug() << msg;
+
+#ifdef KSTARS_LITE
+ KStarsLite::Instance()->notificationMessage(msg);
+#endif
+
QNetworkAccessManager manager;
QNetworkReply *response = manager.get( QNetworkRequest( resolverUrl ) );
@@ -64,14 +76,24 @@ bool NameResolver::NameResolverInternals::sesameResolver( class CatalogEntryData
event.exec();
if (response->error() != QNetworkReply::NoError) {
- qWarning() << "Error trying to get XML response from CDS Sesame server: " << response->errorString();
+ msg = xi18n("Error trying to get XML response from CDS Sesame server: %1", response->errorString());
+ qWarning() << msg;
+
+ #ifdef KSTARS_LITE
+ KStarsLite::Instance()->notificationMessage(msg);
+ #endif
return false;
}
QXmlStreamReader xml( response->readAll() );
if( xml.atEnd() ) {
// file is empty
- qDebug() << "Empty result instead of expected XML from CDS Sesame! Maybe bad internet connection?";
+ msg = xi18n("Empty result instead of expected XML from CDS Sesame! Maybe bad internet connection?");
+ qDebug() << msg;
+
+ #ifdef KSTARS_LITE
+ KStarsLite::Instance()->notificationMessage(msg);
+ #endif
return false;
}
@@ -167,10 +189,21 @@ bool NameResolver::NameResolverInternals::sesameResolver( class CatalogEntryData
}
}
if( xml.hasError() ) {
- qDebug() << "Error parsing XML from CDS Sesame: " << xml.errorString() << " on line " << xml.lineNumber() << " @ col = " << xml.columnNumber();
+ msg = xi18n("Error parsing XML from CDS Sesame: %1 on line %2 @ col = %3", xml.errorString(), xml.lineNumber(), xml.columnNumber());
+ qDebug() << msg;
+
+ #ifdef KSTARS_LITE
+ KStarsLite::Instance()->notificationMessage(msg);
+ #endif
return false;
}
- qDebug() << "Resolved " << name << " successfully!";
+
+ msg = xi18n("Resolved %1 successfully!", name);
+ qDebug() << msg;
+
+#ifdef KSTARS_LITE
+ KStarsLite::Instance()->notificationMessage(msg);
+#endif
qDebug() << "Object type: " << SkyObject::typeName( data.type ) << "; Coordinates: " << data.ra << ";" << data.dec;
return true;
}