Merge lp:~stellarium/stellarium/toastImages into lp:stellarium
- toastImages
- Merge into trunk
Proposed by
Alexander Wolf
Status: | Merged |
---|---|
Merged at revision: | 8858 |
Proposed branch: | lp:~stellarium/stellarium/toastImages |
Merge into: | lp:stellarium |
Diff against target: |
2224 lines (+1671/-115) 32 files modified
data/gui/guiRes.qrc (+2/-0) src/CMakeLists.txt (+6/-1) src/core/MultiLevelJsonBase.cpp (+1/-1) src/core/StelApp.cpp (+6/-1) src/core/StelLocationMgr.cpp (+1/-1) src/core/StelSkyLayerMgr.cpp (+1/-0) src/core/StelSphereGeometry.cpp (+5/-0) src/core/StelTexture.cpp (+6/-4) src/core/StelTexture.hpp (+1/-1) src/core/StelTextureMgr.cpp (+1/-1) src/core/StelToast.cpp (+235/-0) src/core/StelToast.hpp (+114/-0) src/core/StelToastGrid.cpp (+177/-0) src/core/StelToastGrid.hpp (+90/-0) src/core/StelUtils.cpp (+17/-0) src/core/StelUtils.hpp (+3/-0) src/core/modules/ConstellationMgr.cpp (+1/-1) src/core/modules/ToastMgr.cpp (+97/-0) src/core/modules/ToastMgr.hpp (+53/-0) src/gui/ConfigurationDialog.cpp (+8/-11) src/gui/ConfigurationDialog.hpp (+0/-2) src/gui/StelGui.cpp (+31/-0) src/gui/StelGui.hpp (+9/-0) src/gui/configurationDialog.ui (+101/-91) util/DSSToStellarium/UTdssUtils.py (+35/-0) util/DSSToStellarium/createUpperToastLevels.py (+81/-0) util/DSSToStellarium/dssUtils.py (+169/-0) util/DSSToStellarium/generateFullPlate.py (+159/-0) util/DSSToStellarium/prepareAllPlates.py (+117/-0) util/DSSToStellarium/readme.txt (+33/-0) util/toastForShape/main.cpp (+38/-0) util/toastForShape/toastForShape.pro (+73/-0) |
To merge this branch: | bzr merge lp:~stellarium/stellarium/toastImages |
Related bugs: | |
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
gzotti | Approve | ||
Guillaume Chereau | Pending | ||
Fabien Chéreau | Pending | ||
Review via email: mp+310716@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Alexander Wolf (alexwolf) wrote : | # |
TOAST is "tessellated octahedral adaptive subdivision transform" (details: https:/
TODOs - I hope Fabien can help with it (I can't add/change DNS names).
Network behaviour: it's more to the StelTexture class behaviour
Revision history for this message
gzotti (georg-zotti) wrote : | # |
Thanks for the paper. This must be referenced in the Guide chapter to be written.
So this network behaviour problem must then become a "wishlist bug" for StelTexture, and should not impede branch merge.
Then it's OK from my side :-)
review:
Approve
Revision history for this message
Alexander Wolf (alexwolf) wrote : | # |
Offline mode: full collection of DSS has a size 112GiB and it can be problematic to the usage by many users.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'data/gui/btToastSurvey-off.png' | |||
2 | 0 | Binary files data/gui/btToastSurvey-off.png 1970-01-01 00:00:00 +0000 and data/gui/btToastSurvey-off.png 2016-11-13 10:24:15 +0000 differ | 0 | Binary files data/gui/btToastSurvey-off.png 1970-01-01 00:00:00 +0000 and data/gui/btToastSurvey-off.png 2016-11-13 10:24:15 +0000 differ |
3 | === added file 'data/gui/btToastSurvey-on.png' | |||
4 | 1 | Binary files data/gui/btToastSurvey-on.png 1970-01-01 00:00:00 +0000 and data/gui/btToastSurvey-on.png 2016-11-13 10:24:15 +0000 differ | 1 | Binary files data/gui/btToastSurvey-on.png 1970-01-01 00:00:00 +0000 and data/gui/btToastSurvey-on.png 2016-11-13 10:24:15 +0000 differ |
5 | === modified file 'data/gui/guiRes.qrc' | |||
6 | --- data/gui/guiRes.qrc 2015-12-05 17:34:59 +0000 | |||
7 | +++ data/gui/guiRes.qrc 2016-11-13 10:24:15 +0000 | |||
8 | @@ -88,6 +88,8 @@ | |||
9 | 88 | <file>btConstellationLines-on.png</file> | 88 | <file>btConstellationLines-on.png</file> |
10 | 89 | <file>btDSS-off.png</file> | 89 | <file>btDSS-off.png</file> |
11 | 90 | <file>btDSS-on.png</file> | 90 | <file>btDSS-on.png</file> |
12 | 91 | <file>btToastSurvey-off.png</file> | ||
13 | 92 | <file>btToastSurvey-on.png</file> | ||
14 | 91 | <file>btEquatorialGrid-off.png</file> | 93 | <file>btEquatorialGrid-off.png</file> |
15 | 92 | <file>btEquatorialGrid-on.png</file> | 94 | <file>btEquatorialGrid-on.png</file> |
16 | 93 | <file>btEquatorialMount-off.png</file> | 95 | <file>btEquatorialMount-off.png</file> |
17 | 94 | 96 | ||
18 | === modified file 'src/CMakeLists.txt' | |||
19 | --- src/CMakeLists.txt 2016-11-05 13:35:49 +0000 | |||
20 | +++ src/CMakeLists.txt 2016-11-13 10:24:15 +0000 | |||
21 | @@ -153,6 +153,10 @@ | |||
22 | 153 | core/TrailGroup.cpp | 153 | core/TrailGroup.cpp |
23 | 154 | core/RefractionExtinction.hpp | 154 | core/RefractionExtinction.hpp |
24 | 155 | core/RefractionExtinction.cpp | 155 | core/RefractionExtinction.cpp |
25 | 156 | core/StelToast.hpp | ||
26 | 157 | core/StelToast.cpp | ||
27 | 158 | core/StelToastGrid.hpp | ||
28 | 159 | core/StelToastGrid.cpp | ||
29 | 156 | core/StelActionMgr.hpp | 160 | core/StelActionMgr.hpp |
30 | 157 | core/StelActionMgr.cpp | 161 | core/StelActionMgr.cpp |
31 | 158 | core/StelProgressController.hpp | 162 | core/StelProgressController.hpp |
32 | @@ -249,6 +253,8 @@ | |||
33 | 249 | core/modules/StarMgr.hpp | 253 | core/modules/StarMgr.hpp |
34 | 250 | core/modules/StarWrapper.cpp | 254 | core/modules/StarWrapper.cpp |
35 | 251 | core/modules/StarWrapper.hpp | 255 | core/modules/StarWrapper.hpp |
36 | 256 | core/modules/ToastMgr.hpp | ||
37 | 257 | core/modules/ToastMgr.cpp | ||
38 | 252 | core/modules/ZoneArray.cpp | 258 | core/modules/ZoneArray.cpp |
39 | 253 | core/modules/ZodiacalLight.hpp | 259 | core/modules/ZodiacalLight.hpp |
40 | 254 | core/modules/ZodiacalLight.cpp | 260 | core/modules/ZodiacalLight.cpp |
41 | @@ -314,7 +320,6 @@ | |||
42 | 314 | SET(stellarium_RES ${CMAKE_SOURCE_DIR}/data/mainRes.qrc) | 320 | SET(stellarium_RES ${CMAKE_SOURCE_DIR}/data/mainRes.qrc) |
43 | 315 | QT5_ADD_RESOURCES(stellarium_RES_CXX ${stellarium_RES}) | 321 | QT5_ADD_RESOURCES(stellarium_RES_CXX ${stellarium_RES}) |
44 | 316 | 322 | ||
45 | 317 | |||
46 | 318 | ############################################################################################# | 323 | ############################################################################################# |
47 | 319 | ############################# Standard GUI plugin compilation ############################### | 324 | ############################# Standard GUI plugin compilation ############################### |
48 | 320 | ############################################################################################# | 325 | ############################################################################################# |
49 | 321 | 326 | ||
50 | === modified file 'src/core/MultiLevelJsonBase.cpp' | |||
51 | --- src/core/MultiLevelJsonBase.cpp 2014-06-12 15:47:22 +0000 | |||
52 | +++ src/core/MultiLevelJsonBase.cpp 2016-11-13 10:24:15 +0000 | |||
53 | @@ -169,7 +169,7 @@ | |||
54 | 169 | } | 169 | } |
55 | 170 | Q_ASSERT(httpReply==NULL); | 170 | Q_ASSERT(httpReply==NULL); |
56 | 171 | QNetworkRequest req(qurl); | 171 | QNetworkRequest req(qurl); |
58 | 172 | req.setRawHeader("User-Agent", StelUtils::getApplicationName().toLatin1()); | 172 | req.setRawHeader("User-Agent", StelUtils::getUserAgentString().toLatin1()); |
59 | 173 | httpReply = getNetworkAccessManager().get(req); | 173 | httpReply = getNetworkAccessManager().get(req); |
60 | 174 | //qDebug() << "Started downloading " << httpReply->request().url().path(); | 174 | //qDebug() << "Started downloading " << httpReply->request().url().path(); |
61 | 175 | Q_ASSERT(httpReply->error()==QNetworkReply::NoError); | 175 | Q_ASSERT(httpReply->error()==QNetworkReply::NoError); |
62 | 176 | 176 | ||
63 | === modified file 'src/core/StelApp.cpp' | |||
64 | --- src/core/StelApp.cpp 2016-10-23 17:09:45 +0000 | |||
65 | +++ src/core/StelApp.cpp 2016-11-13 10:24:15 +0000 | |||
66 | @@ -37,9 +37,9 @@ | |||
67 | 37 | #include "StelIniParser.hpp" | 37 | #include "StelIniParser.hpp" |
68 | 38 | #include "StelProjector.hpp" | 38 | #include "StelProjector.hpp" |
69 | 39 | #include "StelLocationMgr.hpp" | 39 | #include "StelLocationMgr.hpp" |
70 | 40 | #include "ToastMgr.hpp" | ||
71 | 40 | #include "StelActionMgr.hpp" | 41 | #include "StelActionMgr.hpp" |
72 | 41 | #include "StelPropertyMgr.hpp" | 42 | #include "StelPropertyMgr.hpp" |
73 | 42 | |||
74 | 43 | #include "StelProgressController.hpp" | 43 | #include "StelProgressController.hpp" |
75 | 44 | #include "StelModuleMgr.hpp" | 44 | #include "StelModuleMgr.hpp" |
76 | 45 | #include "StelLocaleMgr.hpp" | 45 | #include "StelLocaleMgr.hpp" |
77 | @@ -457,6 +457,11 @@ | |||
78 | 457 | skyImageMgr->init(); | 457 | skyImageMgr->init(); |
79 | 458 | getModuleMgr().registerModule(skyImageMgr); | 458 | getModuleMgr().registerModule(skyImageMgr); |
80 | 459 | 459 | ||
81 | 460 | // Toast surveys | ||
82 | 461 | ToastMgr* toasts = new ToastMgr(); | ||
83 | 462 | toasts->init(); | ||
84 | 463 | getModuleMgr().registerModule(toasts); | ||
85 | 464 | |||
86 | 460 | // Init audio manager | 465 | // Init audio manager |
87 | 461 | audioMgr = new StelAudioMgr(); | 466 | audioMgr = new StelAudioMgr(); |
88 | 462 | 467 | ||
89 | 463 | 468 | ||
90 | === modified file 'src/core/StelLocationMgr.cpp' | |||
91 | --- src/core/StelLocationMgr.cpp 2016-10-25 15:39:06 +0000 | |||
92 | +++ src/core/StelLocationMgr.cpp 2016-11-13 10:24:15 +0000 | |||
93 | @@ -356,7 +356,7 @@ | |||
94 | 356 | { | 356 | { |
95 | 357 | QNetworkRequest req( QUrl( QString("http://freegeoip.net/json/") ) ); | 357 | QNetworkRequest req( QUrl( QString("http://freegeoip.net/json/") ) ); |
96 | 358 | req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); | 358 | req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); |
98 | 359 | req.setRawHeader("User-Agent", StelUtils::getApplicationName().toLatin1()); | 359 | req.setRawHeader("User-Agent", StelUtils::getUserAgentString().toLatin1()); |
99 | 360 | QNetworkReply* networkReply=StelApp::getInstance().getNetworkAccessManager()->get(req); | 360 | QNetworkReply* networkReply=StelApp::getInstance().getNetworkAccessManager()->get(req); |
100 | 361 | connect(networkReply, SIGNAL(finished()), this, SLOT(changeLocationFromNetworkLookup())); | 361 | connect(networkReply, SIGNAL(finished()), this, SLOT(changeLocationFromNetworkLookup())); |
101 | 362 | } | 362 | } |
102 | 363 | 363 | ||
103 | === modified file 'src/core/StelSkyLayerMgr.cpp' | |||
104 | --- src/core/StelSkyLayerMgr.cpp 2016-06-14 14:56:19 +0000 | |||
105 | +++ src/core/StelSkyLayerMgr.cpp 2016-11-13 10:24:15 +0000 | |||
106 | @@ -69,6 +69,7 @@ | |||
107 | 69 | qWarning() << "ERROR while loading nebula texture set default"; | 69 | qWarning() << "ERROR while loading nebula texture set default"; |
108 | 70 | else | 70 | else |
109 | 71 | insertSkyImage(path); | 71 | insertSkyImage(path); |
110 | 72 | |||
111 | 72 | QSettings* conf = StelApp::getInstance().getSettings(); | 73 | QSettings* conf = StelApp::getInstance().getSettings(); |
112 | 73 | conf->beginGroup("skylayers"); | 74 | conf->beginGroup("skylayers"); |
113 | 74 | foreach (const QString& key, conf->childKeys()) | 75 | foreach (const QString& key, conf->childKeys()) |
114 | 75 | 76 | ||
115 | === modified file 'src/core/StelSphereGeometry.cpp' | |||
116 | --- src/core/StelSphereGeometry.cpp 2016-07-23 05:23:41 +0000 | |||
117 | +++ src/core/StelSphereGeometry.cpp 2016-11-13 10:24:15 +0000 | |||
118 | @@ -1314,6 +1314,11 @@ | |||
119 | 1314 | { | 1314 | { |
120 | 1315 | return SphericalRegionP(new SphericalPolygon(pathFromQVariantList(l))); | 1315 | return SphericalRegionP(new SphericalPolygon(pathFromQVariantList(l))); |
121 | 1316 | } | 1316 | } |
122 | 1317 | else if (code=="CONVEX_POLYGON") | ||
123 | 1318 | { | ||
124 | 1319 | return SphericalRegionP(new SphericalConvexPolygon(singleContourFromQVariantList(l.at(1).toList()))); | ||
125 | 1320 | } | ||
126 | 1321 | |||
127 | 1317 | Q_ASSERT(0); | 1322 | Q_ASSERT(0); |
128 | 1318 | return EmptySphericalRegion::staticInstance; | 1323 | return EmptySphericalRegion::staticInstance; |
129 | 1319 | } | 1324 | } |
130 | 1320 | 1325 | ||
131 | === modified file 'src/core/StelTexture.cpp' | |||
132 | --- src/core/StelTexture.cpp 2016-10-11 14:47:05 +0000 | |||
133 | +++ src/core/StelTexture.cpp 2016-11-13 10:24:15 +0000 | |||
134 | @@ -57,10 +57,12 @@ | |||
135 | 57 | } | 57 | } |
136 | 58 | id = 0; | 58 | id = 0; |
137 | 59 | } | 59 | } |
139 | 60 | if (networkReply != NULL) | 60 | if (networkReply) |
140 | 61 | { | 61 | { |
141 | 62 | networkReply->abort(); | 62 | networkReply->abort(); |
143 | 63 | networkReply->deleteLater(); | 63 | //networkReply->deleteLater(); |
144 | 64 | delete networkReply; | ||
145 | 65 | networkReply = NULL; | ||
146 | 64 | } | 66 | } |
147 | 65 | if (loader != NULL) { | 67 | if (loader != NULL) { |
148 | 66 | delete loader; | 68 | delete loader; |
149 | @@ -124,9 +126,9 @@ | |||
150 | 124 | QNetworkRequest req = QNetworkRequest(QUrl(fullPath)); | 126 | QNetworkRequest req = QNetworkRequest(QUrl(fullPath)); |
151 | 125 | // Define that preference should be given to cached files (no etag checks) | 127 | // Define that preference should be given to cached files (no etag checks) |
152 | 126 | req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); | 128 | req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); |
154 | 127 | req.setRawHeader("User-Agent", StelUtils::getApplicationName().toLatin1()); | 129 | req.setRawHeader("User-Agent", StelUtils::getUserAgentString().toLatin1()); |
155 | 128 | networkReply = StelApp::getInstance().getNetworkAccessManager()->get(req); | 130 | networkReply = StelApp::getInstance().getNetworkAccessManager()->get(req); |
157 | 129 | connect(networkReply, SIGNAL(finished()), this, SLOT(onNetworkReply())); | 131 | connect(networkReply, SIGNAL(finished()), this, SLOT(onNetworkReply())); |
158 | 130 | return false; | 132 | return false; |
159 | 131 | } | 133 | } |
160 | 132 | // The network connection is still running. | 134 | // The network connection is still running. |
161 | 133 | 135 | ||
162 | === modified file 'src/core/StelTexture.hpp' | |||
163 | --- src/core/StelTexture.hpp 2015-02-06 19:40:02 +0000 | |||
164 | +++ src/core/StelTexture.hpp 2016-11-13 10:24:15 +0000 | |||
165 | @@ -147,7 +147,7 @@ | |||
166 | 147 | 147 | ||
167 | 148 | 148 | ||
168 | 149 | //! The URL where to download the file | 149 | //! The URL where to download the file |
170 | 150 | QString fullPath; | 150 | QString fullPath; |
171 | 151 | 151 | ||
172 | 152 | //! True when something when wrong in the loading process | 152 | //! True when something when wrong in the loading process |
173 | 153 | bool errorOccured; | 153 | bool errorOccured; |
174 | 154 | 154 | ||
175 | === modified file 'src/core/StelTextureMgr.cpp' | |||
176 | --- src/core/StelTextureMgr.cpp 2015-03-04 18:42:24 +0000 | |||
177 | +++ src/core/StelTextureMgr.cpp 2016-11-13 10:24:15 +0000 | |||
178 | @@ -67,7 +67,7 @@ | |||
179 | 67 | 67 | ||
180 | 68 | StelTextureSP tex = StelTextureSP(new StelTexture()); | 68 | StelTextureSP tex = StelTextureSP(new StelTexture()); |
181 | 69 | tex->loadParams = params; | 69 | tex->loadParams = params; |
183 | 70 | tex->fullPath = url; | 70 | tex->fullPath = url; |
184 | 71 | if (!lazyLoading) | 71 | if (!lazyLoading) |
185 | 72 | { | 72 | { |
186 | 73 | tex->bind(); | 73 | tex->bind(); |
187 | 74 | 74 | ||
188 | === added file 'src/core/StelToast.cpp' | |||
189 | --- src/core/StelToast.cpp 1970-01-01 00:00:00 +0000 | |||
190 | +++ src/core/StelToast.cpp 2016-11-13 10:24:15 +0000 | |||
191 | @@ -0,0 +1,235 @@ | |||
192 | 1 | /* | ||
193 | 2 | * Stellarium | ||
194 | 3 | * Copyright (C) 2010 Guillaume Chereau | ||
195 | 4 | * | ||
196 | 5 | * This program is free software; you can redistribute it and/or | ||
197 | 6 | * modify it under the terms of the GNU General Public License | ||
198 | 7 | * as published by the Free Software Foundation; either version 2 | ||
199 | 8 | * of the License, or (at your option) any later version. | ||
200 | 9 | * | ||
201 | 10 | * This program is distributed in the hope that it will be useful, | ||
202 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
203 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
204 | 13 | * GNU General Public License for more details. | ||
205 | 14 | * | ||
206 | 15 | * You should have received a copy of the GNU General Public License | ||
207 | 16 | * along with this program; if not, write to the Free Software | ||
208 | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
209 | 18 | */ | ||
210 | 19 | |||
211 | 20 | #include <QtOpenGL> | ||
212 | 21 | #include "StelApp.hpp" | ||
213 | 22 | #include "StelCore.hpp" | ||
214 | 23 | #include "StelPainter.hpp" | ||
215 | 24 | #include "StelTexture.hpp" | ||
216 | 25 | #include "StelTextureMgr.hpp" | ||
217 | 26 | #include "StelToast.hpp" | ||
218 | 27 | |||
219 | 28 | ToastTile::ToastTile(QObject* parent, int level, int x, int y) | ||
220 | 29 | : QObject(parent), level(level), x(x), y(y), empty(false), ready(false), texture(NULL), texFader(NULL) | ||
221 | 30 | { | ||
222 | 31 | Q_ASSERT(level <= getGrid()->getMaxLevel()); | ||
223 | 32 | const ToastSurvey* survey = getSurvey(); | ||
224 | 33 | // create the texture | ||
225 | 34 | imagePath = survey->getTilePath(level, x, y); | ||
226 | 35 | |||
227 | 36 | if (level==0) | ||
228 | 37 | { | ||
229 | 38 | boundingCap.n=Vec3d(1,0,0); | ||
230 | 39 | boundingCap.d=-1.; | ||
231 | 40 | } | ||
232 | 41 | const QVector<Vec3d>& pts = getGrid()->getPolygon(level, x, y); | ||
233 | 42 | Vec3d n = pts.at(0); | ||
234 | 43 | n+=pts.at(1); | ||
235 | 44 | n+=pts.at(2); | ||
236 | 45 | n+=pts.at(3); | ||
237 | 46 | n.normalize(); | ||
238 | 47 | boundingCap.n=n; | ||
239 | 48 | if (level==1) | ||
240 | 49 | boundingCap.d=0; | ||
241 | 50 | else | ||
242 | 51 | boundingCap.d=qMin(qMin(n*pts.at(0), n*pts.at(1)), qMin(n*pts.at(2), n*pts.at(3))); | ||
243 | 52 | } | ||
244 | 53 | |||
245 | 54 | const ToastGrid* ToastTile::getGrid() const | ||
246 | 55 | { | ||
247 | 56 | return getSurvey()->getGrid(); | ||
248 | 57 | } | ||
249 | 58 | |||
250 | 59 | |||
251 | 60 | const ToastSurvey* ToastTile::getSurvey() const | ||
252 | 61 | { | ||
253 | 62 | // the parent can either be a ToastSurvey either be a ToastTile | ||
254 | 63 | ToastSurvey* ret = qobject_cast<ToastSurvey*>(parent()); | ||
255 | 64 | if (ret) | ||
256 | 65 | return ret; | ||
257 | 66 | ToastTile* tile = qobject_cast<ToastTile*>(parent()); | ||
258 | 67 | Q_ASSERT(tile); | ||
259 | 68 | return tile->getSurvey(); | ||
260 | 69 | } | ||
261 | 70 | |||
262 | 71 | |||
263 | 72 | bool ToastTile::isVisible(const SphericalCap& viewportShape, int maxVisibleLevel) const | ||
264 | 73 | { | ||
265 | 74 | if (empty) | ||
266 | 75 | return false; | ||
267 | 76 | if (level == 0) | ||
268 | 77 | return true; | ||
269 | 78 | if (level > maxVisibleLevel) | ||
270 | 79 | return false; | ||
271 | 80 | return viewportShape.intersects(boundingCap); | ||
272 | 81 | } | ||
273 | 82 | |||
274 | 83 | bool ToastTile::isCovered(const SphericalCap& viewportShape) const | ||
275 | 84 | { | ||
276 | 85 | // The tile is covered if we have at least one visible child and all the visible children are all ready to be drawn. | ||
277 | 86 | int nbVisibleChildren = 0; | ||
278 | 87 | foreach (const ToastTile* child, subTiles) | ||
279 | 88 | { | ||
280 | 89 | if (!viewportShape.intersects(child->boundingCap)) | ||
281 | 90 | continue; | ||
282 | 91 | nbVisibleChildren++; | ||
283 | 92 | if (!child->ready || child->texFader->state()==QTimeLine::Running) | ||
284 | 93 | return false; | ||
285 | 94 | } | ||
286 | 95 | return nbVisibleChildren > 0; | ||
287 | 96 | } | ||
288 | 97 | |||
289 | 98 | |||
290 | 99 | void ToastTile::prepareDraw() | ||
291 | 100 | { | ||
292 | 101 | Q_ASSERT(!empty); | ||
293 | 102 | |||
294 | 103 | if (texture.isNull()) | ||
295 | 104 | { | ||
296 | 105 | //qDebug() << "load texture" << imagePath; | ||
297 | 106 | StelTextureMgr& texMgr=StelApp::getInstance().getTextureManager(); | ||
298 | 107 | texture = texMgr.createTextureThread(imagePath, StelTexture::StelTextureParams(true)); | ||
299 | 108 | } | ||
300 | 109 | if (texture.isNull() || (!texture->isLoading() && !texture->canBind() && !texture->getErrorMessage().isEmpty())) | ||
301 | 110 | { | ||
302 | 111 | if (!texture.isNull()) | ||
303 | 112 | qDebug() << "can't get texture" << imagePath << texture->getErrorMessage(); | ||
304 | 113 | empty = true; | ||
305 | 114 | return; | ||
306 | 115 | } | ||
307 | 116 | if (!texture->canBind()) | ||
308 | 117 | return; | ||
309 | 118 | // Get the opengl arrays | ||
310 | 119 | if (vertexArray.empty()) | ||
311 | 120 | { | ||
312 | 121 | int ml = qMin(qMax(3, level+1), getGrid()->getMaxLevel()); | ||
313 | 122 | vertexArray = getGrid()->getVertexArray(level, x, y, ml); | ||
314 | 123 | textureArray = getGrid()->getTextureArray(level, x, y, ml); | ||
315 | 124 | indexArray = getGrid()->getTrianglesIndex(level, x, y, ml); | ||
316 | 125 | } | ||
317 | 126 | |||
318 | 127 | if (subTiles.isEmpty() && level < getSurvey()->getMaxLevel()) | ||
319 | 128 | { | ||
320 | 129 | //qDebug() << "Create children"; | ||
321 | 130 | // Create the children | ||
322 | 131 | for (int i = 0; i < 2; ++i) | ||
323 | 132 | for (int j = 0; j < 2; ++j) | ||
324 | 133 | subTiles.append(new ToastTile(this, level + 1, 2 * this->x + i, 2 * this->y + j)); | ||
325 | 134 | Q_ASSERT(subTiles.size() == 4); | ||
326 | 135 | } | ||
327 | 136 | ready = true; | ||
328 | 137 | } | ||
329 | 138 | |||
330 | 139 | |||
331 | 140 | void ToastTile::drawTile(StelPainter* sPainter) | ||
332 | 141 | { | ||
333 | 142 | if (!ready) | ||
334 | 143 | prepareDraw(); | ||
335 | 144 | |||
336 | 145 | // Still not ready | ||
337 | 146 | if (texture.isNull() || !texture->bind()) | ||
338 | 147 | return; | ||
339 | 148 | |||
340 | 149 | if (!texFader) | ||
341 | 150 | { | ||
342 | 151 | texFader = new QTimeLine(1000, this); | ||
343 | 152 | texFader->start(); | ||
344 | 153 | } | ||
345 | 154 | |||
346 | 155 | if (texFader->state()==QTimeLine::Running) | ||
347 | 156 | { | ||
348 | 157 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode | ||
349 | 158 | glEnable(GL_BLEND); | ||
350 | 159 | sPainter->setColor(1,1,1, texFader->currentValue()); | ||
351 | 160 | } | ||
352 | 161 | else | ||
353 | 162 | { | ||
354 | 163 | glDisable(GL_BLEND); | ||
355 | 164 | sPainter->setColor(1, 1, 1, 1); | ||
356 | 165 | } | ||
357 | 166 | |||
358 | 167 | sPainter->enableTexture2d(true); | ||
359 | 168 | Q_ASSERT(vertexArray.size() == textureArray.size()); | ||
360 | 169 | |||
361 | 170 | glEnable(GL_CULL_FACE); | ||
362 | 171 | // sPainter.drawArrays(GL_TRIANGLES, vertexArray.size(), vertexArray.data(), textureArray.data(), NULL, NULL, indexArray.size(), indexArray.constData()); | ||
363 | 172 | sPainter->setArrays(vertexArray.constData(), textureArray.constData()); | ||
364 | 173 | sPainter->drawFromArray(StelPainter::Triangles, indexArray.size(), 0, true, indexArray.constData()); | ||
365 | 174 | glDisable(GL_CULL_FACE); | ||
366 | 175 | |||
367 | 176 | // SphericalConvexPolygon poly(getGrid()->getPolygon(level, x, y)); | ||
368 | 177 | // sPainter->enableTexture2d(false); | ||
369 | 178 | // sPainter->drawSphericalRegion(&poly, StelPainter::SphericalPolygonDrawModeBoundary); | ||
370 | 179 | } | ||
371 | 180 | |||
372 | 181 | |||
373 | 182 | void ToastTile::draw(StelPainter* sPainter, const SphericalCap& viewportShape, int maxVisibleLevel) | ||
374 | 183 | { | ||
375 | 184 | if (!isVisible(viewportShape, maxVisibleLevel)) | ||
376 | 185 | { | ||
377 | 186 | // Clean up to save memory. | ||
378 | 187 | foreach (ToastTile* child, subTiles) | ||
379 | 188 | { | ||
380 | 189 | child->deleteLater(); | ||
381 | 190 | } | ||
382 | 191 | subTiles.clear(); | ||
383 | 192 | ready = false; | ||
384 | 193 | return; | ||
385 | 194 | } | ||
386 | 195 | if (level==maxVisibleLevel || !isCovered(viewportShape)) | ||
387 | 196 | drawTile(sPainter); | ||
388 | 197 | |||
389 | 198 | // Draw all the children | ||
390 | 199 | foreach (ToastTile* child, subTiles) | ||
391 | 200 | { | ||
392 | 201 | child->draw(sPainter, viewportShape, maxVisibleLevel); | ||
393 | 202 | } | ||
394 | 203 | } | ||
395 | 204 | |||
396 | 205 | /////// ToastSurvey methods //////////// | ||
397 | 206 | ToastSurvey::ToastSurvey(const QString& path, int amaxLevel) | ||
398 | 207 | : grid(amaxLevel), path(path), maxLevel(amaxLevel) | ||
399 | 208 | { | ||
400 | 209 | rootTile = new ToastTile(this, 0, 0, 0); | ||
401 | 210 | } | ||
402 | 211 | |||
403 | 212 | |||
404 | 213 | QString ToastSurvey::getTilePath(int level, int x, int y) const | ||
405 | 214 | { | ||
406 | 215 | QString ret = path; | ||
407 | 216 | ret.replace("{level}", QString::number(level)); | ||
408 | 217 | ret.replace("{x}", QString::number(x)); | ||
409 | 218 | ret.replace("{y}", QString::number(y)); | ||
410 | 219 | return ret; | ||
411 | 220 | } | ||
412 | 221 | |||
413 | 222 | |||
414 | 223 | void ToastSurvey::draw(StelPainter* sPainter) | ||
415 | 224 | { | ||
416 | 225 | // Compute the maximum visible level for the tiles according to the view resolution. | ||
417 | 226 | // We know that each tile at level L represents an angle of 360 / 2**L | ||
418 | 227 | // The maximum angle we want to see is the size of a tile in pixels time the angle for one visible pixel. | ||
419 | 228 | const double anglePerPixel = 1./sPainter->getProjector()->getPixelPerRadAtCenter()*180./M_PI; | ||
420 | 229 | const double maxAngle = anglePerPixel * getTilesSize(); | ||
421 | 230 | int maxVisibleLevel = (int)(log2(360. / maxAngle)); | ||
422 | 231 | |||
423 | 232 | // We also get the viewport shape to discard invisibly tiles. | ||
424 | 233 | const SphericalCap& viewportRegion = sPainter->getProjector()->getBoundingCap(); | ||
425 | 234 | rootTile->draw(sPainter, viewportRegion, maxVisibleLevel); | ||
426 | 235 | } | ||
427 | 0 | 236 | ||
428 | === added file 'src/core/StelToast.hpp' | |||
429 | --- src/core/StelToast.hpp 1970-01-01 00:00:00 +0000 | |||
430 | +++ src/core/StelToast.hpp 2016-11-13 10:24:15 +0000 | |||
431 | @@ -0,0 +1,114 @@ | |||
432 | 1 | /* | ||
433 | 2 | * Stellarium | ||
434 | 3 | * Copyright (C) 2010 Guillaume Chereau | ||
435 | 4 | * | ||
436 | 5 | * This program is free software; you can redistribute it and/or | ||
437 | 6 | * modify it under the terms of the GNU General Public License | ||
438 | 7 | * as published by the Free Software Foundation; either version 2 | ||
439 | 8 | * of the License, or (at your option) any later version. | ||
440 | 9 | * | ||
441 | 10 | * This program is distributed in the hope that it will be useful, | ||
442 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
443 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
444 | 13 | * GNU General Public License for more details. | ||
445 | 14 | * | ||
446 | 15 | * You should have received a copy of the GNU General Public License | ||
447 | 16 | * along with this program; if not, write to the Free Software | ||
448 | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
449 | 18 | */ | ||
450 | 19 | |||
451 | 20 | #ifndef _STELTOAST_HPP_ | ||
452 | 21 | #define _STELTOAST_HPP_ | ||
453 | 22 | |||
454 | 23 | #include <QObject> | ||
455 | 24 | #include <QString> | ||
456 | 25 | #include <QVector> | ||
457 | 26 | |||
458 | 27 | #include "StelSphereGeometry.hpp" | ||
459 | 28 | #include "StelTexture.hpp" | ||
460 | 29 | #include "StelTextureTypes.hpp" | ||
461 | 30 | #include "VecMath.hpp" | ||
462 | 31 | #include "StelToastGrid.hpp" | ||
463 | 32 | |||
464 | 33 | class StelPainter; | ||
465 | 34 | class ToastSurvey; | ||
466 | 35 | |||
467 | 36 | //! @class ToastTile | ||
468 | 37 | //! Represents a tile in a Toast image. | ||
469 | 38 | //! The tiles are stored in a tree structure, using the QObject | ||
470 | 39 | //! children/parent relationships. | ||
471 | 40 | class ToastTile : public QObject | ||
472 | 41 | { | ||
473 | 42 | Q_OBJECT | ||
474 | 43 | |||
475 | 44 | public: | ||
476 | 45 | ToastTile(QObject* parent, int level, int x, int y); | ||
477 | 46 | void draw(StelPainter* painter, const SphericalCap& viewportShape, int maxVisibleLevel); | ||
478 | 47 | bool isTransparent(); | ||
479 | 48 | |||
480 | 49 | protected: | ||
481 | 50 | void drawTile(StelPainter* painter); | ||
482 | 51 | //! Return the survey the tile belongs to. | ||
483 | 52 | const ToastSurvey* getSurvey() const; | ||
484 | 53 | //! Return the toast grid used by the tile. | ||
485 | 54 | const ToastGrid* getGrid() const; | ||
486 | 55 | //! Return whether the tile should be drawn | ||
487 | 56 | bool isVisible(const SphericalCap& viewportShape, int maxVisibleLevel) const; | ||
488 | 57 | //! return whether the tile is covered by its children tiles | ||
489 | 58 | //! This is used to avoid drawing tiles that will be covered anyway | ||
490 | 59 | bool isCovered(const SphericalCap& viewportShape) const; | ||
491 | 60 | void prepareDraw(); | ||
492 | 61 | |||
493 | 62 | private: | ||
494 | 63 | //! The level of the tile | ||
495 | 64 | int level; | ||
496 | 65 | // x coordinate of the tile | ||
497 | 66 | int x; | ||
498 | 67 | // y coordinate of the tile | ||
499 | 68 | int y; | ||
500 | 69 | //! Path to the tile image | ||
501 | 70 | QString imagePath; | ||
502 | 71 | // Set to true if the tile has no texture | ||
503 | 72 | bool empty; | ||
504 | 73 | //! Set to true if the tile is ready to draw | ||
505 | 74 | bool ready; | ||
506 | 75 | //! The texture associated with the tile | ||
507 | 76 | StelTextureSP texture; | ||
508 | 77 | //! The bounding cap used to check if the tile is visible | ||
509 | 78 | SphericalCap boundingCap; | ||
510 | 79 | |||
511 | 80 | QList<ToastTile*> subTiles; | ||
512 | 81 | |||
513 | 82 | // QList<SphericalRegionP> skyConvexPolygons; | ||
514 | 83 | //! OpenGl arrays | ||
515 | 84 | QVector<Vec3d> vertexArray; | ||
516 | 85 | QVector<Vec2f> textureArray; | ||
517 | 86 | QVector<unsigned short> indexArray; | ||
518 | 87 | |||
519 | 88 | // Used for smooth fade in | ||
520 | 89 | class QTimeLine* texFader; | ||
521 | 90 | }; | ||
522 | 91 | |||
523 | 92 | |||
524 | 93 | //! @class ToastSurvey | ||
525 | 94 | //! Represents a full Toast survey. | ||
526 | 95 | class ToastSurvey : public QObject | ||
527 | 96 | { | ||
528 | 97 | Q_OBJECT | ||
529 | 98 | |||
530 | 99 | public: | ||
531 | 100 | ToastSurvey(const QString& path, int maxLevel); | ||
532 | 101 | QString getTilePath(int level, int x, int y) const; | ||
533 | 102 | void draw(StelPainter* sPainter); | ||
534 | 103 | const ToastGrid* getGrid() const {return &grid;} | ||
535 | 104 | int getMaxLevel() const {return maxLevel;} | ||
536 | 105 | int getTilesSize() const {return 256;} | ||
537 | 106 | |||
538 | 107 | private: | ||
539 | 108 | ToastGrid grid; | ||
540 | 109 | QString path; | ||
541 | 110 | ToastTile* rootTile; | ||
542 | 111 | int maxLevel; | ||
543 | 112 | }; | ||
544 | 113 | |||
545 | 114 | #endif // _STELTOAST_HPP_ | ||
546 | 0 | 115 | ||
547 | === added file 'src/core/StelToastGrid.cpp' | |||
548 | --- src/core/StelToastGrid.cpp 1970-01-01 00:00:00 +0000 | |||
549 | +++ src/core/StelToastGrid.cpp 2016-11-13 10:24:15 +0000 | |||
550 | @@ -0,0 +1,177 @@ | |||
551 | 1 | /* | ||
552 | 2 | * Stellarium | ||
553 | 3 | * Copyright (C) 2010 Guillaume Chereau | ||
554 | 4 | * | ||
555 | 5 | * This program is free software; you can redistribute it and/or | ||
556 | 6 | * modify it under the terms of the GNU General Public License | ||
557 | 7 | * as published by the Free Software Foundation; either version 2 | ||
558 | 8 | * of the License, or (at your option) any later version. | ||
559 | 9 | * | ||
560 | 10 | * This program is distributed in the hope that it will be useful, | ||
561 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
562 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
563 | 13 | * GNU General Public License for more details. | ||
564 | 14 | * | ||
565 | 15 | * You should have received a copy of the GNU General Public License | ||
566 | 16 | * along with this program; if not, write to the Free Software | ||
567 | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
568 | 18 | */ | ||
569 | 19 | |||
570 | 20 | #include <limits> | ||
571 | 21 | #include "StelToastGrid.hpp" | ||
572 | 22 | |||
573 | 23 | //! compute the middle of two points on the sphere | ||
574 | 24 | static inline Vec3d middle(const Vec3d& a, const Vec3d b) | ||
575 | 25 | { | ||
576 | 26 | Vec3d ret = a; | ||
577 | 27 | ret += b; | ||
578 | 28 | ret.normalize(); | ||
579 | 29 | return ret; | ||
580 | 30 | } | ||
581 | 31 | |||
582 | 32 | |||
583 | 33 | ToastGrid::ToastGrid(int amaxLevel) | ||
584 | 34 | : maxLevel(amaxLevel), size(pow2(amaxLevel) + 1) | ||
585 | 35 | { | ||
586 | 36 | // We assume that initialization of the grid is fast enough to be | ||
587 | 37 | // done in the constructor. | ||
588 | 38 | init_grid(); | ||
589 | 39 | } | ||
590 | 40 | |||
591 | 41 | |||
592 | 42 | void ToastGrid::init_grid() | ||
593 | 43 | { | ||
594 | 44 | // Allocate the grid memory. | ||
595 | 45 | grid.resize(size * size); | ||
596 | 46 | // Set up the level 0. | ||
597 | 47 | at(0, 0, 0) = at(0, 1, 0) = at(0, 1, 1) = at(0, 0, 1) = Vec3d(0, 0, -1); | ||
598 | 48 | // And the level 1 | ||
599 | 49 | // Need mirror | ||
600 | 50 | at(1, 1, 1) = Vec3d(0, 0, 1); | ||
601 | 51 | at(1, 1, 0) = Vec3d(0, -1, 0); | ||
602 | 52 | at(1, 2, 1) = Vec3d(1, 0, 0); | ||
603 | 53 | at(1, 1, 2) = Vec3d(0, 1, 0); | ||
604 | 54 | at(1, 0, 1) = Vec3d(-1, 0, 0); | ||
605 | 55 | |||
606 | 56 | // Then we can compute the other levels by recursion | ||
607 | 57 | init_grid(1, 0, 0, false); | ||
608 | 58 | init_grid(1, 0, 1, true); | ||
609 | 59 | init_grid(1, 1, 1, false); | ||
610 | 60 | init_grid(1, 1, 0, true); | ||
611 | 61 | } | ||
612 | 62 | |||
613 | 63 | |||
614 | 64 | void ToastGrid::init_grid(int level, int x, int y, bool side) | ||
615 | 65 | { | ||
616 | 66 | Q_ASSERT(level >= 1); // This method won't work for level 0 ! | ||
617 | 67 | int clevel = level + 1; | ||
618 | 68 | int cx = 2*x; | ||
619 | 69 | int cy = 2*y; | ||
620 | 70 | // first we compute all the mid points | ||
621 | 71 | at(clevel, cx, cy+1) = middle(at(level, x, y), at(level, x, y+1)); | ||
622 | 72 | at(clevel, cx+1, cy+2) = middle(at(level, x, y+1), at(level, x+1, y+1)); | ||
623 | 73 | at(clevel, cx+2, cy+1) = middle(at(level, x+1, y+1), at(level, x+1, y)); | ||
624 | 74 | at(clevel, cx+1, cy) = middle(at(level, x+1, y), at(level, x, y)); | ||
625 | 75 | if (side) | ||
626 | 76 | at(clevel, cx+1, cy+1) = middle(at(level, x, y), at(level, x+1, y+1)); | ||
627 | 77 | else | ||
628 | 78 | at(clevel, cx+1, cy+1) = middle(at(level, x, y+1), at(level, x+1, y)); | ||
629 | 79 | // now we can compute the higher levels | ||
630 | 80 | if (clevel < maxLevel) | ||
631 | 81 | { | ||
632 | 82 | init_grid(clevel, cx, cy, side); | ||
633 | 83 | init_grid(clevel, cx+1, cy, side); | ||
634 | 84 | init_grid(clevel, cx+1, cy+1, side); | ||
635 | 85 | init_grid(clevel, cx, cy+1, side); | ||
636 | 86 | } | ||
637 | 87 | } | ||
638 | 88 | |||
639 | 89 | |||
640 | 90 | QVector<Vec3d> ToastGrid::getVertexArray(int level, int x, int y, int resolution) const | ||
641 | 91 | { | ||
642 | 92 | Q_ASSERT(resolution >= level); | ||
643 | 93 | Q_ASSERT(resolution <= maxLevel); | ||
644 | 94 | // The size of the returned array | ||
645 | 95 | int size = pow2(resolution - level) + 1; | ||
646 | 96 | QVector<Vec3d> ret; | ||
647 | 97 | ret.reserve(size * size); | ||
648 | 98 | // Compute the real position in the grid | ||
649 | 99 | int scale = pow2(maxLevel - level); | ||
650 | 100 | x *= scale; | ||
651 | 101 | y *= scale; | ||
652 | 102 | // Fill the array | ||
653 | 103 | int step = pow2(maxLevel - resolution); | ||
654 | 104 | for (int i = 0; i < size; i++) | ||
655 | 105 | { | ||
656 | 106 | for (int j = 0; j < size; j++) | ||
657 | 107 | { | ||
658 | 108 | ret.append(at(x + j * step, y + i * step)); | ||
659 | 109 | } | ||
660 | 110 | } | ||
661 | 111 | Q_ASSERT(ret.size() == size * size); | ||
662 | 112 | return ret; | ||
663 | 113 | } | ||
664 | 114 | |||
665 | 115 | |||
666 | 116 | QVector<Vec2f> ToastGrid::getTextureArray(int level, int x, int y, int resolution) const | ||
667 | 117 | { | ||
668 | 118 | Q_UNUSED(x); | ||
669 | 119 | Q_UNUSED(y); | ||
670 | 120 | Q_ASSERT(resolution >= level); | ||
671 | 121 | Q_ASSERT(resolution <= maxLevel); | ||
672 | 122 | // The size of the returned array | ||
673 | 123 | int size = pow2(resolution - level) + 1; | ||
674 | 124 | QVector<Vec2f> ret; | ||
675 | 125 | ret.reserve(size * size); | ||
676 | 126 | for (int i = size-1; i >= 0; i--) | ||
677 | 127 | { | ||
678 | 128 | for (int j = 0; j < size; j++) | ||
679 | 129 | { | ||
680 | 130 | ret.append(Vec2f(j,i) / (size-1)); | ||
681 | 131 | } | ||
682 | 132 | } | ||
683 | 133 | Q_ASSERT(ret.size() == size * size); | ||
684 | 134 | return ret; | ||
685 | 135 | } | ||
686 | 136 | |||
687 | 137 | |||
688 | 138 | QVector<unsigned short> ToastGrid::getTrianglesIndex(int level, int x, int y, int resolution) const | ||
689 | 139 | { | ||
690 | 140 | Q_ASSERT(resolution >= level); | ||
691 | 141 | Q_ASSERT(resolution <= maxLevel); | ||
692 | 142 | int size = pow2(resolution - level) + 1; | ||
693 | 143 | int nbTiles = (size - 1) * (size - 1); | ||
694 | 144 | // If we are in the top right or the bottom left quadran we invert the diagonal of the triangles. | ||
695 | 145 | int middleIndex = pow2(level) / 2; | ||
696 | 146 | bool invert = (x >= middleIndex) == (y >= middleIndex); | ||
697 | 147 | QVector<unsigned short> ret; | ||
698 | 148 | ret.reserve(nbTiles * 6); | ||
699 | 149 | for (int i = 0; i < size - 1; ++i) | ||
700 | 150 | { | ||
701 | 151 | for (int j = 0; j < size - 1; ++j) | ||
702 | 152 | { | ||
703 | 153 | Q_ASSERT(i * size + j <= std::numeric_limits<short>::max()); | ||
704 | 154 | unsigned int a = i * size + j; | ||
705 | 155 | unsigned int b = (i + 1) * size + j; | ||
706 | 156 | unsigned int c = (i + 1) * size + j + 1; | ||
707 | 157 | unsigned int d = i * size + j + 1; | ||
708 | 158 | if (!invert) | ||
709 | 159 | ret << b << c << a << c << d << a; | ||
710 | 160 | else | ||
711 | 161 | ret << b << d << a << d << b << c; | ||
712 | 162 | } | ||
713 | 163 | } | ||
714 | 164 | |||
715 | 165 | Q_ASSERT(ret.size() == nbTiles * 6); | ||
716 | 166 | return ret; | ||
717 | 167 | } | ||
718 | 168 | |||
719 | 169 | |||
720 | 170 | QVector<Vec3d> ToastGrid::getPolygon(int level, int x, int y) const | ||
721 | 171 | { | ||
722 | 172 | QVector<Vec3d> array = getVertexArray(level, x, y, level); | ||
723 | 173 | QVector<Vec3d> ret; | ||
724 | 174 | ret.reserve(4); | ||
725 | 175 | ret << array[2] << array[3] << array[1] << array[0]; | ||
726 | 176 | return ret; | ||
727 | 177 | } | ||
728 | 0 | 178 | ||
729 | === added file 'src/core/StelToastGrid.hpp' | |||
730 | --- src/core/StelToastGrid.hpp 1970-01-01 00:00:00 +0000 | |||
731 | +++ src/core/StelToastGrid.hpp 2016-11-13 10:24:15 +0000 | |||
732 | @@ -0,0 +1,90 @@ | |||
733 | 1 | /* | ||
734 | 2 | * Stellarium | ||
735 | 3 | * Copyright (C) 2010 Guillaume Chereau | ||
736 | 4 | * | ||
737 | 5 | * This program is free software; you can redistribute it and/or | ||
738 | 6 | * modify it under the terms of the GNU General Public License | ||
739 | 7 | * as published by the Free Software Foundation; either version 2 | ||
740 | 8 | * of the License, or (at your option) any later version. | ||
741 | 9 | * | ||
742 | 10 | * This program is distributed in the hope that it will be useful, | ||
743 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
744 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
745 | 13 | * GNU General Public License for more details. | ||
746 | 14 | * | ||
747 | 15 | * You should have received a copy of the GNU General Public License | ||
748 | 16 | * along with this program; if not, write to the Free Software | ||
749 | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
750 | 18 | */ | ||
751 | 19 | |||
752 | 20 | #ifndef STELTOASTGRID_HPP | ||
753 | 21 | #define STELTOASTGRID_HPP | ||
754 | 22 | |||
755 | 23 | #include <QVector> | ||
756 | 24 | #include "VecMath.hpp" | ||
757 | 25 | |||
758 | 26 | //! Compute 2^x | ||
759 | 27 | inline int pow2(int x) {return 1 << x;} | ||
760 | 28 | |||
761 | 29 | //! @class ToastGrid | ||
762 | 30 | //! Convenience class that can be used to compute the toast grid points. | ||
763 | 31 | //! The ToastGrid class allow to compute the vertex arrays associated | ||
764 | 32 | //! with Toast tiles. Each method refers to a tile by its level and x | ||
765 | 33 | //! and y coordinates. | ||
766 | 34 | class ToastGrid | ||
767 | 35 | { | ||
768 | 36 | public: | ||
769 | 37 | ToastGrid(int maxLevel); | ||
770 | 38 | //! Get the vertice array for a given tile. | ||
771 | 39 | //! The position are stored in a grid. | ||
772 | 40 | //! @param level the level of the tile. | ||
773 | 41 | //! @param x the x coordinate of the tile. | ||
774 | 42 | //! @param y the y coordinate of the tile. | ||
775 | 43 | //! @param resolution the resolution of the returned array. | ||
776 | 44 | QVector<Vec3d> getVertexArray(int level, int x, int y, int resolution) const; | ||
777 | 45 | //! Get the texture array for a given tile. | ||
778 | 46 | //! The position are stored in a grid | ||
779 | 47 | //! @param level the level of the tile. | ||
780 | 48 | //! @param x the x coordinate of the tile. | ||
781 | 49 | //! @param y the y coordinate of the tile. | ||
782 | 50 | //! @param resolution the resolution of the returned array. | ||
783 | 51 | QVector<Vec2f> getTextureArray(int level, int x, int y, int resolution) const; | ||
784 | 52 | //! Get the index of the vertex from getVertexArray sorted as a list of triangles. | ||
785 | 53 | //! @param level the level of the tile. | ||
786 | 54 | //! @param x the x coordinate of the tile. | ||
787 | 55 | //! @param y the y coordinate of the tile. | ||
788 | 56 | //! @param resolution the resolution of the returned array. | ||
789 | 57 | QVector<unsigned short> getTrianglesIndex(int level, int x, int y, int resolution) const; | ||
790 | 58 | //! Returns the polygon contouring a given tile. | ||
791 | 59 | //! @param level the level of the tile. | ||
792 | 60 | //! @param x the x coordinate of the tile. | ||
793 | 61 | //! @param y the y coordinate of the tile. | ||
794 | 62 | QVector<Vec3d> getPolygon(int level, int x, int y) const; | ||
795 | 63 | //! Return the max level of this grid. | ||
796 | 64 | int getMaxLevel() const {return maxLevel;} | ||
797 | 65 | |||
798 | 66 | private: | ||
799 | 67 | //! Get the vector at a given point in the grid | ||
800 | 68 | const Vec3d& at(int x, int y) const {return grid[y * size + x];} | ||
801 | 69 | //! Get the vector at a given point in the grid | ||
802 | 70 | Vec3d& at(int x, int y) {return grid[y * size + x];} | ||
803 | 71 | //! Get the vector at a given point in the grid | ||
804 | 72 | const Vec3d& at(int level, int x, int y) const | ||
805 | 73 | {int scale = pow2(maxLevel - level); return at(scale * x, scale * y);} | ||
806 | 74 | //! Get the vector at a given point in the grid | ||
807 | 75 | Vec3d& at(int level, int x, int y) | ||
808 | 76 | {int scale = pow2(maxLevel - level); return at(scale * x, scale * y);} | ||
809 | 77 | |||
810 | 78 | //! initialize the grid | ||
811 | 79 | void init_grid(); | ||
812 | 80 | void init_grid(int level, int x, int y, bool side); | ||
813 | 81 | |||
814 | 82 | //! The max level of the grid | ||
815 | 83 | int maxLevel; | ||
816 | 84 | //! the size of the grid | ||
817 | 85 | int size; | ||
818 | 86 | //! The actual grid data | ||
819 | 87 | QVector<Vec3d> grid; | ||
820 | 88 | }; | ||
821 | 89 | |||
822 | 90 | #endif // STELTOASTGRID_HPP | ||
823 | 0 | 91 | ||
824 | === modified file 'src/core/StelUtils.cpp' | |||
825 | --- src/core/StelUtils.cpp 2016-10-29 16:37:42 +0000 | |||
826 | +++ src/core/StelUtils.cpp 2016-11-13 10:24:15 +0000 | |||
827 | @@ -56,6 +56,23 @@ | |||
828 | 56 | #endif | 56 | #endif |
829 | 57 | } | 57 | } |
830 | 58 | 58 | ||
831 | 59 | QString getUserAgentString() | ||
832 | 60 | { | ||
833 | 61 | // Get info about operating system | ||
834 | 62 | QString platform = StelUtils::getOperatingSystemInfo(); | ||
835 | 63 | if (platform.contains("Linux")) | ||
836 | 64 | platform = "Linux"; | ||
837 | 65 | if (platform.contains("FreeBSD")) | ||
838 | 66 | platform = "FreeBSD"; | ||
839 | 67 | if (platform.contains("NetBSD")) | ||
840 | 68 | platform = "NetBSD"; | ||
841 | 69 | if (platform.contains("OpenBSD")) | ||
842 | 70 | platform = "OpenBSD"; | ||
843 | 71 | |||
844 | 72 | // Set user agent as "Stellarium/$version$ ($platform$)" | ||
845 | 73 | return QString("Stellarium/%1 (%2)").arg(StelUtils::getApplicationVersion()).arg(platform); | ||
846 | 74 | } | ||
847 | 75 | |||
848 | 59 | QString getOperatingSystemInfo() | 76 | QString getOperatingSystemInfo() |
849 | 60 | { | 77 | { |
850 | 61 | QString OS = "Unknown operating system"; | 78 | QString OS = "Unknown operating system"; |
851 | 62 | 79 | ||
852 | === modified file 'src/core/StelUtils.hpp' | |||
853 | --- src/core/StelUtils.hpp 2016-10-30 11:04:58 +0000 | |||
854 | +++ src/core/StelUtils.hpp 2016-11-13 10:24:15 +0000 | |||
855 | @@ -49,6 +49,9 @@ | |||
856 | 49 | //! Return the name and the version of operating system, i.e. "Mac OS X 10.7" | 49 | //! Return the name and the version of operating system, i.e. "Mac OS X 10.7" |
857 | 50 | QString getOperatingSystemInfo(); | 50 | QString getOperatingSystemInfo(); |
858 | 51 | 51 | ||
859 | 52 | //! Return the user agent name, i.e. "Stellarium/0.15.0 (Linux)" | ||
860 | 53 | QString getUserAgentString(); | ||
861 | 54 | |||
862 | 52 | //! Convert an angle in hms format to radian. | 55 | //! Convert an angle in hms format to radian. |
863 | 53 | //! @param h hour component | 56 | //! @param h hour component |
864 | 54 | //! @param m minute component | 57 | //! @param m minute component |
865 | 55 | 58 | ||
866 | === modified file 'src/core/modules/ConstellationMgr.cpp' | |||
867 | --- src/core/modules/ConstellationMgr.cpp 2016-09-17 18:27:21 +0000 | |||
868 | +++ src/core/modules/ConstellationMgr.cpp 2016-11-13 10:24:15 +0000 | |||
869 | @@ -134,7 +134,7 @@ | |||
870 | 134 | 134 | ||
871 | 135 | StelObjectMgr *objectManager = GETSTELMODULE(StelObjectMgr); | 135 | StelObjectMgr *objectManager = GETSTELMODULE(StelObjectMgr); |
872 | 136 | objectManager->registerStelObjectMgr(this); | 136 | objectManager->registerStelObjectMgr(this); |
874 | 137 | connect(objectManager, SIGNAL(selectedObjectChanged(StelModule::StelModuleSelectAction)), | 137 | connect(objectManager, SIGNAL(selectedObjectChanged(StelModule::StelModuleSelectAction)), |
875 | 138 | this, SLOT(selectedObjectChange(StelModule::StelModuleSelectAction))); | 138 | this, SLOT(selectedObjectChange(StelModule::StelModuleSelectAction))); |
876 | 139 | StelApp *app = &StelApp::getInstance(); | 139 | StelApp *app = &StelApp::getInstance(); |
877 | 140 | connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n())); | 140 | connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n())); |
878 | 141 | 141 | ||
879 | === added file 'src/core/modules/ToastMgr.cpp' | |||
880 | --- src/core/modules/ToastMgr.cpp 1970-01-01 00:00:00 +0000 | |||
881 | +++ src/core/modules/ToastMgr.cpp 2016-11-13 10:24:15 +0000 | |||
882 | @@ -0,0 +1,97 @@ | |||
883 | 1 | /* | ||
884 | 2 | * Stellarium | ||
885 | 3 | * Copyright (C) 2006 Fabien Chereau | ||
886 | 4 | * | ||
887 | 5 | * This program is free software; you can redistribute it and/or | ||
888 | 6 | * modify it under the terms of the GNU General Public License | ||
889 | 7 | * as published by the Free Software Foundation; either version 2 | ||
890 | 8 | * of the License, or (at your option) any later version. | ||
891 | 9 | * | ||
892 | 10 | * This program is distributed in the hope that it will be useful, | ||
893 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
894 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
895 | 13 | * GNU General Public License for more details. | ||
896 | 14 | * | ||
897 | 15 | * You should have received a copy of the GNU General Public License | ||
898 | 16 | * along with this program; if not, write to the Free Software | ||
899 | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
900 | 18 | */ | ||
901 | 19 | |||
902 | 20 | #include <QDebug> | ||
903 | 21 | |||
904 | 22 | #include "ToastMgr.hpp" | ||
905 | 23 | #include "StelToast.hpp" | ||
906 | 24 | #include "StelFader.hpp" | ||
907 | 25 | #include "StelPainter.hpp" | ||
908 | 26 | #include "StelCore.hpp" | ||
909 | 27 | #include "StelApp.hpp" | ||
910 | 28 | #include "StelTranslator.hpp" | ||
911 | 29 | #include "StelModuleMgr.hpp" | ||
912 | 30 | #include "StelSkyLayerMgr.hpp" | ||
913 | 31 | |||
914 | 32 | #include <QSettings> | ||
915 | 33 | |||
916 | 34 | ToastMgr::ToastMgr() | ||
917 | 35 | { | ||
918 | 36 | setObjectName("ToastMgr"); | ||
919 | 37 | fader = new LinearFader(); | ||
920 | 38 | } | ||
921 | 39 | |||
922 | 40 | ToastMgr::~ToastMgr() | ||
923 | 41 | { | ||
924 | 42 | if (survey) | ||
925 | 43 | { | ||
926 | 44 | delete survey; | ||
927 | 45 | survey = NULL; | ||
928 | 46 | } | ||
929 | 47 | |||
930 | 48 | delete fader; | ||
931 | 49 | fader = NULL; | ||
932 | 50 | } | ||
933 | 51 | |||
934 | 52 | void ToastMgr::init() | ||
935 | 53 | { | ||
936 | 54 | QSettings* conf = StelApp::getInstance().getSettings(); | ||
937 | 55 | Q_ASSERT(conf); | ||
938 | 56 | |||
939 | 57 | // TODO: change settings before release (results->survey; dss.astro.altspu.ru->dss.stellarium.org) | ||
940 | 58 | QString toastHost = conf->value("astro/toast_survey_host", "http://dss.astro.altspu.ru").toString(); | ||
941 | 59 | QString toastDir = conf->value("astro/toast_survey_directory", "results").toString(); | ||
942 | 60 | int toastLevel = conf->value("astro/toast_survey_levels", 11).toInt(); | ||
943 | 61 | survey = new ToastSurvey(toastHost+"/" + toastDir + "/{level}/{x}_{y}.jpg", toastLevel); | ||
944 | 62 | survey->setParent(this); | ||
945 | 63 | |||
946 | 64 | // Hide deep-sky survey by default | ||
947 | 65 | setFlagSurveyShow(conf->value("astro/flag_toast_survey", false).toBool()); | ||
948 | 66 | |||
949 | 67 | addAction("actionShow_Toast_Survey", N_("Display Options"), N_("Digitized sky survey"), "surveyDisplayed", "Ctrl+Alt+D"); | ||
950 | 68 | } | ||
951 | 69 | |||
952 | 70 | void ToastMgr::draw(StelCore* core) | ||
953 | 71 | { | ||
954 | 72 | if (!getFlagSurveyShow()) | ||
955 | 73 | return; | ||
956 | 74 | |||
957 | 75 | StelPainter sPainter(core->getProjection(StelCore::FrameJ2000)); | ||
958 | 76 | survey->draw(&sPainter); | ||
959 | 77 | } | ||
960 | 78 | |||
961 | 79 | void ToastMgr::update(double deltaTime) | ||
962 | 80 | { | ||
963 | 81 | fader->update((int)(deltaTime*1000)); | ||
964 | 82 | } | ||
965 | 83 | |||
966 | 84 | void ToastMgr::setFlagSurveyShow(const bool displayed) | ||
967 | 85 | { | ||
968 | 86 | if (*fader != displayed) | ||
969 | 87 | { | ||
970 | 88 | *fader = displayed; | ||
971 | 89 | GETSTELMODULE(StelSkyLayerMgr)->setFlagShow(!displayed); | ||
972 | 90 | emit surveyDisplayedChanged(displayed); | ||
973 | 91 | } | ||
974 | 92 | } | ||
975 | 93 | |||
976 | 94 | bool ToastMgr::getFlagSurveyShow() const | ||
977 | 95 | { | ||
978 | 96 | return *fader; | ||
979 | 97 | } | ||
980 | 0 | 98 | ||
981 | === added file 'src/core/modules/ToastMgr.hpp' | |||
982 | --- src/core/modules/ToastMgr.hpp 1970-01-01 00:00:00 +0000 | |||
983 | +++ src/core/modules/ToastMgr.hpp 2016-11-13 10:24:15 +0000 | |||
984 | @@ -0,0 +1,53 @@ | |||
985 | 1 | /* | ||
986 | 2 | * Stellarium | ||
987 | 3 | * Copyright (C) 2006 Fabien Chereau | ||
988 | 4 | * | ||
989 | 5 | * This program is free software; you can redistribute it and/or | ||
990 | 6 | * modify it under the terms of the GNU General Public License | ||
991 | 7 | * as published by the Free Software Foundation; either version 2 | ||
992 | 8 | * of the License, or (at your option) any later version. | ||
993 | 9 | * | ||
994 | 10 | * This program is distributed in the hope that it will be useful, | ||
995 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
996 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
997 | 13 | * GNU General Public License for more details. | ||
998 | 14 | * | ||
999 | 15 | * You should have received a copy of the GNU General Public License | ||
1000 | 16 | * along with this program; if not, write to the Free Software | ||
1001 | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
1002 | 18 | */ | ||
1003 | 19 | |||
1004 | 20 | #ifndef _TOASTMGR_HPP_ | ||
1005 | 21 | #define _TOASTMGR_HPP_ | ||
1006 | 22 | |||
1007 | 23 | #include "StelModule.hpp" | ||
1008 | 24 | |||
1009 | 25 | class ToastMgr : public StelModule | ||
1010 | 26 | { | ||
1011 | 27 | Q_OBJECT | ||
1012 | 28 | Q_PROPERTY(bool surveyDisplayed | ||
1013 | 29 | READ getFlagSurveyShow | ||
1014 | 30 | WRITE setFlagSurveyShow | ||
1015 | 31 | NOTIFY surveyDisplayedChanged) | ||
1016 | 32 | public: | ||
1017 | 33 | ToastMgr(); | ||
1018 | 34 | virtual ~ToastMgr(); | ||
1019 | 35 | virtual void init(); | ||
1020 | 36 | virtual void update(double deltaTime); | ||
1021 | 37 | virtual void draw(StelCore* core); | ||
1022 | 38 | //! Used to determine the order in which the various modules are drawn. MilkyWay=1, we use 7. | ||
1023 | 39 | virtual double getCallOrder(StelModuleActionName actionName) const {Q_UNUSED(actionName); return 7.;} | ||
1024 | 40 | |||
1025 | 41 | public slots: | ||
1026 | 42 | void setFlagSurveyShow(bool displayed); | ||
1027 | 43 | bool getFlagSurveyShow(void) const; | ||
1028 | 44 | |||
1029 | 45 | signals: | ||
1030 | 46 | void surveyDisplayedChanged(const bool displayed) const; | ||
1031 | 47 | |||
1032 | 48 | private: | ||
1033 | 49 | class ToastSurvey* survey; | ||
1034 | 50 | class LinearFader* fader; | ||
1035 | 51 | }; | ||
1036 | 52 | |||
1037 | 53 | #endif // _TOASTMGR_HPP_ | ||
1038 | 0 | 54 | ||
1039 | === modified file 'src/gui/ConfigurationDialog.cpp' | |||
1040 | --- src/gui/ConfigurationDialog.cpp 2016-11-04 17:18:42 +0000 | |||
1041 | +++ src/gui/ConfigurationDialog.cpp 2016-11-13 10:24:15 +0000 | |||
1042 | @@ -54,6 +54,7 @@ | |||
1043 | 54 | #include "StelJsonParser.hpp" | 54 | #include "StelJsonParser.hpp" |
1044 | 55 | #include "StelTranslator.hpp" | 55 | #include "StelTranslator.hpp" |
1045 | 56 | #include "EphemWrapper.hpp" | 56 | #include "EphemWrapper.hpp" |
1046 | 57 | #include "ToastMgr.hpp" | ||
1047 | 57 | 58 | ||
1048 | 58 | #include <QSettings> | 59 | #include <QSettings> |
1049 | 59 | #include <QDebug> | 60 | #include <QDebug> |
1050 | @@ -77,15 +78,7 @@ | |||
1051 | 77 | customDeltaTEquationDialog = NULL; | 78 | customDeltaTEquationDialog = NULL; |
1052 | 78 | hasDownloadedStarCatalog = false; | 79 | hasDownloadedStarCatalog = false; |
1053 | 79 | isDownloadingStarCatalog = false; | 80 | isDownloadingStarCatalog = false; |
1063 | 80 | savedProjectionType = StelApp::getInstance().getCore()->getCurrentProjectionType(); | 81 | savedProjectionType = StelApp::getInstance().getCore()->getCurrentProjectionType(); |
1055 | 81 | // Get info about operating system | ||
1056 | 82 | QString platform = StelUtils::getOperatingSystemInfo(); | ||
1057 | 83 | if (platform.contains("Linux")) | ||
1058 | 84 | platform = "Linux"; | ||
1059 | 85 | if (platform.contains("FreeBSD")) | ||
1060 | 86 | platform = "FreeBSD"; | ||
1061 | 87 | // Set user agent as "Stellarium/$version$ ($platform$)" | ||
1062 | 88 | userAgent = QString("Stellarium/%1 (%2)").arg(StelUtils::getApplicationVersion()).arg(platform); | ||
1064 | 89 | } | 82 | } |
1065 | 90 | 83 | ||
1066 | 91 | ConfigurationDialog::~ConfigurationDialog() | 84 | ConfigurationDialog::~ConfigurationDialog() |
1067 | @@ -298,6 +291,9 @@ | |||
1068 | 298 | ui->showNebulaBgButtonCheckbox->setChecked(gui->getFlagShowNebulaBackgroundButton()); | 291 | ui->showNebulaBgButtonCheckbox->setChecked(gui->getFlagShowNebulaBackgroundButton()); |
1069 | 299 | connect(ui->showNebulaBgButtonCheckbox, SIGNAL(toggled(bool)), gui, SLOT(setFlagShowNebulaBackgroundButton(bool))); | 292 | connect(ui->showNebulaBgButtonCheckbox, SIGNAL(toggled(bool)), gui, SLOT(setFlagShowNebulaBackgroundButton(bool))); |
1070 | 300 | 293 | ||
1071 | 294 | ui->showToastSurveyButtonCheckbox->setChecked(gui->getFlagShowToastSurveyButton()); | ||
1072 | 295 | connect(ui->showToastSurveyButtonCheckbox, SIGNAL(toggled(bool)), gui, SLOT(setFlagShowToastSurveyButton(bool))); | ||
1073 | 296 | |||
1074 | 301 | ui->showBookmarksButtonCheckBox->setChecked(gui->getFlagShowBookmarksButton()); | 297 | ui->showBookmarksButtonCheckBox->setChecked(gui->getFlagShowBookmarksButton()); |
1075 | 302 | connect(ui->showBookmarksButtonCheckBox, SIGNAL(toggled(bool)), gui, SLOT(setFlagShowBookmarksButton(bool))); | 298 | connect(ui->showBookmarksButtonCheckBox, SIGNAL(toggled(bool)), gui, SLOT(setFlagShowBookmarksButton(bool))); |
1076 | 303 | 299 | ||
1077 | @@ -789,6 +785,7 @@ | |||
1078 | 789 | conf->setValue("gui/auto_hide_horizontal_toolbar", gui->getAutoHideHorizontalButtonBar()); | 785 | conf->setValue("gui/auto_hide_horizontal_toolbar", gui->getAutoHideHorizontalButtonBar()); |
1079 | 790 | conf->setValue("gui/auto_hide_vertical_toolbar", gui->getAutoHideVerticalButtonBar()); | 786 | conf->setValue("gui/auto_hide_vertical_toolbar", gui->getAutoHideVerticalButtonBar()); |
1080 | 791 | conf->setValue("gui/flag_show_nebulae_background_button", gui->getFlagShowNebulaBackgroundButton()); | 787 | conf->setValue("gui/flag_show_nebulae_background_button", gui->getFlagShowNebulaBackgroundButton()); |
1081 | 788 | conf->setValue("gui/flag_show_toast_survey_button", gui->getFlagShowToastSurveyButton()); | ||
1082 | 792 | conf->setValue("gui/flag_show_decimal_degrees", StelApp::getInstance().getFlagShowDecimalDegrees()); | 789 | conf->setValue("gui/flag_show_decimal_degrees", StelApp::getInstance().getFlagShowDecimalDegrees()); |
1083 | 793 | conf->setValue("gui/flag_use_azimuth_from_south", StelApp::getInstance().getFlagSouthAzimuthUsage()); | 790 | conf->setValue("gui/flag_use_azimuth_from_south", StelApp::getInstance().getFlagSouthAzimuthUsage()); |
1084 | 794 | conf->setValue("gui/flag_time_jd", gui->getButtonBar()->getFlagTimeJd()); | 791 | conf->setValue("gui/flag_time_jd", gui->getButtonBar()->getFlagTimeJd()); |
1085 | @@ -1176,7 +1173,7 @@ | |||
1086 | 1176 | QNetworkRequest req(nextStarCatalogToDownload.value("url").toString()); | 1173 | QNetworkRequest req(nextStarCatalogToDownload.value("url").toString()); |
1087 | 1177 | req.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false); | 1174 | req.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false); |
1088 | 1178 | req.setAttribute(QNetworkRequest::RedirectionTargetAttribute, false); | 1175 | req.setAttribute(QNetworkRequest::RedirectionTargetAttribute, false); |
1090 | 1179 | req.setRawHeader("User-Agent", userAgent.toLatin1()); | 1176 | req.setRawHeader("User-Agent", StelUtils::getUserAgentString().toLatin1()); |
1091 | 1180 | starCatalogDownloadReply = StelApp::getInstance().getNetworkAccessManager()->get(req); | 1177 | starCatalogDownloadReply = StelApp::getInstance().getNetworkAccessManager()->get(req); |
1092 | 1181 | starCatalogDownloadReply->setReadBufferSize(1024*1024*2); | 1178 | starCatalogDownloadReply->setReadBufferSize(1024*1024*2); |
1093 | 1182 | connect(starCatalogDownloadReply, SIGNAL(finished()), this, SLOT(downloadFinished())); | 1179 | connect(starCatalogDownloadReply, SIGNAL(finished()), this, SLOT(downloadFinished())); |
1094 | @@ -1230,7 +1227,7 @@ | |||
1095 | 1230 | QNetworkRequest req(redirect.toUrl()); | 1227 | QNetworkRequest req(redirect.toUrl()); |
1096 | 1231 | req.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false); | 1228 | req.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false); |
1097 | 1232 | req.setAttribute(QNetworkRequest::RedirectionTargetAttribute, false); | 1229 | req.setAttribute(QNetworkRequest::RedirectionTargetAttribute, false); |
1099 | 1233 | req.setRawHeader("User-Agent", userAgent.toLatin1()); | 1230 | req.setRawHeader("User-Agent", StelUtils::getUserAgentString().toLatin1()); |
1100 | 1234 | starCatalogDownloadReply = StelApp::getInstance().getNetworkAccessManager()->get(req); | 1231 | starCatalogDownloadReply = StelApp::getInstance().getNetworkAccessManager()->get(req); |
1101 | 1235 | starCatalogDownloadReply->setReadBufferSize(1024*1024*2); | 1232 | starCatalogDownloadReply->setReadBufferSize(1024*1024*2); |
1102 | 1236 | connect(starCatalogDownloadReply, SIGNAL(readyRead()), this, SLOT(newStarCatalogData())); | 1233 | connect(starCatalogDownloadReply, SIGNAL(readyRead()), this, SLOT(newStarCatalogData())); |
1103 | 1237 | 1234 | ||
1104 | === modified file 'src/gui/ConfigurationDialog.hpp' | |||
1105 | --- src/gui/ConfigurationDialog.hpp 2016-10-29 11:47:49 +0000 | |||
1106 | +++ src/gui/ConfigurationDialog.hpp 2016-11-13 10:24:15 +0000 | |||
1107 | @@ -72,8 +72,6 @@ | |||
1108 | 72 | QFile* currentDownloadFile; | 72 | QFile* currentDownloadFile; |
1109 | 73 | class StelProgressController* progressBar; | 73 | class StelProgressController* progressBar; |
1110 | 74 | 74 | ||
1111 | 75 | QString userAgent; | ||
1112 | 76 | |||
1113 | 77 | private slots: | 75 | private slots: |
1114 | 78 | void setNoSelectedInfo(); | 76 | void setNoSelectedInfo(); |
1115 | 79 | void setAllSelectedInfo(); | 77 | void setAllSelectedInfo(); |
1116 | 80 | 78 | ||
1117 | === modified file 'src/gui/StelGui.cpp' | |||
1118 | --- src/gui/StelGui.cpp 2016-10-29 12:45:33 +0000 | |||
1119 | +++ src/gui/StelGui.cpp 2016-11-13 10:24:15 +0000 | |||
1120 | @@ -42,6 +42,7 @@ | |||
1121 | 42 | #include "StelObjectType.hpp" | 42 | #include "StelObjectType.hpp" |
1122 | 43 | #include "StelObject.hpp" | 43 | #include "StelObject.hpp" |
1123 | 44 | #include "SolarSystem.hpp" | 44 | #include "SolarSystem.hpp" |
1124 | 45 | #include "ToastMgr.hpp" | ||
1125 | 45 | #include "StelSkyLayerMgr.hpp" | 46 | #include "StelSkyLayerMgr.hpp" |
1126 | 46 | #include "StelStyle.hpp" | 47 | #include "StelStyle.hpp" |
1127 | 47 | #include "StelSkyDrawer.hpp" | 48 | #include "StelSkyDrawer.hpp" |
1128 | @@ -102,6 +103,8 @@ | |||
1129 | 102 | , flipHoriz(NULL) | 103 | , flipHoriz(NULL) |
1130 | 103 | , flagShowNebulaBackgroundButton(false) | 104 | , flagShowNebulaBackgroundButton(false) |
1131 | 104 | , btShowNebulaeBackground(NULL) | 105 | , btShowNebulaeBackground(NULL) |
1132 | 106 | , flagShowToastSurveyButton(false) | ||
1133 | 107 | , btShowToastSurvey(NULL) | ||
1134 | 105 | , flagShowBookmarksButton(false) | 108 | , flagShowBookmarksButton(false) |
1135 | 106 | , btShowBookmarks(NULL) | 109 | , btShowBookmarks(NULL) |
1136 | 107 | , initDone(false) | 110 | , initDone(false) |
1137 | @@ -382,6 +385,7 @@ | |||
1138 | 382 | // add the flip buttons if requested in the config | 385 | // add the flip buttons if requested in the config |
1139 | 383 | setFlagShowFlipButtons(conf->value("gui/flag_show_flip_buttons", false).toBool()); | 386 | setFlagShowFlipButtons(conf->value("gui/flag_show_flip_buttons", false).toBool()); |
1140 | 384 | setFlagShowNebulaBackgroundButton(conf->value("gui/flag_show_nebulae_background_button", false).toBool()); | 387 | setFlagShowNebulaBackgroundButton(conf->value("gui/flag_show_nebulae_background_button", false).toBool()); |
1141 | 388 | setFlagShowToastSurveyButton(conf->value("gui/flag_show_toast_survey_button", false).toBool()); | ||
1142 | 385 | setFlagShowBookmarksButton(conf->value("gui/flag_show_bookmarks_button", false).toBool()); | 389 | setFlagShowBookmarksButton(conf->value("gui/flag_show_bookmarks_button", false).toBool()); |
1143 | 386 | 390 | ||
1144 | 387 | /////////////////////////////////////////////////////////////////////// | 391 | /////////////////////////////////////////////////////////////////////// |
1145 | @@ -537,6 +541,10 @@ | |||
1146 | 537 | if (getAction("actionShow_DSS")->isChecked() != flag) | 541 | if (getAction("actionShow_DSS")->isChecked() != flag) |
1147 | 538 | getAction("actionShow_DSS")->setChecked(flag); | 542 | getAction("actionShow_DSS")->setChecked(flag); |
1148 | 539 | 543 | ||
1149 | 544 | flag = GETSTELMODULE(ToastMgr)->getFlagSurveyShow(); | ||
1150 | 545 | if (getAction("actionShow_Toast_Survey")->isChecked() != flag) | ||
1151 | 546 | getAction("actionShow_Toast_Survey")->setChecked(flag); | ||
1152 | 547 | |||
1153 | 540 | flag = StelApp::getInstance().getVisionModeNight(); | 548 | flag = StelApp::getInstance().getVisionModeNight(); |
1154 | 541 | if (getAction("actionShow_Night_Mode")->isChecked() != flag) | 549 | if (getAction("actionShow_Night_Mode")->isChecked() != flag) |
1155 | 542 | getAction("actionShow_Night_Mode")->setChecked(flag); | 550 | getAction("actionShow_Night_Mode")->setChecked(flag); |
1156 | @@ -712,6 +720,24 @@ | |||
1157 | 712 | } | 720 | } |
1158 | 713 | } | 721 | } |
1159 | 714 | 722 | ||
1160 | 723 | // Define whether the button toggling TOAST survey images should be visible | ||
1161 | 724 | void StelGui::setFlagShowToastSurveyButton(bool b) | ||
1162 | 725 | { | ||
1163 | 726 | if (b==true) { | ||
1164 | 727 | if (btShowToastSurvey==NULL) { | ||
1165 | 728 | // Create the nebulae background button | ||
1166 | 729 | QPixmap pxmapGlow32x32(":/graphicGui/glow32x32.png"); | ||
1167 | 730 | QPixmap pxmapOn(":/graphicGui/btToastSurvey-on.png"); | ||
1168 | 731 | QPixmap pxmapOff(":/graphicGui/btToastSurvey-off.png"); | ||
1169 | 732 | btShowToastSurvey = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionShow_Toast_Survey"); | ||
1170 | 733 | } | ||
1171 | 734 | getButtonBar()->addButton(btShowToastSurvey, "040-nebulaeGroup"); | ||
1172 | 735 | } else { | ||
1173 | 736 | getButtonBar()->hideButton("actionShow_Toast_Survey"); | ||
1174 | 737 | } | ||
1175 | 738 | flagShowToastSurveyButton = b; | ||
1176 | 739 | } | ||
1177 | 740 | |||
1178 | 715 | void StelGui::setFlagShowDecimalDegrees(bool b) | 741 | void StelGui::setFlagShowDecimalDegrees(bool b) |
1179 | 716 | { | 742 | { |
1180 | 717 | StelApp::getInstance().setFlagShowDecimalDegrees(b); | 743 | StelApp::getInstance().setFlagShowDecimalDegrees(b); |
1181 | @@ -809,6 +835,11 @@ | |||
1182 | 809 | return flagShowNebulaBackgroundButton; | 835 | return flagShowNebulaBackgroundButton; |
1183 | 810 | } | 836 | } |
1184 | 811 | 837 | ||
1185 | 838 | bool StelGui::getFlagShowToastSurveyButton() const | ||
1186 | 839 | { | ||
1187 | 840 | return flagShowToastSurveyButton; | ||
1188 | 841 | } | ||
1189 | 842 | |||
1190 | 812 | bool StelGui::getFlagShowBookmarksButton() const | 843 | bool StelGui::getFlagShowBookmarksButton() const |
1191 | 813 | { | 844 | { |
1192 | 814 | return flagShowBookmarksButton; | 845 | return flagShowBookmarksButton; |
1193 | 815 | 846 | ||
1194 | === modified file 'src/gui/StelGui.hpp' | |||
1195 | --- src/gui/StelGui.hpp 2016-08-24 13:32:23 +0000 | |||
1196 | +++ src/gui/StelGui.hpp 2016-11-13 10:24:15 +0000 | |||
1197 | @@ -92,6 +92,9 @@ | |||
1198 | 92 | //! Get whether the button toggling nebulae background is visible | 92 | //! Get whether the button toggling nebulae background is visible |
1199 | 93 | bool getFlagShowNebulaBackgroundButton() const; | 93 | bool getFlagShowNebulaBackgroundButton() const; |
1200 | 94 | 94 | ||
1201 | 95 | //! Get whether the button toggling TOAST survey is visible | ||
1202 | 96 | bool getFlagShowToastSurveyButton() const; | ||
1203 | 97 | |||
1204 | 95 | //! Get whether the button toggling bookmarks is visible | 98 | //! Get whether the button toggling bookmarks is visible |
1205 | 96 | bool getFlagShowBookmarksButton() const; | 99 | bool getFlagShowBookmarksButton() const; |
1206 | 97 | 100 | ||
1207 | @@ -123,6 +126,9 @@ | |||
1208 | 123 | //! Define whether the button toggling nebulae background should be visible | 126 | //! Define whether the button toggling nebulae background should be visible |
1209 | 124 | void setFlagShowNebulaBackgroundButton(bool b); | 127 | void setFlagShowNebulaBackgroundButton(bool b); |
1210 | 125 | 128 | ||
1211 | 129 | //! Define whether the button toggling TOAST survey should be visible | ||
1212 | 130 | void setFlagShowToastSurveyButton(bool b); | ||
1213 | 131 | |||
1214 | 126 | //! Define whether the button toggling bookmarks should be visible | 132 | //! Define whether the button toggling bookmarks should be visible |
1215 | 127 | void setFlagShowBookmarksButton(bool b); | 133 | void setFlagShowBookmarksButton(bool b); |
1216 | 128 | 134 | ||
1217 | @@ -212,6 +218,9 @@ | |||
1218 | 212 | bool flagShowNebulaBackgroundButton; | 218 | bool flagShowNebulaBackgroundButton; |
1219 | 213 | StelButton* btShowNebulaeBackground; | 219 | StelButton* btShowNebulaeBackground; |
1220 | 214 | 220 | ||
1221 | 221 | bool flagShowToastSurveyButton; | ||
1222 | 222 | StelButton* btShowToastSurvey; | ||
1223 | 223 | |||
1224 | 215 | bool flagShowBookmarksButton; | 224 | bool flagShowBookmarksButton; |
1225 | 216 | StelButton* btShowBookmarks; | 225 | StelButton* btShowBookmarks; |
1226 | 217 | 226 | ||
1227 | 218 | 227 | ||
1228 | === modified file 'src/gui/configurationDialog.ui' | |||
1229 | --- src/gui/configurationDialog.ui 2016-11-05 18:23:26 +0000 | |||
1230 | +++ src/gui/configurationDialog.ui 2016-11-13 10:24:15 +0000 | |||
1231 | @@ -7,7 +7,7 @@ | |||
1232 | 7 | <x>0</x> | 7 | <x>0</x> |
1233 | 8 | <y>0</y> | 8 | <y>0</y> |
1234 | 9 | <width>512</width> | 9 | <width>512</width> |
1236 | 10 | <height>563</height> | 10 | <height>579</height> |
1237 | 11 | </rect> | 11 | </rect> |
1238 | 12 | </property> | 12 | </property> |
1239 | 13 | <layout class="QVBoxLayout"> | 13 | <layout class="QVBoxLayout"> |
1240 | @@ -1291,7 +1291,70 @@ | |||
1241 | 1291 | <property name="bottomMargin"> | 1291 | <property name="bottomMargin"> |
1242 | 1292 | <number>0</number> | 1292 | <number>0</number> |
1243 | 1293 | </property> | 1293 | </property> |
1245 | 1294 | <item row="3" column="0"> | 1294 | <item row="8" column="0" colspan="2"> |
1246 | 1295 | <widget class="QCheckBox" name="autoZoomResetsDirectionCheckbox"> | ||
1247 | 1296 | <property name="toolTip"> | ||
1248 | 1297 | <string>When enabled, the "auto zoom out" key will also set the initial viewing direction</string> | ||
1249 | 1298 | </property> | ||
1250 | 1299 | <property name="text"> | ||
1251 | 1300 | <string>Auto zoom out returns to initial direction of view</string> | ||
1252 | 1301 | </property> | ||
1253 | 1302 | </widget> | ||
1254 | 1303 | </item> | ||
1255 | 1304 | <item row="0" column="1"> | ||
1256 | 1305 | <widget class="QCheckBox" name="diskViewportCheckbox"> | ||
1257 | 1306 | <property name="toolTip"> | ||
1258 | 1307 | <string>Mask out everything outside a central circle in the main view</string> | ||
1259 | 1308 | </property> | ||
1260 | 1309 | <property name="text"> | ||
1261 | 1310 | <string>Disc viewport</string> | ||
1262 | 1311 | </property> | ||
1263 | 1312 | </widget> | ||
1264 | 1313 | </item> | ||
1265 | 1314 | <item row="1" column="1"> | ||
1266 | 1315 | <widget class="QCheckBox" name="gravityLabelCheckbox"> | ||
1267 | 1316 | <property name="toolTip"> | ||
1268 | 1317 | <string>Align labels with the horizon</string> | ||
1269 | 1318 | </property> | ||
1270 | 1319 | <property name="text"> | ||
1271 | 1320 | <string>Gravity labels</string> | ||
1272 | 1321 | </property> | ||
1273 | 1322 | </widget> | ||
1274 | 1323 | </item> | ||
1275 | 1324 | <item row="4" column="1"> | ||
1276 | 1325 | <widget class="QCheckBox" name="decimalDegreeCheckBox"> | ||
1277 | 1326 | <property name="toolTip"> | ||
1278 | 1327 | <string>Use decimal degrees for coordinates</string> | ||
1279 | 1328 | </property> | ||
1280 | 1329 | <property name="text"> | ||
1281 | 1330 | <string>Use decimal degrees</string> | ||
1282 | 1331 | </property> | ||
1283 | 1332 | </widget> | ||
1284 | 1333 | </item> | ||
1285 | 1334 | <item row="0" column="0"> | ||
1286 | 1335 | <widget class="QCheckBox" name="sphericMirrorCheckbox"> | ||
1287 | 1336 | <property name="toolTip"> | ||
1288 | 1337 | <string>Spheric mirror distortion is used when projecting Stellarium onto a spheric mirror for low-cost planetarium systems.</string> | ||
1289 | 1338 | </property> | ||
1290 | 1339 | <property name="text"> | ||
1291 | 1340 | <string>Spheric mirror distortion</string> | ||
1292 | 1341 | </property> | ||
1293 | 1342 | <property name="checkable"> | ||
1294 | 1343 | <bool>true</bool> | ||
1295 | 1344 | </property> | ||
1296 | 1345 | </widget> | ||
1297 | 1346 | </item> | ||
1298 | 1347 | <item row="5" column="1"> | ||
1299 | 1348 | <widget class="QCheckBox" name="topocentricCheckBox"> | ||
1300 | 1349 | <property name="toolTip"> | ||
1301 | 1350 | <string>Activate to view as seen from surface of the planet (recommended). If switched off, display planetocentric view.</string> | ||
1302 | 1351 | </property> | ||
1303 | 1352 | <property name="text"> | ||
1304 | 1353 | <string>Topocentric coordinates</string> | ||
1305 | 1354 | </property> | ||
1306 | 1355 | </widget> | ||
1307 | 1356 | </item> | ||
1308 | 1357 | <item row="4" column="0"> | ||
1309 | 1295 | <widget class="QCheckBox" name="autoEnableAtmosphereCheckBox"> | 1358 | <widget class="QCheckBox" name="autoEnableAtmosphereCheckBox"> |
1310 | 1296 | <property name="toolTip"> | 1359 | <property name="toolTip"> |
1311 | 1297 | <string>Auto-enabling of the atmosphere for bodies with atmosphere in location window</string> | 1360 | <string>Auto-enabling of the atmosphere for bodies with atmosphere in location window</string> |
1312 | @@ -1301,6 +1364,29 @@ | |||
1313 | 1301 | </property> | 1364 | </property> |
1314 | 1302 | </widget> | 1365 | </widget> |
1315 | 1303 | </item> | 1366 | </item> |
1316 | 1367 | <item row="2" column="1"> | ||
1317 | 1368 | <widget class="QCheckBox" name="showFlipButtonsCheckbox"> | ||
1318 | 1369 | <property name="toolTip"> | ||
1319 | 1370 | <string>Toggle vertical and horizontal image flip buttons.</string> | ||
1320 | 1371 | </property> | ||
1321 | 1372 | <property name="text"> | ||
1322 | 1373 | <string>Show flip buttons</string> | ||
1323 | 1374 | </property> | ||
1324 | 1375 | </widget> | ||
1325 | 1376 | </item> | ||
1326 | 1377 | <item row="1" column="0"> | ||
1327 | 1378 | <widget class="QCheckBox" name="selectSingleConstellationButton"> | ||
1328 | 1379 | <property name="toolTip"> | ||
1329 | 1380 | <string>Hide other constellations when you click one</string> | ||
1330 | 1381 | </property> | ||
1331 | 1382 | <property name="statusTip"> | ||
1332 | 1383 | <string>Hide other constellations when you click one</string> | ||
1333 | 1384 | </property> | ||
1334 | 1385 | <property name="text"> | ||
1335 | 1386 | <string>Select single constellation</string> | ||
1336 | 1387 | </property> | ||
1337 | 1388 | </widget> | ||
1338 | 1389 | </item> | ||
1339 | 1304 | <item row="2" column="0"> | 1390 | <item row="2" column="0"> |
1340 | 1305 | <widget class="QCheckBox" name="showNebulaBgButtonCheckbox"> | 1391 | <widget class="QCheckBox" name="showNebulaBgButtonCheckbox"> |
1341 | 1306 | <property name="toolTip"> | 1392 | <property name="toolTip"> |
1342 | @@ -1311,7 +1397,7 @@ | |||
1343 | 1311 | </property> | 1397 | </property> |
1344 | 1312 | </widget> | 1398 | </widget> |
1345 | 1313 | </item> | 1399 | </item> |
1347 | 1314 | <item row="4" column="0"> | 1400 | <item row="5" column="0"> |
1348 | 1315 | <widget class="QCheckBox" name="nutationCheckBox"> | 1401 | <widget class="QCheckBox" name="nutationCheckBox"> |
1349 | 1316 | <property name="toolTip"> | 1402 | <property name="toolTip"> |
1350 | 1317 | <string>Nutation is a small wobble of Earth's axis, amounting to a few arcseconds.</string> | 1403 | <string>Nutation is a small wobble of Earth's axis, amounting to a few arcseconds.</string> |
1351 | @@ -1321,7 +1407,7 @@ | |||
1352 | 1321 | </property> | 1407 | </property> |
1353 | 1322 | </widget> | 1408 | </widget> |
1354 | 1323 | </item> | 1409 | </item> |
1356 | 1324 | <item row="5" column="0"> | 1410 | <item row="6" column="0"> |
1357 | 1325 | <widget class="QCheckBox" name="azimuthFromSouthcheckBox"> | 1411 | <widget class="QCheckBox" name="azimuthFromSouthcheckBox"> |
1358 | 1326 | <property name="toolTip"> | 1412 | <property name="toolTip"> |
1359 | 1327 | <string>Activate this option to calculate azimuth from south towards west.</string> | 1413 | <string>Activate this option to calculate azimuth from south towards west.</string> |
1360 | @@ -1332,72 +1418,16 @@ | |||
1361 | 1332 | </widget> | 1418 | </widget> |
1362 | 1333 | </item> | 1419 | </item> |
1363 | 1334 | <item row="3" column="1"> | 1420 | <item row="3" column="1"> |
1430 | 1335 | <widget class="QCheckBox" name="decimalDegreeCheckBox"> | 1421 | <widget class="QCheckBox" name="showToastSurveyButtonCheckbox"> |
1431 | 1336 | <property name="toolTip"> | 1422 | <property name="toolTip"> |
1432 | 1337 | <string>Use decimal degrees for coordinates</string> | 1423 | <string>Toggle display Digitized Sky Survey.</string> |
1433 | 1338 | </property> | 1424 | </property> |
1434 | 1339 | <property name="text"> | 1425 | <property name="text"> |
1435 | 1340 | <string>Use decimal degrees</string> | 1426 | <string>Show DSS button</string> |
1436 | 1341 | </property> | 1427 | </property> |
1437 | 1342 | </widget> | 1428 | </widget> |
1438 | 1343 | </item> | 1429 | </item> |
1439 | 1344 | <item row="4" column="1"> | 1430 | <item row="6" column="1"> |
1374 | 1345 | <widget class="QCheckBox" name="topocentricCheckBox"> | ||
1375 | 1346 | <property name="toolTip"> | ||
1376 | 1347 | <string>Activate to view as seen from surface of the planet (recommended). If switched off, display planetocentric view.</string> | ||
1377 | 1348 | </property> | ||
1378 | 1349 | <property name="text"> | ||
1379 | 1350 | <string>Topocentric coordinates</string> | ||
1380 | 1351 | </property> | ||
1381 | 1352 | </widget> | ||
1382 | 1353 | </item> | ||
1383 | 1354 | <item row="2" column="1"> | ||
1384 | 1355 | <widget class="QCheckBox" name="showFlipButtonsCheckbox"> | ||
1385 | 1356 | <property name="toolTip"> | ||
1386 | 1357 | <string>Toggle vertical and horizontal image flip buttons.</string> | ||
1387 | 1358 | </property> | ||
1388 | 1359 | <property name="text"> | ||
1389 | 1360 | <string>Show flip buttons</string> | ||
1390 | 1361 | </property> | ||
1391 | 1362 | </widget> | ||
1392 | 1363 | </item> | ||
1393 | 1364 | <item row="1" column="1"> | ||
1394 | 1365 | <widget class="QCheckBox" name="gravityLabelCheckbox"> | ||
1395 | 1366 | <property name="toolTip"> | ||
1396 | 1367 | <string>Align labels with the horizon</string> | ||
1397 | 1368 | </property> | ||
1398 | 1369 | <property name="text"> | ||
1399 | 1370 | <string>Gravity labels</string> | ||
1400 | 1371 | </property> | ||
1401 | 1372 | </widget> | ||
1402 | 1373 | </item> | ||
1403 | 1374 | <item row="1" column="0"> | ||
1404 | 1375 | <widget class="QCheckBox" name="selectSingleConstellationButton"> | ||
1405 | 1376 | <property name="toolTip"> | ||
1406 | 1377 | <string>Hide other constellations when you click one</string> | ||
1407 | 1378 | </property> | ||
1408 | 1379 | <property name="statusTip"> | ||
1409 | 1380 | <string>Hide other constellations when you click one</string> | ||
1410 | 1381 | </property> | ||
1411 | 1382 | <property name="text"> | ||
1412 | 1383 | <string>Select single constellation</string> | ||
1413 | 1384 | </property> | ||
1414 | 1385 | </widget> | ||
1415 | 1386 | </item> | ||
1416 | 1387 | <item row="0" column="0"> | ||
1417 | 1388 | <widget class="QCheckBox" name="sphericMirrorCheckbox"> | ||
1418 | 1389 | <property name="toolTip"> | ||
1419 | 1390 | <string>Spheric mirror distortion is used when projecting Stellarium onto a spheric mirror for low-cost planetarium systems.</string> | ||
1420 | 1391 | </property> | ||
1421 | 1392 | <property name="text"> | ||
1422 | 1393 | <string>Spheric mirror distortion</string> | ||
1423 | 1394 | </property> | ||
1424 | 1395 | <property name="checkable"> | ||
1425 | 1396 | <bool>true</bool> | ||
1426 | 1397 | </property> | ||
1427 | 1398 | </widget> | ||
1428 | 1399 | </item> | ||
1429 | 1400 | <item row="5" column="1"> | ||
1440 | 1401 | <widget class="QCheckBox" name="autoChangeLandscapesCheckBox"> | 1431 | <widget class="QCheckBox" name="autoChangeLandscapesCheckBox"> |
1441 | 1402 | <property name="toolTip"> | 1432 | <property name="toolTip"> |
1442 | 1403 | <string>Automatic change of landscape when planet is changed</string> | 1433 | <string>Automatic change of landscape when planet is changed</string> |
1443 | @@ -1407,27 +1437,7 @@ | |||
1444 | 1407 | </property> | 1437 | </property> |
1445 | 1408 | </widget> | 1438 | </widget> |
1446 | 1409 | </item> | 1439 | </item> |
1468 | 1410 | <item row="0" column="1"> | 1440 | <item row="3" column="0"> |
1448 | 1411 | <widget class="QCheckBox" name="diskViewportCheckbox"> | ||
1449 | 1412 | <property name="toolTip"> | ||
1450 | 1413 | <string>Mask out everything outside a central circle in the main view</string> | ||
1451 | 1414 | </property> | ||
1452 | 1415 | <property name="text"> | ||
1453 | 1416 | <string>Disc viewport</string> | ||
1454 | 1417 | </property> | ||
1455 | 1418 | </widget> | ||
1456 | 1419 | </item> | ||
1457 | 1420 | <item row="7" column="0" colspan="2"> | ||
1458 | 1421 | <widget class="QCheckBox" name="autoZoomResetsDirectionCheckbox"> | ||
1459 | 1422 | <property name="toolTip"> | ||
1460 | 1423 | <string>When enabled, the "auto zoom out" key will also set the initial viewing direction</string> | ||
1461 | 1424 | </property> | ||
1462 | 1425 | <property name="text"> | ||
1463 | 1426 | <string>Auto zoom out returns to initial direction of view</string> | ||
1464 | 1427 | </property> | ||
1465 | 1428 | </widget> | ||
1466 | 1429 | </item> | ||
1467 | 1430 | <item row="6" column="0"> | ||
1469 | 1431 | <widget class="QCheckBox" name="showBookmarksButtonCheckBox"> | 1441 | <widget class="QCheckBox" name="showBookmarksButtonCheckBox"> |
1470 | 1432 | <property name="text"> | 1442 | <property name="text"> |
1471 | 1433 | <string>Show bookmarks button</string> | 1443 | <string>Show bookmarks button</string> |
1472 | 1434 | 1444 | ||
1473 | === added directory 'util/DSSToStellarium' | |||
1474 | === added file 'util/DSSToStellarium/DejaVuSans.ttf' | |||
1475 | 1435 | Binary files util/DSSToStellarium/DejaVuSans.ttf 1970-01-01 00:00:00 +0000 and util/DSSToStellarium/DejaVuSans.ttf 2016-11-13 10:24:15 +0000 differ | 1445 | Binary files util/DSSToStellarium/DejaVuSans.ttf 1970-01-01 00:00:00 +0000 and util/DSSToStellarium/DejaVuSans.ttf 2016-11-13 10:24:15 +0000 differ |
1476 | === added file 'util/DSSToStellarium/UTdssUtils.py' | |||
1477 | --- util/DSSToStellarium/UTdssUtils.py 1970-01-01 00:00:00 +0000 | |||
1478 | +++ util/DSSToStellarium/UTdssUtils.py 2016-11-13 10:24:15 +0000 | |||
1479 | @@ -0,0 +1,35 @@ | |||
1480 | 1 | #!/usr/bin/python | ||
1481 | 2 | |||
1482 | 3 | # This file is part of Stellarium. Stellarium is free software: you can | ||
1483 | 4 | # redistribute it and/or modify it under the terms of the GNU General Public | ||
1484 | 5 | # License as published by the Free Software Foundation, version 2. | ||
1485 | 6 | # | ||
1486 | 7 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
1487 | 8 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
1488 | 9 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
1489 | 10 | # details. | ||
1490 | 11 | # | ||
1491 | 12 | # You should have received a copy of the GNU General Public License along with | ||
1492 | 13 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
1493 | 14 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
1494 | 15 | # | ||
1495 | 16 | # Copyright Fabien Chereau <fabien.chereau@gmail.com> | ||
1496 | 17 | |||
1497 | 18 | import dssUtils | ||
1498 | 19 | import unittest | ||
1499 | 20 | |||
1500 | 21 | class TestDssUtils(unittest.TestCase): | ||
1501 | 22 | |||
1502 | 23 | def setUp(self): | ||
1503 | 24 | pass | ||
1504 | 25 | |||
1505 | 26 | def test_pointProjection(self): | ||
1506 | 27 | wcs = dssUtils.DssWcs("S032") | ||
1507 | 28 | pixPos = [500, 1253] | ||
1508 | 29 | raDecPos = wcs.pixelToRaDec(pixPos) | ||
1509 | 30 | self.assertAlmostEqual(pixPos[0], wcs.raDecToPixel(raDecPos)[0]) | ||
1510 | 31 | self.assertAlmostEqual(pixPos[1], wcs.raDecToPixel(raDecPos)[1]) | ||
1511 | 32 | |||
1512 | 33 | if __name__ == '__main__': | ||
1513 | 34 | unittest.main() | ||
1514 | 35 | |||
1515 | 0 | 36 | ||
1516 | === added file 'util/DSSToStellarium/createUpperToastLevels.py' | |||
1517 | --- util/DSSToStellarium/createUpperToastLevels.py 1970-01-01 00:00:00 +0000 | |||
1518 | +++ util/DSSToStellarium/createUpperToastLevels.py 2016-11-13 10:24:15 +0000 | |||
1519 | @@ -0,0 +1,81 @@ | |||
1520 | 1 | #!/usr/bin/python | ||
1521 | 2 | |||
1522 | 3 | # This file is part of Stellarium. Stellarium is free software: you can | ||
1523 | 4 | # redistribute it and/or modify it under the terms of the GNU General Public | ||
1524 | 5 | # License as published by the Free Software Foundation, version 2. | ||
1525 | 6 | # | ||
1526 | 7 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
1527 | 8 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
1528 | 9 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
1529 | 10 | # details. | ||
1530 | 11 | # | ||
1531 | 12 | # You should have received a copy of the GNU General Public License along with | ||
1532 | 13 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
1533 | 14 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
1534 | 15 | # | ||
1535 | 16 | # Copyright Fabien Chereau <fabien.chereau@gmail.com> | ||
1536 | 17 | |||
1537 | 18 | import Image | ||
1538 | 19 | import os | ||
1539 | 20 | from subprocess import Popen, PIPE, STDOUT | ||
1540 | 21 | |||
1541 | 22 | outDirectory = 'results' | ||
1542 | 23 | level=11 | ||
1543 | 24 | imSize = 256 | ||
1544 | 25 | |||
1545 | 26 | print "Generate upper levels tile in " + outDirectory | ||
1546 | 27 | |||
1547 | 28 | if not os.path.exists(outDirectory): | ||
1548 | 29 | print "Output directory %s doesn't exist. It should be there and contain tiles for level %d" % (outDirectory, level) | ||
1549 | 30 | exit(-1) | ||
1550 | 31 | |||
1551 | 32 | level=level-1 | ||
1552 | 33 | while level>=0: | ||
1553 | 34 | print "Start level %s" % level | ||
1554 | 35 | os.system("mkdir %s/%d" % (outDirectory, level)) | ||
1555 | 36 | allTiles = [] | ||
1556 | 37 | for filename in os.listdir("%s/%d" % (outDirectory, level+1)): | ||
1557 | 38 | basename, extension = filename.split('.') | ||
1558 | 39 | if basename.endswith("partial"): | ||
1559 | 40 | tmp, partial = basename.split('-') | ||
1560 | 41 | if not os.path.exists("%s/%d/%s" % (outDirectory, level+1, tmp+'.'+extension)): | ||
1561 | 42 | cmd = "mv %s/%d/%s %s/%d/%s" % (outDirectory, level+1, filename, outDirectory, level+1, tmp+'.'+extension) | ||
1562 | 43 | os.system(cmd) | ||
1563 | 44 | basename = tmp | ||
1564 | 45 | xystr = basename.split('_') | ||
1565 | 46 | allTiles.append((int(xystr[0]), int(xystr[1]))) | ||
1566 | 47 | |||
1567 | 48 | toGenerate = {} | ||
1568 | 49 | for tile in allTiles: | ||
1569 | 50 | key = (tile[0]/2, tile[1]/2) | ||
1570 | 51 | if key not in toGenerate: | ||
1571 | 52 | toGenerate[key]=[] | ||
1572 | 53 | toGenerate[key].append(tile) | ||
1573 | 54 | |||
1574 | 55 | i = 0 | ||
1575 | 56 | for (x, y) in toGenerate: | ||
1576 | 57 | i = i+1 | ||
1577 | 58 | if i % 1000 == 0: | ||
1578 | 59 | print "%d/%d" % (i,len(toGenerate)) | ||
1579 | 60 | resImg=Image.new("RGB", (imSize, imSize)) | ||
1580 | 61 | tile = toGenerate[(x, y)] | ||
1581 | 62 | if (x*2, y*2) in tile: | ||
1582 | 63 | im = Image.open("%s/%d/%d_%d.jpg" % (outDirectory, level+1, x*2, y*2)).resize((imSize/2, imSize/2), Image.NEAREST) | ||
1583 | 64 | resImg.paste(im, (0, 0)) | ||
1584 | 65 | if (x*2+1, y*2) in tile: | ||
1585 | 66 | im = Image.open("%s/%d/%d_%d.jpg" % (outDirectory, level+1, x*2+1, y*2)).resize((imSize/2, imSize/2), Image.NEAREST) | ||
1586 | 67 | resImg.paste(im, (imSize/2, 0)) | ||
1587 | 68 | if (x*2, y*2+1) in tile: | ||
1588 | 69 | im = Image.open("%s/%d/%d_%d.jpg" % (outDirectory, level+1, x*2, y*2+1)).resize((imSize/2, imSize/2), Image.NEAREST) | ||
1589 | 70 | resImg.paste(im, (0, imSize/2)) | ||
1590 | 71 | if ((x*2+1, y*2+1)) in tile: | ||
1591 | 72 | im = Image.open("%s/%d/%d_%d.jpg" % (outDirectory, level+1, x*2+1, y*2+1)).resize((imSize/2, imSize/2), Image.NEAREST) | ||
1592 | 73 | resImg.paste(im, (imSize/2, imSize/2)) | ||
1593 | 74 | resImg.save("%s/%d/%d_%d.jpg" % (outDirectory, level, x, y), quality=90) | ||
1594 | 75 | |||
1595 | 76 | level=level-1 | ||
1596 | 77 | |||
1597 | 78 | |||
1598 | 79 | |||
1599 | 80 | |||
1600 | 81 | |||
1601 | 0 | 82 | ||
1602 | === added file 'util/DSSToStellarium/dssUtils.py' | |||
1603 | --- util/DSSToStellarium/dssUtils.py 1970-01-01 00:00:00 +0000 | |||
1604 | +++ util/DSSToStellarium/dssUtils.py 2016-11-13 10:24:15 +0000 | |||
1605 | @@ -0,0 +1,169 @@ | |||
1606 | 1 | #!/usr/bin/python | ||
1607 | 2 | |||
1608 | 3 | # This file is part of Stellarium. Stellarium is free software: you can | ||
1609 | 4 | # redistribute it and/or modify it under the terms of the GNU General Public | ||
1610 | 5 | # License as published by the Free Software Foundation, version 2. | ||
1611 | 6 | # | ||
1612 | 7 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
1613 | 8 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
1614 | 9 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
1615 | 10 | # details. | ||
1616 | 11 | # | ||
1617 | 12 | # You should have received a copy of the GNU General Public License along with | ||
1618 | 13 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
1619 | 14 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
1620 | 15 | # | ||
1621 | 16 | # Copyright Fabien Chereau <fabien.chereau@gmail.com> | ||
1622 | 17 | |||
1623 | 18 | |||
1624 | 19 | import Image, ImageFilter, ImageStat, ImageChops | ||
1625 | 20 | import os | ||
1626 | 21 | import json | ||
1627 | 22 | import sys | ||
1628 | 23 | from astropy import wcs | ||
1629 | 24 | from astropy.io import fits | ||
1630 | 25 | import numpy | ||
1631 | 26 | import scipy.interpolate | ||
1632 | 27 | |||
1633 | 28 | def getAllPlatesNames(): | ||
1634 | 29 | """Return the list of all DSS plates names""" | ||
1635 | 30 | ret = [] | ||
1636 | 31 | for i in range(1, 895): | ||
1637 | 32 | ret.append("S%03d" % i) | ||
1638 | 33 | for i in range(2, 899): | ||
1639 | 34 | ret.append("N%03d" % i) | ||
1640 | 35 | return ret | ||
1641 | 36 | |||
1642 | 37 | def getTestingPlatesNames(): | ||
1643 | 38 | """Return a list of some testing DSS plates names""" | ||
1644 | 39 | ret = [] | ||
1645 | 40 | for i in range(100, 305): | ||
1646 | 41 | ret.append("N%03d" % i) | ||
1647 | 42 | return ret | ||
1648 | 43 | |||
1649 | 44 | def getTestingPlatesNamesLMC(): | ||
1650 | 45 | """Return a list of some testing DSS plates names covering the Large Magellanic Cloud (one of the worst case)""" | ||
1651 | 46 | return ["S086", "S085", "S057", "S056", "S033", "S032", "S055", "S054"] | ||
1652 | 47 | |||
1653 | 48 | def getValidRegionForPlate(plateName): | ||
1654 | 49 | """Return the polygon defining the valid pixels inside the full resolution plate image""" | ||
1655 | 50 | if plateName[0]=='N': | ||
1656 | 51 | return [[0,0], [17232, 0], [17232, 1200], [19200, 1200], [19200, 19200], [0, 19200]] | ||
1657 | 52 | else: | ||
1658 | 53 | assert plateName[0]=='S' | ||
1659 | 54 | return [[480,0], [17232, 0], [17232, 17232], [0, 17232], [0, 624], [480, 624]] | ||
1660 | 55 | |||
1661 | 56 | def enhancePlate(plateName, plate, referenceImage): | ||
1662 | 57 | """Return a transformed version of the plate so that it matches the referenceImage | ||
1663 | 58 | This is Fabien's version. It just attempts to scale brightness based on the average | ||
1664 | 59 | brightness on a 8x8 map""" | ||
1665 | 60 | |||
1666 | 61 | print "Enhance darker part of the image" | ||
1667 | 62 | plate = plate.point(lambda t : 2.*t-256.*(t/256.)**1.8) | ||
1668 | 63 | |||
1669 | 64 | """ | ||
1670 | 65 | plate.save("tmp/%s-full.jpg" % plateName, 'JPEG', quality=80) | ||
1671 | 66 | referenceImage.save("tmp/%s-reference.jpg" % plateName, 'JPEG', quality=95) | ||
1672 | 67 | return plate | ||
1673 | 68 | |||
1674 | 69 | print "Enhance plate" | ||
1675 | 70 | plateMap = plate.resize((8,8) , Image.ANTIALIAS) | ||
1676 | 71 | plateMap.save("tmp/%s-full.jpg" % plateName, 'JPEG', quality=95) | ||
1677 | 72 | |||
1678 | 73 | referenceImageMap = referenceImage.resize((8,8) , Image.ANTIALIAS) | ||
1679 | 74 | referenceImageMap.save("tmp/%s-reference.jpg" % plateName, 'JPEG', quality=95) | ||
1680 | 75 | |||
1681 | 76 | diffMap = plateMap-referenceImageMap | ||
1682 | 77 | |||
1683 | 78 | step=8./plate.size[0] | ||
1684 | 79 | |||
1685 | 80 | platePix = plate.load() | ||
1686 | 81 | for i in range(plate.size[0]): | ||
1687 | 82 | for j in range(plate.size[1]): | ||
1688 | 83 | platePix[i, j] = platePix[i, j]+i*step | ||
1689 | 84 | |||
1690 | 85 | print "Done enhancing plate" | ||
1691 | 86 | """ | ||
1692 | 87 | return plate | ||
1693 | 88 | |||
1694 | 89 | def enhancePlate2(plateName, plate, referenceImage): | ||
1695 | 90 | """Return a transformed version of the plate so that it matches the referenceImage""" | ||
1696 | 91 | #print "Enhance darker part of the image" | ||
1697 | 92 | plate = plate.point(lambda t : 2.*t-256.*(t/256.)**1.8) | ||
1698 | 93 | |||
1699 | 94 | enhanceScaling = 32 | ||
1700 | 95 | |||
1701 | 96 | print "Enhance plate" | ||
1702 | 97 | plate = plate.resize((256,256) , Image.BICUBIC) | ||
1703 | 98 | plate.save("tmp/%s-full.jpg" % plateName, 'JPEG', quality=95) | ||
1704 | 99 | #referenceImage = referenceImage.resize(plate.size, Image.BILINEAR) | ||
1705 | 100 | referenceImage.save("tmp/%s-reference.jpg" % plateName, 'JPEG', quality=95) | ||
1706 | 101 | |||
1707 | 102 | plate = None | ||
1708 | 103 | #referenceImage = None | ||
1709 | 104 | |||
1710 | 105 | #os.system("python src/main.py --hi_res tmp/%s-full.jpg --lo_res tmp/%s-reference.jpg --output tmp/%s-enhanced.jpg" % (plateName, plateName, plateName) ) | ||
1711 | 106 | referenceImage.save("tmp/%s-enhanced.jpg" % plateName, 'JPEG', quality=95) | ||
1712 | 107 | |||
1713 | 108 | plate = Image.open("tmp/%s-enhanced.jpg" % plateName) | ||
1714 | 109 | plate = plate.resize((plate.size[0]*enhanceScaling, plate.size[0]*enhanceScaling) , Image.BILINEAR) | ||
1715 | 110 | print "Done enhancing plate" | ||
1716 | 111 | |||
1717 | 112 | return plate | ||
1718 | 113 | |||
1719 | 114 | class DssWcs: | ||
1720 | 115 | """A pixel to sky conversion class. It wraps a WCS object read from the FITS header""" | ||
1721 | 116 | def __init__(self, plateName): | ||
1722 | 117 | # Load the FITS hdulist using astropy.io.fits | ||
1723 | 118 | assert os.path.exists("preparedPlates/") | ||
1724 | 119 | hdulist = fits.open("preparedPlates/%s/%s_00_00_x64-FITS-header.hhh" % (plateName, plateName)) | ||
1725 | 120 | self.w = wcs.WCS(hdulist[0].header) | ||
1726 | 121 | |||
1727 | 122 | try: | ||
1728 | 123 | f = open("preparedPlates/%s/%s.offsets" % (plateName, plateName), 'r') | ||
1729 | 124 | except IOError: | ||
1730 | 125 | self.gridPixelPos = None | ||
1731 | 126 | self.gridOffset = None | ||
1732 | 127 | self.inverseGridPixelPos = None | ||
1733 | 128 | else: | ||
1734 | 129 | offsets = json.loads(f.read()) | ||
1735 | 130 | f.close() | ||
1736 | 131 | |||
1737 | 132 | self.gridPixelPos = [] | ||
1738 | 133 | self.gridOffset = [] | ||
1739 | 134 | self.inverseGridPixelPos = [] | ||
1740 | 135 | for el in offsets: | ||
1741 | 136 | self.gridPixelPos.append(el['pixelPos']) | ||
1742 | 137 | self.gridOffset.append(el['offset']) | ||
1743 | 138 | self.inverseGridPixelPos.append([el['pixelPos'][0]+el['offset'][0], el['pixelPos'][1]+el['offset'][1]]) | ||
1744 | 139 | self.gridPixelPos = numpy.array(self.gridPixelPos) | ||
1745 | 140 | self.gridOffset = numpy.array(self.gridOffset) | ||
1746 | 141 | self.inverseGridPixelPos = numpy.array(self.inverseGridPixelPos) | ||
1747 | 142 | |||
1748 | 143 | def pixelToRaDec(self, pixelPos): | ||
1749 | 144 | """Return the RA DEC pair for a given pixel position (even if outside the plate) | ||
1750 | 145 | the passed wcs must be the one laying in the preparedPlates directory""" | ||
1751 | 146 | arr = [pixelPos[0], pixelPos[1]] | ||
1752 | 147 | if self.inverseGridPixelPos!=None: | ||
1753 | 148 | nearestOffset = scipy.interpolate.griddata(self.inverseGridPixelPos, self.gridOffset, [arr], method='nearest') | ||
1754 | 149 | arr = [arr[0]-nearestOffset[0][0], arr[1]-nearestOffset[0][1]] | ||
1755 | 150 | |||
1756 | 151 | arr = [arr[0]/64.+1.5, arr[1]/64.+1.5] | ||
1757 | 152 | arr = numpy.array([arr], numpy.float_) | ||
1758 | 153 | ret = self.w.wcs_pix2world(arr, 1) | ||
1759 | 154 | return [ret[0][0], ret[0][1]] | ||
1760 | 155 | |||
1761 | 156 | def raDecToPixel(self, raDecPos): | ||
1762 | 157 | """Return the pixel pos for a given RA DEC sky position (even if outside the plate) | ||
1763 | 158 | the passed wcs must be the one laying in the preparedPlates directory""" | ||
1764 | 159 | arr = numpy.array([[raDecPos[0], raDecPos[1]]], numpy.float_) | ||
1765 | 160 | ret = self.w.wcs_world2pix(arr, 1) | ||
1766 | 161 | ret = [(ret[0][0]-1.5)*64., (ret[0][1]-1.5)*64.] | ||
1767 | 162 | |||
1768 | 163 | # Add offset to compensate for linear WCS model errors | ||
1769 | 164 | if self.gridOffset!=None: | ||
1770 | 165 | nearestOffset = scipy.interpolate.griddata(self.gridPixelPos, self.gridOffset, [ret], method='nearest') | ||
1771 | 166 | ret = [ret[0]+nearestOffset[0][0], ret[1]+nearestOffset[0][1]] | ||
1772 | 167 | |||
1773 | 168 | return ret | ||
1774 | 169 | |||
1775 | 0 | 170 | ||
1776 | === added file 'util/DSSToStellarium/generateFullPlate.py' | |||
1777 | --- util/DSSToStellarium/generateFullPlate.py 1970-01-01 00:00:00 +0000 | |||
1778 | +++ util/DSSToStellarium/generateFullPlate.py 2016-11-13 10:24:15 +0000 | |||
1779 | @@ -0,0 +1,159 @@ | |||
1780 | 1 | #!/usr/bin/python | ||
1781 | 2 | |||
1782 | 3 | # This file is part of Stellarium. Stellarium is free software: you can | ||
1783 | 4 | # redistribute it and/or modify it under the terms of the GNU General Public | ||
1784 | 5 | # License as published by the Free Software Foundation, version 2. | ||
1785 | 6 | # | ||
1786 | 7 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
1787 | 8 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
1788 | 9 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
1789 | 10 | # details. | ||
1790 | 11 | # | ||
1791 | 12 | # You should have received a copy of the GNU General Public License along with | ||
1792 | 13 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
1793 | 14 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
1794 | 15 | # | ||
1795 | 16 | # Copyright Fabien Chereau <fabien.chereau@gmail.com> | ||
1796 | 17 | |||
1797 | 18 | |||
1798 | 19 | # ----------------------------------------------------------- | ||
1799 | 20 | # Generate the survey, i.e. | ||
1800 | 21 | # Cut and re-project toast tiles from color DSS plates | ||
1801 | 22 | # ----------------------------------------------------------- | ||
1802 | 23 | # python generateFullPlate.py | ||
1803 | 24 | # | ||
1804 | 25 | # input : the "preparedPlates" directory created in step 1 must be present | ||
1805 | 26 | # output: a "results" directory containing the survey ready for display in Stellarium | ||
1806 | 27 | |||
1807 | 28 | |||
1808 | 29 | import Image, ImageFilter, ImageStat, ImageChops, ImageOps, ImageDraw, ImageFont | ||
1809 | 30 | import os | ||
1810 | 31 | import json | ||
1811 | 32 | from subprocess import Popen, PIPE, STDOUT | ||
1812 | 33 | import sys | ||
1813 | 34 | import dssUtils | ||
1814 | 35 | |||
1815 | 36 | # Test code where I tried to use a low res image from Axel mellinger as reference | ||
1816 | 37 | # for color harmonization (the image we use for the milky way in Stellarium) | ||
1817 | 38 | # It's not working well yet, so let commented for now | ||
1818 | 39 | #mellingerImage = Image.open("mellinger_rgb_rect-curved.jpg") | ||
1819 | 40 | #mellingerImagePix = mellingerImage.load() | ||
1820 | 41 | |||
1821 | 42 | def generatePlate(plateName, maxLevel): | ||
1822 | 43 | if not os.path.exists("results"): | ||
1823 | 44 | os.system("mkdir results") | ||
1824 | 45 | if not os.path.exists("results/%d" % maxLevel): | ||
1825 | 46 | os.system("mkdir results/%d" % maxLevel) | ||
1826 | 47 | if not os.path.exists("tmp"): | ||
1827 | 48 | os.system("mkdir tmp") | ||
1828 | 49 | |||
1829 | 50 | print "-------- " + plateName + " --------" | ||
1830 | 51 | if os.path.exists("results/%s.stamp" % (plateName)): | ||
1831 | 52 | print "Plate %s already processed" % (plateName) | ||
1832 | 53 | return | ||
1833 | 54 | |||
1834 | 55 | assert os.path.exists("preparedPlates") | ||
1835 | 56 | assert os.path.exists("preparedPlates/%s/%s.jpg" % (plateName, plateName)) | ||
1836 | 57 | |||
1837 | 58 | print "Get list of TOAST tiles intersecting the plate" | ||
1838 | 59 | |||
1839 | 60 | wcs = dssUtils.DssWcs(plateName) | ||
1840 | 61 | |||
1841 | 62 | # And make sure to get rid of the plate edges in the corner.. | ||
1842 | 63 | #points = dssUtils.getValidRegionForPlate(plateName) | ||
1843 | 64 | points = [[0,0], [19200, 0], [19200, 19200], [0, 19200]] | ||
1844 | 65 | plateCornersRaDec = [wcs.pixelToRaDec(p) for p in points] | ||
1845 | 66 | cmd = './toastForShape %d "' % (maxLevel) + json.dumps(plateCornersRaDec).replace('"', '\\"') + '"' | ||
1846 | 67 | print cmd | ||
1847 | 68 | p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) | ||
1848 | 69 | jsonTriangles = p.stdout.read() | ||
1849 | 70 | triangles = json.loads(jsonTriangles) | ||
1850 | 71 | |||
1851 | 72 | print "Convert the pixel position of the toast tiles into the existing DSS image" | ||
1852 | 73 | allTrianglesRadecPos = [] | ||
1853 | 74 | for tri in triangles: | ||
1854 | 75 | allTrianglesRadecPos.extend(tri['tile'][1:]) | ||
1855 | 76 | allTrianglesPixelPos = [wcs.raDecToPixel(p) for p in allTrianglesRadecPos] | ||
1856 | 77 | |||
1857 | 78 | # Put all contained triangles (to be cut) in the tiles dict | ||
1858 | 79 | tiles = {} | ||
1859 | 80 | i=0 | ||
1860 | 81 | for tri in triangles: | ||
1861 | 82 | tile = allTrianglesPixelPos[i*4:i*4+4] | ||
1862 | 83 | t = {'XY': [tri['i'], tri['j']], 'tile': tile} | ||
1863 | 84 | tiles[json.dumps(t['XY'])]=t | ||
1864 | 85 | i=i+1 | ||
1865 | 86 | |||
1866 | 87 | tiles = tiles.values() | ||
1867 | 88 | |||
1868 | 89 | print "Cut and save the toast tiles (%d tiles at level %s)." % (len(tiles), maxLevel) | ||
1869 | 90 | |||
1870 | 91 | # Create the sub directories | ||
1871 | 92 | |||
1872 | 93 | os.system("mkdir tmp/%s" % plateName) | ||
1873 | 94 | os.system("mkdir tmp/%s/%d" % (plateName, maxLevel)) | ||
1874 | 95 | |||
1875 | 96 | |||
1876 | 97 | print "load full plate image" | ||
1877 | 98 | resImg = Image.open("preparedPlates/%s/%s.jpg" % (plateName, plateName)) | ||
1878 | 99 | #draw = ImageDraw.Draw(resImg) | ||
1879 | 100 | #font = ImageFont.truetype("DejaVuSans.ttf", 600) | ||
1880 | 101 | #draw.text([9500, 9500], plateName, font=font, fill=(255,255,0)) | ||
1881 | 102 | |||
1882 | 103 | resImg = ImageOps.flip(resImg) | ||
1883 | 104 | |||
1884 | 105 | def raDecToMellinger(raDec): | ||
1885 | 106 | return [(-raDec[0]/360.+0.5)*mellingerImage.size[0], (-raDec[1]/180.+0.5)*mellingerImage.size[1]] | ||
1886 | 107 | |||
1887 | 108 | # Generate a low res reference image from Mellinger data | ||
1888 | 109 | delta = 19200./256. | ||
1889 | 110 | referenceImage = Image.new("RGB", (256, 256)) | ||
1890 | 111 | #pix = referenceImage.load() | ||
1891 | 112 | #for i in range(256): | ||
1892 | 113 | # for j in range(256): | ||
1893 | 114 | # raDec = wcs.pixelToRaDec((i*delta+delta/2, j*delta+delta/2)) | ||
1894 | 115 | # if raDec[0]>180: | ||
1895 | 116 | # raDec[0]=raDec[0]-360 | ||
1896 | 117 | # mellingerPos = raDecToMellinger(raDec) | ||
1897 | 118 | # pix[i, j] = mellingerImagePix[mellingerPos[0], mellingerPos[1]] | ||
1898 | 119 | |||
1899 | 120 | # Enhance plate | ||
1900 | 121 | resImg = dssUtils.enhancePlate(plateName, resImg, referenceImage) | ||
1901 | 122 | |||
1902 | 123 | def isPartial(imageW, imageH, region): | ||
1903 | 124 | for i in range(len(region)/2): | ||
1904 | 125 | p = [region[i*2], region[i*2+1]] | ||
1905 | 126 | if p[0]<0 or p[0]>imageW or p[1]<0 or p[1]>imageH: | ||
1906 | 127 | return True | ||
1907 | 128 | return False | ||
1908 | 129 | |||
1909 | 130 | print "Cut tiles" | ||
1910 | 131 | for tile in tiles: | ||
1911 | 132 | tt = [] | ||
1912 | 133 | partial = False | ||
1913 | 134 | for p in tile['tile']: | ||
1914 | 135 | x=p[0] | ||
1915 | 136 | y=p[1] | ||
1916 | 137 | tt.append(x) | ||
1917 | 138 | tt.append(y) | ||
1918 | 139 | tt = tt[6:]+tt[0:6] | ||
1919 | 140 | |||
1920 | 141 | partial = isPartial(resImg.size[0], resImg.size[1], tt) | ||
1921 | 142 | im = resImg.transform((256,256), Image.QUAD, tuple(tt), Image.BILINEAR) | ||
1922 | 143 | |||
1923 | 144 | xy = tile['XY'] | ||
1924 | 145 | im.save("tmp/%s/%d/%d_%d%s.jpg" % (plateName, maxLevel, xy[0], xy[1], "-partial" if partial else ""), quality=95) | ||
1925 | 146 | |||
1926 | 147 | print "package and store results" | ||
1927 | 148 | os.system("mv tmp/%s/%d/* results/%d/" % (plateName, maxLevel, maxLevel)) | ||
1928 | 149 | os.system("rm -rf tmp/%s" % plateName) | ||
1929 | 150 | os.system("touch results/%s.stamp" % plateName) | ||
1930 | 151 | |||
1931 | 152 | |||
1932 | 153 | if __name__ == '__main__': | ||
1933 | 154 | maxLevel = 11 | ||
1934 | 155 | |||
1935 | 156 | for plate in dssUtils.getAllPlatesNames(): | ||
1936 | 157 | generatePlate(plate, maxLevel) | ||
1937 | 158 | |||
1938 | 159 | os.system("python createUpperToastLevels.py") | ||
1939 | 0 | 160 | ||
1940 | === added file 'util/DSSToStellarium/mellinger_rgb_rect-curved.jpg' | |||
1941 | 1 | Binary files util/DSSToStellarium/mellinger_rgb_rect-curved.jpg 1970-01-01 00:00:00 +0000 and util/DSSToStellarium/mellinger_rgb_rect-curved.jpg 2016-11-13 10:24:15 +0000 differ | 161 | Binary files util/DSSToStellarium/mellinger_rgb_rect-curved.jpg 1970-01-01 00:00:00 +0000 and util/DSSToStellarium/mellinger_rgb_rect-curved.jpg 2016-11-13 10:24:15 +0000 differ |
1942 | === added file 'util/DSSToStellarium/prepareAllPlates.py' | |||
1943 | --- util/DSSToStellarium/prepareAllPlates.py 1970-01-01 00:00:00 +0000 | |||
1944 | +++ util/DSSToStellarium/prepareAllPlates.py 2016-11-13 10:24:15 +0000 | |||
1945 | @@ -0,0 +1,117 @@ | |||
1946 | 1 | #!/usr/bin/python | ||
1947 | 2 | |||
1948 | 3 | # This file is part of Stellarium. Stellarium is free software: you can | ||
1949 | 4 | # redistribute it and/or modify it under the terms of the GNU General Public | ||
1950 | 5 | # License as published by the Free Software Foundation, version 2. | ||
1951 | 6 | # | ||
1952 | 7 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
1953 | 8 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
1954 | 9 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
1955 | 10 | # details. | ||
1956 | 11 | # | ||
1957 | 12 | # You should have received a copy of the GNU General Public License along with | ||
1958 | 13 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
1959 | 14 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
1960 | 15 | # | ||
1961 | 16 | # Copyright Fabien Chereau <fabien.chereau@gmail.com> | ||
1962 | 17 | |||
1963 | 18 | import Image, ImageFilter, ImageStat, ImageChops | ||
1964 | 19 | import os | ||
1965 | 20 | from astLib import astWCS | ||
1966 | 21 | import json | ||
1967 | 22 | from subprocess import Popen, PIPE, STDOUT | ||
1968 | 23 | import sys | ||
1969 | 24 | from multiprocessing import Pool | ||
1970 | 25 | import dssUtils | ||
1971 | 26 | from astropy import wcs | ||
1972 | 27 | from astropy.io import fits | ||
1973 | 28 | import numpy | ||
1974 | 29 | |||
1975 | 30 | # ----------------------------------------------------------- | ||
1976 | 31 | # Pre-process zipped plates to extract only necessary data | ||
1977 | 32 | # This has to be run once if you don't already have the | ||
1978 | 33 | # preprocessed plates | ||
1979 | 34 | # ----------------------------------------------------------- | ||
1980 | 35 | # python prepareAllPlates.py | ||
1981 | 36 | # | ||
1982 | 37 | # input : a directory with all original plates .tgz files (change in code) | ||
1983 | 38 | # output: a directory "preparedPlates" containing for each plate a single full resolution jpg image + a FITS headers necessary for sky-to-pixel projection | ||
1984 | 39 | # usage : you must change the location of your input DSS plates path directly in the script | ||
1985 | 40 | |||
1986 | 41 | # The directory containing the plates .tgz files | ||
1987 | 42 | originalPlatesDirectory = "/media/fabien/data/DSS-orig" | ||
1988 | 43 | |||
1989 | 44 | # Pre-compute meta-infos about the plate as well as a re-combination of all tile into one large image | ||
1990 | 45 | def preparePlate(plateName): | ||
1991 | 46 | if not os.path.exists("preparedPlates"): | ||
1992 | 47 | os.system("mkdir preparedPlates") | ||
1993 | 48 | |||
1994 | 49 | if os.path.exists("preparedPlates/%s-x64-FITS-header.hhh" % plateName): | ||
1995 | 50 | print "%s already processed, skip." % plateName | ||
1996 | 51 | return | ||
1997 | 52 | |||
1998 | 53 | print "-------- " + plateName + " --------" | ||
1999 | 54 | if os.path.exists("preparedPlates/%s" % (plateName)): | ||
2000 | 55 | print "Plate %s already pre-processed" % (plateName) | ||
2001 | 56 | return | ||
2002 | 57 | print "Copy and prepare plate data" | ||
2003 | 58 | os.system("cp %s/%s.tgz ." % (originalPlatesDirectory, plateName)) | ||
2004 | 59 | os.system("tar -xzf %s.tgz" % plateName) | ||
2005 | 60 | os.system("chmod -R a+w %s" % plateName) | ||
2006 | 61 | assert os.path.exists("%s" % plateName) | ||
2007 | 62 | |||
2008 | 63 | print "create full plate image" | ||
2009 | 64 | resImg=Image.new("RGB", (64*300, 64*300)) | ||
2010 | 65 | for j in range(0, 64): | ||
2011 | 66 | for i in range(0,64): | ||
2012 | 67 | if os.path.exists("%s/x1/%s_%.2d_%.2d_x1.jpg" % (plateName, plateName, i, j)): | ||
2013 | 68 | im = Image.open("%s/x1/%s_%.2d_%.2d_x1.jpg" % (plateName, plateName, i, j)) | ||
2014 | 69 | resImg.paste(im, (i*300, 64*300-j*300-300)) | ||
2015 | 70 | else: | ||
2016 | 71 | print "Missing jpeg tile: %s/x1/%s_%.2d_%.2d_x1.jpg" % (plateName, plateName, i, j) | ||
2017 | 72 | |||
2018 | 73 | print "package and store results" | ||
2019 | 74 | os.system("mkdir preparedPlates/%s" % plateName) | ||
2020 | 75 | resImg.save("preparedPlates/%s/%s.jpg" % (plateName, plateName)) | ||
2021 | 76 | os.system("cp %s/x64/%s_00_00_x64.hhh preparedPlates/%s/%s_00_00_x64-FITS-header.hhh" % (plateName, plateName, plateName, plateName)) | ||
2022 | 77 | |||
2023 | 78 | wcsWithoutCorrection = dssUtils.DssWcs(plateName) | ||
2024 | 79 | |||
2025 | 80 | print "Compute the array of pixel offsets needed to adjust WCS conversions." | ||
2026 | 81 | # Load the x1 FITS headers to get the corrective offset term | ||
2027 | 82 | allOffsets = [] | ||
2028 | 83 | |||
2029 | 84 | for i in range(0,64, 4): | ||
2030 | 85 | for j in range(0, 64, 4): | ||
2031 | 86 | if not os.path.exists("%s/x1/%s_%.2d_%.2d_x1.hhh" % (plateName, plateName, i, j)): | ||
2032 | 87 | print "Missing .hhh file" | ||
2033 | 88 | continue | ||
2034 | 89 | hdulist = fits.open("%s/x1/%s_%.2d_%.2d_x1.hhh" % (plateName, plateName, i, j)) | ||
2035 | 90 | w = wcs.WCS(hdulist[0].header) | ||
2036 | 91 | arr = numpy.array([[0., 0.]], numpy.float_) # Bottom left corner | ||
2037 | 92 | radecCorner = w.wcs_pix2world(arr, 1) | ||
2038 | 93 | realPixelPos = [i*300, j*300] | ||
2039 | 94 | currPixelPos = wcsWithoutCorrection.raDecToPixel([radecCorner[0][0], radecCorner[0][1]]) | ||
2040 | 95 | assert currPixelPos!=None | ||
2041 | 96 | allOffsets.append({'pixelPos': currPixelPos, 'offset': [realPixelPos[0]-currPixelPos[0], realPixelPos[1]-currPixelPos[1]]}) | ||
2042 | 97 | |||
2043 | 98 | f = open("preparedPlates/%s/%s.offsets" % (plateName, plateName), 'w') | ||
2044 | 99 | f.write(json.dumps(allOffsets)) | ||
2045 | 100 | f.close() | ||
2046 | 101 | |||
2047 | 102 | print "clean up" | ||
2048 | 103 | os.system("rm %s.tgz" % plateName) | ||
2049 | 104 | os.system("rm -rf %s" % plateName) | ||
2050 | 105 | |||
2051 | 106 | jobsArgs = dssUtils.getAllPlatesNames()() | ||
2052 | 107 | |||
2053 | 108 | pool = Pool(2) | ||
2054 | 109 | try: | ||
2055 | 110 | pool.map_async(preparePlate, jobsArgs).get(9999999) | ||
2056 | 111 | except KeyboardInterrupt: | ||
2057 | 112 | print "Caught KeyboardInterrupt, terminating workers" | ||
2058 | 113 | pool.terminate() | ||
2059 | 114 | pool.join() | ||
2060 | 115 | |||
2061 | 116 | |||
2062 | 117 | |||
2063 | 0 | 118 | ||
2064 | === added file 'util/DSSToStellarium/readme.txt' | |||
2065 | --- util/DSSToStellarium/readme.txt 1970-01-01 00:00:00 +0000 | |||
2066 | +++ util/DSSToStellarium/readme.txt 2016-11-13 10:24:15 +0000 | |||
2067 | @@ -0,0 +1,33 @@ | |||
2068 | 1 | A set of pyton scripts used to process DSS plates for Stellarium | ||
2069 | 2 | |||
2070 | 3 | Dependencies: | ||
2071 | 4 | - astropy: (sudo pip install astropy) | ||
2072 | 5 | - PIL (sudo apt-get install python-imaging) | ||
2073 | 6 | - numpy | ||
2074 | 7 | |||
2075 | 8 | ----------------------------------------------------------- | ||
2076 | 9 | 1- Pre-process zipped plates to extract only necessary data | ||
2077 | 10 | ----------------------------------------------------------- | ||
2078 | 11 | python prepareAllPlates.py | ||
2079 | 12 | |||
2080 | 13 | input: a directory with all original plates .tgz files (change in code) | ||
2081 | 14 | output: a directory "preparedPlates" containing for each plate a single full resolution jpg image + a FITS headers necessary for sky-to-pixel projection | ||
2082 | 15 | usage: you must change the location of your input DSS plates path directly in the script | ||
2083 | 16 | |||
2084 | 17 | |||
2085 | 18 | ----------------------------------------------------------- | ||
2086 | 19 | 2- Generate the survey | ||
2087 | 20 | ----------------------------------------------------------- | ||
2088 | 21 | python generateFullPlate.py | ||
2089 | 22 | |||
2090 | 23 | input: the "preparedPlates" directory created in step 1 must be present | ||
2091 | 24 | output: a "results" directory containing the survey ready for display in Stellarium | ||
2092 | 25 | |||
2093 | 26 | |||
2094 | 27 | ----------------------------------------------------------- | ||
2095 | 28 | 3- Display the survey | ||
2096 | 29 | ----------------------------------------------------------- | ||
2097 | 30 | Get the Stellarium branch bzr+ssh://bazaar.launchpad.net/~stellarium/stellarium/toastImages | ||
2098 | 31 | Change the base location of the survey to match the path where the results/ directory is stored. This can be done in ToastMgr.cpp line 29 | ||
2099 | 32 | Compile and run the soft. Remove ground and atmosphere (press G and A), the survey should be visible in the south hemisphere. | ||
2100 | 33 | |||
2101 | 0 | 34 | ||
2102 | === added file 'util/DSSToStellarium/toastForShape' | |||
2103 | 1 | Binary files util/DSSToStellarium/toastForShape 1970-01-01 00:00:00 +0000 and util/DSSToStellarium/toastForShape 2016-11-13 10:24:15 +0000 differ | 35 | Binary files util/DSSToStellarium/toastForShape 1970-01-01 00:00:00 +0000 and util/DSSToStellarium/toastForShape 2016-11-13 10:24:15 +0000 differ |
2104 | === added directory 'util/toastForShape' | |||
2105 | === added file 'util/toastForShape/main.cpp' | |||
2106 | --- util/toastForShape/main.cpp 1970-01-01 00:00:00 +0000 | |||
2107 | +++ util/toastForShape/main.cpp 2016-11-13 10:24:15 +0000 | |||
2108 | @@ -0,0 +1,38 @@ | |||
2109 | 1 | #include <QtCore/QCoreApplication> | ||
2110 | 2 | #include "StelToast.hpp" | ||
2111 | 3 | #include "StelJsonParser.hpp" | ||
2112 | 4 | |||
2113 | 5 | int main(int argc, char *argv[]) | ||
2114 | 6 | { | ||
2115 | 7 | Q_ASSERT(argc==3); | ||
2116 | 8 | QByteArray ar = argv[1]; | ||
2117 | 9 | bool ok; | ||
2118 | 10 | int level = ar.toInt(&ok); | ||
2119 | 11 | if (!ok) | ||
2120 | 12 | { | ||
2121 | 13 | qFatal("Argument 1 must be a valid level number"); | ||
2122 | 14 | } | ||
2123 | 15 | int length = sqrt(pow(4, level)); | ||
2124 | 16 | SphericalRegionP reg = SphericalRegionP::loadFromQVariant(StelJsonParser::parse(argv[2]).toList()); | ||
2125 | 17 | //SphericalRegionP reg = SphericalRegionP::loadFromQVariant(StelJsonParser::parse("[[21.286982057125858, 82.117482778097937], [341.20801035028205, 82.141350178494122], [308.54824444399429, 86.661406614892087], [54.398199236987082, 86.613098160666411]]").toList()); | ||
2126 | 18 | ToastGrid grid(level); | ||
2127 | 19 | QVariantList l; | ||
2128 | 20 | for (int i=0;i<length;++i) | ||
2129 | 21 | { | ||
2130 | 22 | for (int j=0;j<length;++j) | ||
2131 | 23 | { | ||
2132 | 24 | SphericalConvexPolygon poly(grid.getPolygon(level,i,j)); | ||
2133 | 25 | if (reg->intersects(poly)) | ||
2134 | 26 | { | ||
2135 | 27 | QVariantMap m; | ||
2136 | 28 | m["i"]=i; | ||
2137 | 29 | m["j"]=j; | ||
2138 | 30 | m["tile"]= poly.toQVariant(); | ||
2139 | 31 | l << m; | ||
2140 | 32 | } | ||
2141 | 33 | } | ||
2142 | 34 | } | ||
2143 | 35 | printf("%s", StelJsonParser::write(l).constData()); | ||
2144 | 36 | |||
2145 | 37 | return 0; | ||
2146 | 38 | } | ||
2147 | 0 | 39 | ||
2148 | === added file 'util/toastForShape/toastForShape.pro' | |||
2149 | --- util/toastForShape/toastForShape.pro 1970-01-01 00:00:00 +0000 | |||
2150 | +++ util/toastForShape/toastForShape.pro 2016-11-13 10:24:15 +0000 | |||
2151 | @@ -0,0 +1,73 @@ | |||
2152 | 1 | #------------------------------------------------- | ||
2153 | 2 | # | ||
2154 | 3 | # Project created by QtCreator 2010-11-28T20:43:35 | ||
2155 | 4 | # | ||
2156 | 5 | #------------------------------------------------- | ||
2157 | 6 | |||
2158 | 7 | QT += core gui opengl network | ||
2159 | 8 | |||
2160 | 9 | DEFINES += PACKAGE_VERSION=\\\"0.10.6\\\" | ||
2161 | 10 | DEFINES += DEFAULT_GRAPHICS_SYSTEM=\\\"raster\\\" | ||
2162 | 11 | DEFINES += INSTALL_DATADIR=\\\"/usr/share/stellarium\\\" | ||
2163 | 12 | DEFINES += INSTALL_LOCALEDIR=\\\"/usr/share/locale\\\" | ||
2164 | 13 | DEFINES += NDEBUG=1 | ||
2165 | 14 | |||
2166 | 15 | TARGET = toastForShape | ||
2167 | 16 | CONFIG += console | ||
2168 | 17 | CONFIG -= app_bundle | ||
2169 | 18 | |||
2170 | 19 | TEMPLATE = app | ||
2171 | 20 | |||
2172 | 21 | INCLUDEPATH += ../../src/core/ ../../src/core/external/glues_stel/source ../../src/core/external | ||
2173 | 22 | |||
2174 | 23 | SOURCES += main.cpp \ | ||
2175 | 24 | ../../src/core/StelSphereGeometry.cpp \ | ||
2176 | 25 | ../../src/core/StelToastGrid.cpp \ | ||
2177 | 26 | ../../src/core/StelJsonParser.cpp \ | ||
2178 | 27 | ../../src/core/OctahedronPolygon.cpp \ | ||
2179 | 28 | ../../src/core/StelUtils.cpp \ | ||
2180 | 29 | ../../src/core/StelProjector.cpp \ | ||
2181 | 30 | ../../src/core/external/glues_stel/source/glues_error.c \ | ||
2182 | 31 | ../../src/core/external/glues_stel/source/libtess/tessmono.c \ | ||
2183 | 32 | ../../src/core/external/glues_stel/source/libtess/tess.c \ | ||
2184 | 33 | ../../src/core/external/glues_stel/source/libtess/sweep.c \ | ||
2185 | 34 | ../../src/core/external/glues_stel/source/libtess/render.c \ | ||
2186 | 35 | ../../src/core/external/glues_stel/source/libtess/priorityq.c \ | ||
2187 | 36 | ../../src/core/external/glues_stel/source/libtess/normal.c \ | ||
2188 | 37 | ../../src/core/external/glues_stel/source/libtess/mesh.c \ | ||
2189 | 38 | ../../src/core/external/glues_stel/source/libtess/memalloc.c \ | ||
2190 | 39 | ../../src/core/external/glues_stel/source/libtess/geom.c \ | ||
2191 | 40 | ../../src/core/external/glues_stel/source/libtess/dict.c \ | ||
2192 | 41 | ../../src/core/StelVertexArray.cpp \ | ||
2193 | 42 | ../../src/core/StelTranslator.cpp \ | ||
2194 | 43 | ../../src/core/StelFileMgr.cpp | ||
2195 | 44 | |||
2196 | 45 | HEADERS += \ | ||
2197 | 46 | ../../src/core/VecMath.hpp \ | ||
2198 | 47 | ../../src/core/StelSphereGeometry.hpp \ | ||
2199 | 48 | ../../src/core/StelToastGrid.hpp \ | ||
2200 | 49 | ../../src/core/StelJsonParser.hpp \ | ||
2201 | 50 | ../../src/core/OctahedronPolygon.hpp \ | ||
2202 | 51 | ../../src/core/StelUtils.hpp \ | ||
2203 | 52 | ../../src/core/external/glues_stel/source/glues.h \ | ||
2204 | 53 | ../../src/core/external/glues_stel/source/glues_error.h \ | ||
2205 | 54 | ../../src/core/external/glues_stel/source/libtess/tessmono.h \ | ||
2206 | 55 | ../../src/core/external/glues_stel/source/libtess/tess.h \ | ||
2207 | 56 | ../../src/core/external/glues_stel/source/libtess/sweep.h \ | ||
2208 | 57 | ../../src/core/external/glues_stel/source/libtess/render.h \ | ||
2209 | 58 | ../../src/core/external/glues_stel/source/libtess/priorityq.h \ | ||
2210 | 59 | ../../src/core/external/glues_stel/source/libtess/priorityq-sort.h \ | ||
2211 | 60 | ../../src/core/external/glues_stel/source/libtess/priorityq-heap.h \ | ||
2212 | 61 | ../../src/core/external/glues_stel/source/libtess/normal.h \ | ||
2213 | 62 | ../../src/core/external/glues_stel/source/libtess/mesh.h \ | ||
2214 | 63 | ../../src/core/external/glues_stel/source/libtess/memalloc.h \ | ||
2215 | 64 | ../../src/core/external/glues_stel/source/libtess/geom.h \ | ||
2216 | 65 | ../../src/core/external/glues_stel/source/libtess/dict.h \ | ||
2217 | 66 | ../../src/core/external/glues_stel/source/libtess/dict-list.h \ | ||
2218 | 67 | ../../src/core/StelVertexArray.hpp \ | ||
2219 | 68 | ../../src/core/StelTranslator.hpp | ||
2220 | 69 | |||
2221 | 70 | OTHER_FILES += \ | ||
2222 | 71 | ../../src/core/external/glues_stel/source/libtess/README \ | ||
2223 | 72 | ../../src/core/external/glues_stel/source/libtess/priorityq-heap.i \ | ||
2224 | 73 | ../../src/core/external/glues_stel/source/libtess/alg-outline |
Works like a charm as long as network is good.
Maybe fix following: When disabling network (tset with aircraft mode on notebook), and reenabling, re-establish connection? Not sure what happens currently, network stays disabled. What about short network interruptions - would we have to completely restart Stellarium (and break connection to telescope etc.) to re-enable? It may be acceptable to toggle DSS off/on to reconnect. Maybe give screen notice "DSS: network unavailable" or such?
Things to possibly consider:
Fix TODOs (links) in ToastMgr::init(), and host data at stellarium.org?
Explain what TOAST actually means?
We should be prepared to answer questions about installing data locally (for use at off-line observing sites! Either private PCs or data on an in-house server.) (source, legal state, bandwidth, instructions?)
A chapter in the Guide should explain all this! (Can be added after merge, though.)