Merge lp:~stellarium/stellarium/gz_viewportOffset into lp:stellarium

Proposed by gzotti
Status: Merged
Approved by: Alexander Wolf
Approved revision: 7738
Merged at revision: 7746
Proposed branch: lp:~stellarium/stellarium/gz_viewportOffset
Merge into: lp:stellarium
Diff against target: 651 lines (+263/-60)
11 files modified
src/core/StelCore.cpp (+5/-1)
src/core/StelMovementMgr.cpp (+119/-39)
src/core/StelMovementMgr.hpp (+15/-7)
src/core/StelProjector.cpp (+5/-1)
src/core/StelProjector.hpp (+2/-0)
src/gui/ConfigurationDialog.cpp (+2/-0)
src/gui/ViewDialog.cpp (+16/-5)
src/gui/ViewDialog.hpp (+1/-0)
src/gui/viewDialog.ui (+63/-7)
src/scripting/StelMainScriptAPI.cpp (+34/-0)
src/scripting/StelMainScriptAPI.hpp (+1/-0)
To merge this branch: bzr merge lp:~stellarium/stellarium/gz_viewportOffset
Reviewer Review Type Date Requested Status
Alexander Wolf Approve
gzotti Needs Resubmitting
Review via email: mp+264395@code.launchpad.net

Description of the change

Introducing the option to have a vertically offset screen center. Useful to have e.g. cylindrical views with straight landcape horizon in lower part of the screen.

Object tracking&centering brings those objects into visible screen center. Centering on coordinates puts those coordinates into the offset projection center now, this is intended.

I hope I have not overlooked something in the view geometry?

To post a comment you must log in.
Revision history for this message
Alexander Wolf (alexwolf) wrote :

Current implementation has stepwise centering of the object when zooming. Can it be smooth zooming?

review: Needs Fixing
Revision history for this message
gzotti (georg-zotti) wrote :

Oops... yes, I must have a look into that!

7736. By gzotti

add a "galactic" projection mode for scripting.

7737. By gzotti

Smoothed zooming (keep centered object in center for offset view mode), and repaired offset adjusting for all view frame (mount) modes

Revision history for this message
gzotti (georg-zotti) wrote :

OK, zooming now runs smooth, and in all mount modes. Also made galactic mount mode reachable at least for scripting.

review: Needs Resubmitting
Revision history for this message
Alexander Wolf (alexwolf) wrote :

Zooming with movement is not exactly smooth. Please try simple use case for both versions (trunk and gz_viewportOffset): disable atmosphere and ground, select any object on screen near border and press "/" (zoom in). Movement is stepwize yet.

review: Needs Fixing
Revision history for this message
gzotti (georg-zotti) wrote :

Ouch. Again one of the keys/functions I never found in 7 years because they don't work on German keyboards. OK, after reconfiguring I can see what you mean. Practically object is immediately centered, right?

Are there any other ways of zooming/centering? I always only used the mouse or PgUp/Down.

review: Needs Information
7738. By gzotti

zoom+movement (default key "/") now also smoothened.

Revision history for this message
gzotti (georg-zotti) wrote :

OK, next try please? The selected object is now not immediately centered. I hope it was what you meant?

review: Needs Resubmitting
Revision history for this message
Alexander Wolf (alexwolf) wrote :

Apparently he is not broke a frequently used features now.

review: Approve
Revision history for this message
Alexander Wolf (alexwolf) wrote :

P.S. This feature introduced an issue in projection of the sky (artifacts at the bottom side of the screen).

Revision history for this message
gzotti (georg-zotti) wrote :

