Merge lp:~georg-zotti/stellarium/gz-better-anglemeasure into lp:stellarium

Proposed by gzotti
Status: Merged
Merged at revision: 7072
Proposed branch: lp:~georg-zotti/stellarium/gz-better-anglemeasure
Merge into: lp:stellarium
Diff against target: 633 lines (+321/-53)
6 files modified
plugins/AngleMeasure/CMakeLists.txt (+1/-1)
plugins/AngleMeasure/ChangeLog (+6/-0)
plugins/AngleMeasure/src/AngleMeasure.cpp (+163/-42)
plugins/AngleMeasure/src/AngleMeasure.hpp (+36/-1)
plugins/AngleMeasure/src/gui/AngleMeasureDialog.cpp (+16/-5)
plugins/AngleMeasure/src/gui/angleMeasureDialog.ui (+99/-4)
To merge this branch: bzr merge lp:~georg-zotti/stellarium/gz-better-anglemeasure
Reviewer Review Type Date Requested Status
gzotti Needs Resubmitting
Alexander Wolf Approve
Review via email: mp+237430@code.launchpad.net

Commit message

Added alt-azimuth mode in angle measure plugin

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

What about possible small improvements?

1. GUI changes:
1.1 [ ] Show in equatorial coordinates [ ] ...with position angle
1.2 [ ] Show in horizontal coordinates [ ] ...with position angle

2. Description changes:
2.1 Removing our names from authors list (we already in the contributors list :) )

review: Approve
6954. By gzotti

GUI improvements and author list clarification in AngleMeasurement plugin.

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

I found how to make functional groups in the GUI now. The checkboxes in the group boxes are 1-2 pixels smaller than the single checkboxes, don't know how to fix that.

On the author list: All "contributors" (listed only in the plugin's own config panel) are now in the author list (visible in list in main program's plugin config dialog).

