Merge lp:~georg-zotti/stellarium/gz_plugin-ArchaeoLines into lp:stellarium
- gz_plugin-ArchaeoLines
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 7543 |
Proposed branch: | lp:~georg-zotti/stellarium/gz_plugin-ArchaeoLines |
Merge into: | lp:stellarium |
Diff against target: |
2772 lines (+2619/-6) 17 files modified
CMakeLists.txt (+1/-0) plugins/ArchaeoLines/ArchaeoLines.qrc (+6/-0) plugins/ArchaeoLines/CMakeLists.txt (+12/-0) plugins/ArchaeoLines/COPYING (+340/-0) plugins/ArchaeoLines/ChangeLog (+3/-0) plugins/ArchaeoLines/README (+47/-0) plugins/ArchaeoLines/src/ArchaeoLines.cpp (+890/-0) plugins/ArchaeoLines/src/ArchaeoLines.hpp (+300/-0) plugins/ArchaeoLines/src/CMakeLists.txt (+29/-0) plugins/ArchaeoLines/src/gui/ArchaeoLinesDialog.cpp (+421/-0) plugins/ArchaeoLines/src/gui/ArchaeoLinesDialog.hpp (+108/-0) plugins/ArchaeoLines/src/gui/archaeoLinesDialog.ui (+449/-0) src/core/StelApp.cpp (+4/-0) src/core/StelObjectMgr.cpp (+1/-1) src/core/StelPainter.hpp (+1/-0) src/core/modules/GridLinesMgr.cpp (+2/-2) src/core/modules/LandscapeMgr.hpp (+5/-3) |
To merge this branch: | bzr merge lp:~georg-zotti/stellarium/gz_plugin-ArchaeoLines |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexander Wolf | Approve | ||
gzotti | Needs Resubmitting | ||
Review via email: mp+254910@code.launchpad.net |
Commit message
Description of the change
See branch description.
Any idea/insight how I can have the QColorDialog not in a separate panel?
Alexander Wolf (alexwolf) wrote : | # |
gzotti (georg-zotti) wrote : | # |
Ah good, thanks! I will have a look into how you did this, I also dislike the fullscreen mode switch.
gzotti (georg-zotti) wrote : | # |
Dear Alex,
I have tested 4 systems:
on WinXP/Nvidia there is no problem with your solution.
on Win7/Nvidia I have the same problem in your MeteorShowers config that I saw: if I call the color panel, it is hidden behind the fullscreen main window. If I leave fullscreen before, I see the separate panel. This is why I have made my workaround implementation.
On Win8.1 AMD/Radeon netbook I have the problem.
On Ubuntu 14 / Odroid C1/Mali 450 OpenGL ES2 I have no problem, system panel comes to foreground.
No idea whether it works on Apple, or on Win/IntelGPU.
I am afraid the problem is frequent if not on all Win 7+ systems. (at least Geforce and Radeon.) There were some major changes for GPU driver in Win7, without me knowing details, but maybe this is one of the consequences? The other consequence is the missing tooltips in fullscreen mode - also now just seen on Win8/Radeon! What to do?
1) Ignore the problem and wait for reports of "hung system". This is what my Win8 looks like! Ctrl-Alt-Del with switch to task manager (my usual way out on Win7) immediately goes back to fullscreen Stellarium and does not show the color panel. I was finally forced to reboot. (-1 again for win8...)
2) Keep current solution, and maybe do something similar for your plugin?
3) Keep current solution, but switch out of fullscreen only on Windows builds? (No separation XP/7+, XP is legally dead.)
The problem is not a functional problem for the plugin's main functionality, but a cosmetic issue when configuring it.
Alexander Wolf (alexwolf) wrote : | # |
It can be helpful:
http://
http://
http://
stackoverflow.
Alexander Wolf (alexwolf) wrote : | # |
I think problem with QColorDialog in fullscreen mode at Windows platform should be fixed in any case
gzotti (georg-zotti) wrote : | # |
Not sure if I can invest time in checking if this QTBUG is still an issue on Windows? I don't know how to correctly parentize this Dialog so that it is shown on top of fullscreen Stellarium. Any ideas?
gzotti (georg-zotti) wrote : | # |
OK, this is odd: I just jave installed Win7 on an Intel Core i5 4xxx CPU with HD4600 graphics (will replace my aging XP system which I am retiring), and tried 0.13.2.97-win64. Fullscreen has tooltips here, and in the Meteorshower plugin I can change colors without any problems. So the problem is reduced to (at least some) NVidia and Radeon GPUs on Win7 and later, or maybe even to MinGW builds? (0.13.2.97 built with MSVC.) Is it OK to just remove all fullscreen switching? I am afraid we cannot really solve this.
Alexander Wolf (alexwolf) wrote : | # |
Removing all fullscreen switching within plugin is OK for me.
gzotti (georg-zotti) wrote : | # |
I tried the 0.13.2.97-x64 on Win7/Nvidia. Again the color panel hides behind fullscreen window. So it is a Qt/GPU driver issue that appears at least on some NVidia Geforce and AMD Radeon systems on Win7 and 8.1. For the first time Intel GPU driver looks "better".
Is that OK like this?
Alexander Wolf (alexwolf) wrote : | # |
It's OK for me.
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2015-04-05 15:08:38 +0000 |
3 | +++ CMakeLists.txt 2015-04-09 09:33:54 +0000 |
4 | @@ -169,6 +169,7 @@ |
5 | ADD_PLUGIN(SimpleDrawLine 0) |
6 | #### work plugins #### |
7 | ADD_PLUGIN(AngleMeasure 1) |
8 | +ADD_PLUGIN(ArchaeoLines 1) |
9 | ADD_PLUGIN(CompassMarks 1) |
10 | ADD_PLUGIN(Exoplanets 1) |
11 | ADD_PLUGIN(EquationOfTime 1) |
12 | |
13 | === added directory 'plugins/ArchaeoLines' |
14 | === added file 'plugins/ArchaeoLines/ArchaeoLines.qrc' |
15 | --- plugins/ArchaeoLines/ArchaeoLines.qrc 1970-01-01 00:00:00 +0000 |
16 | +++ plugins/ArchaeoLines/ArchaeoLines.qrc 2015-04-09 09:33:54 +0000 |
17 | @@ -0,0 +1,6 @@ |
18 | +<RCC> |
19 | + <qresource prefix="archaeoLines" > |
20 | + <file>bt_archaeolines_on.png</file> |
21 | + <file>bt_archaeolines_off.png</file> |
22 | + </qresource> |
23 | +</RCC> |
24 | |
25 | === added file 'plugins/ArchaeoLines/CMakeLists.txt' |
26 | --- plugins/ArchaeoLines/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
27 | +++ plugins/ArchaeoLines/CMakeLists.txt 2015-04-09 09:33:54 +0000 |
28 | @@ -0,0 +1,12 @@ |
29 | +# This is the cmake config file for the ArchaeoLines plugin |
30 | +SET(ARCHAEOLINES_VERSION "0.1.0") |
31 | +ADD_DEFINITIONS(-DARCHAEOLINES_VERSION="${ARCHAEOLINES_VERSION}") |
32 | + |
33 | +ADD_SUBDIRECTORY( src ) |
34 | + |
35 | +IF(APPLE) |
36 | + SET(CMAKE_INSTALL_PREFIX $ENV{HOME}/Library/Application\ Support/Stellarium) |
37 | +ElSE(APPLE) |
38 | + SET(CMAKE_INSTALL_PREFIX $ENV{HOME}/.stellarium) |
39 | +ENDIF(APPLE) |
40 | +INSTALL(FILES DESTINATION "modules/ArchaeoLines") |
41 | |
42 | === added file 'plugins/ArchaeoLines/COPYING' |
43 | --- plugins/ArchaeoLines/COPYING 1970-01-01 00:00:00 +0000 |
44 | +++ plugins/ArchaeoLines/COPYING 2015-04-09 09:33:54 +0000 |
45 | @@ -0,0 +1,340 @@ |
46 | + GNU GENERAL PUBLIC LICENSE |
47 | + Version 2, June 1991 |
48 | + |
49 | + Copyright (C) 1989, 1991 Free Software Foundation, Inc. |
50 | + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA |
51 | + Everyone is permitted to copy and distribute verbatim copies |
52 | + of this license document, but changing it is not allowed. |
53 | + |
54 | + Preamble |
55 | + |
56 | + The licenses for most software are designed to take away your |
57 | +freedom to share and change it. By contrast, the GNU General Public |
58 | +License is intended to guarantee your freedom to share and change free |
59 | +software--to make sure the software is free for all its users. This |
60 | +General Public License applies to most of the Free Software |
61 | +Foundation's software and to any other program whose authors commit to |
62 | +using it. (Some other Free Software Foundation software is covered by |
63 | +the GNU Library General Public License instead.) You can apply it to |
64 | +your programs, too. |
65 | + |
66 | + When we speak of free software, we are referring to freedom, not |
67 | +price. Our General Public Licenses are designed to make sure that you |
68 | +have the freedom to distribute copies of free software (and charge for |
69 | +this service if you wish), that you receive source code or can get it |
70 | +if you want it, that you can change the software or use pieces of it |
71 | +in new free programs; and that you know you can do these things. |
72 | + |
73 | + To protect your rights, we need to make restrictions that forbid |
74 | +anyone to deny you these rights or to ask you to surrender the rights. |
75 | +These restrictions translate to certain responsibilities for you if you |
76 | +distribute copies of the software, or if you modify it. |
77 | + |
78 | + For example, if you distribute copies of such a program, whether |
79 | +gratis or for a fee, you must give the recipients all the rights that |
80 | +you have. You must make sure that they, too, receive or can get the |
81 | +source code. And you must show them these terms so they know their |
82 | +rights. |
83 | + |
84 | + We protect your rights with two steps: (1) copyright the software, and |
85 | +(2) offer you this license which gives you legal permission to copy, |
86 | +distribute and/or modify the software. |
87 | + |
88 | + Also, for each author's protection and ours, we want to make certain |
89 | +that everyone understands that there is no warranty for this free |
90 | +software. If the software is modified by someone else and passed on, we |
91 | +want its recipients to know that what they have is not the original, so |
92 | +that any problems introduced by others will not reflect on the original |
93 | +authors' reputations. |
94 | + |
95 | + Finally, any free program is threatened constantly by software |
96 | +patents. We wish to avoid the danger that redistributors of a free |
97 | +program will individually obtain patent licenses, in effect making the |
98 | +program proprietary. To prevent this, we have made it clear that any |
99 | +patent must be licensed for everyone's free use or not licensed at all. |
100 | + |
101 | + The precise terms and conditions for copying, distribution and |
102 | +modification follow. |
103 | + |
104 | |
105 | + GNU GENERAL PUBLIC LICENSE |
106 | + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
107 | + |
108 | + 0. This License applies to any program or other work which contains |
109 | +a notice placed by the copyright holder saying it may be distributed |
110 | +under the terms of this General Public License. The "Program", below, |
111 | +refers to any such program or work, and a "work based on the Program" |
112 | +means either the Program or any derivative work under copyright law: |
113 | +that is to say, a work containing the Program or a portion of it, |
114 | +either verbatim or with modifications and/or translated into another |
115 | +language. (Hereinafter, translation is included without limitation in |
116 | +the term "modification".) Each licensee is addressed as "you". |
117 | + |
118 | +Activities other than copying, distribution and modification are not |
119 | +covered by this License; they are outside its scope. The act of |
120 | +running the Program is not restricted, and the output from the Program |
121 | +is covered only if its contents constitute a work based on the |
122 | +Program (independent of having been made by running the Program). |
123 | +Whether that is true depends on what the Program does. |
124 | + |
125 | + 1. You may copy and distribute verbatim copies of the Program's |
126 | +source code as you receive it, in any medium, provided that you |
127 | +conspicuously and appropriately publish on each copy an appropriate |
128 | +copyright notice and disclaimer of warranty; keep intact all the |
129 | +notices that refer to this License and to the absence of any warranty; |
130 | +and give any other recipients of the Program a copy of this License |
131 | +along with the Program. |
132 | + |
133 | +You may charge a fee for the physical act of transferring a copy, and |
134 | +you may at your option offer warranty protection in exchange for a fee. |
135 | + |
136 | + 2. You may modify your copy or copies of the Program or any portion |
137 | +of it, thus forming a work based on the Program, and copy and |
138 | +distribute such modifications or work under the terms of Section 1 |
139 | +above, provided that you also meet all of these conditions: |
140 | + |
141 | + a) You must cause the modified files to carry prominent notices |
142 | + stating that you changed the files and the date of any change. |
143 | + |
144 | + b) You must cause any work that you distribute or publish, that in |
145 | + whole or in part contains or is derived from the Program or any |
146 | + part thereof, to be licensed as a whole at no charge to all third |
147 | + parties under the terms of this License. |
148 | + |
149 | + c) If the modified program normally reads commands interactively |
150 | + when run, you must cause it, when started running for such |
151 | + interactive use in the most ordinary way, to print or display an |
152 | + announcement including an appropriate copyright notice and a |
153 | + notice that there is no warranty (or else, saying that you provide |
154 | + a warranty) and that users may redistribute the program under |
155 | + these conditions, and telling the user how to view a copy of this |
156 | + License. (Exception: if the Program itself is interactive but |
157 | + does not normally print such an announcement, your work based on |
158 | + the Program is not required to print an announcement.) |
159 | + |
160 | |
161 | +These requirements apply to the modified work as a whole. If |
162 | +identifiable sections of that work are not derived from the Program, |
163 | +and can be reasonably considered independent and separate works in |
164 | +themselves, then this License, and its terms, do not apply to those |
165 | +sections when you distribute them as separate works. But when you |
166 | +distribute the same sections as part of a whole which is a work based |
167 | +on the Program, the distribution of the whole must be on the terms of |
168 | +this License, whose permissions for other licensees extend to the |
169 | +entire whole, and thus to each and every part regardless of who wrote it. |
170 | + |
171 | +Thus, it is not the intent of this section to claim rights or contest |
172 | +your rights to work written entirely by you; rather, the intent is to |
173 | +exercise the right to control the distribution of derivative or |
174 | +collective works based on the Program. |
175 | + |
176 | +In addition, mere aggregation of another work not based on the Program |
177 | +with the Program (or with a work based on the Program) on a volume of |
178 | +a storage or distribution medium does not bring the other work under |
179 | +the scope of this License. |
180 | + |
181 | + 3. You may copy and distribute the Program (or a work based on it, |
182 | +under Section 2) in object code or executable form under the terms of |
183 | +Sections 1 and 2 above provided that you also do one of the following: |
184 | + |
185 | + a) Accompany it with the complete corresponding machine-readable |
186 | + source code, which must be distributed under the terms of Sections |
187 | + 1 and 2 above on a medium customarily used for software interchange; or, |
188 | + |
189 | + b) Accompany it with a written offer, valid for at least three |
190 | + years, to give any third party, for a charge no more than your |
191 | + cost of physically performing source distribution, a complete |
192 | + machine-readable copy of the corresponding source code, to be |
193 | + distributed under the terms of Sections 1 and 2 above on a medium |
194 | + customarily used for software interchange; or, |
195 | + |
196 | + c) Accompany it with the information you received as to the offer |
197 | + to distribute corresponding source code. (This alternative is |
198 | + allowed only for noncommercial distribution and only if you |
199 | + received the program in object code or executable form with such |
200 | + an offer, in accord with Subsection b above.) |
201 | + |
202 | +The source code for a work means the preferred form of the work for |
203 | +making modifications to it. For an executable work, complete source |
204 | +code means all the source code for all modules it contains, plus any |
205 | +associated interface definition files, plus the scripts used to |
206 | +control compilation and installation of the executable. However, as a |
207 | +special exception, the source code distributed need not include |
208 | +anything that is normally distributed (in either source or binary |
209 | +form) with the major components (compiler, kernel, and so on) of the |
210 | +operating system on which the executable runs, unless that component |
211 | +itself accompanies the executable. |
212 | + |
213 | +If distribution of executable or object code is made by offering |
214 | +access to copy from a designated place, then offering equivalent |
215 | +access to copy the source code from the same place counts as |
216 | +distribution of the source code, even though third parties are not |
217 | +compelled to copy the source along with the object code. |
218 | + |
219 | |
220 | + 4. You may not copy, modify, sublicense, or distribute the Program |
221 | +except as expressly provided under this License. Any attempt |
222 | +otherwise to copy, modify, sublicense or distribute the Program is |
223 | +void, and will automatically terminate your rights under this License. |
224 | +However, parties who have received copies, or rights, from you under |
225 | +this License will not have their licenses terminated so long as such |
226 | +parties remain in full compliance. |
227 | + |
228 | + 5. You are not required to accept this License, since you have not |
229 | +signed it. However, nothing else grants you permission to modify or |
230 | +distribute the Program or its derivative works. These actions are |
231 | +prohibited by law if you do not accept this License. Therefore, by |
232 | +modifying or distributing the Program (or any work based on the |
233 | +Program), you indicate your acceptance of this License to do so, and |
234 | +all its terms and conditions for copying, distributing or modifying |
235 | +the Program or works based on it. |
236 | + |
237 | + 6. Each time you redistribute the Program (or any work based on the |
238 | +Program), the recipient automatically receives a license from the |
239 | +original licensor to copy, distribute or modify the Program subject to |
240 | +these terms and conditions. You may not impose any further |
241 | +restrictions on the recipients' exercise of the rights granted herein. |
242 | +You are not responsible for enforcing compliance by third parties to |
243 | +this License. |
244 | + |
245 | + 7. If, as a consequence of a court judgment or allegation of patent |
246 | +infringement or for any other reason (not limited to patent issues), |
247 | +conditions are imposed on you (whether by court order, agreement or |
248 | +otherwise) that contradict the conditions of this License, they do not |
249 | +excuse you from the conditions of this License. If you cannot |
250 | +distribute so as to satisfy simultaneously your obligations under this |
251 | +License and any other pertinent obligations, then as a consequence you |
252 | +may not distribute the Program at all. For example, if a patent |
253 | +license would not permit royalty-free redistribution of the Program by |
254 | +all those who receive copies directly or indirectly through you, then |
255 | +the only way you could satisfy both it and this License would be to |
256 | +refrain entirely from distribution of the Program. |
257 | + |
258 | +If any portion of this section is held invalid or unenforceable under |
259 | +any particular circumstance, the balance of the section is intended to |
260 | +apply and the section as a whole is intended to apply in other |
261 | +circumstances. |
262 | + |
263 | +It is not the purpose of this section to induce you to infringe any |
264 | +patents or other property right claims or to contest validity of any |
265 | +such claims; this section has the sole purpose of protecting the |
266 | +integrity of the free software distribution system, which is |
267 | +implemented by public license practices. Many people have made |
268 | +generous contributions to the wide range of software distributed |
269 | +through that system in reliance on consistent application of that |
270 | +system; it is up to the author/donor to decide if he or she is willing |
271 | +to distribute software through any other system and a licensee cannot |
272 | +impose that choice. |
273 | + |
274 | +This section is intended to make thoroughly clear what is believed to |
275 | +be a consequence of the rest of this License. |
276 | + |
277 | |
278 | + 8. If the distribution and/or use of the Program is restricted in |
279 | +certain countries either by patents or by copyrighted interfaces, the |
280 | +original copyright holder who places the Program under this License |
281 | +may add an explicit geographical distribution limitation excluding |
282 | +those countries, so that distribution is permitted only in or among |
283 | +countries not thus excluded. In such case, this License incorporates |
284 | +the limitation as if written in the body of this License. |
285 | + |
286 | + 9. The Free Software Foundation may publish revised and/or new versions |
287 | +of the General Public License from time to time. Such new versions will |
288 | +be similar in spirit to the present version, but may differ in detail to |
289 | +address new problems or concerns. |
290 | + |
291 | +Each version is given a distinguishing version number. If the Program |
292 | +specifies a version number of this License which applies to it and "any |
293 | +later version", you have the option of following the terms and conditions |
294 | +either of that version or of any later version published by the Free |
295 | +Software Foundation. If the Program does not specify a version number of |
296 | +this License, you may choose any version ever published by the Free Software |
297 | +Foundation. |
298 | + |
299 | + 10. If you wish to incorporate parts of the Program into other free |
300 | +programs whose distribution conditions are different, write to the author |
301 | +to ask for permission. For software which is copyrighted by the Free |
302 | +Software Foundation, write to the Free Software Foundation; we sometimes |
303 | +make exceptions for this. Our decision will be guided by the two goals |
304 | +of preserving the free status of all derivatives of our free software and |
305 | +of promoting the sharing and reuse of software generally. |
306 | + |
307 | + NO WARRANTY |
308 | + |
309 | + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
310 | +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
311 | +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
312 | +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED |
313 | +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
314 | +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS |
315 | +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE |
316 | +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, |
317 | +REPAIR OR CORRECTION. |
318 | + |
319 | + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
320 | +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
321 | +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, |
322 | +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING |
323 | +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED |
324 | +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY |
325 | +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER |
326 | +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE |
327 | +POSSIBILITY OF SUCH DAMAGES. |
328 | + |
329 | + END OF TERMS AND CONDITIONS |
330 | + |
331 | |
332 | + How to Apply These Terms to Your New Programs |
333 | + |
334 | + If you develop a new program, and you want it to be of the greatest |
335 | +possible use to the public, the best way to achieve this is to make it |
336 | +free software which everyone can redistribute and change under these terms. |
337 | + |
338 | + To do so, attach the following notices to the program. It is safest |
339 | +to attach them to the start of each source file to most effectively |
340 | +convey the exclusion of warranty; and each file should have at least |
341 | +the "copyright" line and a pointer to where the full notice is found. |
342 | + |
343 | + <one line to give the program's name and a brief idea of what it does.> |
344 | + Copyright (C) <year> <name of author> |
345 | + |
346 | + This program is free software; you can redistribute it and/or modify |
347 | + it under the terms of the GNU General Public License as published by |
348 | + the Free Software Foundation; either version 2 of the License, or |
349 | + (at your option) any later version. |
350 | + |
351 | + This program is distributed in the hope that it will be useful, |
352 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
353 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
354 | + GNU General Public License for more details. |
355 | + |
356 | + You should have received a copy of the GNU General Public License |
357 | + along with this program; if not, write to the Free Software |
358 | + Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA |
359 | + |
360 | + |
361 | +Also add information on how to contact you by electronic and paper mail. |
362 | + |
363 | +If the program is interactive, make it output a short notice like this |
364 | +when it starts in an interactive mode: |
365 | + |
366 | + Gnomovision version 69, Copyright (C) year name of author |
367 | + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
368 | + This is free software, and you are welcome to redistribute it |
369 | + under certain conditions; type `show c' for details. |
370 | + |
371 | +The hypothetical commands `show w' and `show c' should show the appropriate |
372 | +parts of the General Public License. Of course, the commands you use may |
373 | +be called something other than `show w' and `show c'; they could even be |
374 | +mouse-clicks or menu items--whatever suits your program. |
375 | + |
376 | +You should also get your employer (if you work as a programmer) or your |
377 | +school, if any, to sign a "copyright disclaimer" for the program, if |
378 | +necessary. Here is a sample; alter the names: |
379 | + |
380 | + Yoyodyne, Inc., hereby disclaims all copyright interest in the program |
381 | + `Gnomovision' (which makes passes at compilers) written by James Hacker. |
382 | + |
383 | + <signature of Ty Coon>, 1 April 1989 |
384 | + Ty Coon, President of Vice |
385 | + |
386 | +This General Public License does not permit incorporating your program into |
387 | +proprietary programs. If your program is a subroutine library, you may |
388 | +consider it more useful to permit linking proprietary applications with the |
389 | +library. If this is what you want to do, use the GNU Library General |
390 | +Public License instead of this License. |
391 | |
392 | === added file 'plugins/ArchaeoLines/ChangeLog' |
393 | --- plugins/ArchaeoLines/ChangeLog 1970-01-01 00:00:00 +0000 |
394 | +++ plugins/ArchaeoLines/ChangeLog 2015-04-09 09:33:54 +0000 |
395 | @@ -0,0 +1,3 @@ |
396 | +0.0.1 [2014-11-29] |
397 | +Created basic plugin |
398 | + |
399 | |
400 | === added file 'plugins/ArchaeoLines/README' |
401 | --- plugins/ArchaeoLines/README 1970-01-01 00:00:00 +0000 |
402 | +++ plugins/ArchaeoLines/README 2015-04-09 09:33:54 +0000 |
403 | @@ -0,0 +1,47 @@ |
404 | +ArchaeoLines plugin for Stellarium |
405 | +================================== |
406 | + |
407 | +A tool to show the most relevant directions discussed in archeoastronomical alignment studies. |
408 | + |
409 | +TODO |
410 | +==== |
411 | + |
412 | ++ implement it... |
413 | ++ |
414 | + |
415 | +BUILDING THE PLUGIN |
416 | +=================== |
417 | + |
418 | +Please note, these instructions are only directly applicable to Linux. |
419 | +Windows and OSX targets will probably require modification of the |
420 | +CMakeLists.txt file. |
421 | + |
422 | +0. Install and build the SVN version of Stellarium as per the |
423 | +instructions on the Stellarium wiki: |
424 | + |
425 | + http://stellarium.org/wiki/index.php/Compilation_on_Linux |
426 | + |
427 | +NOTE: that the main program build must be set so that the libStelMain.so |
428 | +file will be generated. This is achieved by setting the |
429 | +GENERATE_STELMAINLIB variable in the main Stellarium CMakeLists.txt file |
430 | +to 1, like so: |
431 | + |
432 | + SET(GENERATE_STELMAINLIB 1) |
433 | + |
434 | +1. Set the environment variable STELROOT to the root of the Stellarium |
435 | +source tree. The Stellarium build directory is expected to be: |
436 | + |
437 | + $STELROOT/builds/unix |
438 | + |
439 | +2. Create a sub-directory builds/unix and change into that directory. |
440 | + |
441 | +3. Run: |
442 | + |
443 | + cmake ../.. |
444 | + make |
445 | + make install |
446 | + |
447 | +If all goes well, the relevant files should be built and copied to your |
448 | +~/.stellarium/modules directory. |
449 | + |
450 | + |
451 | |
452 | === added file 'plugins/ArchaeoLines/bt_archaeolines.tif' |
453 | Binary files plugins/ArchaeoLines/bt_archaeolines.tif 1970-01-01 00:00:00 +0000 and plugins/ArchaeoLines/bt_archaeolines.tif 2015-04-09 09:33:54 +0000 differ |
454 | === added file 'plugins/ArchaeoLines/bt_archaeolines_off.png' |
455 | Binary files plugins/ArchaeoLines/bt_archaeolines_off.png 1970-01-01 00:00:00 +0000 and plugins/ArchaeoLines/bt_archaeolines_off.png 2015-04-09 09:33:54 +0000 differ |
456 | === added file 'plugins/ArchaeoLines/bt_archaeolines_on.png' |
457 | Binary files plugins/ArchaeoLines/bt_archaeolines_on.png 1970-01-01 00:00:00 +0000 and plugins/ArchaeoLines/bt_archaeolines_on.png 2015-04-09 09:33:54 +0000 differ |
458 | === added directory 'plugins/ArchaeoLines/src' |
459 | === added file 'plugins/ArchaeoLines/src/ArchaeoLines.cpp' |
460 | --- plugins/ArchaeoLines/src/ArchaeoLines.cpp 1970-01-01 00:00:00 +0000 |
461 | +++ plugins/ArchaeoLines/src/ArchaeoLines.cpp 2015-04-09 09:33:54 +0000 |
462 | @@ -0,0 +1,890 @@ |
463 | +/* |
464 | + * Copyright (C) 2014 Georg Zotti |
465 | + * |
466 | + * This program is free software; you can redistribute it and/or |
467 | + * modify it under the terms of the GNU General Public License |
468 | + * as published by the Free Software Foundation; either version 2 |
469 | + * of the License, or (at your option) any later version. |
470 | + * |
471 | + * This program is distributed in the hope that it will be useful, |
472 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
473 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
474 | + * GNU General Public License for more details. |
475 | + * |
476 | + * You should have received a copy of the GNU General Public License |
477 | + * along with this program; if not, write to the Free Software |
478 | + * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. |
479 | + */ |
480 | + |
481 | +#include "StelUtils.hpp" |
482 | +#include "StelProjector.hpp" |
483 | +#include "StelPainter.hpp" |
484 | +#include "StelApp.hpp" |
485 | +#include "StelCore.hpp" |
486 | +#include "StelFileMgr.hpp" |
487 | +#include "StelLocaleMgr.hpp" |
488 | +#include "StelModuleMgr.hpp" |
489 | +#include "StelObjectMgr.hpp" |
490 | +#include "StelGui.hpp" |
491 | +#include "StelGuiItems.hpp" |
492 | +#include "StelVertexArray.hpp" |
493 | +#include "ArchaeoLines.hpp" |
494 | +#include "ArchaeoLinesDialog.hpp" |
495 | +#include "SolarSystem.hpp" |
496 | +#include "Planet.hpp" |
497 | + |
498 | +#include <QDebug> |
499 | +#include <QTimer> |
500 | +#include <QPixmap> |
501 | +#include <QColor> |
502 | +#include <QtNetwork> |
503 | +#include <QSettings> |
504 | +#include <QMouseEvent> |
505 | +#include <cmath> |
506 | + |
507 | +//! This method is the one called automatically by the StelModuleMgr just |
508 | +//! after loading the dynamic library |
509 | +StelModule* ArchaeoLinesStelPluginInterface::getStelModule() const |
510 | +{ |
511 | + return new ArchaeoLines(); |
512 | +} |
513 | + |
514 | +StelPluginInfo ArchaeoLinesStelPluginInterface::getPluginInfo() const |
515 | +{ |
516 | + // Allow to load the resources when used as a static plugin |
517 | + Q_INIT_RESOURCE(ArchaeoLines); |
518 | + |
519 | + StelPluginInfo info; |
520 | + info.id = "ArchaeoLines"; |
521 | + info.displayedName = N_("ArchaeoLines"); |
522 | + info.authors = "Georg Zotti"; |
523 | + info.contact = "http://homepage.univie.ac.at/Georg.Zotti"; |
524 | + info.description = N_("A tool for archaeo-/ethnoastronomical alignment studies"); |
525 | + info.version = ARCHAEOLINES_VERSION; |
526 | + return info; |
527 | +} |
528 | + |
529 | +ArchaeoLines::ArchaeoLines() |
530 | + : flagShowArchaeoLines(false) |
531 | + , withDecimalDegree(false) |
532 | + , flagUseDmsFormat(false) |
533 | + , flagShowEquinox(false) |
534 | + , flagShowSolstices(false) |
535 | + , flagShowCrossquarters(false) |
536 | + , flagShowMajorStandstills(false) |
537 | + , flagShowMinorStandstills(false) |
538 | + , flagShowZenithPassage(false) |
539 | + , flagShowNadirPassage(false) |
540 | + , flagShowSelectedObject(false) |
541 | + , flagShowCurrentSun(false) |
542 | + , flagShowCurrentMoon(false) |
543 | + , enumShowCurrentPlanet(ArchaeoLine::CurrentPlanetNone) |
544 | + , toolbarButton(NULL) |
545 | +{ |
546 | + setObjectName("ArchaeoLines"); |
547 | + font.setPixelSize(16); |
548 | + core=StelApp::getInstance().getCore(); |
549 | + Q_ASSERT(core); |
550 | + objMgr=GETSTELMODULE(StelObjectMgr); |
551 | + Q_ASSERT(objMgr); |
552 | + |
553 | + // optimize readabiity so that each upper line of the lunistice doubles is labeled. |
554 | + equinoxLine = new ArchaeoLine(ArchaeoLine::Equinox, 0.0); |
555 | + northernSolsticeLine = new ArchaeoLine(ArchaeoLine::Solstices, 23.50); |
556 | + southernSolsticeLine = new ArchaeoLine(ArchaeoLine::Solstices, -23.50); |
557 | + northernCrossquarterLine = new ArchaeoLine(ArchaeoLine::Crossquarters, 16.50); |
558 | + southernCrossquarterLine = new ArchaeoLine(ArchaeoLine::Crossquarters, -16.50); |
559 | + northernMajorStandstillLine0 = new ArchaeoLine(ArchaeoLine::MajorStandstill, 23.5+5.1); |
560 | + northernMajorStandstillLine1 = new ArchaeoLine(ArchaeoLine::MajorStandstill, 23.5+5.1); |
561 | + northernMajorStandstillLine0->setLabelVisible(false); |
562 | + northernMinorStandstillLine2 = new ArchaeoLine(ArchaeoLine::MinorStandstill, 23.5-5.1); |
563 | + northernMinorStandstillLine3 = new ArchaeoLine(ArchaeoLine::MinorStandstill, 23.5-5.1); |
564 | + northernMinorStandstillLine2->setLabelVisible(false); |
565 | + southernMinorStandstillLine4 = new ArchaeoLine(ArchaeoLine::MinorStandstill, -23.5+5.1); |
566 | + southernMinorStandstillLine5 = new ArchaeoLine(ArchaeoLine::MinorStandstill, -23.5+5.1); |
567 | + southernMinorStandstillLine4->setLabelVisible(false); |
568 | + southernMajorStandstillLine6 = new ArchaeoLine(ArchaeoLine::MajorStandstill, -23.5-5.1); |
569 | + southernMajorStandstillLine7 = new ArchaeoLine(ArchaeoLine::MajorStandstill, -23.5-5.1); |
570 | + southernMajorStandstillLine6->setLabelVisible(false); |
571 | + zenithPassageLine = new ArchaeoLine(ArchaeoLine::ZenithPassage, 48.0); |
572 | + nadirPassageLine = new ArchaeoLine(ArchaeoLine::NadirPassage, 42.0); |
573 | + selectedObjectLine = new ArchaeoLine(ArchaeoLine::SelectedObject, 0.0); |
574 | + currentSunLine = new ArchaeoLine(ArchaeoLine::CurrentSun, 0.0); |
575 | + currentMoonLine = new ArchaeoLine(ArchaeoLine::CurrentMoon, 0.0); |
576 | + currentPlanetLine = new ArchaeoLine(ArchaeoLine::CurrentPlanetNone, 0.0); |
577 | + |
578 | + configDialog = new ArchaeoLinesDialog(); |
579 | + conf = StelApp::getInstance().getSettings(); |
580 | +} |
581 | + |
582 | +ArchaeoLines::~ArchaeoLines() |
583 | +{ |
584 | + delete equinoxLine; equinoxLine=NULL; |
585 | + delete northernSolsticeLine; northernSolsticeLine=NULL; |
586 | + delete southernSolsticeLine; southernSolsticeLine=NULL; |
587 | + delete northernCrossquarterLine; northernCrossquarterLine=NULL; |
588 | + delete southernCrossquarterLine; southernCrossquarterLine=NULL; |
589 | + delete northernMajorStandstillLine0; northernMajorStandstillLine0=NULL; |
590 | + delete northernMajorStandstillLine1; northernMajorStandstillLine1=NULL; |
591 | + delete northernMinorStandstillLine2; northernMinorStandstillLine2=NULL; |
592 | + delete northernMinorStandstillLine3; northernMinorStandstillLine3=NULL; |
593 | + delete southernMinorStandstillLine4; southernMinorStandstillLine4=NULL; |
594 | + delete southernMinorStandstillLine5; southernMinorStandstillLine5=NULL; |
595 | + delete southernMajorStandstillLine6; southernMajorStandstillLine6=NULL; |
596 | + delete southernMajorStandstillLine7; southernMajorStandstillLine7=NULL; |
597 | + delete zenithPassageLine; zenithPassageLine=NULL; |
598 | + delete nadirPassageLine; nadirPassageLine=NULL; |
599 | + delete selectedObjectLine; selectedObjectLine=NULL; |
600 | + delete currentSunLine; currentSunLine=NULL; |
601 | + delete currentMoonLine; currentMoonLine=NULL; |
602 | + delete currentPlanetLine; currentPlanetLine=NULL; |
603 | + |
604 | + delete configDialog; configDialog=NULL; |
605 | +} |
606 | + |
607 | +bool ArchaeoLines::configureGui(bool show) |
608 | +{ |
609 | + if (show) |
610 | + configDialog->setVisible(true); |
611 | + return true; |
612 | +} |
613 | + |
614 | +//! Determine which "layer" the plugin's drawing will happen on. |
615 | +double ArchaeoLines::getCallOrder(StelModuleActionName actionName) const |
616 | +{ |
617 | + if (actionName==StelModule::ActionDraw) |
618 | + return StelApp::getInstance().getModuleMgr().getModule("NebulaMgr")->getCallOrder(actionName)+10.; // same as lines from core (hint AW) |
619 | + return 0; |
620 | +} |
621 | + |
622 | +void ArchaeoLines::init() |
623 | +{ |
624 | + Q_ASSERT(equinoxLine); |
625 | + Q_ASSERT(northernSolsticeLine); |
626 | + Q_ASSERT(southernSolsticeLine); |
627 | + Q_ASSERT(northernCrossquarterLine); |
628 | + Q_ASSERT(southernCrossquarterLine); |
629 | + Q_ASSERT(northernMajorStandstillLine0); |
630 | + Q_ASSERT(northernMajorStandstillLine1); |
631 | + Q_ASSERT(northernMinorStandstillLine2); |
632 | + Q_ASSERT(northernMinorStandstillLine3); |
633 | + Q_ASSERT(southernMinorStandstillLine4); |
634 | + Q_ASSERT(southernMinorStandstillLine5); |
635 | + Q_ASSERT(southernMajorStandstillLine6); |
636 | + Q_ASSERT(southernMajorStandstillLine7); |
637 | + Q_ASSERT(zenithPassageLine); |
638 | + Q_ASSERT(nadirPassageLine); |
639 | + Q_ASSERT(selectedObjectLine); |
640 | + Q_ASSERT(currentSunLine); |
641 | + Q_ASSERT(currentMoonLine); |
642 | + Q_ASSERT(currentPlanetLine); |
643 | + |
644 | + if (!conf->childGroups().contains("ArchaeoLines")) |
645 | + restoreDefaultSettings(); |
646 | + |
647 | + loadSettings(); |
648 | + |
649 | + StelApp& app = StelApp::getInstance(); |
650 | + |
651 | + // Create action for enable/disable & hook up signals |
652 | + addAction("actionShow_Archaeo_Lines", N_("ArchaeoLines"), N_("ArchaeoLines"), "enabled", "Ctrl+U"); |
653 | + |
654 | + // Add a toolbar button |
655 | + try |
656 | + { |
657 | + StelGui* gui = dynamic_cast<StelGui*>(app.getGui()); |
658 | + if (gui!=NULL) |
659 | + { |
660 | + toolbarButton = new StelButton(NULL, |
661 | + QPixmap(":/archaeoLines/bt_archaeolines_on.png"), |
662 | + QPixmap(":/archaeoLines/bt_archaeolines_off.png"), |
663 | + QPixmap(":/graphicGui/glow32x32.png"), |
664 | + "actionShow_Archaeo_Lines"); |
665 | + gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup"); |
666 | + } |
667 | + } |
668 | + catch (std::runtime_error& e) |
669 | + { |
670 | + qWarning() << "WARNING: unable to create toolbar button for ArchaeoLines plugin: " << e.what(); |
671 | + } |
672 | +} |
673 | + |
674 | +void ArchaeoLines::update(double deltaTime) |
675 | +{ |
676 | + static SolarSystem *ssystem=GETSTELMODULE(SolarSystem); |
677 | + static const double lunarI=5.145396; // inclination of lunar orbit |
678 | + // compute min and max distance values for horizontal parallax. |
679 | + // Meeus, AstrAlg 98, p342. |
680 | + static const double meanDist=385000.56; // km earth-moon. |
681 | + static const double addedValues=20905.355+3699.111+2955.968+569.925+48.888+3.149+246.158+152.138+170.733+ |
682 | + 204.586+129.620+108.743+104.755+10.321+79.661+34.782+23.210+21.636+24.208+30.824+8.379+ |
683 | + 16.675+12.831+10.445+11.650+14.403+7.003+10.056+6.322+9.884; |
684 | + static const double minDist=meanDist-addedValues; |
685 | + static const double maxDist=meanDist+addedValues; |
686 | + static const double sinPiMin=6378.14/maxDist; |
687 | + static const double sinPiMax=6378.14/minDist; // maximal parallax at min. distance! |
688 | + static double eps; |
689 | + |
690 | + PlanetP planet=ssystem->getSun(); |
691 | + double dec_equ, ra_equ; |
692 | + StelUtils::rectToSphe(&ra_equ,&dec_equ,planet->getEquinoxEquatorialPos(core)); |
693 | + currentSunLine->setDeclination(dec_equ * 180.0/M_PI); |
694 | + planet=ssystem->getMoon(); |
695 | + StelUtils::rectToSphe(&ra_equ,&dec_equ,planet->getEquinoxEquatorialPos(core)); |
696 | + currentMoonLine->setDeclination(dec_equ * 180.0/M_PI); |
697 | + |
698 | + if (enumShowCurrentPlanet>ArchaeoLine::CurrentPlanetNone) |
699 | + { |
700 | + const char *planetStrings[]={"", "Mercury", "Venus", "Mars", "Jupiter", "Saturn"}; |
701 | + QString currentPlanet(planetStrings[enumShowCurrentPlanet - ArchaeoLine::CurrentPlanetNone]); |
702 | + planet=ssystem->searchByEnglishName(currentPlanet); |
703 | + Q_ASSERT(planet); |
704 | + StelUtils::rectToSphe(&ra_equ,&dec_equ,planet->getEquinoxEquatorialPos(core)); |
705 | + currentPlanetLine->setDeclination(dec_equ * 180.0/M_PI); |
706 | + } |
707 | + |
708 | + double newJD=core->getJDay(); |
709 | + if (fabs(newJD-lastJD) > 10.0) // enough to compute this every 10 days? |
710 | + { |
711 | + eps= ssystem->getEarth()->getRotObliquity(core->getJDay()) *180.0/M_PI; |
712 | + static const double invSqrt2=1.0/std::sqrt(2.0); |
713 | + northernSolsticeLine->setDeclination( eps); |
714 | + southernSolsticeLine->setDeclination(-eps); |
715 | + northernCrossquarterLine->setDeclination( eps*invSqrt2); |
716 | + southernCrossquarterLine->setDeclination(-eps*invSqrt2); |
717 | + lastJD=newJD; |
718 | + } |
719 | + StelLocation loc=core->getCurrentLocation(); |
720 | + |
721 | + // compute parallax correction with Meeus 40.6. First, find H from h=0, then add corrections. |
722 | + |
723 | + static const double b_over_a=0.99664719; |
724 | + double latRad=loc.latitude*M_PI/180.0; |
725 | + double u=std::atan(b_over_a*std::tan(latRad)); |
726 | + double rhoSinPhiP=b_over_a*std::sin(u)+loc.altitude/6378140.0*std::sin(latRad); |
727 | + double rhoCosPhiP= std::cos(u)+loc.altitude/6378140.0*std::cos(latRad); |
728 | + |
729 | + QVector<double> lunarDE(8), sinPi(8); |
730 | + lunarDE[0]=(eps+lunarI)*M_PI/180.0; // min_distance=max_parallax |
731 | + lunarDE[1]=(eps+lunarI)*M_PI/180.0; |
732 | + lunarDE[2]=(eps-lunarI)*M_PI/180.0; |
733 | + lunarDE[3]=(eps-lunarI)*M_PI/180.0; |
734 | + lunarDE[4]=(-eps+lunarI)*M_PI/180.0; |
735 | + lunarDE[5]=(-eps+lunarI)*M_PI/180.0; |
736 | + lunarDE[6]=(-eps-lunarI)*M_PI/180.0; |
737 | + lunarDE[7]=(-eps-lunarI)*M_PI/180.0; |
738 | + for (int i=0; i<8; i+=2){ |
739 | + sinPi[i]=sinPiMax; |
740 | + sinPi[i+1]=sinPiMin; |
741 | + } |
742 | + |
743 | + // In the following we compute parallax-corrected declinations of the setting moon for max and min distances. |
744 | + // odd indices for max_distance=min_parallax, even indices for min_distance=max_parallax. References are for Meeus AstrAlg 1998. |
745 | + QVector<double> cosHo(8), sinHo(8); // setting hour angles. |
746 | + for (int i=0; i<8; i++){ |
747 | + cosHo[i]=qMax(-1.0, qMin(1.0, -std::tan(latRad)*std::tan(lunarDE[i]))); |
748 | + sinHo[i]=std::sin(std::acos(cosHo[i])); |
749 | + } |
750 | + |
751 | + // 40.6 |
752 | + QVector<double> A(8), B(8), C(8), q(8), lunarDEtopo(8); |
753 | + for (int i=0; i<8; i++){ |
754 | + A[i]=std::cos(lunarDE[i])*sinHo[i]; |
755 | + B[i]=std::cos(lunarDE[i])*cosHo[i]-rhoCosPhiP*sinPi[i]; |
756 | + C[i]=std::sin(lunarDE[i])-rhoSinPhiP*sinPi[i]; |
757 | + q[i]=std::sqrt(A[i]*A[i]+B[i]*B[i]+C[i]*C[i]); |
758 | + lunarDEtopo[i]=std::asin(C[i]/q[i]); |
759 | + } |
760 | + northernMajorStandstillLine0->setDeclination(lunarDEtopo[0] *180.0/M_PI); |
761 | + northernMajorStandstillLine1->setDeclination(lunarDEtopo[1] *180.0/M_PI); |
762 | + northernMinorStandstillLine2->setDeclination(lunarDEtopo[2] *180.0/M_PI); |
763 | + northernMinorStandstillLine3->setDeclination(lunarDEtopo[3] *180.0/M_PI); |
764 | + southernMinorStandstillLine4->setDeclination(lunarDEtopo[4] *180.0/M_PI); |
765 | + southernMinorStandstillLine5->setDeclination(lunarDEtopo[5] *180.0/M_PI); |
766 | + southernMajorStandstillLine6->setDeclination(lunarDEtopo[6] *180.0/M_PI); |
767 | + southernMajorStandstillLine7->setDeclination(lunarDEtopo[7] *180.0/M_PI); |
768 | + |
769 | + zenithPassageLine->setDeclination(loc.latitude); |
770 | + nadirPassageLine->setDeclination(-loc.latitude); |
771 | + |
772 | + // Selected object? |
773 | + if (objMgr->getWasSelected()) |
774 | + { |
775 | + StelObjectP obj=objMgr->getSelectedObject().first(); |
776 | + StelUtils::rectToSphe(&ra_equ,&dec_equ,obj->getEquinoxEquatorialPos(core)); |
777 | + selectedObjectLine->setDeclination(dec_equ * 180.0/M_PI); |
778 | + selectedObjectLine->setLabel(obj->getNameI18n()); |
779 | + |
780 | + } |
781 | + |
782 | + // Updates for line brightness |
783 | + lineFader.update((int)(deltaTime*1000)); |
784 | + equinoxLine->update(deltaTime); |
785 | + northernSolsticeLine->update(deltaTime); |
786 | + southernSolsticeLine->update(deltaTime); |
787 | + northernCrossquarterLine->update(deltaTime); |
788 | + southernCrossquarterLine->update(deltaTime); |
789 | + northernMajorStandstillLine0->update(deltaTime); |
790 | + northernMajorStandstillLine1->update(deltaTime); |
791 | + northernMinorStandstillLine2->update(deltaTime); |
792 | + northernMinorStandstillLine3->update(deltaTime); |
793 | + southernMinorStandstillLine4->update(deltaTime); |
794 | + southernMinorStandstillLine5->update(deltaTime); |
795 | + southernMajorStandstillLine6->update(deltaTime); |
796 | + southernMajorStandstillLine7->update(deltaTime); |
797 | + zenithPassageLine->update(deltaTime); |
798 | + nadirPassageLine->update(deltaTime); |
799 | + selectedObjectLine->update(deltaTime); |
800 | + currentSunLine->update(deltaTime); |
801 | + currentMoonLine->update(deltaTime); |
802 | + currentPlanetLine->update(deltaTime); |
803 | + |
804 | + withDecimalDegree = StelApp::getInstance().getFlagShowDecimalDegrees();; |
805 | +} |
806 | + |
807 | + |
808 | +//! Draw any parts on the screen which are for our module |
809 | +void ArchaeoLines::draw(StelCore* core) |
810 | +{ |
811 | + equinoxLine->draw(core, lineFader.getInterstate()); |
812 | + northernSolsticeLine->draw(core, lineFader.getInterstate()); |
813 | + southernSolsticeLine->draw(core, lineFader.getInterstate()); |
814 | + northernCrossquarterLine->draw(core, lineFader.getInterstate()); |
815 | + southernCrossquarterLine->draw(core, lineFader.getInterstate()); |
816 | + northernMajorStandstillLine0->draw(core, lineFader.getInterstate()); |
817 | + northernMajorStandstillLine1->draw(core, lineFader.getInterstate()); |
818 | + northernMinorStandstillLine2->draw(core, lineFader.getInterstate()); |
819 | + northernMinorStandstillLine3->draw(core, lineFader.getInterstate()); |
820 | + southernMinorStandstillLine4->draw(core, lineFader.getInterstate()); |
821 | + southernMinorStandstillLine5->draw(core, lineFader.getInterstate()); |
822 | + southernMajorStandstillLine6->draw(core, lineFader.getInterstate()); |
823 | + southernMajorStandstillLine7->draw(core, lineFader.getInterstate()); |
824 | + zenithPassageLine->draw(core, lineFader.getInterstate()); |
825 | + nadirPassageLine->draw(core, lineFader.getInterstate()); |
826 | + if (objMgr->getWasSelected()) |
827 | + selectedObjectLine->draw(core, lineFader.getInterstate()); |
828 | + currentSunLine->draw(core, lineFader.getInterstate()); |
829 | + currentMoonLine->draw(core, lineFader.getInterstate()); |
830 | + if (enumShowCurrentPlanet>ArchaeoLine::CurrentPlanetNone) |
831 | + currentPlanetLine->draw(core, lineFader.getInterstate()); |
832 | +} |
833 | + |
834 | + |
835 | +void ArchaeoLines::enableArchaeoLines(bool b) |
836 | +{ |
837 | + flagShowArchaeoLines = b; |
838 | + lineFader = b; |
839 | +} |
840 | + |
841 | + |
842 | +//void ArchaeoLines::useDmsFormat(bool b) |
843 | +//{ |
844 | +// flagUseDmsFormat=b; |
845 | +// conf->setValue("ArchaeoLines/angle_format_dms", isDmsFormat()); |
846 | +//} |
847 | + |
848 | +void ArchaeoLines::restoreDefaultSettings() |
849 | +{ |
850 | + Q_ASSERT(conf); |
851 | + // Remove the old values... |
852 | + conf->remove("ArchaeoLines"); |
853 | + // ...load the default values... |
854 | + loadSettings(); |
855 | +} |
856 | + |
857 | +void ArchaeoLines::loadSettings() |
858 | +{ |
859 | + //useDmsFormat(conf->value("ArchaeoLines/angle_format_dms", false).toBool()); |
860 | + |
861 | + equinoxColor = StelUtils::strToVec3f(conf->value("ArchaeoLines/color_equinox", "1.00,1.00,0.5").toString()); |
862 | + equinoxLine->setColor(equinoxColor); |
863 | + solsticesColor = StelUtils::strToVec3f(conf->value("ArchaeoLines/color_solstices", "1.00,1.00,0.25").toString()); |
864 | + northernSolsticeLine->setColor(solsticesColor); |
865 | + southernSolsticeLine->setColor(solsticesColor); |
866 | + crossquartersColor = StelUtils::strToVec3f(conf->value("ArchaeoLines/color_crossquarters", "1.00,0.75,0.25").toString()); |
867 | + northernCrossquarterLine->setColor(crossquartersColor); |
868 | + southernCrossquarterLine->setColor(crossquartersColor); |
869 | + majorStandstillColor = StelUtils::strToVec3f(conf->value("ArchaeoLines/color_major_standstill", "0.25,1.00,0.25").toString()); |
870 | + northernMajorStandstillLine0->setColor(majorStandstillColor); |
871 | + northernMajorStandstillLine1->setColor(majorStandstillColor); |
872 | + southernMajorStandstillLine6->setColor(majorStandstillColor); |
873 | + southernMajorStandstillLine7->setColor(majorStandstillColor); |
874 | + minorStandstillColor = StelUtils::strToVec3f(conf->value("ArchaeoLines/color_minor_standstill", "0.20,0.75,0.20").toString()); |
875 | + northernMinorStandstillLine2->setColor(minorStandstillColor); |
876 | + northernMinorStandstillLine3->setColor(minorStandstillColor); |
877 | + southernMinorStandstillLine4->setColor(minorStandstillColor); |
878 | + southernMinorStandstillLine5->setColor(minorStandstillColor); |
879 | + zenithPassageColor = StelUtils::strToVec3f(conf->value("ArchaeoLines/color_zenith_passage", "1.00,0.75,0.75").toString()); |
880 | + zenithPassageLine->setColor(zenithPassageColor); |
881 | + nadirPassageColor = StelUtils::strToVec3f(conf->value("ArchaeoLines/color_nadir_passage", "1.00,0.75,0.75").toString()); |
882 | + nadirPassageLine->setColor(nadirPassageColor); |
883 | + selectedObjectColor = StelUtils::strToVec3f(conf->value("ArchaeoLines/color_selected_object", "1.00,1.00,1.00").toString()); |
884 | + selectedObjectLine->setColor(selectedObjectColor); |
885 | + currentSunColor = StelUtils::strToVec3f(conf->value("ArchaeoLines/color_current_sun", "1.00,1.00,0.75").toString()); |
886 | + currentSunLine->setColor(currentSunColor); |
887 | + currentMoonColor = StelUtils::strToVec3f(conf->value("ArchaeoLines/color_current_moon", "0.50,1.00,0.50").toString()); |
888 | + currentMoonLine->setColor(currentMoonColor); |
889 | + currentPlanetColor = StelUtils::strToVec3f(conf->value("ArchaeoLines/color_current_planet", "0.25,0.80,1.00").toString()); |
890 | + currentPlanetLine->setColor(currentPlanetColor); |
891 | + |
892 | + // 5 solar limits |
893 | + showEquinox(conf->value("ArchaeoLines/show_equinox", true).toBool()); |
894 | + showSolstices(conf->value("ArchaeoLines/show_solstices", true).toBool()); |
895 | + showCrossquarters(conf->value("ArchaeoLines/show_crossquarters", true).toBool()); |
896 | + // 4 lunar limits |
897 | + showMajorStandstills(conf->value("ArchaeoLines/show_major_standstills", true).toBool()); |
898 | + showMinorStandstills(conf->value("ArchaeoLines/show_minor_standstills", true).toBool()); |
899 | + // esp. Mesoamerica |
900 | + showZenithPassage(conf->value("ArchaeoLines/show_zenith_passage", true).toBool()); |
901 | + showNadirPassage(conf->value("ArchaeoLines/show_nadir_passage", true).toBool()); |
902 | + // indicator for a line representing currently selected object |
903 | + showSelectedObject(conf->value("ArchaeoLines/show_selected_object", false).toBool()); |
904 | + // indicators for current declinations (those move fast over days...) |
905 | + showCurrentSun(conf->value("ArchaeoLines/show_current_sun", true).toBool()); |
906 | + showCurrentMoon(conf->value("ArchaeoLines/show_current_moon", true).toBool()); |
907 | + showCurrentPlanet(conf->value("ArchaeoLines/show_current_planet", "none").toString()); |
908 | +} |
909 | + |
910 | +void ArchaeoLines::showEquinox(bool b) |
911 | +{ |
912 | + flagShowEquinox=b; |
913 | + conf->setValue("ArchaeoLines/show_equinox", isEquinoxDisplayed()); |
914 | + equinoxLine->setDisplayed(b); |
915 | +} |
916 | +void ArchaeoLines::showSolstices(bool b) |
917 | +{ |
918 | + flagShowSolstices=b; |
919 | + conf->setValue("ArchaeoLines/show_solstices", isSolsticesDisplayed()); |
920 | + northernSolsticeLine->setDisplayed(b); |
921 | + southernSolsticeLine->setDisplayed(b); |
922 | +} |
923 | +void ArchaeoLines::showCrossquarters(bool b) |
924 | +{ |
925 | + flagShowCrossquarters=b; |
926 | + conf->setValue("ArchaeoLines/show_crossquarters", isCrossquartersDisplayed()); |
927 | + northernCrossquarterLine->setDisplayed(b); |
928 | + southernCrossquarterLine->setDisplayed(b); |
929 | +} |
930 | +void ArchaeoLines::showMajorStandstills(bool b) |
931 | +{ |
932 | + flagShowMajorStandstills=b; |
933 | + conf->setValue("ArchaeoLines/show_major_standstills", isMajorStandstillsDisplayed()); |
934 | + northernMajorStandstillLine0->setDisplayed(b); |
935 | + northernMajorStandstillLine1->setDisplayed(b); |
936 | + southernMajorStandstillLine6->setDisplayed(b); |
937 | + southernMajorStandstillLine7->setDisplayed(b); |
938 | +} |
939 | +void ArchaeoLines::showMinorStandstills(bool b) |
940 | +{ |
941 | + flagShowMinorStandstills=b; |
942 | + conf->setValue("ArchaeoLines/show_minor_standstills", isMinorStandstillsDisplayed()); |
943 | + northernMinorStandstillLine2->setDisplayed(b); |
944 | + northernMinorStandstillLine3->setDisplayed(b); |
945 | + southernMinorStandstillLine4->setDisplayed(b); |
946 | + southernMinorStandstillLine5->setDisplayed(b); |
947 | +} |
948 | +void ArchaeoLines::showZenithPassage(bool b) |
949 | +{ |
950 | + flagShowZenithPassage=b; |
951 | + conf->setValue("ArchaeoLines/show_zenith_passage", isZenithPassageDisplayed()); |
952 | + zenithPassageLine->setDisplayed(b); |
953 | +} |
954 | +void ArchaeoLines::showNadirPassage(bool b) |
955 | +{ |
956 | + flagShowNadirPassage=b; |
957 | + conf->setValue("ArchaeoLines/show_nadir_passage", isNadirPassageDisplayed()); |
958 | + nadirPassageLine->setDisplayed(b); |
959 | +} |
960 | +void ArchaeoLines::showSelectedObject(bool b) |
961 | +{ |
962 | + flagShowSelectedObject=b; |
963 | + conf->setValue("ArchaeoLines/show_selected_object", isSelectedObjectDisplayed()); |
964 | + selectedObjectLine->setDisplayed(b); |
965 | +} |
966 | +void ArchaeoLines::showCurrentSun(bool b) |
967 | +{ |
968 | + flagShowCurrentSun=b; |
969 | + conf->setValue("ArchaeoLines/show_current_sun", isCurrentSunDisplayed()); |
970 | + currentSunLine->setDisplayed(b); |
971 | +} |
972 | +void ArchaeoLines::showCurrentMoon(bool b) |
973 | +{ |
974 | + flagShowCurrentMoon=b; |
975 | + conf->setValue("ArchaeoLines/show_current_moon", isCurrentMoonDisplayed()); |
976 | + currentMoonLine->setDisplayed(b); |
977 | +} |
978 | + |
979 | +void ArchaeoLines::showCurrentPlanet(ArchaeoLine::Line l) |
980 | +{ |
981 | + enumShowCurrentPlanet=l; |
982 | + const char *planetStrings[]={"none", "Mercury", "Venus", "Mars", "Jupiter", "Saturn"}; |
983 | + |
984 | + conf->setValue("ArchaeoLines/show_current_planet", planetStrings[l-ArchaeoLine::CurrentPlanetNone]); |
985 | + currentPlanetLine->setLineType(enumShowCurrentPlanet); |
986 | + currentPlanetLine->setDisplayed(enumShowCurrentPlanet != ArchaeoLine::CurrentPlanetNone); |
987 | +} |
988 | + |
989 | +void ArchaeoLines::showCurrentPlanet(QString planet) |
990 | +{ |
991 | + if (planet=="none") |
992 | + enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetNone; |
993 | + else if (planet=="Mercury") |
994 | + enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetMercury; |
995 | + else if (planet=="Venus") |
996 | + enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetVenus; |
997 | + else if (planet=="Mars") |
998 | + enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetMars; |
999 | + else if (planet=="Jupiter") |
1000 | + enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetJupiter; |
1001 | + else if (planet=="Saturn") |
1002 | + enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetSaturn; |
1003 | + else { |
1004 | + qWarning() << "ArchaeoLines: showCurrentPlanet: Invalid planet requested: " << planet; |
1005 | + enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetNone; |
1006 | + } |
1007 | + |
1008 | + conf->setValue("ArchaeoLines/show_current_planet", planet); |
1009 | + currentPlanetLine->setLineType(enumShowCurrentPlanet); |
1010 | + currentPlanetLine->setDisplayed(enumShowCurrentPlanet != ArchaeoLine::CurrentPlanetNone); |
1011 | +} |
1012 | + |
1013 | +// called by the dialog UI, converts QColor (0..255) to Stellarium's Vec3f float color. |
1014 | +void ArchaeoLines::setLineColor(ArchaeoLine::Line whichLine, QColor color) |
1015 | +{ |
1016 | + switch (whichLine){ |
1017 | + case ArchaeoLine::Equinox: |
1018 | + equinoxColor.set(color.redF(), color.greenF(), color.blueF()); |
1019 | + conf->setValue("ArchaeoLines/color_equinox", QString("%1,%2,%3").arg(equinoxColor.v[0]).arg(equinoxColor.v[1]).arg(equinoxColor.v[2])); |
1020 | + equinoxLine->setColor(equinoxColor); |
1021 | + break; |
1022 | + case ArchaeoLine::Solstices: |
1023 | + solsticesColor.set(color.redF(), color.greenF(), color.blueF()); |
1024 | + conf->setValue("ArchaeoLines/color_solstices", QString("%1,%2,%3").arg(solsticesColor.v[0]).arg(solsticesColor.v[1]).arg(solsticesColor.v[2])); |
1025 | + northernSolsticeLine->setColor(solsticesColor); |
1026 | + southernSolsticeLine->setColor(solsticesColor); |
1027 | + break; |
1028 | + case ArchaeoLine::Crossquarters: |
1029 | + crossquartersColor.set(color.redF(), color.greenF(), color.blueF()); |
1030 | + conf->setValue("ArchaeoLines/color_crossquarters", QString("%1,%2,%3").arg(crossquartersColor.v[0]).arg(crossquartersColor.v[1]).arg(crossquartersColor.v[2])); |
1031 | + northernCrossquarterLine->setColor(crossquartersColor); |
1032 | + southernCrossquarterLine->setColor(crossquartersColor); |
1033 | + break; |
1034 | + case ArchaeoLine::MajorStandstill: |
1035 | + majorStandstillColor.set(color.redF(), color.greenF(), color.blueF()); |
1036 | + conf->setValue("ArchaeoLines/color_major_standstill", QString("%1,%2,%3").arg(majorStandstillColor.v[0]).arg(majorStandstillColor.v[1]).arg(majorStandstillColor.v[2])); |
1037 | + northernMajorStandstillLine0->setColor(majorStandstillColor); |
1038 | + southernMajorStandstillLine7->setColor(majorStandstillColor); |
1039 | + northernMajorStandstillLine1->setColor(majorStandstillColor); |
1040 | + southernMajorStandstillLine6->setColor(majorStandstillColor); |
1041 | + break; |
1042 | + case ArchaeoLine::MinorStandstill: |
1043 | + minorStandstillColor.set(color.redF(), color.greenF(), color.blueF()); |
1044 | + conf->setValue("ArchaeoLines/color_minor_standstill", QString("%1,%2,%3").arg(minorStandstillColor.v[0]).arg(minorStandstillColor.v[1]).arg(minorStandstillColor.v[2])); |
1045 | + northernMinorStandstillLine2->setColor(minorStandstillColor); |
1046 | + southernMinorStandstillLine4->setColor(minorStandstillColor); |
1047 | + northernMinorStandstillLine3->setColor(minorStandstillColor); |
1048 | + southernMinorStandstillLine5->setColor(minorStandstillColor); |
1049 | + break; |
1050 | + case ArchaeoLine::ZenithPassage: |
1051 | + zenithPassageColor.set(color.redF(), color.greenF(), color.blueF()); |
1052 | + conf->setValue("ArchaeoLines/color_zenith_passage", QString("%1,%2,%3").arg(zenithPassageColor.v[0]).arg(zenithPassageColor.v[1]).arg(zenithPassageColor.v[2])); |
1053 | + zenithPassageLine->setColor(zenithPassageColor); |
1054 | + break; |
1055 | + case ArchaeoLine::NadirPassage: |
1056 | + nadirPassageColor.set(color.redF(), color.greenF(), color.blueF()); |
1057 | + conf->setValue("ArchaeoLines/color_nadir_passage", QString("%1,%2,%3").arg(nadirPassageColor.v[0]).arg(nadirPassageColor.v[1]).arg(nadirPassageColor.v[2])); |
1058 | + nadirPassageLine->setColor(nadirPassageColor); |
1059 | + break; |
1060 | + case ArchaeoLine::SelectedObject: |
1061 | + selectedObjectColor.set(color.redF(), color.greenF(), color.blueF()); |
1062 | + conf->setValue("ArchaeoLines/color_selected_object", QString("%1,%2,%3").arg(selectedObjectColor.v[0]).arg(selectedObjectColor.v[1]).arg(selectedObjectColor.v[2])); |
1063 | + selectedObjectLine->setColor(selectedObjectColor); |
1064 | + break; |
1065 | + case ArchaeoLine::CurrentSun: |
1066 | + currentSunColor.set(color.redF(), color.greenF(), color.blueF()); |
1067 | + conf->setValue("ArchaeoLines/color_current_sun", QString("%1,%2,%3").arg(currentSunColor.v[0]).arg(currentSunColor.v[1]).arg(currentSunColor.v[2])); |
1068 | + currentSunLine->setColor(currentSunColor); |
1069 | + break; |
1070 | + case ArchaeoLine::CurrentMoon: |
1071 | + currentMoonColor.set(color.redF(), color.greenF(), color.blueF()); |
1072 | + conf->setValue("ArchaeoLines/color_current_moon", QString("%1,%2,%3").arg(currentMoonColor.v[0]).arg(currentMoonColor.v[1]).arg(currentMoonColor.v[2])); |
1073 | + currentMoonLine->setColor(currentMoonColor); |
1074 | + break; |
1075 | + case ArchaeoLine::CurrentPlanetNone: |
1076 | + case ArchaeoLine::CurrentPlanetMercury: |
1077 | + case ArchaeoLine::CurrentPlanetVenus: |
1078 | + case ArchaeoLine::CurrentPlanetMars: |
1079 | + case ArchaeoLine::CurrentPlanetJupiter: |
1080 | + case ArchaeoLine::CurrentPlanetSaturn: |
1081 | + currentPlanetColor.set(color.redF(), color.greenF(), color.blueF()); |
1082 | + conf->setValue("ArchaeoLines/color_current_planet", QString("%1,%2,%3").arg(currentPlanetColor.v[0]).arg(currentPlanetColor.v[1]).arg(currentPlanetColor.v[2])); |
1083 | + currentPlanetLine->setColor(currentPlanetColor); |
1084 | + break; |
1085 | + default: |
1086 | + Q_ASSERT(0); |
1087 | + } |
1088 | +} |
1089 | + |
1090 | +// called by the dialog UI, converts Stellarium's Vec3f float color to QColor (0..255). |
1091 | +QColor ArchaeoLines::getLineColor(ArchaeoLine::Line whichLine) |
1092 | +{ |
1093 | + QColor color(0,0,0); |
1094 | + Vec3f* vColor; |
1095 | + switch (whichLine){ |
1096 | + case ArchaeoLine::Equinox: |
1097 | + vColor=&equinoxColor; |
1098 | + break; |
1099 | + case ArchaeoLine::Solstices: |
1100 | + vColor=&solsticesColor; |
1101 | + break; |
1102 | + case ArchaeoLine::Crossquarters: |
1103 | + vColor=&crossquartersColor; |
1104 | + break; |
1105 | + case ArchaeoLine::MajorStandstill: |
1106 | + vColor=&majorStandstillColor; |
1107 | + break; |
1108 | + case ArchaeoLine::MinorStandstill: |
1109 | + vColor=&minorStandstillColor; |
1110 | + break; |
1111 | + case ArchaeoLine::ZenithPassage: |
1112 | + vColor=&zenithPassageColor; |
1113 | + break; |
1114 | + case ArchaeoLine::NadirPassage: |
1115 | + vColor=&nadirPassageColor; |
1116 | + break; |
1117 | + case ArchaeoLine::SelectedObject: |
1118 | + vColor=&selectedObjectColor; |
1119 | + break; |
1120 | + case ArchaeoLine::CurrentSun: |
1121 | + vColor=¤tSunColor; |
1122 | + break; |
1123 | + case ArchaeoLine::CurrentMoon: |
1124 | + vColor=¤tMoonColor; |
1125 | + break; |
1126 | + case ArchaeoLine::CurrentPlanetNone: |
1127 | + case ArchaeoLine::CurrentPlanetMercury: |
1128 | + case ArchaeoLine::CurrentPlanetVenus: |
1129 | + case ArchaeoLine::CurrentPlanetMars: |
1130 | + case ArchaeoLine::CurrentPlanetJupiter: |
1131 | + case ArchaeoLine::CurrentPlanetSaturn: |
1132 | + vColor=¤tPlanetColor; |
1133 | + break; |
1134 | + default: |
1135 | + Q_ASSERT(0); |
1136 | + } |
1137 | + color.setRgbF(vColor->v[0], vColor->v[1], vColor->v[2]); |
1138 | + return color; |
1139 | +} |
1140 | + |
1141 | + |
1142 | +// callback stuff shamelessly taken from GridLinesMgr. Changes: Text MUST be filled, can also be empty for no label! |
1143 | +struct ALViewportEdgeIntersectCallbackData |
1144 | +{ |
1145 | + ALViewportEdgeIntersectCallbackData(StelPainter* p) |
1146 | + : sPainter(p) |
1147 | + {;} |
1148 | + StelPainter* sPainter; |
1149 | + //Vec4f textColor; |
1150 | + QString text; // Label to display at the intersection of the lines and screen side |
1151 | +}; |
1152 | + |
1153 | +// Callback which draws the label of the grid |
1154 | +void alViewportEdgeIntersectCallback(const Vec3d& screenPos, const Vec3d& direction, void* userData) |
1155 | +{ |
1156 | + // TODO: decide whether to use different color for labels. |
1157 | + // Currently label color is equal to line color, and provisions for changing that are commented away. |
1158 | + |
1159 | + ALViewportEdgeIntersectCallbackData* d = static_cast<ALViewportEdgeIntersectCallbackData*>(userData); |
1160 | + Vec3d direc(direction); |
1161 | + direc.normalize(); |
1162 | + //const Vec4f tmpColor = d->sPainter->getColor(); |
1163 | + //d->sPainter->setColor(d->textColor[0], d->textColor[1], d->textColor[2], d->textColor[3]); |
1164 | + |
1165 | + QString text = d->text; // original text-from-coordinates taken out! |
1166 | + if (text.isEmpty()) |
1167 | + return; |
1168 | + |
1169 | + double angleDeg = std::atan2(-direc[1], -direc[0])*180./M_PI; |
1170 | + float xshift=6.f; |
1171 | + if (angleDeg>90. || angleDeg<-90.) |
1172 | + { |
1173 | + angleDeg+=180.; |
1174 | + xshift=-d->sPainter->getFontMetrics().width(text)-6.f; |
1175 | + } |
1176 | + |
1177 | + d->sPainter->drawText(screenPos[0], screenPos[1], text, angleDeg, xshift, 3); |
1178 | + //d->sPainter->setColor(tmpColor[0], tmpColor[1], tmpColor[2], tmpColor[3]); // RESTORE |
1179 | +} |
1180 | + |
1181 | + |
1182 | +ArchaeoLine::ArchaeoLine(ArchaeoLine::Line lineType, double declination) : |
1183 | + lineType(lineType), declination(declination), color(0.f, 0.f, 1.f), frameType(StelCore::FrameEquinoxEqu), flagLabel(true) |
1184 | +{ |
1185 | + // Font size is 14 |
1186 | + font.setPixelSize(StelApp::getInstance().getBaseFontSize()+1); |
1187 | + updateLabel(); |
1188 | + fader.setDuration(1000); |
1189 | + // Initialize the message strings and make sure they are translated when the language changes. |
1190 | + StelApp& app = StelApp::getInstance(); |
1191 | + //updateLabel(); // WHY AGAIN?? |
1192 | + connect(&app, SIGNAL(languageChanged()), this, SLOT(updateLabel())); |
1193 | + |
1194 | +} |
1195 | + |
1196 | +void ArchaeoLine::updateLabel() |
1197 | +{ |
1198 | + //qDebug() << "ArchaeoLine::updateLabel(): lineType is " << lineType; |
1199 | + // TODO: decide whether showing declinations in addition. |
1200 | + switch (lineType) |
1201 | + { |
1202 | + case ArchaeoLine::Equinox: |
1203 | + label = q_("Equinox"); |
1204 | + break; |
1205 | + case ArchaeoLine::Solstices: |
1206 | + label = q_("Solstice"); |
1207 | + break; |
1208 | + case ArchaeoLine::Crossquarters: |
1209 | + label = q_("Crossquarter"); |
1210 | + break; |
1211 | + case ArchaeoLine::MajorStandstill: |
1212 | + label = q_("Major Lunar Standstill"); |
1213 | + break; |
1214 | + case ArchaeoLine::MinorStandstill: |
1215 | + label = q_("Minor Lunar Standstill"); |
1216 | + break; |
1217 | + case ArchaeoLine::ZenithPassage: |
1218 | + label = q_("Zenith Passage"); |
1219 | + break; |
1220 | + case ArchaeoLine::NadirPassage: |
1221 | + label = q_("Nadir Passage"); |
1222 | + break; |
1223 | + case ArchaeoLine::SelectedObject: |
1224 | + label = q_("Selected Object"); |
1225 | + break; |
1226 | + case ArchaeoLine::CurrentSun: |
1227 | + label = q_("Sun"); |
1228 | + break; |
1229 | + case ArchaeoLine::CurrentMoon: |
1230 | + label = q_("Moon"); |
1231 | + break; |
1232 | + case ArchaeoLine::CurrentPlanetNone: |
1233 | + label = q_("error if you can read this"); |
1234 | + break; |
1235 | + case ArchaeoLine::CurrentPlanetMercury: |
1236 | + label = q_("Mercury"); |
1237 | + break; |
1238 | + case ArchaeoLine::CurrentPlanetVenus: |
1239 | + label = q_("Venus"); |
1240 | + break; |
1241 | + case ArchaeoLine::CurrentPlanetMars: |
1242 | + label = q_("Mars"); |
1243 | + break; |
1244 | + case ArchaeoLine::CurrentPlanetJupiter: |
1245 | + label = q_("Jupiter"); |
1246 | + break; |
1247 | + case ArchaeoLine::CurrentPlanetSaturn: |
1248 | + label = q_("Saturn"); |
1249 | + break; |
1250 | + default: |
1251 | + Q_ASSERT(0); |
1252 | + } |
1253 | +} |
1254 | + |
1255 | + |
1256 | +void ArchaeoLine::draw(StelCore *core, float intensity) const |
1257 | +{ |
1258 | + // borrowed largely from GridLinesMgr. |
1259 | + if (intensity*fader.getInterstate() < 0.000001f) |
1260 | + return; |
1261 | + |
1262 | + |
1263 | + StelProjectorP prj = core->getProjection(frameType, StelCore::RefractionAuto); |
1264 | + |
1265 | + // Get the bounding halfspace |
1266 | + const SphericalCap& viewPortSphericalCap = prj->getBoundingCap(); |
1267 | + |
1268 | + // Initialize a painter and set OpenGL state |
1269 | + StelPainter sPainter(prj); |
1270 | + sPainter.setColor(color[0], color[1], color[2], intensity*fader.getInterstate()); |
1271 | + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode |
1272 | + glDisable(GL_TEXTURE_2D); |
1273 | + glEnable(GL_BLEND); |
1274 | + |
1275 | + // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH |
1276 | + #ifdef GL_LINE_SMOOTH |
1277 | + if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL) |
1278 | + glEnable(GL_LINE_SMOOTH); |
1279 | + #endif |
1280 | + |
1281 | + //Vec4f textColor(color[0], color[1], color[2], intensity*fader.getInterstate()); |
1282 | + |
1283 | + ALViewportEdgeIntersectCallbackData userData(&sPainter); |
1284 | + sPainter.setFont(font); |
1285 | + //userData.textColor = textColor; |
1286 | + userData.text = (isLabelVisible() ? label : ""); |
1287 | + ///////////////////////////////////////////////// |
1288 | + // Draw the line |
1289 | + const double lat=declination*M_PI/180.0; |
1290 | + SphericalCap declinationCap(Vec3d(0,0,1), std::sin(lat)); |
1291 | + const Vec3d rotCenter(0,0,declinationCap.d); |
1292 | + |
1293 | + Vec3d p1, p2; |
1294 | + if (!SphericalCap::intersectionPoints(viewPortSphericalCap, declinationCap, p1, p2)) |
1295 | + { |
1296 | + if ((viewPortSphericalCap.d<declinationCap.d && viewPortSphericalCap.contains(declinationCap.n)) |
1297 | + || (viewPortSphericalCap.d<-declinationCap.d && viewPortSphericalCap.contains(-declinationCap.n))) |
1298 | + { |
1299 | + // The line is fully included in the viewport, draw it in 3 sub-arcs to avoid length > 180. |
1300 | + Vec3d pt1; |
1301 | + Vec3d pt2; |
1302 | + Vec3d pt3; |
1303 | + const double lon1=0.0; |
1304 | + const double lon2=120.0*M_PI/180.0; |
1305 | + const double lon3=240.0*M_PI/180.0; |
1306 | + StelUtils::spheToRect(lon1, lat, pt1); pt1.normalize(); |
1307 | + StelUtils::spheToRect(lon2, lat, pt2); pt2.normalize(); |
1308 | + StelUtils::spheToRect(lon3, lat, pt3); pt3.normalize(); |
1309 | + |
1310 | + sPainter.drawSmallCircleArc(pt1, pt2, rotCenter, alViewportEdgeIntersectCallback, &userData); |
1311 | + sPainter.drawSmallCircleArc(pt2, pt3, rotCenter, alViewportEdgeIntersectCallback, &userData); |
1312 | + sPainter.drawSmallCircleArc(pt3, pt1, rotCenter, alViewportEdgeIntersectCallback, &userData); |
1313 | + #ifdef GL_LINE_SMOOTH |
1314 | + if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL) |
1315 | + glDisable(GL_LINE_SMOOTH); |
1316 | + #endif |
1317 | + glDisable(GL_BLEND); |
1318 | + return; |
1319 | + } |
1320 | + else |
1321 | + { |
1322 | + #ifdef GL_LINE_SMOOTH |
1323 | + if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL) |
1324 | + glDisable(GL_LINE_SMOOTH); |
1325 | + #endif |
1326 | + glDisable(GL_BLEND); |
1327 | + return; |
1328 | + } |
1329 | + } |
1330 | + // Draw the arc in 2 sub-arcs to avoid lengths > 180 deg |
1331 | + Vec3d middlePoint = p1-rotCenter+p2-rotCenter; |
1332 | + middlePoint.normalize(); |
1333 | + middlePoint*=(p1-rotCenter).length(); |
1334 | + middlePoint+=rotCenter; |
1335 | + if (!viewPortSphericalCap.contains(middlePoint)) |
1336 | + { |
1337 | + middlePoint-=rotCenter; |
1338 | + middlePoint*=-1.; |
1339 | + middlePoint+=rotCenter; |
1340 | + } |
1341 | + |
1342 | + sPainter.drawSmallCircleArc(p1, middlePoint, rotCenter,alViewportEdgeIntersectCallback, &userData); |
1343 | + sPainter.drawSmallCircleArc(p2, middlePoint, rotCenter, alViewportEdgeIntersectCallback, &userData); |
1344 | + |
1345 | + // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH |
1346 | + #ifdef GL_LINE_SMOOTH |
1347 | + if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL) |
1348 | + glDisable(GL_LINE_SMOOTH); |
1349 | + #endif |
1350 | + |
1351 | + glDisable(GL_BLEND); |
1352 | +} |
1353 | |
1354 | === added file 'plugins/ArchaeoLines/src/ArchaeoLines.hpp' |
1355 | --- plugins/ArchaeoLines/src/ArchaeoLines.hpp 1970-01-01 00:00:00 +0000 |
1356 | +++ plugins/ArchaeoLines/src/ArchaeoLines.hpp 2015-04-09 09:33:54 +0000 |
1357 | @@ -0,0 +1,300 @@ |
1358 | +/* |
1359 | + * Copyright (C) 2014 Georg Zotti |
1360 | + * |
1361 | + * This program is free software; you can redistribute it and/or |
1362 | + * modify it under the terms of the GNU General Public License |
1363 | + * as published by the Free Software Foundation; either version 2 |
1364 | + * of the License, or (at your option) any later version. |
1365 | + * |
1366 | + * This program is distributed in the hope that it will be useful, |
1367 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1368 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1369 | + * GNU General Public License for more details. |
1370 | + * |
1371 | + * You should have received a copy of the GNU General Public License |
1372 | + * along with this program; if not, write to the Free Software |
1373 | + * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. |
1374 | + */ |
1375 | + |
1376 | +#ifndef ARCHAEOLINES_HPP_ |
1377 | +#define ARCHAEOLINES_HPP_ |
1378 | + |
1379 | +#include <QFont> |
1380 | +#include <QColor> |
1381 | +#include <QKeyEvent> |
1382 | +#include "VecMath.hpp" |
1383 | +#include "StelModule.hpp" |
1384 | +#include "StelFader.hpp" |
1385 | +#include "StelCore.hpp" |
1386 | +#include "StelObjectMgr.hpp" |
1387 | + |
1388 | +class QTimer; |
1389 | +class QPixmap; |
1390 | +class StelButton; |
1391 | +class ArchaeoLinesDialog; |
1392 | +class ArchaeoLine; |
1393 | + |
1394 | + |
1395 | +//! @class ArchaeoLine |
1396 | +//! Class which manages a line (small circle) to display around the sky like the solstices line. |
1397 | +//! Modelled after @class SkyLine found in GridLinesMgr.cpp at V0.13.2, but with small-circle drawing. |
1398 | +class ArchaeoLine : QObject |
1399 | +{ |
1400 | + Q_OBJECT |
1401 | + Q_PROPERTY(Vec3f color READ getColor WRITE setColor) |
1402 | + Q_PROPERTY(bool flagLabel READ isLabelVisible WRITE setLabelVisible) |
1403 | +public: |
1404 | + enum Line { |
1405 | + Equinox, |
1406 | + Solstices, |
1407 | + Crossquarters, |
1408 | + MajorStandstill, |
1409 | + MinorStandstill, |
1410 | + ZenithPassage, |
1411 | + NadirPassage, |
1412 | + SelectedObject, |
1413 | + CurrentSun, |
1414 | + CurrentMoon, |
1415 | + CurrentPlanetNone, // actually a placeholder for counting/testing. By itself it makes no sense, i.e. deactivates the planet line |
1416 | + CurrentPlanetMercury, |
1417 | + CurrentPlanetVenus, |
1418 | + CurrentPlanetMars, |
1419 | + CurrentPlanetJupiter, |
1420 | + CurrentPlanetSaturn |
1421 | + }; |
1422 | + |
1423 | + ArchaeoLine(ArchaeoLine::Line lineType, double declination); |
1424 | + virtual ~ArchaeoLine(){} |
1425 | + void draw(StelCore* core, float intensity=1.0f) const; |
1426 | + const Vec3f& getColor() const {return color;} |
1427 | + bool isDisplayed(void) const {return fader;} |
1428 | + |
1429 | +public slots: |
1430 | + void setColor(const Vec3f& c) {color = c;} |
1431 | + void update(double deltaTime) {fader.update((int)(deltaTime*1000));} |
1432 | + void setFadeDuration(float duration) {fader.setDuration((int)(duration*1000.f));} |
1433 | + void setDisplayed(const bool displayed){fader = displayed;} |
1434 | + void setFontSize(double newSize){font.setPixelSize(newSize);} |
1435 | + //! Re-translates the label. |
1436 | + void updateLabel(); |
1437 | + void setLabelVisible(bool b){flagLabel=b;} |
1438 | + //! reset declination (degrees) of this small arc. |
1439 | + void setDeclination(double decl){declination=decl;} |
1440 | + bool isLabelVisible() const{return flagLabel;} |
1441 | + void setLineType(ArchaeoLine::Line line) {lineType=line; updateLabel();} // Meaningful only for CurrentPlanet... types |
1442 | + //! change label. Used only for selected-object line - the other labels should not be changed! |
1443 | + void setLabel(const QString newLabel){label=newLabel;} |
1444 | + |
1445 | +private: |
1446 | + ArchaeoLine::Line lineType; |
1447 | + double declination; // degrees |
1448 | + Vec3f color; |
1449 | + StelCore::FrameType frameType; |
1450 | + bool flagLabel; //! show the label. (some should be permanently silent) |
1451 | + QString label; |
1452 | + LinearFader fader; |
1453 | + QFont font; |
1454 | +}; |
1455 | + |
1456 | +//! Main class of the ArchaeoLines plug-in. |
1457 | +//! Provides an on-screen visualisation of several small circles relevant mainly to archaeoastronomy. |
1458 | +//! GZ 2014-12 |
1459 | +class ArchaeoLines : public StelModule |
1460 | +{ |
1461 | + Q_OBJECT |
1462 | + Q_PROPERTY(bool enabled |
1463 | + READ isEnabled |
1464 | + WRITE enableArchaeoLines) |
1465 | +// Q_PROPERTY(bool dmsFormat |
1466 | +// READ isDmsFormat |
1467 | +// WRITE useDmsFormat) |
1468 | + Q_PROPERTY(bool flagShowEquinox |
1469 | + READ isEquinoxDisplayed |
1470 | + WRITE showEquinox) |
1471 | + Q_PROPERTY(bool flagShowSolstices |
1472 | + READ isSolsticesDisplayed |
1473 | + WRITE showSolstices) |
1474 | + Q_PROPERTY(bool flagShowCrossquarters |
1475 | + READ isCrossquartersDisplayed |
1476 | + WRITE showCrossquarters) |
1477 | + Q_PROPERTY(bool flagShowMajorStandstills |
1478 | + READ isMajorStandstillsDisplayed |
1479 | + WRITE showMajorStandstills) |
1480 | + Q_PROPERTY(bool flagShowMinorStandstills |
1481 | + READ isMinorStandstillsDisplayed |
1482 | + WRITE showMinorStandstills) |
1483 | + Q_PROPERTY(bool flagShowZenithPassage |
1484 | + READ isZenithPassageDisplayed |
1485 | + WRITE showZenithPassage) |
1486 | + Q_PROPERTY(bool flagShowNadirPassage |
1487 | + READ isNadirPassageDisplayed |
1488 | + WRITE showNadirPassage) |
1489 | + Q_PROPERTY(bool flagShowSelectedObject |
1490 | + READ isSelectedObjectDisplayed |
1491 | + WRITE showSelectedObject) |
1492 | + Q_PROPERTY(bool flagShowCurrentSun |
1493 | + READ isCurrentSunDisplayed |
1494 | + WRITE showCurrentSun) |
1495 | + Q_PROPERTY(bool flagShowCurrentMoon |
1496 | + READ isCurrentMoonDisplayed |
1497 | + WRITE showCurrentMoon) |
1498 | + Q_PROPERTY(ArchaeoLine::Line enumShowCurrentPlanet |
1499 | + READ whichCurrentPlanetDisplayed |
1500 | + WRITE showCurrentPlanet) |
1501 | + |
1502 | +public: |
1503 | + ArchaeoLines(); |
1504 | + virtual ~ArchaeoLines(); |
1505 | + |
1506 | + |
1507 | + |
1508 | + /////////////////////////////////////////////////////////////////////////// |
1509 | + // Methods defined in the StelModule class |
1510 | + virtual void init(); |
1511 | + virtual void update(double deltaTime); |
1512 | + virtual void draw(StelCore* core); |
1513 | + virtual double getCallOrder(StelModuleActionName actionName) const; |
1514 | + virtual void handleKeys(class QKeyEvent* event){event->setAccepted(false);} |
1515 | + virtual bool configureGui(bool show=true); |
1516 | + bool isEnabled() const {return flagShowArchaeoLines;} |
1517 | + bool isDmsFormat() const { return flagUseDmsFormat; } // NOT SURE IF USEFUL |
1518 | + bool isEquinoxDisplayed() const {return flagShowEquinox;} |
1519 | + bool isSolsticesDisplayed() const {return flagShowSolstices;} |
1520 | + bool isCrossquartersDisplayed() const {return flagShowCrossquarters;} |
1521 | + bool isMajorStandstillsDisplayed() const {return flagShowMajorStandstills;} |
1522 | + bool isMinorStandstillsDisplayed() const {return flagShowMinorStandstills;} |
1523 | + bool isZenithPassageDisplayed() const {return flagShowZenithPassage;} |
1524 | + bool isNadirPassageDisplayed() const {return flagShowNadirPassage;} |
1525 | + bool isSelectedObjectDisplayed() const {return flagShowSelectedObject;} |
1526 | + bool isCurrentSunDisplayed() const {return flagShowCurrentSun;} |
1527 | + bool isCurrentMoonDisplayed() const {return flagShowCurrentMoon;} |
1528 | + ArchaeoLine::Line whichCurrentPlanetDisplayed() const {return enumShowCurrentPlanet;} |
1529 | + |
1530 | + //! Restore the plug-in's settings to the default state. |
1531 | + //! Replace the plug-in's settings in Stellarium's configuration file |
1532 | + //! with the default values and re-load them. |
1533 | + //! Uses internally loadSettings(). |
1534 | + void restoreDefaultSettings(); |
1535 | + |
1536 | + //! Load the plug-in's settings from the configuration file. |
1537 | + //! Settings are kept in the "ArchaeoLines" section in Stellarium's |
1538 | + //! configuration file. If no such section exists, it will load default |
1539 | + //! values. |
1540 | + //! @see restoreDefaultSettings() |
1541 | + void loadSettings(); |
1542 | + |
1543 | + |
1544 | +public slots: |
1545 | + void enableArchaeoLines(bool b); |
1546 | + //void useDmsFormat(bool b); |
1547 | + |
1548 | + void showEquinox(bool b); |
1549 | + void showSolstices(bool b); |
1550 | + void showCrossquarters(bool b); |
1551 | + void showMajorStandstills(bool b); |
1552 | + void showMinorStandstills(bool b); |
1553 | + void showZenithPassage(bool b); |
1554 | + void showNadirPassage(bool b); |
1555 | + void showSelectedObject(bool b); |
1556 | + void showCurrentSun(bool b); |
1557 | + void showCurrentMoon(bool b); |
1558 | + void showCurrentPlanet(ArchaeoLine::Line l); // Allowed values for l: CurrentPlanetNone...CurrentPlanetSaturn. |
1559 | + void showCurrentPlanet(QString planet); // Allowed values for planet: "none", "Mercury", "Venus", "Mars", "Jupiter", "Saturn". |
1560 | + |
1561 | + // called by the dialog GUI, converts GUI's QColor (0..255) to Stellarium's Vec3f float color. |
1562 | + void setLineColor(ArchaeoLine::Line whichLine, QColor color); |
1563 | + // called by the dialog UI, converts Stellarium's Vec3f float color to QColor (0..255). |
1564 | + QColor getLineColor(ArchaeoLine::Line whichLine); |
1565 | + |
1566 | +private: |
1567 | + QFont font; |
1568 | + bool flagShowArchaeoLines; |
1569 | + bool withDecimalDegree; |
1570 | + bool flagUseDmsFormat; |
1571 | + LinearFader lineFader; |
1572 | + |
1573 | + Vec3f equinoxColor; |
1574 | + Vec3f solsticesColor; |
1575 | + Vec3f crossquartersColor; |
1576 | + Vec3f majorStandstillColor; |
1577 | + Vec3f minorStandstillColor; |
1578 | + Vec3f zenithPassageColor; |
1579 | + Vec3f nadirPassageColor; |
1580 | + Vec3f selectedObjectColor; |
1581 | + Vec3f currentSunColor; |
1582 | + Vec3f currentMoonColor; |
1583 | + Vec3f currentPlanetColor; |
1584 | + |
1585 | + |
1586 | + |
1587 | + bool flagShowEquinox; |
1588 | + bool flagShowSolstices; |
1589 | + bool flagShowCrossquarters; |
1590 | + bool flagShowMajorStandstills; |
1591 | + bool flagShowMinorStandstills; |
1592 | + bool flagShowZenithPassage; |
1593 | + bool flagShowNadirPassage; |
1594 | + bool flagShowSelectedObject; |
1595 | + bool flagShowCurrentSun; |
1596 | + bool flagShowCurrentMoon; |
1597 | + ArchaeoLine::Line enumShowCurrentPlanet; |
1598 | + // These should go into ArchaeoLine single-line class! |
1599 | + double lastJD; // cache last-time-computed to 1/month or so? |
1600 | + |
1601 | + ArchaeoLine * equinoxLine; |
1602 | + ArchaeoLine * northernSolsticeLine; |
1603 | + ArchaeoLine * southernSolsticeLine; |
1604 | + ArchaeoLine * northernCrossquarterLine; |
1605 | + ArchaeoLine * southernCrossquarterLine; |
1606 | + ArchaeoLine * northernMajorStandstillLine0; |
1607 | + ArchaeoLine * northernMajorStandstillLine1; |
1608 | + ArchaeoLine * northernMinorStandstillLine2; |
1609 | + ArchaeoLine * northernMinorStandstillLine3; |
1610 | + ArchaeoLine * southernMinorStandstillLine4; |
1611 | + ArchaeoLine * southernMinorStandstillLine5; |
1612 | + ArchaeoLine * southernMajorStandstillLine6; |
1613 | + ArchaeoLine * southernMajorStandstillLine7; |
1614 | + ArchaeoLine * zenithPassageLine; |
1615 | + ArchaeoLine * nadirPassageLine; |
1616 | + ArchaeoLine * selectedObjectLine; |
1617 | + ArchaeoLine * currentSunLine; |
1618 | + ArchaeoLine * currentMoonLine; |
1619 | + ArchaeoLine * currentPlanetLine; |
1620 | + |
1621 | + StelButton* toolbarButton; |
1622 | + |
1623 | + // draw one arc. |
1624 | + //! @param core the StelCore object |
1625 | + //! @param declination of the small circle |
1626 | + //! @param frameType usually StelCore::FrameEquinoxEqu |
1627 | + //! @param refractionMode usually StelCore::RefractionAuto |
1628 | + //! @param txtColor color used for any text printed regarding this line |
1629 | + //! @param lineColor color used for this line |
1630 | +// void drawOne(StelCore *core, const float declination, const StelCore::FrameType frameType, const StelCore::RefractionMode refractionMode, const Vec3f txtColor, const Vec3f lineColor); |
1631 | + |
1632 | + QSettings* conf; |
1633 | + |
1634 | + // GUI |
1635 | + ArchaeoLinesDialog* configDialog; |
1636 | + StelCore* core; // used quite often, better keep a reference... |
1637 | + StelObjectMgr* objMgr; |
1638 | +}; |
1639 | + |
1640 | + |
1641 | + |
1642 | +#include <QObject> |
1643 | +#include "StelPluginInterface.hpp" |
1644 | + |
1645 | +//! This class is used by Qt to manage a plug-in interface |
1646 | +class ArchaeoLinesStelPluginInterface : public QObject, public StelPluginInterface |
1647 | +{ |
1648 | + Q_OBJECT |
1649 | + Q_PLUGIN_METADATA(IID StelPluginInterface_iid) |
1650 | + Q_INTERFACES(StelPluginInterface) |
1651 | +public: |
1652 | + virtual StelModule* getStelModule() const; |
1653 | + virtual StelPluginInfo getPluginInfo() const; |
1654 | +}; |
1655 | + |
1656 | +#endif /*ARCHAEOLINES_HPP_*/ |
1657 | + |
1658 | |
1659 | === added file 'plugins/ArchaeoLines/src/CMakeLists.txt' |
1660 | --- plugins/ArchaeoLines/src/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
1661 | +++ plugins/ArchaeoLines/src/CMakeLists.txt 2015-04-09 09:33:54 +0000 |
1662 | @@ -0,0 +1,29 @@ |
1663 | +INCLUDE_DIRECTORIES(. gui) |
1664 | +LINK_DIRECTORIES(${BUILD_DIR}/src) |
1665 | + |
1666 | +SET(ArchaeoLines_SRCS |
1667 | + ArchaeoLines.hpp |
1668 | + ArchaeoLines.cpp |
1669 | + gui/ArchaeoLinesDialog.hpp |
1670 | + gui/ArchaeoLinesDialog.cpp |
1671 | +) |
1672 | + |
1673 | +SET(ArchaeoLines_UIS |
1674 | + gui/archaeoLinesDialog.ui |
1675 | +) |
1676 | + |
1677 | +QT5_WRAP_UI(ArchaeoLines_UIS_H ${ArchaeoLines_UIS}) |
1678 | + |
1679 | +################# compiles resources files ############ |
1680 | +SET(ArchaeoLines_RES ../ArchaeoLines.qrc) |
1681 | +QT5_ADD_RESOURCES(ArchaeoLines_RES_CXX ${ArchaeoLines_RES}) |
1682 | + |
1683 | +SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) |
1684 | + |
1685 | +ADD_LIBRARY(ArchaeoLines-static STATIC ${ArchaeoLines_SRCS} ${ArchaeoLines_RES_CXX} ${ArchaeoLines_UIS_H}) |
1686 | +QT5_USE_MODULES(ArchaeoLines-static Core Network Widgets Declarative) |
1687 | +# The library target "ArchaeoLines-static" has a default OUTPUT_NAME of "ArchaeoLines-static", so change it. |
1688 | +SET_TARGET_PROPERTIES(ArchaeoLines-static PROPERTIES OUTPUT_NAME "ArchaeoLines") |
1689 | +TARGET_LINK_LIBRARIES(ArchaeoLines-static ${extLinkerOption}) |
1690 | +SET_TARGET_PROPERTIES(ArchaeoLines-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
1691 | +ADD_DEPENDENCIES(AllStaticPlugins ArchaeoLines-static) |
1692 | |
1693 | === added directory 'plugins/ArchaeoLines/src/gui' |
1694 | === added file 'plugins/ArchaeoLines/src/gui/ArchaeoLinesDialog.cpp' |
1695 | --- plugins/ArchaeoLines/src/gui/ArchaeoLinesDialog.cpp 1970-01-01 00:00:00 +0000 |
1696 | +++ plugins/ArchaeoLines/src/gui/ArchaeoLinesDialog.cpp 2015-04-09 09:33:54 +0000 |
1697 | @@ -0,0 +1,421 @@ |
1698 | +/* |
1699 | + * ArchaeoLines plug-in for Stellarium |
1700 | + * |
1701 | + * Copyright (C) 2014 Georg Zotti |
1702 | + * |
1703 | + * This program is free software; you can redistribute it and/or |
1704 | + * modify it under the terms of the GNU General Public License |
1705 | + * as published by the Free Software Foundation; either version 2 |
1706 | + * of the License, or (at your option) any later version. |
1707 | + * |
1708 | + * This program is distributed in the hope that it will be useful, |
1709 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1710 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1711 | + * GNU General Public License for more details. |
1712 | + * |
1713 | + * You should have received a copy of the GNU General Public License |
1714 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1715 | + */ |
1716 | + |
1717 | +#include "ArchaeoLines.hpp" |
1718 | +#include "ArchaeoLinesDialog.hpp" |
1719 | +#include "ui_archaeoLinesDialog.h" |
1720 | + |
1721 | +#include "StelApp.hpp" |
1722 | +#include "StelLocaleMgr.hpp" |
1723 | +#include "StelModule.hpp" |
1724 | +#include "StelModuleMgr.hpp" |
1725 | +#include "StelMainView.hpp" |
1726 | + |
1727 | +ArchaeoLinesDialog::ArchaeoLinesDialog() |
1728 | + : al(NULL) |
1729 | +{ |
1730 | + ui = new Ui_archaeoLinesDialog(); |
1731 | + //colorDialog = new QColorDialog(NULL); |
1732 | +} |
1733 | + |
1734 | +ArchaeoLinesDialog::~ArchaeoLinesDialog() |
1735 | +{ |
1736 | + //delete colorDialog; colorDialog=NULL; |
1737 | + delete ui; ui=NULL; |
1738 | +} |
1739 | + |
1740 | +void ArchaeoLinesDialog::retranslate() |
1741 | +{ |
1742 | + if (dialog) |
1743 | + { |
1744 | + ui->retranslateUi(dialog); |
1745 | + setAboutHtml(); |
1746 | + } |
1747 | +} |
1748 | + |
1749 | +void ArchaeoLinesDialog::createDialogContent() |
1750 | +{ |
1751 | + al = GETSTELMODULE(ArchaeoLines); |
1752 | + ui->setupUi(dialog); |
1753 | + |
1754 | +#ifdef Q_OS_WIN |
1755 | + //Kinetic scrolling for tablet pc and pc |
1756 | + QList<QWidget *> addscroll; |
1757 | + addscroll << ui->aboutTextBrowser; |
1758 | + installKineticScrolling(addscroll); |
1759 | +#endif |
1760 | + |
1761 | + connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); |
1762 | + connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); |
1763 | + |
1764 | + //ui->useDmsFormatCheckBox->setChecked(al->isDmsFormat()); |
1765 | + //connect(ui->useDmsFormatCheckBox, SIGNAL(toggled(bool)), al, SLOT(useDmsFormat(bool))); |
1766 | + |
1767 | + ui->equinoxCheckBox->setChecked(al->isEquinoxDisplayed()); |
1768 | + connect(ui->equinoxCheckBox, SIGNAL(toggled(bool)), al, SLOT(showEquinox(bool))); |
1769 | + ui->solsticesCheckBox->setChecked(al->isSolsticesDisplayed()); |
1770 | + connect(ui->solsticesCheckBox, SIGNAL(toggled(bool)), al, SLOT(showSolstices(bool))); |
1771 | + ui->crossquarterCheckBox->setChecked(al->isCrossquartersDisplayed()); |
1772 | + connect(ui->crossquarterCheckBox, SIGNAL(toggled(bool)), al, SLOT(showCrossquarters(bool))); |
1773 | + ui->majorStandstillCheckBox->setChecked(al->isMajorStandstillsDisplayed()); |
1774 | + connect(ui->majorStandstillCheckBox, SIGNAL(toggled(bool)), al, SLOT(showMajorStandstills(bool))); |
1775 | + ui->minorStandstillCheckBox->setChecked(al->isMinorStandstillsDisplayed()); |
1776 | + connect(ui->minorStandstillCheckBox, SIGNAL(toggled(bool)), al, SLOT(showMinorStandstills(bool))); |
1777 | + ui->zenithPassageCheckBox->setChecked(al->isZenithPassageDisplayed()); |
1778 | + connect(ui->zenithPassageCheckBox, SIGNAL(toggled(bool)), al, SLOT(showZenithPassage(bool))); |
1779 | + ui->nadirPassageCheckBox->setChecked(al->isNadirPassageDisplayed()); |
1780 | + connect(ui->nadirPassageCheckBox, SIGNAL(toggled(bool)), al, SLOT(showNadirPassage(bool))); |
1781 | + ui->selectedObjectCheckBox->setChecked(al->isSelectedObjectDisplayed()); |
1782 | + connect(ui->selectedObjectCheckBox, SIGNAL(toggled(bool)), al, SLOT(showSelectedObject(bool))); |
1783 | + ui->currentSunCheckBox->setChecked(al->isCurrentSunDisplayed()); |
1784 | + connect(ui->currentSunCheckBox, SIGNAL(toggled(bool)), al, SLOT(showCurrentSun(bool))); |
1785 | + ui->currentMoonCheckBox->setChecked(al->isCurrentMoonDisplayed()); |
1786 | + connect(ui->currentMoonCheckBox, SIGNAL(toggled(bool)), al, SLOT(showCurrentMoon(bool))); |
1787 | + // Planet ComboBox requires special handling! |
1788 | + ui->currentPlanetComboBox->setCurrentIndex(al->whichCurrentPlanetDisplayed()-ArchaeoLine::CurrentPlanetNone); |
1789 | + connect(ui->currentPlanetComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setCurrentPlanetFromGUI(int))); |
1790 | + |
1791 | + equinoxColor = al->getLineColor(ArchaeoLine::Equinox); |
1792 | + solsticeColor = al->getLineColor(ArchaeoLine::Solstices); |
1793 | + crossquarterColor = al->getLineColor(ArchaeoLine::Crossquarters); |
1794 | + majorStandstillColor = al->getLineColor(ArchaeoLine::MajorStandstill); |
1795 | + minorStandstillColor = al->getLineColor(ArchaeoLine::MinorStandstill); |
1796 | + zenithPassageColor = al->getLineColor(ArchaeoLine::ZenithPassage); |
1797 | + nadirPassageColor = al->getLineColor(ArchaeoLine::NadirPassage); |
1798 | + selectedObjectColor = al->getLineColor(ArchaeoLine::SelectedObject); |
1799 | + currentSunColor = al->getLineColor(ArchaeoLine::CurrentSun); |
1800 | + currentMoonColor = al->getLineColor(ArchaeoLine::CurrentMoon); |
1801 | + currentPlanetColor = al->getLineColor(ArchaeoLine::CurrentPlanetNone); |
1802 | + equinoxColorPixmap=QPixmap(48, 12); |
1803 | + equinoxColorPixmap.fill(equinoxColor); |
1804 | + ui->equinoxColorToolButton->setIconSize(QSize(48, 12)); |
1805 | + ui->equinoxColorToolButton->setIcon(QIcon(equinoxColorPixmap)); |
1806 | + solsticeColorPixmap=QPixmap(48, 12); |
1807 | + solsticeColorPixmap.fill(solsticeColor); |
1808 | + ui->solsticesColorToolButton->setIconSize(QSize(48, 12)); |
1809 | + ui->solsticesColorToolButton->setIcon(QIcon(solsticeColorPixmap)); |
1810 | + crossquarterColorPixmap=QPixmap(48, 12); |
1811 | + crossquarterColorPixmap.fill(crossquarterColor); |
1812 | + ui->crossquarterColorToolButton->setIconSize(QSize(48, 12)); |
1813 | + ui->crossquarterColorToolButton->setIcon(QIcon(crossquarterColorPixmap)); |
1814 | + minorStandstillColorPixmap=QPixmap(48, 12); |
1815 | + minorStandstillColorPixmap.fill(minorStandstillColor); |
1816 | + ui->minorStandstillColorToolButton->setIconSize(QSize(48, 12)); |
1817 | + ui->minorStandstillColorToolButton->setIcon(QIcon(minorStandstillColorPixmap)); |
1818 | + majorStandstillColorPixmap=QPixmap(48, 12); |
1819 | + majorStandstillColorPixmap.fill(majorStandstillColor); |
1820 | + ui->majorStandstillColorToolButton->setIconSize(QSize(48, 12)); |
1821 | + ui->majorStandstillColorToolButton->setIcon(QIcon(majorStandstillColorPixmap)); |
1822 | + zenithPassageColorPixmap=QPixmap(48, 12); |
1823 | + zenithPassageColorPixmap.fill(zenithPassageColor); |
1824 | + ui->zenithPassageColorToolButton->setIconSize(QSize(48, 12)); |
1825 | + ui->zenithPassageColorToolButton->setIcon(QIcon(zenithPassageColorPixmap)); |
1826 | + nadirPassageColorPixmap=QPixmap(48, 12); |
1827 | + nadirPassageColorPixmap.fill(nadirPassageColor); |
1828 | + ui->nadirPassageColorToolButton->setIconSize(QSize(48, 12)); |
1829 | + ui->nadirPassageColorToolButton->setIcon(QIcon(nadirPassageColorPixmap)); |
1830 | + selectedObjectColorPixmap=QPixmap(48, 12); |
1831 | + selectedObjectColorPixmap.fill(selectedObjectColor); |
1832 | + ui->selectedObjectColorToolButton->setIconSize(QSize(48, 12)); |
1833 | + ui->selectedObjectColorToolButton->setIcon(QIcon(selectedObjectColorPixmap)); |
1834 | + currentSunColorPixmap=QPixmap(48, 12); |
1835 | + currentSunColorPixmap.fill(currentSunColor); |
1836 | + ui->currentSunColorToolButton->setIconSize(QSize(48, 12)); |
1837 | + ui->currentSunColorToolButton->setIcon(QIcon(currentSunColorPixmap)); |
1838 | + currentMoonColorPixmap=QPixmap(48, 12); |
1839 | + currentMoonColorPixmap.fill(currentMoonColor); |
1840 | + ui->currentMoonColorToolButton->setIconSize(QSize(48, 12)); |
1841 | + ui->currentMoonColorToolButton->setIcon(QIcon(currentMoonColorPixmap)); |
1842 | + currentPlanetColorPixmap=QPixmap(48, 12); |
1843 | + currentPlanetColorPixmap.fill(currentPlanetColor); |
1844 | + ui->currentPlanetColorToolButton->setIconSize(QSize(48, 12)); |
1845 | + ui->currentPlanetColorToolButton->setIcon(QIcon(currentPlanetColorPixmap)); |
1846 | + |
1847 | + connect(ui->equinoxColorToolButton, SIGNAL(released()), this, SLOT(askEquinoxColor())); |
1848 | + connect(ui->solsticesColorToolButton, SIGNAL(released()), this, SLOT(askSolsticeColor())); |
1849 | + connect(ui->crossquarterColorToolButton, SIGNAL(released()), this, SLOT(askCrossquarterColor())); |
1850 | + connect(ui->majorStandstillColorToolButton, SIGNAL(released()), this, SLOT(askMajorStandstillColor())); |
1851 | + connect(ui->minorStandstillColorToolButton, SIGNAL(released()), this, SLOT(askMinorStandstillColor())); |
1852 | + connect(ui->zenithPassageColorToolButton, SIGNAL(released()), this, SLOT(askZenithPassageColor())); |
1853 | + connect(ui->nadirPassageColorToolButton, SIGNAL(released()), this, SLOT(askNadirPassageColor())); |
1854 | + connect(ui->selectedObjectColorToolButton, SIGNAL(released()), this, SLOT(askSelectedObjectColor())); |
1855 | + connect(ui->currentSunColorToolButton, SIGNAL(released()), this, SLOT(askCurrentSunColor())); |
1856 | + connect(ui->currentMoonColorToolButton, SIGNAL(released()), this, SLOT(askCurrentMoonColor())); |
1857 | + connect(ui->currentPlanetColorToolButton, SIGNAL(released()), this, SLOT(askCurrentPlanetColor())); |
1858 | + |
1859 | + connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(resetArchaeoLinesSettings())); |
1860 | + |
1861 | + ui->formatDisplayBox->hide(); |
1862 | + // We must apparently warn about a potential problem, but only on Windows. (QTBUG-35302) |
1863 | + #ifndef Q_OS_WIN |
1864 | + ui->switchToWindowedModeLabel->hide(); |
1865 | + #endif |
1866 | + setAboutHtml(); |
1867 | +} |
1868 | + |
1869 | +void ArchaeoLinesDialog::setCurrentPlanetFromGUI(int index) |
1870 | +{ |
1871 | + Q_ASSERT(al); |
1872 | + al->showCurrentPlanet((ArchaeoLine::Line) (ArchaeoLine::CurrentPlanetNone+index)); |
1873 | +} |
1874 | + |
1875 | + |
1876 | +void ArchaeoLinesDialog::setAboutHtml(void) |
1877 | +{ |
1878 | + QString html = "<html><head></head><body>"; |
1879 | + html += "<h2>" + q_("ArchaeoLines Plug-in") + "</h2><table width=\"90%\">"; |
1880 | + html += "<tr width=\"30%\"><td><strong>" + q_("Version") + ":</strong></td><td>" + ARCHAEOLINES_VERSION + "</td></tr>"; |
1881 | + html += "<tr><td><strong>" + q_("Author") + ":</strong></td><td>Georg Zotti</td></tr>"; |
1882 | + //html += "<tr><td><strong>" + q_("Contributors") + ":</strong></td><td> List with br separators </td></tr>"; |
1883 | + html += "</table>"; |
1884 | + |
1885 | + html += "<p>" + q_("The ArchaeoLines plugin displays any combination of declination arcs most relevant to archaeo- or ethnoastronomical studies.") + "</p>"; |
1886 | + html += "<ul><li>" + q_("Declinations of equinoxes (i.e. equator) and the solstices") + "</li>"; |
1887 | + html += "<li>" + q_("Declinations of the crossquarter days (days right between solstices and equinoxes)") + "</li>"; |
1888 | + html += "<li>" + q_("Declinations of the Major Lunar Standstills") + "</li>"; |
1889 | + html += "<li>" + q_("Declinations of the Minor Lunar Standstills") + "</li>"; |
1890 | + html += "<li>" + q_("Declination of the Zenith passage") + "</li>"; |
1891 | + html += "<li>" + q_("Declination of the Nadir passage") + "</li>"; |
1892 | + html += "<li>" + q_("Declination of the currently selected object") + "</li>"; |
1893 | + html += "<li>" + q_("Current declination of the sun") + "</li>"; |
1894 | + html += "<li>" + q_("Current declination of the moon") + "</li>"; |
1895 | + html += "<li>" + q_("Current declination of a naked-eye planet") + "</li></ul>"; |
1896 | + html += "<p>" + q_("The lunar lines include horizon parallax effects. " |
1897 | + "There are two lines each drawn, for maximum and minimum distance of the moon. " |
1898 | + "Note that declination of the moon at the major standstill can exceed the " |
1899 | + "indicated limits if it is high in the sky due to parallax effects.") + "</p>"; |
1900 | + |
1901 | + html += "<h3>" + q_("Links") + "</h3>"; |
1902 | + html += "<p>" + QString(q_("Support is provided via the Launchpad website. Be sure to put \"%1\" in the subject when posting.")).arg("ArchaeoLines plugin") + "</p>"; |
1903 | + html += "<p><ul>"; |
1904 | + // TRANSLATORS: The numbers contain the opening and closing tag of an HTML link |
1905 | + html += "<li>" + QString(q_("If you have a question, you can %1get an answer here%2").arg("<a href=\"https://answers.launchpad.net/stellarium\">")).arg("</a>") + "</li>"; |
1906 | + // TRANSLATORS: The numbers contain the opening and closing tag of an HTML link |
1907 | + html += "<li>" + QString(q_("Bug reports can be made %1here%2.")).arg("<a href=\"https://bugs.launchpad.net/stellarium\">").arg("</a>") + "</li>"; |
1908 | + // TRANSLATORS: The numbers contain the opening and closing tag of an HTML link |
1909 | + html += "<li>" + q_("If you would like to make a feature request, you can create a bug report, and set the severity to \"wishlist\".") + "</li>"; |
1910 | + //// TRANSLATORS: The numbers contain the opening and closing tag of an HTML link |
1911 | + //html += "<li>" + q_("If you want to read full information about this plugin and its history, you can %1get info here%2.").arg("<a href=\"http://stellarium.org/wiki/index.php/ArchaeoLines_plugin\">").arg("</a>") + "</li>"; |
1912 | + html += "</ul></p></body></html>"; |
1913 | + |
1914 | + StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui()); |
1915 | + if(gui!=NULL) |
1916 | + { |
1917 | + QString htmlStyleSheet(gui->getStelStyle().htmlStyleSheet); |
1918 | + ui->aboutTextBrowser->document()->setDefaultStyleSheet(htmlStyleSheet); |
1919 | + } |
1920 | + |
1921 | + ui->aboutTextBrowser->setHtml(html); |
1922 | +} |
1923 | + |
1924 | + |
1925 | +void ArchaeoLinesDialog::resetArchaeoLinesSettings() |
1926 | +{ |
1927 | + al->restoreDefaultSettings(); |
1928 | + equinoxColor = al->getLineColor(ArchaeoLine::Equinox); |
1929 | + solsticeColor = al->getLineColor(ArchaeoLine::Solstices); |
1930 | + crossquarterColor = al->getLineColor(ArchaeoLine::Crossquarters); |
1931 | + majorStandstillColor = al->getLineColor(ArchaeoLine::MajorStandstill); |
1932 | + minorStandstillColor = al->getLineColor(ArchaeoLine::MinorStandstill); |
1933 | + zenithPassageColor = al->getLineColor(ArchaeoLine::ZenithPassage); |
1934 | + nadirPassageColor = al->getLineColor(ArchaeoLine::NadirPassage); |
1935 | + selectedObjectColor = al->getLineColor(ArchaeoLine::SelectedObject); |
1936 | + currentSunColor = al->getLineColor(ArchaeoLine::CurrentSun); |
1937 | + currentMoonColor = al->getLineColor(ArchaeoLine::CurrentMoon); |
1938 | + currentPlanetColor = al->getLineColor(ArchaeoLine::CurrentPlanetNone); |
1939 | + equinoxColorPixmap.fill(equinoxColor); |
1940 | + ui->equinoxColorToolButton->setIcon(QIcon(equinoxColorPixmap)); |
1941 | + solsticeColorPixmap.fill(solsticeColor); |
1942 | + ui->solsticesColorToolButton->setIcon(QIcon(solsticeColorPixmap)); |
1943 | + crossquarterColorPixmap.fill(crossquarterColor); |
1944 | + ui->crossquarterColorToolButton->setIcon(QIcon(crossquarterColorPixmap)); |
1945 | + minorStandstillColorPixmap.fill(minorStandstillColor); |
1946 | + ui->minorStandstillColorToolButton->setIcon(QIcon(minorStandstillColorPixmap)); |
1947 | + majorStandstillColorPixmap.fill(majorStandstillColor); |
1948 | + ui->majorStandstillColorToolButton->setIcon(QIcon(majorStandstillColorPixmap)); |
1949 | + zenithPassageColorPixmap.fill(zenithPassageColor); |
1950 | + ui->zenithPassageColorToolButton->setIcon(QIcon(zenithPassageColorPixmap)); |
1951 | + nadirPassageColorPixmap.fill(nadirPassageColor); |
1952 | + ui->nadirPassageColorToolButton->setIcon(QIcon(nadirPassageColorPixmap)); |
1953 | + selectedObjectColorPixmap.fill(selectedObjectColor); |
1954 | + ui->selectedObjectColorToolButton->setIcon(QIcon(selectedObjectColorPixmap)); |
1955 | + currentSunColorPixmap.fill(currentSunColor); |
1956 | + ui->currentSunColorToolButton->setIcon(QIcon(currentSunColorPixmap)); |
1957 | + currentMoonColorPixmap.fill(currentMoonColor); |
1958 | + ui->currentMoonColorToolButton->setIcon(QIcon(currentMoonColorPixmap)); |
1959 | + currentPlanetColorPixmap.fill(currentPlanetColor); |
1960 | + ui->currentPlanetColorToolButton->setIcon(QIcon(currentPlanetColorPixmap)); |
1961 | + |
1962 | + ui->equinoxCheckBox->setChecked(al->isEquinoxDisplayed()); |
1963 | + ui->solsticesCheckBox->setChecked(al->isSolsticesDisplayed()); |
1964 | + ui->crossquarterCheckBox->setChecked(al->isCrossquartersDisplayed()); |
1965 | + ui->majorStandstillCheckBox->setChecked(al->isMajorStandstillsDisplayed()); |
1966 | + ui->minorStandstillCheckBox->setChecked(al->isMinorStandstillsDisplayed()); |
1967 | + ui->zenithPassageCheckBox->setChecked(al->isZenithPassageDisplayed()); |
1968 | + ui->nadirPassageCheckBox->setChecked(al->isNadirPassageDisplayed()); |
1969 | + ui->selectedObjectCheckBox->setChecked(al->isSelectedObjectDisplayed()); |
1970 | + ui->currentSunCheckBox->setChecked(al->isCurrentSunDisplayed()); |
1971 | + ui->currentMoonCheckBox->setChecked(al->isCurrentMoonDisplayed()); |
1972 | + ui->currentPlanetComboBox->setCurrentIndex(al->whichCurrentPlanetDisplayed()-ArchaeoLine::CurrentPlanetNone); |
1973 | +} |
1974 | + |
1975 | +// These are called by the respective buttons. |
1976 | +void ArchaeoLinesDialog::askEquinoxColor() |
1977 | +{ |
1978 | + QColor c=QColorDialog::getColor(equinoxColor, NULL, q_("Select color for equinox line")); |
1979 | + if (c.isValid()) |
1980 | + { |
1981 | + equinoxColor=c; |
1982 | + al->setLineColor(ArchaeoLine::Equinox, c); |
1983 | + equinoxColorPixmap.fill(c); |
1984 | + ui->equinoxColorToolButton->setIcon(QIcon(equinoxColorPixmap)); |
1985 | + } |
1986 | +} |
1987 | + |
1988 | +void ArchaeoLinesDialog::askSolsticeColor() |
1989 | +{ |
1990 | + QColor c=QColorDialog::getColor(solsticeColor, NULL, q_("Select color for solstice lines")); |
1991 | + if (c.isValid()) |
1992 | + { |
1993 | + solsticeColor=c; |
1994 | + al->setLineColor(ArchaeoLine::Solstices, c); |
1995 | + solsticeColorPixmap.fill(c); |
1996 | + ui->solsticesColorToolButton->setIcon(QIcon(solsticeColorPixmap)); |
1997 | + } |
1998 | +} |
1999 | + |
2000 | +void ArchaeoLinesDialog::askCrossquarterColor() |
2001 | +{ |
2002 | + QColor c=QColorDialog::getColor(crossquarterColor, NULL, q_("Select color for crossquarter lines")); |
2003 | + if (c.isValid()) |
2004 | + { |
2005 | + crossquarterColor=c; |
2006 | + al->setLineColor(ArchaeoLine::Crossquarters, c); |
2007 | + crossquarterColorPixmap.fill(c); |
2008 | + ui->crossquarterColorToolButton->setIcon(QIcon(crossquarterColorPixmap)); |
2009 | + } |
2010 | +} |
2011 | + |
2012 | +void ArchaeoLinesDialog::askMajorStandstillColor() |
2013 | +{ |
2014 | + QColor c=QColorDialog::getColor(majorStandstillColor, NULL, q_("Select color for major standstill lines")); |
2015 | + if (c.isValid()) |
2016 | + { |
2017 | + majorStandstillColor=c; |
2018 | + al->setLineColor(ArchaeoLine::MajorStandstill, c); |
2019 | + majorStandstillColorPixmap.fill(c); |
2020 | + ui->majorStandstillColorToolButton->setIcon(QIcon(majorStandstillColorPixmap)); |
2021 | + } |
2022 | +} |
2023 | + |
2024 | +void ArchaeoLinesDialog::askMinorStandstillColor() |
2025 | +{ |
2026 | + QColor c=QColorDialog::getColor(minorStandstillColor, NULL, q_("Select color for minor standstill lines")); |
2027 | + if (c.isValid()) |
2028 | + { |
2029 | + minorStandstillColor=c; |
2030 | + al->setLineColor(ArchaeoLine::MinorStandstill, c); |
2031 | + minorStandstillColorPixmap.fill(c); |
2032 | + ui->minorStandstillColorToolButton->setIcon(QIcon(minorStandstillColorPixmap)); |
2033 | + } |
2034 | +} |
2035 | + |
2036 | +void ArchaeoLinesDialog::askZenithPassageColor() |
2037 | +{ |
2038 | + QColor c=QColorDialog::getColor(zenithPassageColor, NULL, q_("Select color for zenith passage line")); |
2039 | + if (c.isValid()) |
2040 | + { |
2041 | + zenithPassageColor=c; |
2042 | + al->setLineColor(ArchaeoLine::ZenithPassage, c); |
2043 | + zenithPassageColorPixmap.fill(c); |
2044 | + ui->zenithPassageColorToolButton->setIcon(QIcon(zenithPassageColorPixmap)); |
2045 | + } |
2046 | +} |
2047 | + |
2048 | +void ArchaeoLinesDialog::askNadirPassageColor() |
2049 | +{ |
2050 | + QColor c=QColorDialog::getColor(nadirPassageColor, NULL, q_("Select color for nadir passage line")); |
2051 | + if (c.isValid()) |
2052 | + { |
2053 | + nadirPassageColor=c; |
2054 | + al->setLineColor(ArchaeoLine::NadirPassage, c); |
2055 | + nadirPassageColorPixmap.fill(c); |
2056 | + ui->nadirPassageColorToolButton->setIcon(QIcon(nadirPassageColorPixmap)); |
2057 | + } |
2058 | +} |
2059 | + |
2060 | +void ArchaeoLinesDialog::askSelectedObjectColor() |
2061 | +{ |
2062 | + QColor c=QColorDialog::getColor(selectedObjectColor, NULL, q_("Select color for selected object line")); |
2063 | + if (c.isValid()) |
2064 | + { |
2065 | + selectedObjectColor=c; |
2066 | + al->setLineColor(ArchaeoLine::SelectedObject, c); |
2067 | + selectedObjectColorPixmap.fill(c); |
2068 | + ui->selectedObjectColorToolButton->setIcon(QIcon(selectedObjectColorPixmap)); |
2069 | + } |
2070 | +} |
2071 | + |
2072 | +void ArchaeoLinesDialog::askCurrentSunColor() |
2073 | +{ |
2074 | + QColor c=QColorDialog::getColor(currentSunColor, NULL, q_("Select color for current sun line")); |
2075 | + if (c.isValid()) |
2076 | + { |
2077 | + currentSunColor=c; |
2078 | + al->setLineColor(ArchaeoLine::CurrentSun, c); |
2079 | + currentSunColorPixmap.fill(c); |
2080 | + ui->currentSunColorToolButton->setIcon(QIcon(currentSunColorPixmap)); |
2081 | + } |
2082 | +} |
2083 | + |
2084 | +void ArchaeoLinesDialog::askCurrentMoonColor() |
2085 | +{ |
2086 | + QColor c=QColorDialog::getColor(currentMoonColor, NULL, q_("Select color for current moon line")); |
2087 | + if (c.isValid()) |
2088 | + { |
2089 | + currentMoonColor=c; |
2090 | + al->setLineColor(ArchaeoLine::CurrentMoon, c); |
2091 | + currentMoonColorPixmap.fill(c); |
2092 | + ui->currentMoonColorToolButton->setIcon(QIcon(currentMoonColorPixmap)); |
2093 | + } |
2094 | +} |
2095 | + |
2096 | +void ArchaeoLinesDialog::askCurrentPlanetColor() |
2097 | +{ |
2098 | + QColor c=QColorDialog::getColor(currentPlanetColor, NULL, q_("Select color for current planet line")); |
2099 | + if (c.isValid()) |
2100 | + { |
2101 | + currentPlanetColor=c; |
2102 | + al->setLineColor(ArchaeoLine::CurrentPlanetNone, c); |
2103 | + currentPlanetColorPixmap.fill(c); |
2104 | + ui->currentPlanetColorToolButton->setIcon(QIcon(currentPlanetColorPixmap)); |
2105 | + } |
2106 | +} |
2107 | + |
2108 | +// Notes/Observations by GZ in 2015-04 with Qt5.4.0/MinGW on Windows7SP1. |
2109 | +// (1) There are issues in calling the QColorPanel that seem to be related to QTBUG-35302, |
2110 | +// although it was reportedly fixed at least for X11 in Qt5.3.0. |
2111 | +// On Win7 with NVidia Geforce and Win8.1 on Radeon, the color panel hides behind the Stellarium main window if set to fullscreen. |
2112 | +// On Win7 with Intel HD4600, and various Linuces, no problem is seen, the color panel is right on top of the fullscreen main window. |
2113 | +// It seems not to depend on MinGW vs. MSVC builds, but on details in GPU drivers and Qt. |
2114 | + |
2115 | +// (2) Likely another bug in QColorDialog: If you choose one of the preconfigured colors (left half), |
2116 | +// on next change of that color it will have toggled one high bit of one component. |
2117 | +// On next change, it will be toggled again. |
2118 | +// If you configure a color from the right color field, all is OK (unless you "hit" a preconfigured color in the right field). |
2119 | |
2120 | === added file 'plugins/ArchaeoLines/src/gui/ArchaeoLinesDialog.hpp' |
2121 | --- plugins/ArchaeoLines/src/gui/ArchaeoLinesDialog.hpp 1970-01-01 00:00:00 +0000 |
2122 | +++ plugins/ArchaeoLines/src/gui/ArchaeoLinesDialog.hpp 2015-04-09 09:33:54 +0000 |
2123 | @@ -0,0 +1,108 @@ |
2124 | +/* |
2125 | + * ArchaeoLines plug-in for Stellarium |
2126 | + * |
2127 | + * Copyright (C) 2014 Georg Zotti |
2128 | + * |
2129 | + * This program is free software; you can redistribute it and/or |
2130 | + * modify it under the terms of the GNU General Public License |
2131 | + * as published by the Free Software Foundation; either version 2 |
2132 | + * of the License, or (at your option) any later version. |
2133 | + * |
2134 | + * This program is distributed in the hope that it will be useful, |
2135 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2136 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2137 | + * GNU General Public License for more details. |
2138 | + * |
2139 | + * You should have received a copy of the GNU General Public License |
2140 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2141 | + */ |
2142 | + |
2143 | +#ifndef _ARCHAEOLINESDIALOG_HPP_ |
2144 | +#define _ARCHAEOLINESDIALOG_HPP_ |
2145 | + |
2146 | +#include "StelDialog.hpp" |
2147 | +#include "StelGui.hpp" |
2148 | +#include "StelTranslator.hpp" |
2149 | + |
2150 | +#include <QString> |
2151 | +#include <QColor> |
2152 | +#include <QColorDialog> |
2153 | + |
2154 | +class Ui_archaeoLinesDialog; |
2155 | +class ArchaeoLines; |
2156 | + |
2157 | +//! Main window of the ArchaeoLines plug-in. |
2158 | +class ArchaeoLinesDialog : public StelDialog |
2159 | +{ |
2160 | + Q_OBJECT |
2161 | + |
2162 | +public: |
2163 | + ArchaeoLinesDialog(); |
2164 | + ~ArchaeoLinesDialog(); |
2165 | + |
2166 | +public slots: |
2167 | + void retranslate(); |
2168 | + // actions to be called by the color dialog |
2169 | + // These must also forward the colors in float format to the ArchaeoLines object. |
2170 | + void setEquinoxColor(QColor color){equinoxColor=color;} |
2171 | + void setSolsticeColor(QColor color){solsticeColor=color;} |
2172 | + void setCrossquarterColor(QColor color){crossquarterColor=color;} |
2173 | + void setMajorStandstillColor(QColor color){majorStandstillColor=color;} |
2174 | + void setMinorStandstillColor(QColor color){minorStandstillColor=color;} |
2175 | + void setZenithPassageColor(QColor color){zenithPassageColor=color;} |
2176 | + void setNadirPassageColor(QColor color){nadirPassageColor=color;} |
2177 | + void setCurrentSunColor(QColor color){currentSunColor=color;} |
2178 | + void setCurrentMoonColor(QColor color){currentMoonColor=color;} |
2179 | + void setCurrentPlanetColor(QColor color){currentPlanetColor=color;} |
2180 | + void setSelectedObjectColor(QColor color){selectedObjectColor=color;} |
2181 | + void askEquinoxColor(); |
2182 | + void askSolsticeColor(); |
2183 | + void askCrossquarterColor(); |
2184 | + void askMajorStandstillColor(); |
2185 | + void askMinorStandstillColor(); |
2186 | + void askZenithPassageColor(); |
2187 | + void askNadirPassageColor(); |
2188 | + void askCurrentSunColor(); |
2189 | + void askCurrentMoonColor(); |
2190 | + void askCurrentPlanetColor(); |
2191 | + void askSelectedObjectColor(); |
2192 | + |
2193 | +protected: |
2194 | + void createDialogContent(); |
2195 | + |
2196 | +private: |
2197 | + Ui_archaeoLinesDialog* ui; |
2198 | + ArchaeoLines* al; |
2199 | + // These are colors to be settable with a QColorDialog. |
2200 | + QColor equinoxColor; |
2201 | + QColor solsticeColor; |
2202 | + QColor crossquarterColor; |
2203 | + QColor majorStandstillColor; |
2204 | + QColor minorStandstillColor; |
2205 | + QColor zenithPassageColor; |
2206 | + QColor nadirPassageColor; |
2207 | + QColor currentSunColor; |
2208 | + QColor currentMoonColor; |
2209 | + QColor currentPlanetColor; |
2210 | + QColor selectedObjectColor; |
2211 | + QPixmap equinoxColorPixmap; |
2212 | + QPixmap solsticeColorPixmap; |
2213 | + QPixmap crossquarterColorPixmap; |
2214 | + QPixmap majorStandstillColorPixmap; |
2215 | + QPixmap minorStandstillColorPixmap; |
2216 | + QPixmap zenithPassageColorPixmap; |
2217 | + QPixmap nadirPassageColorPixmap; |
2218 | + QPixmap currentSunColorPixmap; |
2219 | + QPixmap currentMoonColorPixmap; |
2220 | + QPixmap currentPlanetColorPixmap; |
2221 | + QPixmap selectedObjectColorPixmap; |
2222 | + void setAboutHtml(); |
2223 | + |
2224 | +private slots: |
2225 | + void resetArchaeoLinesSettings(); |
2226 | + //! setting planet requires a small function to link Combobox indices to line IDs. |
2227 | + void setCurrentPlanetFromGUI(int index); |
2228 | + |
2229 | +}; |
2230 | + |
2231 | +#endif /* _ARCHAEOLINESDIALOG_HPP_ */ |
2232 | |
2233 | === added file 'plugins/ArchaeoLines/src/gui/archaeoLinesDialog.ui' |
2234 | --- plugins/ArchaeoLines/src/gui/archaeoLinesDialog.ui 1970-01-01 00:00:00 +0000 |
2235 | +++ plugins/ArchaeoLines/src/gui/archaeoLinesDialog.ui 2015-04-09 09:33:54 +0000 |
2236 | @@ -0,0 +1,449 @@ |
2237 | +<?xml version="1.0" encoding="UTF-8"?> |
2238 | +<ui version="4.0"> |
2239 | + <class>archaeoLinesDialog</class> |
2240 | + <widget class="QWidget" name="archaeoLinesDialog"> |
2241 | + <property name="geometry"> |
2242 | + <rect> |
2243 | + <x>0</x> |
2244 | + <y>0</y> |
2245 | + <width>530</width> |
2246 | + <height>454</height> |
2247 | + </rect> |
2248 | + </property> |
2249 | + <property name="windowTitle"> |
2250 | + <string>Pulsars Configuration</string> |
2251 | + </property> |
2252 | + <layout class="QVBoxLayout" name="verticalLayout_2"> |
2253 | + <property name="spacing"> |
2254 | + <number>0</number> |
2255 | + </property> |
2256 | + <property name="leftMargin"> |
2257 | + <number>0</number> |
2258 | + </property> |
2259 | + <property name="topMargin"> |
2260 | + <number>0</number> |
2261 | + </property> |
2262 | + <property name="rightMargin"> |
2263 | + <number>0</number> |
2264 | + </property> |
2265 | + <property name="bottomMargin"> |
2266 | + <number>0</number> |
2267 | + </property> |
2268 | + <item> |
2269 | + <widget class="BarFrame" name="TitleBar"> |
2270 | + <property name="sizePolicy"> |
2271 | + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> |
2272 | + <horstretch>0</horstretch> |
2273 | + <verstretch>0</verstretch> |
2274 | + </sizepolicy> |
2275 | + </property> |
2276 | + <property name="minimumSize"> |
2277 | + <size> |
2278 | + <width>530</width> |
2279 | + <height>25</height> |
2280 | + </size> |
2281 | + </property> |
2282 | + <property name="maximumSize"> |
2283 | + <size> |
2284 | + <width>16777215</width> |
2285 | + <height>25</height> |
2286 | + </size> |
2287 | + </property> |
2288 | + <property name="focusPolicy"> |
2289 | + <enum>Qt::NoFocus</enum> |
2290 | + </property> |
2291 | + <property name="autoFillBackground"> |
2292 | + <bool>false</bool> |
2293 | + </property> |
2294 | + <property name="frameShape"> |
2295 | + <enum>QFrame::StyledPanel</enum> |
2296 | + </property> |
2297 | + <layout class="QHBoxLayout"> |
2298 | + <property name="spacing"> |
2299 | + <number>0</number> |
2300 | + </property> |
2301 | + <property name="leftMargin"> |
2302 | + <number>0</number> |
2303 | + </property> |
2304 | + <property name="topMargin"> |
2305 | + <number>0</number> |
2306 | + </property> |
2307 | + <property name="rightMargin"> |
2308 | + <number>4</number> |
2309 | + </property> |
2310 | + <property name="bottomMargin"> |
2311 | + <number>0</number> |
2312 | + </property> |
2313 | + <item> |
2314 | + <spacer> |
2315 | + <property name="orientation"> |
2316 | + <enum>Qt::Horizontal</enum> |
2317 | + </property> |
2318 | + <property name="sizeHint" stdset="0"> |
2319 | + <size> |
2320 | + <width>40</width> |
2321 | + <height>20</height> |
2322 | + </size> |
2323 | + </property> |
2324 | + </spacer> |
2325 | + </item> |
2326 | + <item> |
2327 | + <widget class="QLabel" name="stelWindowTitle"> |
2328 | + <property name="text"> |
2329 | + <string>ArchaeoLines Plug-in Configuration</string> |
2330 | + </property> |
2331 | + </widget> |
2332 | + </item> |
2333 | + <item> |
2334 | + <spacer> |
2335 | + <property name="orientation"> |
2336 | + <enum>Qt::Horizontal</enum> |
2337 | + </property> |
2338 | + <property name="sizeHint" stdset="0"> |
2339 | + <size> |
2340 | + <width>40</width> |
2341 | + <height>20</height> |
2342 | + </size> |
2343 | + </property> |
2344 | + </spacer> |
2345 | + </item> |
2346 | + <item> |
2347 | + <widget class="QPushButton" name="closeStelWindow"> |
2348 | + <property name="minimumSize"> |
2349 | + <size> |
2350 | + <width>16</width> |
2351 | + <height>16</height> |
2352 | + </size> |
2353 | + </property> |
2354 | + <property name="maximumSize"> |
2355 | + <size> |
2356 | + <width>16</width> |
2357 | + <height>16</height> |
2358 | + </size> |
2359 | + </property> |
2360 | + <property name="focusPolicy"> |
2361 | + <enum>Qt::NoFocus</enum> |
2362 | + </property> |
2363 | + <property name="text"> |
2364 | + <string/> |
2365 | + </property> |
2366 | + </widget> |
2367 | + </item> |
2368 | + </layout> |
2369 | + </widget> |
2370 | + </item> |
2371 | + <item> |
2372 | + <widget class="QTabWidget" name="tabs"> |
2373 | + <property name="currentIndex"> |
2374 | + <number>0</number> |
2375 | + </property> |
2376 | + <property name="documentMode"> |
2377 | + <bool>false</bool> |
2378 | + </property> |
2379 | + <widget class="QWidget" name="settingsTab"> |
2380 | + <attribute name="title"> |
2381 | + <string>ArchaeoLines</string> |
2382 | + </attribute> |
2383 | + <layout class="QVBoxLayout" name="verticalLayout_3"> |
2384 | + <item> |
2385 | + <widget class="QLabel" name="switchToWindowedModeLabel"> |
2386 | + <property name="text"> |
2387 | + <string>To change colors you may have to leave fullscreen mode!</string> |
2388 | + </property> |
2389 | + </widget> |
2390 | + </item> |
2391 | + <item> |
2392 | + <layout class="QFormLayout" name="formLayout"> |
2393 | + <property name="fieldGrowthPolicy"> |
2394 | + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> |
2395 | + </property> |
2396 | + <item row="0" column="0"> |
2397 | + <widget class="QCheckBox" name="equinoxCheckBox"> |
2398 | + <property name="text"> |
2399 | + <string>Equinox line (Equator)</string> |
2400 | + </property> |
2401 | + </widget> |
2402 | + </item> |
2403 | + <item row="0" column="1"> |
2404 | + <widget class="QToolButton" name="equinoxColorToolButton"> |
2405 | + <property name="text"> |
2406 | + <string>EquinoxColor...</string> |
2407 | + </property> |
2408 | + </widget> |
2409 | + </item> |
2410 | + <item row="1" column="0"> |
2411 | + <widget class="QCheckBox" name="solsticesCheckBox"> |
2412 | + <property name="text"> |
2413 | + <string>Solstice Lines</string> |
2414 | + </property> |
2415 | + </widget> |
2416 | + </item> |
2417 | + <item row="1" column="1"> |
2418 | + <widget class="QToolButton" name="solsticesColorToolButton"> |
2419 | + <property name="text"> |
2420 | + <string>SolsticeColor...</string> |
2421 | + </property> |
2422 | + </widget> |
2423 | + </item> |
2424 | + <item row="2" column="0"> |
2425 | + <widget class="QCheckBox" name="crossquarterCheckBox"> |
2426 | + <property name="text"> |
2427 | + <string>Crossquarter Lines</string> |
2428 | + </property> |
2429 | + </widget> |
2430 | + </item> |
2431 | + <item row="2" column="1"> |
2432 | + <widget class="QToolButton" name="crossquarterColorToolButton"> |
2433 | + <property name="toolTip"> |
2434 | + <string>Change color</string> |
2435 | + </property> |
2436 | + <property name="text"> |
2437 | + <string>CrossquarterColor...</string> |
2438 | + </property> |
2439 | + </widget> |
2440 | + </item> |
2441 | + <item row="3" column="0"> |
2442 | + <widget class="QCheckBox" name="majorStandstillCheckBox"> |
2443 | + <property name="text"> |
2444 | + <string>Major Lunar Standstill lines</string> |
2445 | + </property> |
2446 | + </widget> |
2447 | + </item> |
2448 | + <item row="3" column="1"> |
2449 | + <widget class="QToolButton" name="majorStandstillColorToolButton"> |
2450 | + <property name="text"> |
2451 | + <string>majorLunarStandstillColor...</string> |
2452 | + </property> |
2453 | + </widget> |
2454 | + </item> |
2455 | + <item row="4" column="0"> |
2456 | + <widget class="QCheckBox" name="minorStandstillCheckBox"> |
2457 | + <property name="text"> |
2458 | + <string>Minor Lunar Standstill lines</string> |
2459 | + </property> |
2460 | + </widget> |
2461 | + </item> |
2462 | + <item row="4" column="1"> |
2463 | + <widget class="QToolButton" name="minorStandstillColorToolButton"> |
2464 | + <property name="text"> |
2465 | + <string>minorLunarStandstillColor...</string> |
2466 | + </property> |
2467 | + </widget> |
2468 | + </item> |
2469 | + <item row="5" column="0"> |
2470 | + <widget class="QCheckBox" name="zenithPassageCheckBox"> |
2471 | + <property name="text"> |
2472 | + <string>Declination of Zenith passage</string> |
2473 | + </property> |
2474 | + </widget> |
2475 | + </item> |
2476 | + <item row="5" column="1"> |
2477 | + <widget class="QToolButton" name="zenithPassageColorToolButton"> |
2478 | + <property name="text"> |
2479 | + <string>zenithPassageColor...</string> |
2480 | + </property> |
2481 | + </widget> |
2482 | + </item> |
2483 | + <item row="6" column="0"> |
2484 | + <widget class="QCheckBox" name="nadirPassageCheckBox"> |
2485 | + <property name="text"> |
2486 | + <string>Declination of Nadir passage</string> |
2487 | + </property> |
2488 | + </widget> |
2489 | + </item> |
2490 | + <item row="6" column="1"> |
2491 | + <widget class="QToolButton" name="nadirPassageColorToolButton"> |
2492 | + <property name="text"> |
2493 | + <string>NadirPassageColor...</string> |
2494 | + </property> |
2495 | + </widget> |
2496 | + </item> |
2497 | + <item row="7" column="0"> |
2498 | + <widget class="QCheckBox" name="currentSunCheckBox"> |
2499 | + <property name="text"> |
2500 | + <string>Current Sun</string> |
2501 | + </property> |
2502 | + </widget> |
2503 | + </item> |
2504 | + <item row="7" column="1"> |
2505 | + <widget class="QToolButton" name="currentSunColorToolButton"> |
2506 | + <property name="text"> |
2507 | + <string>SunColor...</string> |
2508 | + </property> |
2509 | + </widget> |
2510 | + </item> |
2511 | + <item row="8" column="0"> |
2512 | + <widget class="QCheckBox" name="currentMoonCheckBox"> |
2513 | + <property name="text"> |
2514 | + <string>Current Moon</string> |
2515 | + </property> |
2516 | + </widget> |
2517 | + </item> |
2518 | + <item row="8" column="1"> |
2519 | + <widget class="QToolButton" name="currentMoonColorToolButton"> |
2520 | + <property name="text"> |
2521 | + <string>MoonColor...</string> |
2522 | + </property> |
2523 | + </widget> |
2524 | + </item> |
2525 | + <item row="9" column="0"> |
2526 | + <widget class="QComboBox" name="currentPlanetComboBox"> |
2527 | + <property name="sizePolicy"> |
2528 | + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> |
2529 | + <horstretch>0</horstretch> |
2530 | + <verstretch>0</verstretch> |
2531 | + </sizepolicy> |
2532 | + </property> |
2533 | + <property name="minimumSize"> |
2534 | + <size> |
2535 | + <width>150</width> |
2536 | + <height>0</height> |
2537 | + </size> |
2538 | + </property> |
2539 | + <property name="currentIndex"> |
2540 | + <number>0</number> |
2541 | + </property> |
2542 | + <item> |
2543 | + <property name="text"> |
2544 | + <string>Current Planet: None</string> |
2545 | + </property> |
2546 | + </item> |
2547 | + <item> |
2548 | + <property name="text"> |
2549 | + <string>Current Planet: Mercury</string> |
2550 | + </property> |
2551 | + </item> |
2552 | + <item> |
2553 | + <property name="text"> |
2554 | + <string>Current Planet: Venus</string> |
2555 | + </property> |
2556 | + </item> |
2557 | + <item> |
2558 | + <property name="text"> |
2559 | + <string>Current Planet: Mars</string> |
2560 | + </property> |
2561 | + </item> |
2562 | + <item> |
2563 | + <property name="text"> |
2564 | + <string>Current Planet: Jupiter</string> |
2565 | + </property> |
2566 | + </item> |
2567 | + <item> |
2568 | + <property name="text"> |
2569 | + <string>Current Planet: Saturn</string> |
2570 | + </property> |
2571 | + </item> |
2572 | + </widget> |
2573 | + </item> |
2574 | + <item row="9" column="1"> |
2575 | + <widget class="QToolButton" name="currentPlanetColorToolButton"> |
2576 | + <property name="text"> |
2577 | + <string>PlanetColor...</string> |
2578 | + </property> |
2579 | + </widget> |
2580 | + </item> |
2581 | + <item row="10" column="0"> |
2582 | + <widget class="QCheckBox" name="selectedObjectCheckBox"> |
2583 | + <property name="text"> |
2584 | + <string>Selected Object</string> |
2585 | + </property> |
2586 | + </widget> |
2587 | + </item> |
2588 | + <item row="10" column="1"> |
2589 | + <widget class="QToolButton" name="selectedObjectColorToolButton"> |
2590 | + <property name="text"> |
2591 | + <string>SelectedObjectColor...</string> |
2592 | + </property> |
2593 | + </widget> |
2594 | + </item> |
2595 | + </layout> |
2596 | + </item> |
2597 | + <item> |
2598 | + <widget class="QGroupBox" name="formatDisplayBox"> |
2599 | + <property name="enabled"> |
2600 | + <bool>false</bool> |
2601 | + </property> |
2602 | + <property name="title"> |
2603 | + <string>Format</string> |
2604 | + </property> |
2605 | + <property name="flat"> |
2606 | + <bool>true</bool> |
2607 | + </property> |
2608 | + <layout class="QGridLayout" name="gridLayout_3"> |
2609 | + <item row="0" column="0"> |
2610 | + <widget class="QCheckBox" name="useDmsFormatCheckBox"> |
2611 | + <property name="text"> |
2612 | + <string>Use dms format for angles</string> |
2613 | + </property> |
2614 | + </widget> |
2615 | + </item> |
2616 | + </layout> |
2617 | + </widget> |
2618 | + </item> |
2619 | + <item> |
2620 | + <spacer name="verticalSpacer_3"> |
2621 | + <property name="orientation"> |
2622 | + <enum>Qt::Vertical</enum> |
2623 | + </property> |
2624 | + <property name="sizeHint" stdset="0"> |
2625 | + <size> |
2626 | + <width>20</width> |
2627 | + <height>120</height> |
2628 | + </size> |
2629 | + </property> |
2630 | + </spacer> |
2631 | + </item> |
2632 | + <item> |
2633 | + <layout class="QHBoxLayout" name="horizontalLayout_7"> |
2634 | + <item> |
2635 | + <widget class="QPushButton" name="restoreDefaultsButton"> |
2636 | + <property name="sizePolicy"> |
2637 | + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> |
2638 | + <horstretch>0</horstretch> |
2639 | + <verstretch>0</verstretch> |
2640 | + </sizepolicy> |
2641 | + </property> |
2642 | + <property name="text"> |
2643 | + <string>Restore default settings</string> |
2644 | + </property> |
2645 | + </widget> |
2646 | + </item> |
2647 | + </layout> |
2648 | + </item> |
2649 | + </layout> |
2650 | + </widget> |
2651 | + <widget class="QWidget" name="aboutTab"> |
2652 | + <attribute name="title"> |
2653 | + <string comment="tab in plugin windows">About</string> |
2654 | + </attribute> |
2655 | + <layout class="QVBoxLayout" name="verticalLayout_11"> |
2656 | + <property name="spacing"> |
2657 | + <number>9</number> |
2658 | + </property> |
2659 | + <item> |
2660 | + <widget class="QTextBrowser" name="aboutTextBrowser"> |
2661 | + <property name="openExternalLinks"> |
2662 | + <bool>true</bool> |
2663 | + </property> |
2664 | + <property name="openLinks"> |
2665 | + <bool>true</bool> |
2666 | + </property> |
2667 | + </widget> |
2668 | + </item> |
2669 | + </layout> |
2670 | + </widget> |
2671 | + </widget> |
2672 | + </item> |
2673 | + </layout> |
2674 | + </widget> |
2675 | + <customwidgets> |
2676 | + <customwidget> |
2677 | + <class>BarFrame</class> |
2678 | + <extends>QFrame</extends> |
2679 | + <header>Dialog.hpp</header> |
2680 | + <container>1</container> |
2681 | + </customwidget> |
2682 | + </customwidgets> |
2683 | + <resources/> |
2684 | + <connections/> |
2685 | +</ui> |
2686 | |
2687 | === modified file 'src/core/StelApp.cpp' |
2688 | --- src/core/StelApp.cpp 2015-03-25 18:18:33 +0000 |
2689 | +++ src/core/StelApp.cpp 2015-04-09 09:33:54 +0000 |
2690 | @@ -90,6 +90,10 @@ |
2691 | Q_IMPORT_PLUGIN(AngleMeasureStelPluginInterface) |
2692 | #endif |
2693 | |
2694 | +#ifdef USE_STATIC_PLUGIN_ARCHAEOLINES |
2695 | +Q_IMPORT_PLUGIN(ArchaeoLinesStelPluginInterface) |
2696 | +#endif |
2697 | + |
2698 | #ifdef USE_STATIC_PLUGIN_COMPASSMARKS |
2699 | Q_IMPORT_PLUGIN(CompassMarksStelPluginInterface) |
2700 | #endif |
2701 | |
2702 | === modified file 'src/core/StelObjectMgr.cpp' |
2703 | --- src/core/StelObjectMgr.cpp 2015-03-30 07:40:56 +0000 |
2704 | +++ src/core/StelObjectMgr.cpp 2015-04-09 09:33:54 +0000 |
2705 | @@ -228,7 +228,7 @@ |
2706 | } |
2707 | |
2708 | /************************************************************************* |
2709 | - Return the list objects of type "withType" which was recently selected by |
2710 | + Return the list objects of type "type" which was recently selected by |
2711 | the user |
2712 | *************************************************************************/ |
2713 | QList<StelObjectP> StelObjectMgr::getSelectedObject(const QString& type) |
2714 | |
2715 | === modified file 'src/core/StelPainter.hpp' |
2716 | --- src/core/StelPainter.hpp 2015-01-05 16:39:19 +0000 |
2717 | +++ src/core/StelPainter.hpp 2015-04-09 09:33:54 +0000 |
2718 | @@ -106,6 +106,7 @@ |
2719 | //! The algorithm ensures that the line will look smooth, even for non linear distortion. |
2720 | //! Each time the small circle crosses the edge of the viewport, the viewportEdgeIntersectCallback is called with the |
2721 | //! screen 2d position, direction of the currently drawn arc toward the inside of the viewport. |
2722 | + //! Example: A latitude circle has 0/0/sin(latitude) as rotCenter. |
2723 | //! If rotCenter is equal to 0,0,0, the method draws a great circle. |
2724 | void drawSmallCircleArc(const Vec3d& start, const Vec3d& stop, const Vec3d& rotCenter, void (*viewportEdgeIntersectCallback)(const Vec3d& screenPos, const Vec3d& direction, void* userData)=NULL, void* userData=NULL); |
2725 | |
2726 | |
2727 | === modified file 'src/core/modules/GridLinesMgr.cpp' |
2728 | --- src/core/modules/GridLinesMgr.cpp 2015-03-22 09:33:56 +0000 |
2729 | +++ src/core/modules/GridLinesMgr.cpp 2015-04-09 09:33:54 +0000 |
2730 | @@ -329,8 +329,8 @@ |
2731 | gridStepMeridianRad = (frameType==StelCore::FrameAltAz || frameType==StelCore::FrameGalactic) ? M_PI/180.* 10. : M_PI/180.* 15.; |
2732 | else |
2733 | { |
2734 | - const double closetResLon = (frameType==StelCore::FrameAltAz || frameType==StelCore::FrameGalactic) ? getClosestResolutionDMS(prj->getPixelPerRadAtCenter()*std::cos(lat2)) : getClosestResolutionHMS(prj->getPixelPerRadAtCenter()*std::cos(lat2)); |
2735 | - gridStepMeridianRad = M_PI/180.* ((northPoleInViewport || southPoleInViewport) ? 15. : closetResLon); |
2736 | + const double closestResLon = (frameType==StelCore::FrameAltAz || frameType==StelCore::FrameGalactic) ? getClosestResolutionDMS(prj->getPixelPerRadAtCenter()*std::cos(lat2)) : getClosestResolutionHMS(prj->getPixelPerRadAtCenter()*std::cos(lat2)); |
2737 | + gridStepMeridianRad = M_PI/180.* ((northPoleInViewport || southPoleInViewport) ? 15. : closestResLon); |
2738 | } |
2739 | |
2740 | // Get the bounding halfspace |
2741 | |
2742 | === modified file 'src/core/modules/LandscapeMgr.hpp' |
2743 | --- src/core/modules/LandscapeMgr.hpp 2015-01-24 16:08:50 +0000 |
2744 | +++ src/core/modules/LandscapeMgr.hpp 2015-04-09 09:33:54 +0000 |
2745 | @@ -24,11 +24,11 @@ |
2746 | |
2747 | #include "StelModule.hpp" |
2748 | #include "StelUtils.hpp" |
2749 | +#include "Landscape.hpp" |
2750 | |
2751 | #include <QMap> |
2752 | #include <QStringList> |
2753 | |
2754 | -class Landscape; |
2755 | class Atmosphere; |
2756 | class Cardinals; |
2757 | class QSettings; |
2758 | @@ -117,7 +117,7 @@ |
2759 | Landscape* createFromFile(const QString& landscapeFile, const QString& landscapeId); |
2760 | |
2761 | // GZ: implement StelModule's method. For test purposes only, we implement a manual transparency sampler. |
2762 | - // TODO: comment this away for final builds |
2763 | + // TODO: comment this away for final builds. Please leave it in until this feature is finished. |
2764 | // virtual void handleMouseClicks(class QMouseEvent*); |
2765 | |
2766 | public slots: |
2767 | @@ -325,7 +325,9 @@ |
2768 | //! Set flag for auto-enable atmosphere for planets with atmospheres in location window |
2769 | void setFlagAtmosphereAutoEnable(bool b); |
2770 | |
2771 | - |
2772 | + //! Forward opacity query to current landscape. |
2773 | + //! @param azalt direction of view line to sample in azaltimuth coordinates. |
2774 | + float getLandscapeOpacity(Vec3d azalt) const {return landscape->getOpacity(azalt);} |
2775 | |
2776 | signals: |
2777 | void atmosphereDisplayedChanged(const bool displayed); |
Georg, Meteor Showers plugin has similar feature (QColorDialog) and I didn't have any problem with selecting color in the fullscreen mode. Forced switching in the windowed mode is not good idea IMHO.