Well, yes, if you zoom out too far, some artifacts/limitations of any projection become apparent even stronger than without offsetting center. I see some disturbing faces or lines when zooming out in stereographic projection near zenith, and faces of the "sphere border", but the "solution" would simply include an fov limit adaptation, but I think it is better like that, and users can zoom in a bit if the weird faces really disturb.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/core/StelCore.cpp'
2--- src/core/StelCore.cpp 2015-07-08 10:37:11 +0000
3+++ src/core/StelCore.cpp 2015-07-24 14:57:31 +0000
4@@ -86,6 +86,10 @@
5 const float viewportCenterX = conf->value("projection/viewport_center_x",0.5f*viewport_width).toFloat();
6 const float viewportCenterY = conf->value("projection/viewport_center_y",0.5f*viewport_height).toFloat();
7 currentProjectorParams.viewportCenter.set(viewportCenterX, viewportCenterY);
8+ const float viewportCenterOffsetX = conf->value("projection/viewport_center_offset_x",0.f).toFloat();
9+ const float viewportCenterOffsetY = conf->value("projection/viewport_center_offset_y",0.f).toFloat();
10+ currentProjectorParams.viewportCenterOffset.set(viewportCenterOffsetX, viewportCenterOffsetY);
11+
12 currentProjectorParams.viewportFovDiameter = conf->value("projection/viewport_fov_diameter", qMin(viewport_width,viewport_height)).toFloat();
13 currentProjectorParams.flipHorz = conf->value("projection/flip_horz",false).toBool();
14 currentProjectorParams.flipVert = conf->value("projection/flip_vert",false).toBool();
15@@ -384,7 +388,7 @@
16 {
17 // Maximize display when resized since it invalidates previous options anyway
18 currentProjectorParams.viewportXywh.set(x, y, width, height);
19- currentProjectorParams.viewportCenter.set(x+0.5*width, y+0.5*height);
20+ currentProjectorParams.viewportCenter.set(x+(0.5+currentProjectorParams.viewportCenterOffset.v[0])*width, y+(0.5+currentProjectorParams.viewportCenterOffset.v[1])*height);
21 currentProjectorParams.viewportFovDiameter = qMin(width,height);
22 }
23
24
25=== modified file 'src/core/StelMovementMgr.cpp'
26--- src/core/StelMovementMgr.cpp 2015-04-01 14:36:44 +0000
27+++ src/core/StelMovementMgr.cpp 2015-07-24 14:57:31 +0000
28@@ -1,6 +1,7 @@
29 /*
30 * Stellarium
31 * Copyright (C) 2007 Fabien Chereau
32+ * Copyright (C) 2015 Georg Zotti (offset view adaptations)
33 *
34 * This program is free software; you can redistribute it and/or
35 * modify it under the terms of the GNU General Public License
36@@ -102,9 +103,7 @@
37 flagAutoZoomOutResetsDirection = conf->value("navigation/auto_zoom_out_resets_direction", true).toBool();
38 flagEnableMouseNavigation = conf->value("navigation/flag_enable_mouse_navigation",true).toBool();
39
40- minFov = 0.001389; // minimal FOV = 5"
41- // GZ: This value should be configurable! Zooming in too much is useless for archaeoastronomy.
42- minFov = conf->value("navigation/min_fov",minFov).toDouble();
43+ minFov = conf->value("navigation/min_fov",0.001389).toDouble(); // default: minimal FOV = 5"
44 maxFov = 100.;
45 initFov = conf->value("navigation/init_fov",60.f).toFloat();
46 currentFov = initFov;
47@@ -464,7 +463,7 @@
48 }
49
50 /*************************************************************************
51- The selected objects changed, follow it it we were already following another one
52+ The selected objects changed, follow it if we were already following another one
53 *************************************************************************/
54 void StelMovementMgr::selectedObjectChange(StelModule::StelModuleSelectAction)
55 {
56@@ -561,29 +560,24 @@
57 if (deltaAz<-0.2)
58 deltaAz = -0.2;
59 }
60- else
61+ else if (deltaAz>0)
62 {
63- if (deltaAz>0)
64- {
65- deltaAz = (depl/30);
66- if (deltaAz>0.2)
67- deltaAz = 0.2;
68- }
69+ deltaAz = (depl/30);
70+ if (deltaAz>0.2)
71+ deltaAz = 0.2;
72 }
73+
74 if (deltaAlt<0)
75 {
76 deltaAlt = -depl/30;
77 if (deltaAlt<-0.2)
78 deltaAlt = -0.2;
79 }
80- else
81+ else if (deltaAlt>0)
82 {
83- if (deltaAlt>0)
84- {
85- deltaAlt = depl/30;
86- if (deltaAlt>0.2)
87- deltaAlt = 0.2;
88- }
89+ deltaAlt = depl/30;
90+ if (deltaAlt>0.2)
91+ deltaAlt = 0.2;
92 }
93
94 if (deltaFov<0)
95@@ -592,14 +586,11 @@
96 if (deltaFov<-0.15*currentFov)
97 deltaFov = -0.15*currentFov;
98 }
99- else
100+ else if (deltaFov>0)
101 {
102- if (deltaFov>0)
103- {
104- deltaFov = deplzoom*5;
105- if (deltaFov>20)
106- deltaFov = 20;
107- }
108+ deltaFov = deplzoom*5;
109+ if (deltaFov>20)
110+ deltaFov = 20;
111 }
112
113 if (deltaFov != 0 )
114@@ -618,7 +609,32 @@
115 if (!move.targetObject.isNull())
116 {
117 // if zooming in, object may be moving so be sure to zoom to latest position
118- move.aim = core->altAzToJ2000(move.targetObject->getAltAzPosAuto(core), StelCore::RefractionOff);
119+ // In case we have offset center, we want object still visible in center.
120+ // Note that if we do not center on an object, we set view direction of the potentially offset screen center!
121+ // This is by design, to allow accurate setting of display coordinates.
122+ Vec3d v;
123+ switch (mountMode)
124+ {
125+ case MountAltAzimuthal:
126+ v = move.targetObject->getAltAzPosAuto(core);
127+ break;
128+ case MountEquinoxEquatorial:
129+ v = move.targetObject->getEquinoxEquatorialPos(core);
130+ break;
131+ case MountGalactic:
132+ v = move.targetObject->getGalacticPos(core);
133+ break;
134+ default:
135+ qWarning() << "StelMovementMgr: unexpected mountMode" << mountMode;
136+ Q_ASSERT(0);
137+ }
138+
139+ double lat, lon;
140+ StelUtils::rectToSphe(&lon, &lat, v);
141+ float altOffset=core->getCurrentStelProjectorParams().viewportCenterOffset[1]*currentFov*M_PI/180.0f;
142+ lat+=altOffset;
143+ StelUtils::spheToRect(lon, lat, v);
144+ move.aim=mountFrameToJ2000(v);
145 move.aim.normalize();
146 move.aim*=2.;
147 }
148@@ -686,8 +702,30 @@
149 {
150 if (flagTracking && objectMgr->getWasSelected()) // Equatorial vision vector locked on selected object
151 {
152- Vec3d v = objectMgr->getSelectedObject()[0]->getAltAzPosAuto(core);
153- setViewDirectionJ2000(core->altAzToJ2000(v, StelCore::RefractionOff));
154+ Vec3d v;
155+ switch (mountMode)
156+ {
157+ case MountAltAzimuthal:
158+ v = objectMgr->getSelectedObject()[0]->getAltAzPosAuto(core);
159+ break;
160+ case MountEquinoxEquatorial:
161+ v = objectMgr->getSelectedObject()[0]->getEquinoxEquatorialPos(core);
162+ break;
163+ case MountGalactic:
164+ v = objectMgr->getSelectedObject()[0]->getGalacticPos(core);
165+ break;
166+ default:
167+ qWarning() << "StelMovementMgr: unexpected mountMode" << mountMode;
168+ Q_ASSERT(0);
169+ }
170+
171+ double lat, lon; // general: longitudinal, latitudinal
172+ StelUtils::rectToSphe(&lon, &lat, v);
173+ float latOffset=core->getCurrentStelProjectorParams().viewportCenterOffset[1]*currentFov*M_PI/180.0f;
174+ lat+=latOffset;
175+ StelUtils::spheToRect(lon, lat, v);
176+
177+ setViewDirectionJ2000(mountFrameToJ2000(v));
178 }
179 else
180 {
181@@ -705,7 +743,7 @@
182 }
183 }
184
185-// Go and zoom to the selected object.
186+// Go and zoom to the selected object. (Action linked to key, default "/")
187 void StelMovementMgr::autoZoomIn(float moveDuration, bool allowManualZoom)
188 {
189 if (!objectMgr->getWasSelected())
190@@ -716,7 +754,7 @@
191 float manualMoveDuration;
192 if (!getFlagTracking())
193 {
194- setFlagTracking(true);
195+ setFlagTracking(true); // includes a call to moveToObject(), but without zooming=1!
196 moveToObject(objectMgr->getSelectedObject()[0], moveDuration, 1);
197 manualMoveDuration = moveDuration;
198 }
199@@ -784,7 +822,7 @@
200 }
201 }
202
203-
204+// This is called when you press SPACEBAR: slowly centering&tracking object
205 void StelMovementMgr::setFlagTracking(bool b)
206 {
207 if (!b || !objectMgr->getWasSelected())
208@@ -801,6 +839,7 @@
209
210 ////////////////////////////////////////////////////////////////////////////////
211 // Move to the given J2000 equatorial position
212+
213 void StelMovementMgr::moveToJ2000(const Vec3d& aim, float moveDuration, int zooming)
214 {
215 moveDuration /= movementsSpeedFactor;
216@@ -935,23 +974,64 @@
217 // Use a smooth function
218 double c;
219
220- if( zoomMove.start > zoomMove.aim )
221+ if( zoomMove.startFov > zoomMove.aimFov )
222 {
223- // slow down as approach final view
224+ // slow down as we approach final view
225 c = 1 - (1-zoomMove.coef)*(1-zoomMove.coef)*(1-zoomMove.coef);
226 }
227 else
228 {
229- // speed up as leave zoom target
230+ // speed up as we leave zoom target
231 c = (zoomMove.coef)*(zoomMove.coef)*(zoomMove.coef);
232 }
233
234- setFov(zoomMove.start + (zoomMove.aim - zoomMove.start) * c);
235+ double newFov=zoomMove.startFov + (zoomMove.aimFov - zoomMove.startFov) * c;
236+
237 zoomMove.coef+=zoomMove.speed*deltaTime*1000;
238 if (zoomMove.coef>=1.)
239 {
240 flagAutoZoom = 0;
241- setFov(zoomMove.aim);
242+ newFov=zoomMove.aimFov;
243+ }
244+
245+ setFov(newFov); // updates currentFov->don't use newFov later!
246+
247+ // In case we have offset center, we want object still visible in center.
248+ if (flagTracking && objectMgr->getWasSelected()) // vision vector locked on selected object
249+ {
250+ Vec3d v;
251+ switch (mountMode)
252+ {
253+ case MountAltAzimuthal:
254+ v = objectMgr->getSelectedObject()[0]->getAltAzPosAuto(core);
255+ break;
256+ case MountEquinoxEquatorial:
257+ v = objectMgr->getSelectedObject()[0]->getEquinoxEquatorialPos(core);
258+ break;
259+ case MountGalactic:
260+ v = objectMgr->getSelectedObject()[0]->getGalacticPos(core);
261+ break;
262+ default:
263+ qWarning() << "StelMovementMgr: unexpected mountMode" << mountMode;
264+ Q_ASSERT(0);
265+ }
266+
267+ double lat, lon; // general: longitudinal, latitudinal
268+ StelUtils::rectToSphe(&lon, &lat, v);
269+ float latOffset=core->getCurrentStelProjectorParams().viewportCenterOffset[1]*currentFov*M_PI/180.0f;
270+ lat+=latOffset;
271+ StelUtils::spheToRect(lon, lat, v);
272+
273+ if (flagAutoMove)
274+ {
275+ move.aim=mountFrameToJ2000(v);
276+ move.aim.normalize();
277+ move.aim*=2.;
278+ }
279+ else
280+ {
281+ setViewDirectionJ2000(mountFrameToJ2000(v));
282+ }
283 }
284 }
285 }
286@@ -961,8 +1041,8 @@
287 {
288 moveDuration /= movementsSpeedFactor;
289
290- zoomMove.aim=aim_fov;
291- zoomMove.start=currentFov;
292+ zoomMove.aimFov=aim_fov;
293+ zoomMove.startFov=currentFov;
294 zoomMove.speed=1.f/(moveDuration*1000);
295 zoomMove.coef=0.;
296 flagAutoZoom = true;
297@@ -991,7 +1071,7 @@
298
299 double StelMovementMgr::getAimFov(void) const
300 {
301- return (flagAutoZoom ? zoomMove.aim : currentFov);
302+ return (flagAutoZoom ? zoomMove.aimFov : currentFov);
303 }
304
305 void StelMovementMgr::setMaxFov(double max)
306
307=== modified file 'src/core/StelMovementMgr.hpp'
308--- src/core/StelMovementMgr.hpp 2015-03-25 18:18:33 +0000
309+++ src/core/StelMovementMgr.hpp 2015-07-24 14:57:31 +0000
310@@ -1,6 +1,7 @@
311 /*
312 * Stellarium
313 * Copyright (C) 2007 Fabien Chereau
314+ * Copyright (C) 2015 Georg Zotti (offset view adaptations)
315 *
316 * This program is free software; you can redistribute it and/or
317 * modify it under the terms of the GNU General Public License
318@@ -38,6 +39,8 @@
319 public:
320
321 //! Possible mount modes defining the reference frame in which head movements occur.
322+ //! MountGalactic is currently only available via scripting API: core.clear("galactic")
323+ // TODO: add others like MountEcliptical
324 enum MountMode { MountAltAzimuthal, MountEquinoxEquatorial, MountGalactic};
325
326 StelMovementMgr(StelCore* core);
327@@ -157,7 +160,7 @@
328
329 //! Change the zoom level.
330 //! @param aimFov The desired field of view in degrees.
331- //! @param moveDuration The time that the operation should take to complete.
332+ //! @param moveDuration The time that the operation should take to complete. [seconds]
333 void zoomTo(double aimFov, float moveDuration = 1.);
334 //! Get the current Field Of View in degrees
335 double getCurrentFov() const {return currentFov;}
336@@ -221,10 +224,10 @@
337 Vec3d j2000ToMountFrame(const Vec3d& v) const;
338 Vec3d mountFrameToJ2000(const Vec3d& v) const;
339
340- double currentFov; // The current FOV in degree
341+ double currentFov; // The current FOV in degrees
342 double initFov; // The FOV at startup
343- double minFov; // Minimum FOV in degree
344- double maxFov; // Maximum FOV in degree
345+ double minFov; // Minimum FOV in degrees
346+ double maxFov; // Maximum FOV in degrees
347 double initConstellationIntensity; // The initial constellation art intensity (level at startup)
348
349 void setFov(double f)
350@@ -287,7 +290,7 @@
351 double deltaFov,deltaAlt,deltaAz; // View movement
352
353 bool flagManualZoom; // Define whether auto zoom can go further
354- float autoMoveDuration; // Duration of movement for the auto move to a selected objectin seconds
355+ float autoMoveDuration; // Duration of movement for the auto move to a selected object in seconds
356
357 // Mouse control options
358 bool isDragging, hasDragged;
359@@ -311,10 +314,15 @@
360
361 //! @internal
362 //! Store data for auto-zoom.
363+ // Components:
364+ // startFov: field of view at start
365+ // aimFov: intended field of view at end of zoom move
366+ // speed: rate of change. UNITS?
367+ // coef: set to 0 at begin of zoom, will increase to 1 during autozoom motion.
368 struct AutoZoom
369 {
370- double start;
371- double aim;
372+ double startFov;
373+ double aimFov;
374 float speed;
375 float coef;
376 };
377
378=== modified file 'src/core/StelProjector.cpp'
379--- src/core/StelProjector.cpp 2014-11-06 10:59:07 +0000
380+++ src/core/StelProjector.cpp 2015-07-24 14:57:31 +0000
381@@ -22,6 +22,8 @@
382
383 #include "StelProjector.hpp"
384 #include "StelProjectorClasses.hpp"
385+#include "StelApp.hpp"
386+#include "StelCore.hpp"
387
388 #include <QDebug>
389 #include <QString>
390@@ -385,7 +387,9 @@
391 void StelProjector::computeBoundingCap()
392 {
393 bool ok = unProject(viewportXywh[0]+0.5f*viewportXywh[2], viewportXywh[1]+0.5f*viewportXywh[3], boundingCap.n);
394- Q_ASSERT(ok); // The central point should be at a valid position by definition
395+ // The central point should be at a valid position by definition.
396+ // When center is offset, this assumption may not hold however.
397+ Q_ASSERT(ok || (StelApp::getInstance().getCore()->getCurrentStelProjectorParams().viewportCenterOffset.lengthSquared()>0.0) );
398 const bool needNormalization = fabs(boundingCap.n.lengthSquared()-1.)>0.00000001;
399
400 // Now need to determine the aperture
401
402=== modified file 'src/core/StelProjector.hpp'
403--- src/core/StelProjector.hpp 2014-11-06 10:59:07 +0000
404+++ src/core/StelProjector.hpp 2015-07-24 14:57:31 +0000
405@@ -102,6 +102,7 @@
406 , zNear(0.f)
407 , zFar(0.f)
408 , viewportCenter(128.f, 128.f)
409+ , viewportCenterOffset(0.f, 0.f)
410 , viewportFovDiameter(0.f)
411 , flipHorz(false)
412 , flipVert(false)
413@@ -114,6 +115,7 @@
414 StelProjectorMaskType maskType; //! The current projector mask
415 float zNear, zFar; //! Near and far clipping planes
416 Vec2f viewportCenter; //! Viewport center in screen pixel
417+ Vec2f viewportCenterOffset; //! GZ: Viewport center's offset in fractions of screen width/height. Usable e.g. in cylindrical projection to move horizon down.
418 float viewportFovDiameter; //! diameter of the FOV disk in pixel
419 bool flipHorz, flipVert; //! Whether to flip in horizontal or vertical directions
420 float devicePixelsPerPixel; //! The number of device pixel per "Device Independent Pixels" (value is usually 1, but 2 for mac retina screens)
421
422=== modified file 'src/gui/ConfigurationDialog.cpp'
423--- src/gui/ConfigurationDialog.cpp 2015-05-23 20:00:14 +0000
424+++ src/gui/ConfigurationDialog.cpp 2015-07-24 14:57:31 +0000
425@@ -695,6 +695,8 @@
426 conf->setValue("gui/flag_show_flip_buttons", gui->getFlagShowFlipButtons());
427 conf->setValue("video/viewport_effect", StelApp::getInstance().getViewportEffect());
428 conf->setValue("projection/viewport", StelProjector::maskTypeToString(proj->getMaskType()));
429+ conf->setValue("projection/viewport_center_offset_x", core->getCurrentStelProjectorParams().viewportCenterOffset[0]);
430+ conf->setValue("projection/viewport_center_offset_y", core->getCurrentStelProjectorParams().viewportCenterOffset[1]);
431 conf->setValue("viewing/flag_gravity_labels", proj->getFlagGravityLabels());
432 conf->setValue("navigation/auto_zoom_out_resets_direction", mvmgr->getFlagAutoZoomOutResetsDirection());
433 conf->setValue("gui/flag_mouse_cursor_timeout", StelMainView::getInstance().getFlagCursorTimeout());
434
435=== modified file 'src/gui/ViewDialog.cpp'
436--- src/gui/ViewDialog.cpp 2015-05-23 20:00:14 +0000
437+++ src/gui/ViewDialog.cpp 2015-07-24 14:57:31 +0000
438@@ -134,8 +134,11 @@
439 connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
440
441 populateLists();
442+ ui->viewportOffsetSpinBox->setValue((int) round(StelApp::getInstance().getCore()->getCurrentStelProjectorParams().viewportCenterOffset[1] * 100.0f));
443+
444 connect(ui->culturesListWidget, SIGNAL(currentTextChanged(const QString&)), this, SLOT(skyCultureChanged(const QString&)));
445 connect(ui->projectionListWidget, SIGNAL(currentTextChanged(const QString&)), this, SLOT(projectionChanged(const QString&)));
446+ connect(ui->viewportOffsetSpinBox, SIGNAL(valueChanged(int)), this, SLOT(viewportVerticalShiftChanged(int)));
447 connect(ui->landscapesListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(landscapeChanged(QListWidgetItem*)));
448
449 // Connect and initialize checkboxes and other widgets
450@@ -602,6 +605,18 @@
451 ui->projectionTextBrowser->setHtml(core->getProjection(StelCore::FrameJ2000)->getHtmlSummary());
452 }
453
454+void ViewDialog::viewportVerticalShiftChanged(const int shift)
455+{
456+ StelCore* core = StelApp::getInstance().getCore();
457+ StelProjector::StelProjectorParams params=core->getCurrentStelProjectorParams();
458+ params.viewportCenterOffset[1]=qMax(-0.5f, qMin(shift/100.0f, 0.5f)); // Sanity check
459+
460+ params.viewportCenter.set(params.viewportXywh[0]+(0.5f+params.viewportCenterOffset.v[0])*params.viewportXywh[2],
461+ params.viewportXywh[1]+(0.5f+params.viewportCenterOffset.v[1])*params.viewportXywh[3]);
462+
463+ core->setCurrentStelProjectorParams(params);
464+}
465+
466 void ViewDialog::landscapeChanged(QListWidgetItem* item)
467 {
468 LandscapeMgr* lmgr = GETSTELMODULE(LandscapeMgr);
469@@ -612,8 +627,7 @@
470 ui->landscapeTextBrowser->setHtml(lmgr->getCurrentLandscapeHtmlDescription());
471 ui->useAsDefaultLandscapeCheckBox->setChecked(lmgr->getDefaultLandscapeID()==lmgr->getCurrentLandscapeID());
472 ui->useAsDefaultLandscapeCheckBox->setEnabled(lmgr->getDefaultLandscapeID()!=lmgr->getCurrentLandscapeID());
473- //StelSkyDrawer *drawer=StelApp::getInstance().getSkyDrawer();
474- // GZ: Reset values that might have changed.
475+ // Reset values that might have changed.
476 ui->showFogCheckBox->setChecked(lmgr->getFlagFog());
477 ui->lightPollutionSpinBox->setValue(StelApp::getInstance().getCore()->getSkyDrawer()->getBortleScaleIndex());
478 }
479@@ -630,9 +644,6 @@
480 {
481 if(atmosphereDialog == NULL)
482 atmosphereDialog = new AtmosphereDialog();
483- //ui->temperatureDoubleSpinBox->setValue(StelApp::getInstance().getCore()->getSkyDrawer()->getAtmosphereTemperature());
484- //ui->extinctionDoubleSpinBox->setValue(StelApp::getInstance().getCore()->getSkyDrawer()->getExtinctionCoefficient());
485- //ui->pressureDoubleSpinBox->setValue(StelApp::getInstance().getCore()->getSkyDrawer()->getAtmospherePressure());
486
487 atmosphereDialog->setVisible(true);
488 }
489
490=== modified file 'src/gui/ViewDialog.hpp'
491--- src/gui/ViewDialog.hpp 2015-04-11 14:08:59 +0000
492+++ src/gui/ViewDialog.hpp 2015-07-24 14:57:31 +0000
493@@ -50,6 +50,7 @@
494 void populateLists();
495 void skyCultureChanged(const QString& cultureName);
496 void projectionChanged(const QString& projectionName);
497+ void viewportVerticalShiftChanged(const int shift);
498 void landscapeChanged(QListWidgetItem* item);
499 void setZhrFromControls(int zhr);
500 void updateZhrDescription();
501
502=== modified file 'src/gui/viewDialog.ui'
503--- src/gui/viewDialog.ui 2015-05-23 20:00:14 +0000
504+++ src/gui/viewDialog.ui 2015-07-24 14:57:31 +0000
505@@ -340,7 +340,7 @@
506 <item row="1" column="0">
507 <widget class="QStackedWidget" name="stackedWidget">
508 <property name="currentIndex">
509- <number>0</number>
510+ <number>1</number>
511 </property>
512 <widget class="QWidget" name="page">
513 <layout class="QGridLayout" name="gridLayout">
514@@ -1636,11 +1636,68 @@
515 </widget>
516 </item>
517 <item>
518- <widget class="QTextBrowser" name="projectionTextBrowser">
519- <property name="openExternalLinks">
520- <bool>true</bool>
521- </property>
522- </widget>
523+ <layout class="QVBoxLayout" name="projectionDetailsVerticalLayout">
524+ <item>
525+ <widget class="QTextBrowser" name="projectionTextBrowser">
526+ <property name="openExternalLinks">
527+ <bool>true</bool>
528+ </property>
529+ </widget>
530+ </item>
531+ <item>
532+ <layout class="QHBoxLayout" name="viewportOffsetHorizontalLayout">
533+ <item>
534+ <widget class="QLabel" name="viewportOffsetLabel">
535+ <property name="text">
536+ <string>Vertical viewport offset</string>
537+ </property>
538+ </widget>
539+ </item>
540+ <item>
541+ <widget class="QSpinBox" name="viewportOffsetSpinBox">
542+ <property name="sizePolicy">
543+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
544+ <horstretch>0</horstretch>
545+ <verstretch>0</verstretch>
546+ </sizepolicy>
547+ </property>
548+ <property name="minimum">
549+ <number>-50</number>
550+ </property>
551+ <property name="maximum">
552+ <number>50</number>
553+ </property>
554+ </widget>
555+ </item>
556+ <item>
557+ <widget class="QLabel" name="percentLabel">
558+ <property name="sizePolicy">
559+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
560+ <horstretch>0</horstretch>
561+ <verstretch>0</verstretch>
562+ </sizepolicy>
563+ </property>
564+ <property name="text">
565+ <string>%</string>
566+ </property>
567+ </widget>
568+ </item>
569+ <item>
570+ <spacer name="horizontalSpacer">
571+ <property name="orientation">
572+ <enum>Qt::Horizontal</enum>
573+ </property>
574+ <property name="sizeHint" stdset="0">
575+ <size>
576+ <width>40</width>
577+ <height>20</height>
578+ </size>
579+ </property>
580+ </spacer>
581+ </item>
582+ </layout>
583+ </item>
584+ </layout>
585 </item>
586 </layout>
587 </widget>
588@@ -2171,7 +2228,6 @@
589 <tabstop>showConstellationBoundariesCheckBox</tabstop>
590 <tabstop>showConstellationArtCheckBox</tabstop>
591 <tabstop>constellationArtBrightnessSpinBox</tabstop>
592- <tabstop>projectionTextBrowser</tabstop>
593 <tabstop>landscapeTextBrowser</tabstop>
594 <tabstop>showGroundCheckBox</tabstop>
595 <tabstop>showFogCheckBox</tabstop>
596
597=== modified file 'src/scripting/StelMainScriptAPI.cpp'
598--- src/scripting/StelMainScriptAPI.cpp 2015-04-21 20:23:14 +0000
599+++ src/scripting/StelMainScriptAPI.cpp 2015-07-24 14:57:31 +0000
600@@ -1072,6 +1072,40 @@
601 lmgr->setFlagFog(false);
602 zl->setFlagShow(false);
603 }
604+ else if (state.toLower() == "galactic")
605+ {
606+ movmgr->setMountMode(StelMovementMgr::MountGalactic);
607+ skyd->setFlagTwinkle(false);
608+ skyd->setFlagLuminanceAdaptation(false);
609+ ssmgr->setFlagPlanets(false);
610+ ssmgr->setFlagHints(false);
611+ ssmgr->setFlagOrbits(false);
612+ ssmgr->setFlagMoonScale(false);
613+ ssmgr->setFlagTrails(false);
614+ mmgr->setZHR(0);
615+ glmgr->setFlagAzimuthalGrid(false);
616+ glmgr->setFlagGalacticGrid(false);
617+ glmgr->setFlagEquatorGrid(false);
618+ glmgr->setFlagEquatorLine(false);
619+ glmgr->setFlagEclipticLine(false);
620+ glmgr->setFlagMeridianLine(false);
621+ glmgr->setFlagLongitudeLine(false);
622+ glmgr->setFlagHorizonLine(false);
623+ glmgr->setFlagGalacticEquatorLine(false);
624+ glmgr->setFlagEquatorJ2000Grid(false);
625+ lmgr->setFlagCardinalsPoints(false);
626+ cmgr->setFlagLines(false);
627+ cmgr->setFlagLabels(false);
628+ cmgr->setFlagBoundaries(false);
629+ cmgr->setFlagArt(false);
630+ smgr->setFlagLabels(false);
631+ ssmgr->setFlagLabels(false);
632+ nmgr->setFlagHints(false);
633+ lmgr->setFlagLandscape(false);
634+ lmgr->setFlagAtmosphere(false);
635+ lmgr->setFlagFog(false);
636+ zl->setFlagShow(false);
637+ }
638 else
639 {
640 qWarning() << "WARNING clear(" << state << ") - state not known";
641
642=== modified file 'src/scripting/StelMainScriptAPI.hpp'
643--- src/scripting/StelMainScriptAPI.hpp 2015-07-05 19:50:54 +0000
644+++ src/scripting/StelMainScriptAPI.hpp 2015-07-24 14:57:31 +0000
645@@ -219,6 +219,7 @@
646 //! - starchart : equatorial mount, constellation lines,
647 //! no landscape, atmosphere etc. labels & markers on.
648 //! - deepspace : like starchart, but no planets, no eq.grid, no markers, no lines.
649+ //! - galactic : like deepspace, but in galactic coordinate system.
650 //! @param state the name of a preset state.
651 void clear(const QString& state="natural");
652