review: Needs Resubmitting

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/AngleMeasure/CMakeLists.txt'
--- plugins/AngleMeasure/CMakeLists.txt 2014-03-03 19:43:04 +0000
+++ plugins/AngleMeasure/CMakeLists.txt 2014-10-07 18:19:23 +0000
@@ -1,5 +1,5 @@
1# This is the cmake config file for the AngleMeasure plugin1# This is the cmake config file for the AngleMeasure plugin
2SET(ANGLEMEASURE_VERSION "0.3.1")2SET(ANGLEMEASURE_VERSION "0.4.0")
3ADD_DEFINITIONS(-DANGLEMEASURE_VERSION="${ANGLEMEASURE_VERSION}")3ADD_DEFINITIONS(-DANGLEMEASURE_VERSION="${ANGLEMEASURE_VERSION}")
44
5ADD_SUBDIRECTORY( src )5ADD_SUBDIRECTORY( src )
66
=== modified file 'plugins/AngleMeasure/ChangeLog'
--- plugins/AngleMeasure/ChangeLog 2014-02-16 12:58:17 +0000
+++ plugins/AngleMeasure/ChangeLog 2014-10-07 18:19:23 +0000
@@ -1,3 +1,9 @@
10.3.2 [2014-08-14]
2Added horizontal mode (no refraction)
3
40.3.1
5Undocumented change
6
10.3.070.3.0
2Added GUI8Added GUI
3Added calculation of position angle9Added calculation of position angle
410
=== modified file 'plugins/AngleMeasure/src/AngleMeasure.cpp'
--- plugins/AngleMeasure/src/AngleMeasure.cpp 2014-04-15 19:39:05 +0000
+++ plugins/AngleMeasure/src/AngleMeasure.cpp 2014-10-07 18:19:23 +0000
@@ -1,5 +1,6 @@
1/*1/*
2 * Copyright (C) 2009 Matthew Gates2 * Copyright (C) 2009 Matthew Gates
3 * Copyright (C) 2014 Georg Zotti
3 *4 *
4 * This program is free software; you can redistribute it and/or5 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License6 * modify it under the terms of the GNU General Public License
@@ -54,7 +55,7 @@
54 StelPluginInfo info;55 StelPluginInfo info;
55 info.id = "AngleMeasure";56 info.id = "AngleMeasure";
56 info.displayedName = N_("Angle Measure");57 info.displayedName = N_("Angle Measure");
57 info.authors = "Matthew Gates";58 info.authors = "Matthew Gates, Bogdan Marinov, Alexander Wolf, Georg Zotti";
58 info.contact = "http://porpoisehead.net/";59 info.contact = "http://porpoisehead.net/";
59 info.description = N_("Provides an angle measurement tool");60 info.description = N_("Provides an angle measurement tool");
60 info.version = ANGLEMEASURE_VERSION;61 info.version = ANGLEMEASURE_VERSION;
@@ -67,6 +68,11 @@
67 , angle(0.)68 , angle(0.)
68 , flagUseDmsFormat(false)69 , flagUseDmsFormat(false)
69 , flagShowPA(false)70 , flagShowPA(false)
71 , flagShowEquatorial(false)
72 , flagShowHorizontal(false)
73 , flagShowHorizontalPA(false)
74 , flagShowHorizontalStartSkylinked(false)
75 , flagShowHorizontalEndSkylinked(false)
70 , toolbarButton(NULL)76 , toolbarButton(NULL)
71{77{
72 setObjectName("AngleMeasure");78 setObjectName("AngleMeasure");
@@ -117,6 +123,12 @@
117 perp1EndPoint.set(0.,0.,0.);123 perp1EndPoint.set(0.,0.,0.);
118 perp2StartPoint.set(0.,0.,0.);124 perp2StartPoint.set(0.,0.,0.);
119 perp2EndPoint.set(0.,0.,0.);125 perp2EndPoint.set(0.,0.,0.);
126 startPointHor.set(0.,0.,0.);
127 endPointHor.set(0.,0.,0.);
128 perp1StartPointHor.set(0.,0.,0.);
129 perp1EndPointHor.set(0.,0.,0.);
130 perp2StartPointHor.set(0.,0.,0.);
131 perp2EndPointHor.set(0.,0.,0.);
120132
121 StelApp& app = StelApp::getInstance();133 StelApp& app = StelApp::getInstance();
122134
@@ -152,15 +164,25 @@
152{164{
153 messageFader.update((int)(deltaTime*1000));165 messageFader.update((int)(deltaTime*1000));
154 lineVisible.update((int)(deltaTime*1000));166 lineVisible.update((int)(deltaTime*1000));
167 static StelCore *core=StelApp::getInstance().getCore();
168
169 // if altAz endpoint linked to the rotating sky, move respective point(s)
170 if (flagShowHorizontalStartSkylinked)
171 {
172 startPointHor = core->equinoxEquToAltAz(startPoint, StelCore::RefractionAuto);
173 calculateEnds();
174 }
175 if (flagShowHorizontalEndSkylinked)
176 {
177 endPointHor = core->equinoxEquToAltAz(endPoint, StelCore::RefractionAuto);
178 calculateEnds();
179 }
155}180}
156181
157//! Draw any parts on the screen which are for our module182
158void AngleMeasure::draw(StelCore* core)183void AngleMeasure::drawOne(StelCore *core, const StelCore::FrameType frameType, const StelCore::RefractionMode refractionMode, const Vec3f txtColor, const Vec3f lineColor)
159{184{
160 if (lineVisible.getInterstate() < 0.000001f && messageFader.getInterstate() < 0.000001f)185 const StelProjectorP prj = core->getProjection(frameType, refractionMode);
161 return;
162
163 const StelProjectorP prj = core->getProjection(StelCore::FrameEquinoxEqu);
164 StelPainter painter(prj);186 StelPainter painter(prj);
165 painter.setFont(font);187 painter.setFont(font);
166188
@@ -169,36 +191,61 @@
169 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);191 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
170 glEnable(GL_BLEND);192 glEnable(GL_BLEND);
171 glEnable(GL_TEXTURE_2D);193 glEnable(GL_TEXTURE_2D);
172 194
173 Vec3d xy;195 Vec3d xy;
174 QString displayedText;196 QString displayedText;
175 if (prj->project(perp1EndPoint,xy))197 if (frameType==StelCore::FrameEquinoxEqu)
176 {198 {
177 painter.setColor(textColor[0], textColor[1], textColor[2], lineVisible.getInterstate());199 if (prj->project(perp1EndPoint,xy))
178 if (flagShowPA)200 {
179 displayedText = QString("%1 (%2%3)").arg(calculateAngle(), messagePA, calculatePositionAngle(startPoint, endPoint));201 painter.setColor(txtColor[0], txtColor[1], txtColor[2], lineVisible.getInterstate());
180 else202 if (flagShowPA)
181 displayedText = calculateAngle();203 displayedText = QString("%1 (%2%3)").arg(calculateAngle(), messagePA, calculatePositionAngle(startPoint, endPoint));
182 painter.drawText(xy[0], xy[1], displayedText, 0, 15, 15);204 else
205 displayedText = calculateAngle();
206 painter.drawText(xy[0], xy[1], displayedText, 0, 15, 15);
207 }
208 }
209 else
210 {
211 if (prj->project(perp1EndPointHor,xy))
212 {
213 painter.setColor(txtColor[0], txtColor[1], txtColor[2], lineVisible.getInterstate());
214 if (flagShowHorizontalPA)
215 displayedText = QString("%1 (%2%3)").arg(calculateAngle(true), messagePA, calculatePositionAngle(startPointHor, endPointHor));
216 else
217 displayedText = calculateAngle(true);
218 painter.drawText(xy[0], xy[1], displayedText, 0, 15, -5);
219 }
183 }220 }
184221
185 glDisable(GL_TEXTURE_2D);222 glDisable(GL_TEXTURE_2D);
186 // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH223 // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH
187 // glEnable(GL_LINE_SMOOTH);224 // glEnable(GL_LINE_SMOOTH);
188 glEnable(GL_BLEND);225 glEnable(GL_BLEND);
189 226
190 // main line is a great circle 227 // main line is a great circle
191 painter.setColor(lineColor[0], lineColor[1], lineColor[2], lineVisible.getInterstate());228 painter.setColor(lineColor[0], lineColor[1], lineColor[2], lineVisible.getInterstate());
192 painter.drawGreatCircleArc(startPoint, endPoint, NULL);229 if (frameType==StelCore::FrameEquinoxEqu)
193230 {
194 // End lines231 painter.drawGreatCircleArc(startPoint, endPoint, NULL);
195 painter.drawGreatCircleArc(perp1StartPoint, perp1EndPoint, NULL);232
196 painter.drawGreatCircleArc(perp2StartPoint, perp2EndPoint, NULL);233 // End lines
234 painter.drawGreatCircleArc(perp1StartPoint, perp1EndPoint, NULL);
235 painter.drawGreatCircleArc(perp2StartPoint, perp2EndPoint, NULL);
236 }
237 else
238 {
239 painter.drawGreatCircleArc(startPointHor, endPointHor, NULL);
240
241 // End lines
242 painter.drawGreatCircleArc(perp1StartPointHor, perp1EndPointHor, NULL);
243 painter.drawGreatCircleArc(perp2StartPointHor, perp2EndPointHor, NULL);
244 }
197 }245 }
198
199 if (messageFader.getInterstate() > 0.000001f)246 if (messageFader.getInterstate() > 0.000001f)
200 {247 {
201 painter.setColor(textColor[0], textColor[1], textColor[2], messageFader.getInterstate());248 painter.setColor(txtColor[0], txtColor[1], txtColor[2], messageFader.getInterstate());
202 int x = 83;249 int x = 83;
203 int y = 120;250 int y = 120;
204 int ls = painter.getFontMetrics().lineSpacing();251 int ls = painter.getFontMetrics().lineSpacing();
@@ -208,19 +255,39 @@
208 y -= ls;255 y -= ls;
209 painter.drawText(x, y, messageRightButton);256 painter.drawText(x, y, messageRightButton);
210 }257 }
258
259
260}
261
262//! Draw any parts on the screen which are for our module
263void AngleMeasure::draw(StelCore* core)
264{
265 if (lineVisible.getInterstate() < 0.000001f && messageFader.getInterstate() < 0.000001f)
266 return;
267 if (flagShowHorizontal)
268 {
269 drawOne(core, StelCore::FrameAltAz, StelCore::RefractionOff, horTextColor, horLineColor);
270 }
271 if (flagShowEquatorial)
272 {
273 drawOne(core, StelCore::FrameEquinoxEqu, StelCore::RefractionAuto, textColor, lineColor);
274 }
211}275}
212276
213QString AngleMeasure::calculatePositionAngle(const Vec3d p1, const Vec3d p2) const277QString AngleMeasure::calculatePositionAngle(const Vec3d p1, const Vec3d p2) const
214{278{
215 double y = cos(p2.latitude())*sin(p2.longitude()-p1.longitude());279 double y = cos(p2.latitude())*sin(p2.longitude()-p1.longitude());
216 double x = cos(p1.latitude())*sin(p2.latitude()) - sin(p1.latitude())*cos(p2.latitude())*cos(p2.longitude()-p1.longitude());280 double x = cos(p1.latitude())*sin(p2.latitude()) - sin(p1.latitude())*cos(p2.latitude())*cos(p2.longitude()-p1.longitude());
217 double r = std::atan(y/x);281 double r = std::atan2(y,x);
218 if (x<0)282 // GZ ATAN2 makes many tests unnecessary...
219 r += M_PI;283// if (x<0)
220 if (y<0)284// r += M_PI;
221 r += 2*M_PI;285// if (y<0)
222 if (r>(2*M_PI))286// r += 2*M_PI;
223 r -= 2*M_PI;287// if (r>(2*M_PI))
288// r -= 2*M_PI;
289 if (r<0)
290 r+= 2*M_PI;
224291
225 unsigned int d, m;292 unsigned int d, m;
226 double s;293 double s;
@@ -249,12 +316,16 @@
249 {316 {
250 const StelProjectorP prj = StelApp::getInstance().getCore()->getProjection(StelCore::FrameEquinoxEqu);317 const StelProjectorP prj = StelApp::getInstance().getCore()->getProjection(StelCore::FrameEquinoxEqu);
251 prj->unProject(event->x(),event->y(),startPoint);318 prj->unProject(event->x(),event->y(),startPoint);
319 const StelProjectorP prjHor = StelApp::getInstance().getCore()->getProjection(StelCore::FrameAltAz, StelCore::RefractionOff);
320 prjHor->unProject(event->x(),event->y(),startPointHor);
321
252322
253 // first click reset the line... only draw it after we've dragged a little.323 // first click reset the line... only draw it after we've dragged a little.
254 if (!dragging)324 if (!dragging)
255 {325 {
256 lineVisible = false;326 lineVisible = false;
257 endPoint = startPoint;327 endPoint = startPoint;
328 endPointHor=startPointHor;
258 }329 }
259 else330 else
260 lineVisible = true;331 lineVisible = true;
@@ -275,6 +346,8 @@
275 {346 {
276 const StelProjectorP prj = StelApp::getInstance().getCore()->getProjection(StelCore::FrameEquinoxEqu);347 const StelProjectorP prj = StelApp::getInstance().getCore()->getProjection(StelCore::FrameEquinoxEqu);
277 prj->unProject(event->x(),event->y(),endPoint);348 prj->unProject(event->x(),event->y(),endPoint);
349 const StelProjectorP prjHor = StelApp::getInstance().getCore()->getProjection(StelCore::FrameAltAz, StelCore::RefractionOff);
350 prjHor->unProject(event->x(),event->y(),endPointHor);
278 calculateEnds();351 calculateEnds();
279 event->setAccepted(true);352 event->setAccepted(true);
280 return;353 return;
@@ -288,6 +361,8 @@
288 {361 {
289 const StelProjectorP prj = StelApp::getInstance().getCore()->getProjection(StelCore::FrameEquinoxEqu);362 const StelProjectorP prj = StelApp::getInstance().getCore()->getProjection(StelCore::FrameEquinoxEqu);
290 prj->unProject(x,y,endPoint);363 prj->unProject(x,y,endPoint);
364 const StelProjectorP prjHor = StelApp::getInstance().getCore()->getProjection(StelCore::FrameAltAz, StelCore::RefractionOff);
365 prjHor->unProject(x,y,endPointHor);
291 calculateEnds();366 calculateEnds();
292 lineVisible = true;367 lineVisible = true;
293 return true;368 return true;
@@ -298,29 +373,41 @@
298373
299void AngleMeasure::calculateEnds(void)374void AngleMeasure::calculateEnds(void)
300{375{
301 Vec3d v0 = endPoint - startPoint;376 if (flagShowEquatorial)
302 Vec3d v1 = Vec3d(0,0,0) - startPoint;377 calculateEndsOneLine(startPoint, endPoint, perp1StartPoint, perp1EndPoint, perp2StartPoint, perp2EndPoint, angle);
378 if (flagShowHorizontal)
379 calculateEndsOneLine(startPointHor, endPointHor, perp1StartPointHor, perp1EndPointHor, perp2StartPointHor, perp2EndPointHor, angleHor);
380}
381
382void AngleMeasure::calculateEndsOneLine(const Vec3d start, const Vec3d end, Vec3d &perp1Start, Vec3d &perp1End, Vec3d &perp2Start, Vec3d &perp2End, double &angle)
383{
384 Vec3d v0 = end - start;
385 Vec3d v1 = Vec3d(0,0,0) - start;
303 Vec3d p = v0 ^ v1;386 Vec3d p = v0 ^ v1;
304 p *= 0.08; // end width387 p *= 0.08; // end width
305 perp1StartPoint.set(startPoint[0]-p[0],startPoint[1]-p[1],startPoint[2]-p[2]);388 perp1Start.set(start[0]-p[0],start[1]-p[1],start[2]-p[2]);
306 perp1EndPoint.set(startPoint[0]+p[0],startPoint[1]+p[1],startPoint[2]+p[2]);389 perp1End.set(start[0]+p[0],start[1]+p[1],start[2]+p[2]);
307390
308 v1 = Vec3d(0,0,0) - endPoint;391 v1 = Vec3d(0,0,0) - end;
309 p = v0 ^ v1;392 p = v0 ^ v1;
310 p *= 0.08; // end width393 p *= 0.08; // end width
311 perp2StartPoint.set(endPoint[0]-p[0],endPoint[1]-p[1],endPoint[2]-p[2]);394 perp2Start.set(end[0]-p[0],end[1]-p[1],end[2]-p[2]);
312 perp2EndPoint.set(endPoint[0]+p[0],endPoint[1]+p[1],endPoint[2]+p[2]);395 perp2End.set(end[0]+p[0],end[1]+p[1],end[2]+p[2]);
313396
314 angle = startPoint.angle(endPoint);397 angle = start.angle(end);
315}398}
316399
317QString AngleMeasure::calculateAngle() const400// GZ Misnomer! should be called formatAngleString()
401QString AngleMeasure::calculateAngle(bool horizontal) const
318{402{
319 unsigned int d, m;403 unsigned int d, m;
320 double s;404 double s;
321 bool sign;405 bool sign;
322406
323 StelUtils::radToDms(angle, sign, d, m, s);407 if (horizontal)
408 StelUtils::radToDms(angleHor, sign, d, m, s);
409 else
410 StelUtils::radToDms(angle, sign, d, m, s);
324 if (flagUseDmsFormat)411 if (flagUseDmsFormat)
325 return QString("%1d %2m %3s").arg(d).arg(m).arg(s, 0, 'f', 2);412 return QString("%1d %2m %3s").arg(d).arg(m).arg(s, 0, 'f', 2);
326 else413 else
@@ -344,6 +431,26 @@
344 flagShowPA = b;431 flagShowPA = b;
345}432}
346433
434void AngleMeasure::showPositionAngleHor(bool b)
435{
436 flagShowHorizontalPA = b;
437}
438void AngleMeasure::showEquatorial(bool b)
439{
440 flagShowEquatorial = b;
441}
442void AngleMeasure::showHorizontal(bool b)
443{
444 flagShowHorizontal = b;
445}
446void AngleMeasure::showHorizontalStartSkylinked(bool b)
447{
448 flagShowHorizontalStartSkylinked = b;
449}
450void AngleMeasure::showHorizontalEndSkylinked(bool b)
451{
452 flagShowHorizontalEndSkylinked = b;
453}
347void AngleMeasure::useDmsFormat(bool b)454void AngleMeasure::useDmsFormat(bool b)
348{455{
349 flagUseDmsFormat=b;456 flagUseDmsFormat=b;
@@ -380,6 +487,8 @@
380 conf->beginGroup("AngleMeasure");487 conf->beginGroup("AngleMeasure");
381 conf->setValue("text_color", "0,0.5,1");488 conf->setValue("text_color", "0,0.5,1");
382 conf->setValue("line_color", "0,0.5,1");489 conf->setValue("line_color", "0,0.5,1");
490 conf->setValue("text_color_horizontal", "0.9,0.6,0.4");
491 conf->setValue("line_color_horizontal", "0.9,0.6,0.4");
383 conf->endGroup();492 conf->endGroup();
384}493}
385494
@@ -391,6 +500,13 @@
391 showPositionAngle(conf->value("show_position_angle", false).toBool());500 showPositionAngle(conf->value("show_position_angle", false).toBool());
392 textColor = StelUtils::strToVec3f(conf->value("text_color", "0,0.5,1").toString());501 textColor = StelUtils::strToVec3f(conf->value("text_color", "0,0.5,1").toString());
393 lineColor = StelUtils::strToVec3f(conf->value("line_color", "0,0.5,1").toString());502 lineColor = StelUtils::strToVec3f(conf->value("line_color", "0,0.5,1").toString());
503 horTextColor = StelUtils::strToVec3f(conf->value("text_color_horizontal", "0.9,0.6,0.4").toString());
504 horLineColor = StelUtils::strToVec3f(conf->value("line_color_horizontal", "0.9,0.6,0.4").toString());
505 showPositionAngleHor(conf->value("show_position_angle_horizontal", false).toBool());
506 flagShowEquatorial = conf->value("show_equatorial", true).toBool();
507 flagShowHorizontal = conf->value("show_horizontal", false).toBool();
508 flagShowHorizontalStartSkylinked = conf->value("link_horizontal_start_to_sky", false).toBool();
509 flagShowHorizontalEndSkylinked = conf->value("link_horizontal_end_to_sky", false).toBool();
394510
395 conf->endGroup();511 conf->endGroup();
396}512}
@@ -401,6 +517,11 @@
401517
402 conf->setValue("angle_format_dms", isDmsFormat());518 conf->setValue("angle_format_dms", isDmsFormat());
403 conf->setValue("show_position_angle", isPaDisplayed());519 conf->setValue("show_position_angle", isPaDisplayed());
520 conf->setValue("show_position_angle_horizontal", isHorPaDisplayed());
521 conf->setValue("show_equatorial", isEquatorial());
522 conf->setValue("show_horizontal", isHorizontal());
523 conf->setValue("link_horizontal_start_to_sky", isHorizontalStartSkylinked());
524 conf->setValue("link_horizontal_end_to_sky", isHorizontalEndSkylinked());
404525
405 conf->endGroup();526 conf->endGroup();
406}527}
407528
=== modified file 'plugins/AngleMeasure/src/AngleMeasure.hpp'
--- plugins/AngleMeasure/src/AngleMeasure.hpp 2014-03-01 15:42:49 +0000
+++ plugins/AngleMeasure/src/AngleMeasure.hpp 2014-10-07 18:19:23 +0000
@@ -1,5 +1,6 @@
1/*1/*
2 * Copyright (C) 2009 Matthew Gates2 * Copyright (C) 2009 Matthew Gates
3 * Copyright (C) 2014 Georg Zotti
3 *4 *
4 * This program is free software; you can redistribute it and/or5 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License6 * modify it under the terms of the GNU General Public License
@@ -25,6 +26,7 @@
25#include "VecMath.hpp"26#include "VecMath.hpp"
26#include "StelModule.hpp"27#include "StelModule.hpp"
27#include "StelFader.hpp"28#include "StelFader.hpp"
29#include "StelCore.hpp"
2830
29class QTimer;31class QTimer;
30class QPixmap;32class QPixmap;
@@ -33,6 +35,10 @@
3335
34//! Main class of the Angle Measure plug-in.36//! Main class of the Angle Measure plug-in.
35//! Provides an on-screen angle measuring tool.37//! Provides an on-screen angle measuring tool.
38//! GZ extended in 2014-09, enough to call it V4.0
39//! Equatorial Mode (original): mark start,end: distance/position angle in the sky, line rotates with sky, spherical angles influenced by refraction (numbers given on celestial sphere).
40//! Horizontal Mode: mark start,end: distance/position angle in alt/azimuthal coordinates, line stays fixed in alt-az system. Angle may be different near to horizon because of refraction!
41//! It is possible to link start and/or end to the sky. Distance/position angle still always in alt/azimuthal coordinates.
36class AngleMeasure : public StelModule42class AngleMeasure : public StelModule
37{43{
38 Q_OBJECT44 Q_OBJECT
@@ -62,6 +68,12 @@
62 bool isEnabled() const {return flagShowAngleMeasure;}68 bool isEnabled() const {return flagShowAngleMeasure;}
63 bool isDmsFormat() const { return flagUseDmsFormat; }69 bool isDmsFormat() const { return flagUseDmsFormat; }
64 bool isPaDisplayed() const { return flagShowPA; }70 bool isPaDisplayed() const { return flagShowPA; }
71 bool isEquatorial() const { return flagShowEquatorial; }
72 bool isHorizontal() const { return flagShowHorizontal; }
73 bool isHorizontalStartSkylinked() const { return flagShowHorizontalStartSkylinked; }
74 bool isHorizontalEndSkylinked() const { return flagShowHorizontalEndSkylinked; }
75 bool isHorPaDisplayed() const { return flagShowHorizontalPA; }
76
6577
66 //! Restore the plug-in's settings to the default state.78 //! Restore the plug-in's settings to the default state.
67 //! Replace the plug-in's settings in Stellarium's configuration file79 //! Replace the plug-in's settings in Stellarium's configuration file
@@ -88,6 +100,11 @@
88 void enableAngleMeasure(bool b);100 void enableAngleMeasure(bool b);
89 void useDmsFormat(bool b);101 void useDmsFormat(bool b);
90 void showPositionAngle(bool b);102 void showPositionAngle(bool b);
103 void showPositionAngleHor(bool b);
104 void showEquatorial(bool b);
105 void showHorizontal(bool b);
106 void showHorizontalStartSkylinked(bool b);
107 void showHorizontalEndSkylinked(bool b);
91108
92private slots:109private slots:
93 void updateMessageText();110 void updateMessageText();
@@ -115,11 +132,29 @@
115 double angle;132 double angle;
116 bool flagUseDmsFormat;133 bool flagUseDmsFormat;
117 bool flagShowPA;134 bool flagShowPA;
135 bool flagShowEquatorial;
136 bool flagShowHorizontal;
137 bool flagShowHorizontalPA;
138 bool flagShowHorizontalStartSkylinked;
139 bool flagShowHorizontalEndSkylinked;
140 Vec3f horTextColor;
141 Vec3f horLineColor;
142 Vec3d startPointHor;
143 Vec3d endPointHor;
144 Vec3d perp1StartPointHor;
145 Vec3d perp1EndPointHor;
146 Vec3d perp2StartPointHor;
147 Vec3d perp2EndPointHor;
148 double angleHor;
149
150
118 StelButton* toolbarButton;151 StelButton* toolbarButton;
119152
120 void calculateEnds();153 void calculateEnds();
121 QString calculateAngle(void) const;154 void calculateEndsOneLine(const Vec3d start, const Vec3d end, Vec3d &perp1Start, Vec3d &perp1End, Vec3d &perp2Start, Vec3d &perp2End, double &angle);
155 QString calculateAngle(bool horizontal=false) const;
122 QString calculatePositionAngle(const Vec3d p1, const Vec3d p2) const;156 QString calculatePositionAngle(const Vec3d p1, const Vec3d p2) const;
157 void drawOne(StelCore *core, const StelCore::FrameType frameType, const StelCore::RefractionMode refractionMode, const Vec3f txtColor, const Vec3f lineColor);
123158
124 QSettings* conf;159 QSettings* conf;
125160
126161
=== modified file 'plugins/AngleMeasure/src/gui/AngleMeasureDialog.cpp'
--- plugins/AngleMeasure/src/gui/AngleMeasureDialog.cpp 2014-09-08 14:57:05 +0000
+++ plugins/AngleMeasure/src/gui/AngleMeasureDialog.cpp 2014-10-07 18:19:23 +0000
@@ -1,7 +1,7 @@
1/*1/*
2 * Angle Measure plug-in for Stellarium2 * Angle Measure plug-in for Stellarium
3 *3 *
4 * Copyright (C) 2014 Alexander Wolf4 * Copyright (C) 2014 Alexander Wolf, Georg Zotti
5 *5 *
6 * This program is free software; you can redistribute it and/or6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License7 * modify it under the terms of the GNU General Public License
@@ -53,9 +53,9 @@
53 am = GETSTELMODULE(AngleMeasure);53 am = GETSTELMODULE(AngleMeasure);
54 ui->setupUi(dialog);54 ui->setupUi(dialog);
5555
56 //Kinetic scrolling for tablet pc and pc56 //Kinetic scrolling for tablet pc and pc
57 QList<QWidget *> addscroll;57 QList<QWidget *> addscroll;
58 addscroll << ui->aboutTextBrowser;58 addscroll << ui->aboutTextBrowser;
59 installKineticScrolling(addscroll);59 installKineticScrolling(addscroll);
6060
61 connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));61 connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
@@ -65,6 +65,16 @@
65 connect(ui->useDmsFormatCheckBox, SIGNAL(toggled(bool)), am, SLOT(useDmsFormat(bool)));65 connect(ui->useDmsFormatCheckBox, SIGNAL(toggled(bool)), am, SLOT(useDmsFormat(bool)));
66 ui->showPositionAngleCheckBox->setChecked(am->isPaDisplayed());66 ui->showPositionAngleCheckBox->setChecked(am->isPaDisplayed());
67 connect(ui->showPositionAngleCheckBox, SIGNAL(toggled(bool)), am, SLOT(showPositionAngle(bool)));67 connect(ui->showPositionAngleCheckBox, SIGNAL(toggled(bool)), am, SLOT(showPositionAngle(bool)));
68 ui->showPositionAngleHorizontalCheckBox->setChecked(am->isHorPaDisplayed());
69 connect(ui->showPositionAngleHorizontalCheckBox, SIGNAL(toggled(bool)), am, SLOT(showPositionAngleHor(bool)));
70 ui->showEquatorial_GroupBox->setChecked(am->isEquatorial());
71 connect(ui->showEquatorial_GroupBox, SIGNAL(toggled(bool)), am, SLOT(showEquatorial(bool)));
72 ui->showHorizontal_GroupBox->setChecked(am->isHorizontal());
73 connect(ui->showHorizontal_GroupBox, SIGNAL(toggled(bool)), am, SLOT(showHorizontal(bool)));
74 ui->azAltStartOnSkyCheckBox->setChecked(am->isHorizontalStartSkylinked());
75 connect(ui->azAltStartOnSkyCheckBox, SIGNAL(toggled(bool)), am, SLOT(showHorizontalStartSkylinked(bool)));
76 ui->azAltEndOnSkyCheckBox->setChecked(am->isHorizontalEndSkylinked());
77 connect(ui->azAltEndOnSkyCheckBox, SIGNAL(toggled(bool)), am, SLOT(showHorizontalEndSkylinked(bool)));
6878
69 connect(ui->saveSettingsButton, SIGNAL(clicked()), this, SLOT(saveAngleMeasureSettings()));79 connect(ui->saveSettingsButton, SIGNAL(clicked()), this, SLOT(saveAngleMeasureSettings()));
70 connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(resetAngleMeasureSettings()));80 connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(resetAngleMeasureSettings()));
@@ -78,10 +88,11 @@
78 html += "<h2>" + q_("Angle Measure Plug-in") + "</h2><table width=\"90%\">";88 html += "<h2>" + q_("Angle Measure Plug-in") + "</h2><table width=\"90%\">";
79 html += "<tr width=\"30%\"><td><strong>" + q_("Version") + ":</strong></td><td>" + ANGLEMEASURE_VERSION + "</td></tr>";89 html += "<tr width=\"30%\"><td><strong>" + q_("Version") + ":</strong></td><td>" + ANGLEMEASURE_VERSION + "</td></tr>";
80 html += "<tr><td><strong>" + q_("Author") + ":</strong></td><td>Matthew Gates</td></tr>";90 html += "<tr><td><strong>" + q_("Author") + ":</strong></td><td>Matthew Gates</td></tr>";
81 html += "<tr><td><strong>" + q_("Contributors") + ":</strong></td><td>Bogdan Marinov<br />Alexander Wolf &lt;alex.v.wolf@gmail.com&gt;</td></tr>";91 html += "<tr><td><strong>" + q_("Contributors") + ":</strong></td><td>Bogdan Marinov<br />Alexander Wolf &lt;alex.v.wolf@gmail.com&gt; <br />Georg Zotti</td></tr>";
82 html += "</table>";92 html += "</table>";
8393
84 html += "<p>" + q_("The Angle Measure plugin is a small tool which is used to measure the angular distance between two points on the sky (and calculation of position angle between those two points).") + "</p>";94 html += "<p>" + q_("The Angle Measure plugin is a small tool which is used to measure the angular distance between two points on the sky (and calculation of position angle between those two points).") + "</p>";
95 html += "<p>" + q_("Start and end points in horizontal mode can be linked to the rotating sky, which may be helpful to keep relations between landscape and some celestial object or (with both linked) for Dobsonian starhopping.") + "</p>";
85 html += "<p>" + q_("*goes misty eyed* I recall measuring the size of the Cassini Division when I was a student. It was not the high academic glamor one might expect... It was cloudy... It was rainy... The observatory lab had some old scopes set up at one end, pointing at a <em>photograph</em> of Saturn at the other end of the lab. We measured. We calculated. We wished we were in Hawaii.") + "</p>";96 html += "<p>" + q_("*goes misty eyed* I recall measuring the size of the Cassini Division when I was a student. It was not the high academic glamor one might expect... It was cloudy... It was rainy... The observatory lab had some old scopes set up at one end, pointing at a <em>photograph</em> of Saturn at the other end of the lab. We measured. We calculated. We wished we were in Hawaii.") + "</p>";
8697
87 html += "<h3>" + q_("Links") + "</h3>";98 html += "<h3>" + q_("Links") + "</h3>";
8899
=== modified file 'plugins/AngleMeasure/src/gui/angleMeasureDialog.ui'
--- plugins/AngleMeasure/src/gui/angleMeasureDialog.ui 2014-02-16 12:58:17 +0000
+++ plugins/AngleMeasure/src/gui/angleMeasureDialog.ui 2014-10-07 18:19:23 +0000
@@ -162,10 +162,105 @@
162 </widget>162 </widget>
163 </item>163 </item>
164 <item>164 <item>
165 <widget class="QCheckBox" name="showPositionAngleCheckBox">165 <widget class="QGroupBox" name="showEquatorial_GroupBox">
166 <property name="text">166 <property name="sizePolicy">
167 <string>Show position angle</string>167 <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
168 </property>168 <horstretch>0</horstretch>
169 <verstretch>0</verstretch>
170 </sizepolicy>
171 </property>
172 <property name="minimumSize">
173 <size>
174 <width>0</width>
175 <height>80</height>
176 </size>
177 </property>
178 <property name="title">
179 <string>Show in Equatorial Coordinates</string>
180 </property>
181 <property name="flat">
182 <bool>true</bool>
183 </property>
184 <property name="checkable">
185 <bool>true</bool>
186 </property>
187 <widget class="QCheckBox" name="showPositionAngleCheckBox">
188 <property name="enabled">
189 <bool>true</bool>
190 </property>
191 <property name="geometry">
192 <rect>
193 <x>26</x>
194 <y>40</y>
195 <width>400</width>
196 <height>17</height>
197 </rect>
198 </property>
199 <property name="text">
200 <string>Display with position angle</string>
201 </property>
202 </widget>
203 </widget>
204 </item>
205 <item>
206 <widget class="QGroupBox" name="showHorizontal_GroupBox">
207 <property name="minimumSize">
208 <size>
209 <width>0</width>
210 <height>135</height>
211 </size>
212 </property>
213 <property name="title">
214 <string>Show in Horizontal Coordinates</string>
215 </property>
216 <property name="flat">
217 <bool>true</bool>
218 </property>
219 <property name="checkable">
220 <bool>true</bool>
221 </property>
222 <widget class="QCheckBox" name="showPositionAngleHorizontalCheckBox">
223 <property name="geometry">
224 <rect>
225 <x>26</x>
226 <y>40</y>
227 <width>484</width>
228 <height>17</height>
229 </rect>
230 </property>
231 <property name="toolTip">
232 <string>(e.g. for Dobson starhopping)</string>
233 </property>
234 <property name="text">
235 <string>Display with position angle </string>
236 </property>
237 </widget>
238 <widget class="QCheckBox" name="azAltStartOnSkyCheckBox">
239 <property name="geometry">
240 <rect>
241 <x>26</x>
242 <y>65</y>
243 <width>400</width>
244 <height>17</height>
245 </rect>
246 </property>
247 <property name="text">
248 <string>Attach start point to rotating sky</string>
249 </property>
250 </widget>
251 <widget class="QCheckBox" name="azAltEndOnSkyCheckBox">
252 <property name="geometry">
253 <rect>
254 <x>26</x>
255 <y>90</y>
256 <width>400</width>
257 <height>17</height>
258 </rect>
259 </property>
260 <property name="text">
261 <string>Attach end point to rotating sky</string>
262 </property>
263 </widget>
169 </widget>264 </widget>
170 </item>265 </item>
171 </layout>266 </layout>