Merge branch 'master' into feature/NewAtmosphere

This commit is contained in:
Jonathas Costa
2017-06-08 12:13:32 -04:00
58 changed files with 9965 additions and 2927 deletions

View File

@@ -96,7 +96,7 @@ add_executable(${APPLICATION_NAME}
${RESOURCE_FILE}
)
if (OPENSPACE_SPOUT_SUPPORT)
copy_files(
ghl_copy_files(
${APPLICATION_NAME}
${OPENSPACE_APPS_DIR}/OpenSpace/ext/spout/SpoutLibrary.dll
)

View File

@@ -42,10 +42,16 @@
#include <fmt/format.h>
#include <Windows.h>
#include <dbghelp.h>
#include <shellapi.h>
#include <shlobj.h>
#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable : 4091)
#include <dbghelp.h>
#pragma warning (pop)
#endif // _MSC_VER
#endif // WIN32
#ifdef OPENVR_SUPPORT

View File

@@ -95,6 +95,7 @@ return {
"sun",
"stars",
"milkyway",
-- "satellites"
}
}

View File

@@ -14,6 +14,18 @@ return {
},
},
},
{
-- The default reference frame for Earth-orbiting satellites
Name = "EarthInertial",
Parent = "EarthBarycenter",
Transform = {
Rotation = {
Type = "SpiceRotation",
SourceFrame = "J2000",
DestinationFrame = "GALACTIC",
}
},
},
-- EarthTrail module
{
Name = "EarthTrail",

View File

@@ -0,0 +1,71 @@
function preInitialization()
--[[
The scripts in this function are executed after the scene is loaded but before the
scene elements have been initialized, thus they should be used to set the time at
which the scene should start and other settings that might determine initialization
critical objects.
]]--
openspace.spice.loadKernel("${SPICE}/naif0011.tls")
openspace.spice.loadKernel("${SPICE}/pck00010.tpc")
-- openspace.spice.loadKernel("${OPENSPACE_DATA}/spice/de430_1850-2150.bsp")
openspace.time.setTime(openspace.time.currentWallTime())
--Test for vernal equinox time 2017
--openspace.time.setTime("2017 MAR 20 10:28:30.500")
dofile(openspace.absPath('${SCRIPTS}/bind_keys_satellites.lua'))
end
function postInitialization()
--[[
The scripts in this function are executed after all objects in the scene have been
created and initialized, but before the first render call. This is the place to set
graphical settings for the renderables.
]]--
openspace.printInfo("Setting default values")
openspace.setPropertyValue("SunMarker.renderable.enabled", false)
openspace.setPropertyValue("SunGlare.renderable.enabled", false)
openspace.setPropertyValue("MilkyWay.renderable.enabled", false)
openspace.setPropertyValue("EarthMarker.renderable.enabled", false)
openspace.setPropertyValue("EarthTrail.renderable.enabled", false)
openspace.setPropertyValue("Earth.renderable.performShading", false)
openspace.resetCameraDirection()
openspace.printInfo("Done setting default values")
if openspace.modules.isLoaded("ISWA") then
openspace.iswa.addCdfFiles("${OPENSPACE_DATA}/cdflist.json");
--openspace.iswa.addCygnet(7);
--openspace.iswa.addCygnet(-4,"Data","Gm");
--openspace.iswa.addCygnet(-5,"Data","Gm");
--openspace.iswa.addCygnet(-6,"Data","Gm");
--openspace.iswa.addCygnet(-7,"Data","Gm");
--openspace.iswa.addCygnet(-8,"Data","Gm");
--openspace.iswa.addCygnet(-9,"Data","Gm");
end
end
return {
ScenePath = ".",
CommonFolder = "common",
Camera = {
Focus = "Earth",
Position = {-54343425747.129051, -73298476295.934555, 116584089130.590012},
Rotation = {-0.078983, 0.830093, 0.014241, -0.551819},
},
Modules = {
--"satellites/earth",
"sun",
"earth",
-- "stars",
-- "milkyway",
"satellites"
}
}

View File

@@ -0,0 +1,66 @@
#!/bin/lua
--For debug purposes, but also for generating raw output in case the parsing
-- isn't working as intended.
function tableLength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
output = dofile("satellites.mod")
outputLen = tableLength(output)
print("return {")
for i=1,outputLen do
type=output[i].Renderable.Type
print(" {")
if( type == "RenderablePlane" ) then
print(" Name = \"" .. output[i].Name .. "\",")
print(" Parent = \"" .. output[i].Parent .. "\",")
print(" Renderable = {")
print(" Type = \"" .. output[i].Renderable.Type .. "\",")
print(" Size = {".. output[i].Renderable.Size[1] .. "," .. output[i].Renderable.Size[2] .. "},")
print(" Origin = \"".. output[i].Renderable.Origin .. "\",")
print(" Body = \"" .. output[i].Renderable.Body .. "\",")
if (output[i].Renderable.Billboard) then
print(" Billboard = true,")
else
print(" Billboard = false,")
end
print(" Texture = \"" .. output[i].Renderable.Texture .. "\",")
print(" },")
print(" Transform = {")
print(" Translation = {")
print(" Type = \"" .. output[i].Transform.Translation.Type .. "\",")
print(" Body = \"" .. output[i].Transform.Translation.Body .. "\",")
print(" Observer = \"" .. output[i].Transform.Translation.Observer .. "\",")
print(" File = \"" .. output[i].Transform.Translation.File .. "\",")
print(" LineNum = " .. output[i].Transform.Translation.LineNum .. ",")
print(" },")
print(" Scale = {")
print(" Type = \"" .. output[i].Transform.Scale.Type .. "\",")
print(" Scale = " .. output[i].Transform.Scale.Scale .. ",")
print(" },")
print(" },")
elseif( type == "RenderableTrailOrbit" ) then
print(" Name = \"" .. output[i].Name .. "\",")
print(" Parent = \"" .. output[i].Parent .. "\",")
print(" Renderable = {")
print(" Type = \"" .. output[i].Renderable.Type .. "\",")
print(" Translation = {")
print(" Type = \"" .. output[i].Renderable.Translation.Type .. "\",")
print(" Body = \"" .. output[i].Renderable.Translation.Body .. "\",")
print(" Observer = \"" .. output[i].Renderable.Translation.Observer .. "\",")
print(" File = \"" .. output[i].Renderable.Translation.File .. "\",")
print(" LineNum = " .. output[i].Renderable.Translation.LineNum .. ",")
print(" },")
print(" Color = {" .. output[i].Renderable.Color[1] .. "," .. output[i].Renderable.Color[2] .. "," .. output[i].Renderable.Color[3] .. "},")
print(" Period = " .. output[i].Renderable.Period .. ",")
print(" Resolution = " .. output[i].Renderable.Resolution .. ",")
print(" },")
print(" GuiName = \"" .. output[i].GuiName .. "\",")
end
print(" },")
end
print("}")

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1,169 @@
DOWNLOAD = false
function dirListing(dirname)
f = io.popen('ls ' .. dirname)
files = {}
for name in f:lines() do
table.insert(files, name)
end
return files
end
function values(t)
local i = 0
return function () i = i + 1; return t[i] end
end
function trimString(s)
s = s:gsub("^%s*(.-)%s*$", "%1")
s = s:gsub("%s+", "_")
s = s:gsub("[%-()]", "")
return s
end
function getPeriodFromFile(line2)
return tonumber(string.sub(line2, 53, 63))
end
function getNumLinesInFile(filename)
local ctr = 0
for _ in io.lines(filename) do
ctr = ctr + 1
end
return ctr
end
function isEmpty(s)
return s == nil or s == ''
end
--Check format of a set of 3 TLE file lines and return nonzero if there is a format error
function checkTleFileFormat(lineArr)
if isEmpty(lineArr[1]) or isEmpty(lineArr[2]) or isEmpty(lineArr[3]) then
return -1
end
if string.sub(lineArr[2], 1, 2) ~= "1 " then
return -1
end
if string.sub(lineArr[3], 1, 2) ~= "2 " then
return -1
end
return 0
end
function getSat(title, file, lineNum)
return {
Name = title,
Parent = "EarthInertial",
Renderable = {
Type = "RenderablePlane",
Size = 3e4,
Origin = "Center",
Body = "TLE",
Billboard = true,
Texture = "satB.png"
},
Transform = {
Translation = {
Type = "TLETranslation",
Body = title,
Observer = "EarthInertial",
File = file,
LineNum = lineNum
},
Scale = {
Type = "StaticScale",
Scale = 1,
}
}
}
end
function getSatTrail(title, file, lineNum, per, color)
trailName = title .. "_trail"
return {
Name = trailName,
Parent = "EarthInertial",
Renderable = {
Type = "RenderableTrailOrbit",
Translation = {
Type = "TLETranslation",
Body = title,
Observer = "EarthInertial",
File = file,
LineNum = lineNum
},
Color = color,
Period = per,
Resolution = 160
},
GuiName = "/Satellites/" .. trailName
}
end
-------------------------------------------------------------
--Name, URL, and color scheme for each satellite group
satelliteGroups = {
{ title = "GPS",
url = "http://celestrak.com/NORAD/elements/gps-ops.txt",
trailColor = {0.9, 0.5, 0.0}
},
{ title = "SpaceStations",
url = "http://celestrak.com/NORAD/elements/stations.txt",
trailColor = {0.9, 0.0, 0.0}
},
{ title = "Geostationary",
url = "http://celestrak.com/NORAD/elements/geo.txt",
trailColor = {0.9, 0.9, 0.0}
},
}
modElements = {}
fileErr = ""
for sOrbit in values(satelliteGroups) do
filename = sOrbit.url:match("([^/]+)$")
filenameSansExt = filename:gsub(filename:match "(%.%w+)$", "")
sOrbit.path = "satellites/tle/" .. filename
if DOWNLOAD then
openspace.downloadFile(sOrbit.url, sOrbit.path)
end
sOrbit.path = "../" .. sOrbit.path
pathFromScenegraphParent = "./" .. sOrbit.path
line = {}
myfile = io.open(sOrbit.path, "r")
lines = getNumLinesInFile(sOrbit.path)
--now loop through the tle file and get each set of 3 lines
if myfile then
for n=1,lines,3 do
line[1] = myfile:read('*l') --title line
line[2] = myfile:read('*l')
line[3] = myfile:read('*l')
if( checkTleFileFormat(line) == 0 ) then
title = trimString(line[1])
per = getPeriodFromFile(line[3])
per = 1.0 / per * 2 --trail for 2x a single revolution
table.insert(modElements, getSat(filenameSansExt .. "_" .. title, pathFromScenegraphParent, n))
table.insert(modElements, getSatTrail(filenameSansExt .. "_" .. title,
pathFromScenegraphParent, n, per, sOrbit.trailColor))
else
fileErr = " TLE file syntax error on line " .. n .. ": " .. sOrbit.path
break
end
end
else
fileErr = " File not found: " .. sOrbit.path
break
end
end
assert(fileErr == "", fileErr)
if (fileErr == "") then
return modElements
else
return "Invalid file: " .. fileErr
end

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,93 @@
GPS BIIR-2 (PRN 13)
1 24876U 97035A 17157.59786847 .00000019 00000-0 00000-0 0 9996
2 24876 55.5513 227.5274 0034589 106.0906 254.3641 2.00561883145810
GPS BIIR-3 (PRN 11)
1 25933U 99055A 17157.81823278 -.00000081 00000-0 00000-0 0 9990
2 25933 51.6254 78.0928 0166095 94.4525 354.0300 2.00558378129440
GPS BIIR-4 (PRN 20)
1 26360U 00025A 17157.82515987 .00000060 00000-0 00000-0 0 9996
2 26360 53.1170 155.3222 0040993 91.9775 104.3666 2.00561532125131
GPS BIIR-5 (PRN 28)
1 26407U 00040A 17157.93926722 -.00000076 00000-0 00000-0 0 9998
2 26407 56.6372 345.5470 0199158 270.1220 289.7792 2.00567008123812
GPS BIIR-6 (PRN 14)
1 26605U 00071A 17157.87543271 .00000026 00000-0 00000-0 0 9993
2 26605 55.1227 225.2520 0093903 248.3083 174.0281 2.00565489121414
GPS BIIR-7 (PRN 18)
1 26690U 01004A 17157.89507387 .00000063 00000-0 00000-0 0 9995
2 26690 53.0389 158.2602 0183394 256.9116 288.9071 2.00570451119814
GPS BIIR-8 (PRN 16)
1 27663U 03005A 17157.94951778 -.00000076 00000-0 00000-0 0 9997
2 27663 56.7061 345.2850 0092504 24.7076 300.8478 2.00560319105174
GPS BIIR-9 (PRN 21)
1 27704U 03010A 17157.88465515 -.00000050 00000-0 00000-0 0 9993
2 27704 53.8528 98.6489 0242249 264.5394 334.3334 2.00563816103977
GPS BIIR-10 (PRN 22)
1 28129U 03058A 17157.28858587 .00000066 00000-0 00000-0 0 9992
2 28129 52.9268 158.2762 0077488 261.4987 97.6433 2.00547197 98653
GPS BIIR-11 (PRN 19)
1 28190U 04009A 17157.67197517 -.00000090 00000-0 00000-0 0 9997
2 28190 55.9984 46.3329 0100885 55.9552 221.8691 2.00564644 96849
GPS BIIR-12 (PRN 23)
1 28361U 04023A 17157.86272955 .00000033 00000-0 00000-0 0 9990
2 28361 54.1085 220.3751 0119012 220.1274 106.1343 2.00555923 94908
GPS BIIR-13 (PRN 02)
1 28474U 04045A 17157.74251056 -.00000050 00000-0 00000-0 0 9995
2 28474 54.2321 98.1213 0170418 247.2038 351.6925 2.00548722 92298
GPS BIIRM-1 (PRN 17)
1 28874U 05038A 17157.68738399 -.00000090 00000-0 00000-0 0 9999
2 28874 56.1546 43.5924 0118451 254.5136 55.9262 2.00568186 85694
GPS BIIRM-2 (PRN 31)
1 29486U 06042A 17157.89402977 -.00000073 00000-0 00000-0 0 9999
2 29486 55.4047 282.7005 0084721 343.9526 36.5660 2.00559154 78309
GPS BIIRM-3 (PRN 12)
1 29601U 06052A 17157.30711204 -.00000075 00000-0 00000-0 0 9993
2 29601 56.6791 344.2294 0064809 49.4604 311.1238 2.00552294 77266
GPS BIIRM-4 (PRN 15)
1 32260U 07047A 17157.13563594 .00000032 00000-0 00000-0 0 9993
2 32260 53.2348 216.7628 0090280 32.1796 328.4497 2.00547487 70695
GPS BIIRM-5 (PRN 29)
1 32384U 07062A 17156.21822177 -.00000098 00000-0 00000-0 0 9993
2 32384 56.2180 44.2317 0006335 4.0971 192.7823 2.00570259 69404
GPS BIIRM-6 (PRN 07)
1 32711U 08012A 17157.53427379 -.00000075 00000-0 00000-0 0 9999
2 32711 55.1332 282.0856 0107470 212.2063 147.1234 2.00556288 67631
GPS BIIRM-8 (PRN 05)
1 35752U 09043A 17157.70219478 .00000069 00000-0 00000-0 0 9992
2 35752 54.2537 159.9422 0048788 28.4210 116.6992 2.00553334 57229
GPS BIIF-1 (PRN 25)
1 36585U 10022A 17157.89436302 -.00000078 00000-0 00000-0 0 9994
2 36585 55.9864 341.0322 0063534 45.4099 345.2901 2.00574808 51467
GPS BIIF-2 (PRN 01)
1 37753U 11036A 17157.85963422 -.00000044 00000-0 00000-0 0 9995
2 37753 55.4395 101.1871 0066031 30.2070 60.5198 2.00562311 43146
GPS BIIF-3 (PRN 24)
1 38833U 12053A 17157.72375300 -.00000072 00000-0 00000-0 0 9994
2 38833 54.1611 279.0056 0055661 25.8719 334.3965 2.00561617 33411
GPS BIIF-4 (PRN 27)
1 39166U 13023A 17157.07836358 -.00000093 00000-0 00000-0 0 9998
2 39166 55.8615 40.6350 0047704 18.0209 342.1899 2.00565151 29728
GPS BIIF-5 (PRN 30)
1 39533U 14008A 17157.58173524 -.00000078 00000-0 00000-0 0 9998
2 39533 54.3154 284.3055 0028684 182.6529 177.3191 2.00563830 23567
GPS BIIF-6 (PRN 06)
1 39741U 14026A 17157.35873360 -.00000044 00000-0 00000-0 0 9992
2 39741 55.4261 100.7272 0009830 291.4939 68.3647 2.00562339 22395
GPS BIIF-7 (PRN 09)
1 40105U 14045A 17157.45126217 .00000031 00000-0 00000-0 0 9997
2 40105 54.6318 220.2927 0005069 122.1672 237.9622 2.00569715 19965
GPS BIIF-8 (PRN 03)
1 40294U 14068A 17157.32446828 .00000074 00000-0 00000-0 0 9997
2 40294 55.0008 160.9300 0007263 345.6258 14.3805 2.00557500 19060
GPS BIIF-9 (PRN 26)
1 40534U 15013A 17157.46020623 -.00000081 00000-0 00000-0 0 9990
2 40534 54.9417 340.1560 0018129 358.6255 1.3832 2.00559260 16117
GPS BIIF-10 (PRN 08)
1 40730U 15033A 17157.11983367 -.00000094 00000-0 00000-0 0 9999
2 40730 55.3960 40.3091 0027177 318.4074 41.4282 2.00567662 13865
GPS BIIF-11 (PRN 10)
1 41019U 15062A 17157.67265313 .00000072 00000-0 00000-0 0 9992
2 41019 55.0103 160.7038 0026458 206.0557 153.8364 2.00563621 11698
GPS BIIF-12 (PRN 32)
1 41328U 16007A 17157.76013989 .00000034 00000-0 00000-0 0 9993
2 41328 54.8890 220.4662 0013935 220.3704 139.6078 2.00556828 9756

View File

@@ -0,0 +1,285 @@
ISS (ZARYA)
1 25544U 98067A 17157.94655197 .00002630 00000-0 47191-4 0 9994
2 25544 51.6418 89.3693 0004703 241.3496 157.2990 15.53992000 60168
TIANGONG 1
1 37820U 11053A 17157.70967876 .00020914 00000-0 11813-3 0 9994
2 37820 42.7593 264.1306 0019426 359.5204 148.5490 15.78435713326314
AGGIESAT 4
1 41313U 98067HP 17157.16086447 .00018711 00000-0 13577-3 0 9993
2 41313 51.6375 59.3234 0004723 101.9367 258.2161 15.73442509 77199
BEVO 2
1 41314U 98067HQ 17157.88632967 .00703414 31345-3 45291-3 0 9995
2 41314 51.6177 25.8163 0007485 251.9715 108.0487 16.16778687 77482
NODES 2
1 41477U 98067HX 17157.90383726 .00052219 00000-0 26238-3 0 9995
2 41477 51.6294 56.6595 0003371 94.5932 265.5455 15.81168393 60445
NODES 1
1 41478U 98067HY 17157.81578248 .00053127 00000-0 27329-3 0 9992
2 41478 51.6327 57.5946 0003116 94.0560 266.0798 15.80650524 60427
FLOCK 2E'-1
1 41479U 98067HZ 17157.82937824 .00017516 00000-0 15561-3 0 9990
2 41479 51.6361 69.0720 0001235 132.9379 227.1721 15.68631858 60232
FLOCK 2E'-3
1 41480U 98067JA 17157.85350922 .00015886 00000-0 14210-3 0 9991
2 41480 51.6360 68.5033 0000732 66.0320 294.0753 15.68548906 60237
FLOCK 2E'-2
1 41481U 98067JB 17157.93598542 .00014396 00000-0 12524-3 0 9994
2 41481 51.6345 66.7643 0001590 141.5719 218.5391 15.69326443 60254
FLOCK 2E'-4
1 41482U 98067JC 17157.79065223 .00022341 00000-0 17773-3 0 9994
2 41482 51.6345 66.5289 0001496 79.7829 280.3337 15.71128503 60244
FLOCK 2E-1
1 41483U 98067ID 17157.29569450 .00013969 00000-0 13019-3 0 9996
2 41483 51.6375 72.3135 0002141 32.0954 328.0172 15.67656718 59998
FLOCK 2E-2
1 41484U 98067JE 17157.23012824 .00019455 00000-0 16890-3 0 9995
2 41484 51.6385 71.1428 0002213 46.7114 313.4067 15.69112127 60000
FLOCK 2E-3
1 41486U 98067JG 17157.94249624 .00012046 00000-0 11618-3 0 9997
2 41486 51.6371 70.6259 0002649 64.7641 295.3629 15.66964173 60095
FLOCK 2E-4
1 41487U 98067JH 17157.79997702 .00013956 00000-0 12913-3 0 9998
2 41487 51.6373 69.6496 0003643 57.6827 302.4521 15.67836732 60092
FLOCK 2E-6
1 41563U 98067JM 17157.84789515 .00010970 00000-0 10867-3 0 9999
2 41563 51.6366 71.4681 0001397 138.8569 221.2533 15.66405325 58148
FLOCK 2E-5
1 41564U 98067JN 17157.85787038 .00011762 00000-0 11662-3 0 9993
2 41564 51.6367 71.5423 0001207 135.2529 224.8564 15.66295284 58135
FLOCK 2E-7
1 41565U 98067JP 17157.81556449 .00017448 00000-0 15131-3 0 9992
2 41565 51.6360 68.2287 0004609 80.6839 279.4679 15.69221451 58070
FLOCK 2E-8
1 41566U 98067JQ 17157.91086070 .00121698 16725-4 36063-3 0 9997
2 41566 51.6286 49.8665 0004713 142.6928 217.4407 15.92335896 58310
FLOCK 2E'-5
1 41567U 98067JR 17157.78191446 .00011191 00000-0 11495-3 0 9990
2 41567 51.6378 73.2981 0004907 93.3825 266.7732 15.65457253 57979
FLOCK 2E'-6
1 41568U 98067JS 17157.77145550 .00014626 00000-0 13869-3 0 9998
2 41568 51.6364 70.9405 0004513 92.1048 268.0465 15.67174872 58038
FLOCK 2E'-8
1 41569U 98067JT 17157.91417765 .00016441 00000-0 14148-3 0 9993
2 41569 51.6361 67.3905 0002434 64.2282 295.8966 15.69467197 57974
FLOCK 2E'-7
1 41570U 98067JU 17157.81477341 .00022161 00000-0 16934-3 0 9991
2 41570 51.6364 65.2376 0002923 51.8320 308.2941 15.72094779 58010
FLOCK 2E-9
1 41571U 98067JV 17157.85234832 .00017668 00000-0 14924-3 0 9995
2 41571 51.6366 66.9928 0004309 82.3948 277.7538 15.69854026 57958
FLOCK 2E-10
1 41572U 98067JW 17157.81407914 .00017118 00000-0 15232-3 0 9998
2 41572 51.6364 68.9926 0004709 84.5269 275.6265 15.68604804 57928
FLOCK 2E-12
1 41573U 98067JX 17157.94759666 .00016648 00000-0 14342-3 0 9995
2 41573 51.6359 67.6218 0004148 94.9148 265.2323 15.69425430 57951
FLOCK 2E-11
1 41574U 98067JY 17157.94425949 .00017277 00000-0 14780-3 0 9995
2 41574 51.6347 66.8056 0005101 97.8056 262.3520 15.69560822 57963
FLOCK 2E'-9
1 41575U 98067JZ 17157.81983142 .00020007 00000-0 16391-3 0 9991
2 41575 51.6346 66.7030 0004859 109.2903 250.8620 15.70492303 57943
FLOCK 2E'-10
1 41576U 98067KA 17157.81080505 .00018690 00000-0 16006-3 0 9991
2 41576 51.6368 68.2311 0004669 108.5169 251.6336 15.69470167 57824
FLOCK 2E'-11
1 41577U 98067KB 17157.84387094 .00016884 00000-0 14804-3 0 9995
2 41577 51.6373 68.4600 0005029 90.7988 269.3585 15.68978391 57649
FLOCK 2E'-12
1 41578U 98067KC 17157.85229234 .00021128 00000-0 17555-3 0 9991
2 41578 51.6350 67.7005 0005424 83.6803 276.4812 15.70108031 57654
FLOCK 2E'-13
1 41761U 98067KH 17157.84121992 .00007650 00000-0 96912-4 0 9995
2 41761 51.6386 82.7486 0005694 217.4113 142.6484 15.60558941 41297
FLOCK 2E'-14
1 41762U 98067KJ 17157.95581036 .00008251 00000-0 10337-3 0 9991
2 41762 51.6398 82.0348 0005588 217.7092 142.3510 15.60728191 41318
FLOCK 2E'-16
1 41763U 98067KK 17157.86607714 .00009474 00000-0 11591-3 0 9995
2 41763 51.6398 82.1815 0004711 229.1912 130.8674 15.61149602 41266
FLOCK 2E'-15
1 41764U 98067KL 17157.85165937 .00007422 00000-0 94554-4 0 9993
2 41764 51.6395 82.8349 0005200 225.0806 134.9766 15.60465657 41250
TIANGONG-2
1 41765U 16057A 17157.80446253 .00002148 00000-0 29064-4 0 9995
2 41765 42.7836 56.6308 0011038 266.5003 156.2729 15.61250586 41363
FLOCK 2E'-18
1 41769U 98067KM 17157.90167314 .00007746 00000-0 98248-4 0 9998
2 41769 51.6397 82.4126 0004132 251.5664 108.4880 15.60508848 41269
FLOCK 2E'-17
1 41776U 98067KN 17157.95839727 .00007735 00000-0 97973-4 0 9997
2 41776 51.6407 82.0579 0004483 252.8988 107.1514 15.60548603 41262
FLOCK 2E'-19
1 41777U 98067KP 17157.25856684 .00014123 00000-0 15879-3 0 9995
2 41777 51.6383 83.3506 0003434 249.6465 110.4161 15.62884005 41142
FLOCK 2E'-20
1 41782U 98067KQ 17157.95631435 .00009933 00000-0 11651-3 0 9990
2 41782 51.6397 80.5325 0003339 246.9810 113.0833 15.62193473 41113
BANXING-2
1 41834U 16057H 17157.77057558 .00008103 00000-0 75609-4 0 9997
2 41834 42.7847 52.6919 0007283 184.5004 279.8030 15.67673228 35473
STARS-C
1 41895U 98067KR 17157.84313134 .00019979 00000-0 23763-3 0 9994
2 41895 51.6388 85.7683 0002910 282.4174 77.6493 15.61123932 26374
TANCREDO-1
1 41931U 98067KT 17157.96072007 .00039094 00000-0 36943-3 0 9993
2 41931 51.6375 82.7854 0004077 216.5790 143.4928 15.66595418 21991
ITF-2
1 41932U 98067KU 17157.88784681 .00010759 00000-0 14197-3 0 9997
2 41932 51.6410 86.8287 0004551 222.4119 137.6522 15.58968825 21931
WASEDA-SAT3
1 41933U 98067KV 17157.86766680 .00012735 00000-0 16372-3 0 9998
2 41933 51.6393 86.6847 0004401 224.8923 135.1714 15.59470034 21932
AOBA-VELOX 3
1 41935U 98067KX 17157.81606468 .00011476 00000-0 14944-3 0 9996
2 41935 51.6407 87.0963 0003886 226.1035 133.9638 15.59246212 22020
TUPOD
1 41936U 98067KY 17157.83506049 .00063704 00000-0 50159-3 0 9992
2 41936 51.6364 81.9421 0002677 193.2921 166.8006 15.70842192 21474
OSNSAT
1 41939U 98067KZ 17157.84088402 .00022114 00000-0 24411-3 0 9996
2 41939 51.6393 84.9970 0004937 223.7956 136.2648 15.62981464 21312
PROGRESS-MS 05
1 42056U 17010A 17157.62806167 .00002380 00000-0 43406-4 0 9997
2 42056 51.6419 90.9570 0004682 239.7339 175.9756 15.53988626 60112
LEMUR-2-REDFERN-GOES
1 42059U 98067LA 17157.87023427 .00010532 00000-0 14537-3 0 9998
2 42059 51.6398 88.2022 0006952 257.0236 102.9980 15.57773986 14409
TECHEDSAT 5
1 42066U 98067LB 17157.88081783 .00130272 00000-0 92629-3 0 9998
2 42066 51.6337 83.7399 0002362 159.2104 200.8991 15.72955201 14190
LEMUR-2-TRUTNA
1 42067U 98067LC 17157.83820430 .00021776 00000-0 27852-3 0 9998
2 42067 51.6394 87.9877 0006160 253.1659 106.8658 15.59134351 14230
LEMUR-2-AUSTINTACIOUS
1 42068U 98067LD 17157.86892448 .00014740 00000-0 19909-3 0 9997
2 42068 51.6396 88.1920 0006243 256.1891 103.8407 15.57991820 14338
LEMUR-2-TRUTNAHD
1 42069U 98067LE 17157.80477585 .00011342 00000-0 15525-3 0 9998
2 42069 51.6404 88.5168 0006281 253.3949 106.6354 15.57911149 14374
ISS DEB
1 42434U 98067LF 17157.20389631 .00040897 00000-0 48519-3 0 9998
2 42434 51.6377 91.2421 0003699 204.1460 155.9360 15.60776006 10458
CYGNUS OA-7
1 42681U 17019A 17157.83399044 .00001407 00000-0 30326-4 0 9990
2 42681 51.6394 89.9608 0004737 238.3552 236.4249 15.52253009 7650
SOYUZ-MS 04
1 42682U 17020A 17157.62806167 .00002380 00000-0 43406-4 0 9993
2 42682 51.6419 90.9570 0004682 239.7339 175.9756 15.53988626 60117
TIANZHOU 1
1 42684U 17021A 17153.14877196 .00078565 00000-0 89444-3 0 9998
2 42684 42.7826 84.4016 0010794 236.6582 266.9899 15.61251018 6668
ISS DEB
1 42697U 98067LG 17157.84861892 .00037507 00000-0 52116-3 0 9995
2 42697 51.6412 89.5469 0003850 241.7810 118.2802 15.56620141 5063
SOMP2
1 42700U 98067LH 17157.85852898 .00010448 00000-0 15717-3 0 9998
2 42700 51.6402 89.6186 0005697 289.6047 70.4329 15.55441951 3338
HAVELSAT
1 42701U 98067LJ 17157.85877506 .00009249 00000-0 14019-3 0 9993
2 42701 51.6404 89.6204 0005687 290.2093 69.8287 15.55398233 3328
COLUMBIA
1 42702U 98067LK 17157.85640689 .00019375 00000-0 28110-3 0 9992
2 42702 51.6402 89.6049 0005582 283.5939 76.4431 15.55829187 3256
SGSAT
1 42703U 98067LL 17157.85837147 .00016082 00000-0 23650-3 0 9996
2 42703 51.6399 89.6179 0001779 215.0092 145.0783 15.55619060 3249
CXBN-2
1 42704U 98067LM 17157.86087475 .00009857 00000-0 14967-3 0 9992
2 42704 51.6403 89.6346 0001531 217.8699 142.2185 15.55266596 3259
ICECUBE
1 42705U 98067LN 17157.86139170 .00012469 00000-0 18766-3 0 9997
2 42705 51.6404 89.6388 0001477 225.7849 134.3021 15.55229909 3316
PHOENIX
1 42706U 98067LP 17157.85919097 .00010424 00000-0 15699-3 0 9992
2 42706 51.6405 89.6243 0000606 264.1635 95.9287 15.55419085 3245
X-CUBESAT
1 42707U 98067LQ 17157.85942325 .00010489 00000-0 15798-3 0 9994
2 42707 51.6402 89.6253 0000714 261.3522 98.7388 15.55408199 3234
QBEE50-LTU-OC
1 42708U 98067LR 17157.85976115 .00010073 00000-0 15218-3 0 9995
2 42708 51.6403 89.6273 0000806 257.2200 102.8701 15.55374747 3199
ALTAIR PATHFINDER
1 42711U 98067LS 17157.86492244 .00006899 00000-0 10825-3 0 9996
2 42711 51.6401 89.6607 0004088 214.3267 145.7460 15.54917330 2901
SHARC
1 42712U 98067LT 17157.86348986 .00006919 00000-0 10815-3 0 9992
2 42712 51.6404 89.6521 0001998 212.8804 147.2063 15.55020563 3144
ZA-AEROSAT
1 42713U 98067LU 17157.86235707 .00008829 00000-0 13523-3 0 9990
2 42713 51.6402 89.6446 0001922 199.0347 161.0573 15.55180619 2906
LINK
1 42714U 98067LV 17157.86266135 .00009504 00000-0 14497-3 0 9992
2 42714 51.6401 89.6466 0002117 206.7176 153.3706 15.55190802 3011
CSUNSAT 1
1 42715U 98067LW 17157.86415953 .00009161 00000-0 14070-3 0 9993
2 42715 51.6400 89.6561 0004236 203.1814 156.8987 15.55050192 2904
UPSAT
1 42716U 98067LX 17157.86094233 .00011468 00000-0 17226-3 0 9997
2 42716 51.6402 89.6352 0004008 295.0779 64.9796 15.55373568 3039
SPACECUBE
1 42717U 98067LY 17157.86170034 .00009917 00000-0 15049-3 0 9999
2 42717 51.6403 89.6401 0003993 293.5006 66.5565 15.55272760 2273
HOOPOE
1 42718U 98067LZ 17157.86153836 .00010781 00000-0 16274-3 0 9993
2 42718 51.6403 89.6391 0003987 292.5690 67.4879 15.55311723 2274
UNSW-ECO
1 42721U 98067MA 17157.80343503 .00013771 00000-0 20735-3 0 9992
2 42721 51.6403 89.9999 0007120 268.2498 91.7677 15.55097441 1963
NJUST-1
1 42722U 98067MB 17157.25292095 .00001440 00000-0 28291-4 0 9997
2 42722 51.6402 92.7556 0007027 267.2164 245.0421 15.54901758 1874
CHALLENGER
1 42723U 98067MC 17157.80404552 .00011009 00000-0 16798-3 0 9992
2 42723 51.6404 90.0040 0006958 268.5782 91.4412 15.54978044 1941
DUTHSAT
1 42724U 98067MD 17157.80428604 .00013264 00000-0 20078-3 0 9998
2 42724 51.6404 90.0056 0006075 271.4432 88.5863 15.54994883 1861
LILACSAT-1
1 42725U 98067ME 17157.80476334 .00008530 00000-0 13233-3 0 9997
2 42725 51.6404 90.0092 0006008 272.8653 87.1650 15.54873181 1864
NSIGHT-1
1 42726U 98067MF 17157.86942714 .00006534 00000-0 10336-3 0 9997
2 42726 51.6405 89.6907 0005990 273.7292 86.3014 15.54792750 1882
SNUSAT-1
1 42727U 98067MG 17157.86945727 .00009989 00000-0 15371-3 0 9996
2 42727 51.6398 89.6902 0007575 228.4973 131.5369 15.54864564 1848
QBITO
1 42728U 98067MH 17155.94045484 .00010441 00000-0 16007-3 0 9997
2 42728 51.6397 99.3085 0003029 277.2248 82.8398 15.54926471 1380
AALTO-2
1 42729U 98067MJ 17155.81189444 .00010269 00000-0 15754-3 0 9995
2 42729 51.6399 99.9497 0003050 275.8476 84.2168 15.54929551 1379
SUSAT
1 42730U 98067MK 17157.80448090 .00010291 00000-0 15784-3 0 9991
2 42730 51.6404 90.0078 0003110 281.5326 78.5315 15.54933074 1678
I-INSPIRE II
1 42731U 98067ML 17156.13327249 .00009265 00000-0 14256-3 0 9991
2 42731 51.6393 98.3448 0007164 207.3399 152.7216 15.54972835 1467
POLYITAN-2-SAU
1 42732U 98067MM 17155.94043987 .00010678 00000-0 16312-3 0 9999
2 42732 51.6392 99.3069 0007216 206.4771 153.5852 15.54981238 1438
SNUSAT-1B
1 42733U 98067MN 17157.80452231 .00009513 00000-0 14625-3 0 9994
2 42733 51.6398 90.0067 0007034 214.9107 145.1423 15.54959154 1721
EXALTA-1
1 42734U 98067MP 17156.39039283 .00009453 00000-0 14516-3 0 9998
2 42734 51.6396 97.0623 0008589 235.9084 124.1092 15.54988337 1452
AOXIANG-1
1 42735U 98067MQ 17157.80450021 .00008356 00000-0 12927-3 0 9998
2 42735 51.6402 90.0072 0007677 265.5134 94.4980 15.54971752 3094
BEEAGLESAT
1 42736U 98067MR 17155.94091570 .00008525 00000-0 13203-3 0 9998
2 42736 51.6398 99.3106 0007570 257.5066 102.5078 15.54911642 1499
ATLANTIS
1 42737U 98067MS 17157.73973140 .00018727 00000-0 27851-3 0 9999
2 42737 51.6395 90.3231 0007506 257.5958 102.4193 15.55165668 1662
DRAGON CRS-11
1 42744U 17030A 17157.37842914 .00002356 00000-0 43046-4 0 9998
2 42744 51.6419 92.2016 0004681 238.9005 219.3491 15.53987082 60075
FALCON 9 DEB
1 42745U 17030B 17156.27917736 -.00003619 11440-4 00000-0 0 9999
2 42745 51.6486 97.5083 0103286 51.0958 103.4391 16.01768424 228
FALCON 9 DEB
1 42746U 17030C 17156.87548135 -.00561144 11417-4 -52194-3 0 9990
2 42746 51.6257 94.2528 0099282 55.6445 305.5405 16.01548785 322

View File

@@ -0,0 +1,48 @@
#!/bin/lua
function tableLength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
output = dofile("satellites.mod")
outputLen = tableLength(output)
for i=1,outputLen do
type=output[i].Renderable.Type
print("------------", i)
if( type == "RenderablePlane" ) then
print(output[i].Name)
print(output[i].Parent)
print(output[i].Renderable.Type)
print(output[i].Renderable.Size[1])
print(output[i].Renderable.Size[2])
print(output[i].Renderable.Origin)
print(output[i].Renderable.Body)
print(output[i].Renderable.Billboard)
print(output[i].Renderable.Texture)
print(output[i].Transform.Translation.Type)
print(output[i].Transform.Translation.Body)
print(output[i].Transform.Translation.Observer)
print(output[i].Transform.Translation.File)
print(output[i].Transform.Translation.LineNum)
print(output[i].Transform.Scale.Type)
print(output[i].Transform.Scale.Scale)
elseif( type == "RenderableTrailOrbit" ) then
print(output[i].Name)
print(output[i].Parent)
print(output[i].Renderable.Type)
print(output[i].Renderable.Translation.Type)
print(output[i].Renderable.Translation.Body)
print(output[i].Renderable.Translation.Observer)
print(output[i].Renderable.Translation.File)
print(output[i].Renderable.Translation.LineNum)
print(output[i].Renderable.Color[1])
print(output[i].Renderable.Color[2])
print(output[i].Renderable.Color[3])
print(output[i].Renderable.Period)
print(output[i].Renderable.Resolution)
print(output[i].GuiName)
end
end

File diff suppressed because it is too large Load Diff

View File

@@ -85,9 +85,19 @@ public:
DownloadManager(std::string requestURL, int applicationVersion,
bool useMultithreadedDownload = true);
// callbacks happen on a different thread
std::shared_ptr<FileFuture> downloadFile(const std::string& url, const ghoul::filesystem::File& file,
//downloadFile
// url - specifies the target of the download
// file - specifies path to local saved file
// overrideFile - if true, overrides existing file of same name
// failOnError - if true, http codes >= 400 (client/server errors) result in fail
// timeout_secs - timeout in seconds before giving up on download (0 = no timeout)
// finishedCallback - callback when download finished (happens on different thread)
// progressCallback - callback for status during (happens on different thread)
std::shared_ptr<FileFuture> downloadFile(const std::string& url,
const ghoul::filesystem::File& file,
bool overrideFile = true,
bool failOnError = false,
unsigned int timeout_secs = 0,
DownloadFinishedCallback finishedCallback = DownloadFinishedCallback(),
DownloadProgressCallback progressCallback = DownloadProgressCallback()
);

View File

@@ -66,7 +66,7 @@ struct CameraKeyframe {
// Follow focus node rotation?
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_followNodeRotation), reinterpret_cast<char*>(&_followNodeRotation) + sizeof(_followNodeRotation));
int nodeNameLength = _focusNode.size();
int nodeNameLength = static_cast<int>(_focusNode.size());
// Add focus node
buffer.insert(buffer.end(), reinterpret_cast<char*>(&nodeNameLength), reinterpret_cast<char*>(&nodeNameLength) + sizeof(nodeNameLength));

View File

@@ -91,6 +91,6 @@ bool compareKeyframeTimeWithTime(const KeyframeBase& a, double b);
} // namespace openspace
#include <openspace/util/timeline.inl>;
#include <openspace/util/timeline.inl>
#endif // __OPENSPACE_CORE___TIMELINE___H__

View File

@@ -325,7 +325,7 @@ void RenderableFieldlines::loadSeedPoints() {
loadSeedPointsFromTable();
break;
default:
ghoul_assert(false, "Missing case label");
throw ghoul::MissingCaseException();
}
}

View File

@@ -92,7 +92,7 @@ Geodetic2 GeodeticPatch::getCorner(Quad q) const {
case NORTH_EAST: return Geodetic2(maxLat(), maxLon());// northEastCorner();
case SOUTH_WEST: return Geodetic2(minLat(), minLon());// southWestCorner();
case SOUTH_EAST: return Geodetic2(minLat(), maxLon());// southEastCorner();
default: ghoul_assert(false, "Missing case label");
default: throw ghoul::MissingCaseException();
}
}

View File

@@ -28,6 +28,8 @@
#include <modules/globebrowsing/other/concurrentqueue.h>
#include <modules/globebrowsing/other/threadpool.h>
#include <mutex>
namespace openspace {
namespace globebrowsing {
@@ -62,6 +64,7 @@ public:
private:
ConcurrentQueue<std::shared_ptr<Job<P>>> _finishedJobs;
std::shared_ptr<ThreadPool> threadPool;
std::mutex _finishedJobsMutex;
};
} // namespace globebrowsing

View File

@@ -42,6 +42,7 @@ template<typename P>
void ConcurrentJobManager<P>::enqueueJob(std::shared_ptr<Job<P>> job) {
threadPool->enqueue([this, job]() {
job->execute();
std::lock_guard<std::mutex> lock(_finishedJobsMutex);
_finishedJobs.push(job);
});
}
@@ -54,6 +55,7 @@ void ConcurrentJobManager<P>::clearEnqueuedJobs() {
template<typename P>
std::shared_ptr<Job<P>> ConcurrentJobManager<P>::popFinishedJob() {
ghoul_assert(_finishedJobs.size() > 0, "There is no finished job to pop!");
std::lock_guard<std::mutex> lock(_finishedJobsMutex);
return _finishedJobs.pop();
}

View File

@@ -29,6 +29,8 @@
#include <modules/globebrowsing/other/lruthreadpool.h>
#include <modules/globebrowsing/other/concurrentjobmanager.h>
#include <mutex>
namespace openspace {
namespace globebrowsing {
@@ -85,6 +87,7 @@ private:
ConcurrentQueue<std::shared_ptr<Job<P>>> _finishedJobs;
/// An LRU thread pool is used since the jobs can be bumped and hence prioritized.
std::shared_ptr<LRUThreadPool<KeyType>> _threadPool;
std::mutex _finishedJobsMutex;
};
} // namespace globebrowsing

View File

@@ -39,6 +39,7 @@ void PrioritizingConcurrentJobManager<P, KeyType>::enqueueJob(std::shared_ptr<Jo
{
_threadPool->enqueue([this, job]() {
job->execute();
std::lock_guard<std::mutex> lock(_finishedJobsMutex);
_finishedJobs.push(job);
}, key);
}
@@ -68,7 +69,9 @@ void PrioritizingConcurrentJobManager<P, KeyType>::clearEnqueuedJobs() {
template<typename P, typename KeyType>
std::shared_ptr<Job<P>> PrioritizingConcurrentJobManager<P, KeyType>::popFinishedJob() {
ghoul_assert(_finishedJobs.size() > 0, "There is no finished job to pop!");
return _finishedJobs.pop();
std::lock_guard<std::mutex> lock(_finishedJobsMutex);
std::shared_ptr<Job<P>> result = _finishedJobs.pop();
return result;
}
template<typename P, typename KeyType>

View File

@@ -240,16 +240,11 @@ int PixelRegion::area() const {
int PixelRegion::edge(Side side) const {
switch (side) {
case Side::LEFT:
return start.x;
case Side::TOP:
return start.y;
case Side::RIGHT:
return start.x + numPixels.x;
case Side::BOTTOM:
return start.y + numPixels.y;
default:
ghoul_assert(false, "Missing case label");
case Side::LEFT: return start.x;
case Side::TOP: return start.y;
case Side::RIGHT: return start.x + numPixels.x;
case Side::BOTTOM: return start.y + numPixels.y;
default: throw ghoul::MissingCaseException();
}
}

View File

@@ -65,10 +65,15 @@ GdalRawTileDataReader::GdalRawTileDataReader(const std::string& filePath,
{
_initDirectory = baseDirectory.empty() ? CPLGetCurrentDir() : baseDirectory;
_datasetFilePath = filePath;
ensureInitialized();
{ // Aquire lock
std::lock_guard<std::mutex> lockGuard(_datasetLock);
initialize();
}
}
GdalRawTileDataReader::~GdalRawTileDataReader() {
std::lock_guard<std::mutex> lockGuard(_datasetLock);
if (_dataset != nullptr) {
GDALClose(_dataset);
_dataset = nullptr;
@@ -76,6 +81,7 @@ GdalRawTileDataReader::~GdalRawTileDataReader() {
}
void GdalRawTileDataReader::reset() {
std::lock_guard<std::mutex> lockGuard(_datasetLock);
_cached._maxLevel = -1;
if (_dataset != nullptr) {
GDALClose(_dataset);
@@ -84,52 +90,32 @@ void GdalRawTileDataReader::reset() {
initialize();
}
int GdalRawTileDataReader::maxChunkLevel() {
ensureInitialized();
if (_cached._maxLevel < 0) {
int numOverviews = _dataset->GetRasterBand(1)->GetOverviewCount();
_cached._maxLevel = -_cached._tileLevelDifference;
if (numOverviews > 0) {
_cached._maxLevel += numOverviews - 1;
}
}
int GdalRawTileDataReader::maxChunkLevel() const {
return _cached._maxLevel;
}
float GdalRawTileDataReader::noDataValueAsFloat() const {
float noDataValue;
if (_dataset && _dataset->GetRasterBand(1)) {
noDataValue = _dataset->GetRasterBand(1)->GetNoDataValue();
}
else {
noDataValue = std::numeric_limits<float>::min();
}
return noDataValue;
return _gdalDatasetMetaDataCached.noDataValue;
}
int GdalRawTileDataReader::rasterXSize() const {
return _dataset->GetRasterXSize();
return _gdalDatasetMetaDataCached.rasterXSize;
}
int GdalRawTileDataReader::rasterYSize() const {
return _dataset->GetRasterYSize();
return _gdalDatasetMetaDataCached.rasterYSize;
}
float GdalRawTileDataReader::depthOffset() const {
return _dataset->GetRasterBand(1)->GetOffset();
return _gdalDatasetMetaDataCached.offset;
}
float GdalRawTileDataReader::depthScale() const {
return _dataset->GetRasterBand(1)->GetScale();
return _gdalDatasetMetaDataCached.scale;
}
std::array<double, 6> GdalRawTileDataReader::getGeoTransform() const {
std::array<double, 6> padfTransform;
CPLErr err = _dataset->GetGeoTransform(&padfTransform[0]);
if (err == CE_Failure) {
return RawTileDataReader::getGeoTransform();
}
return padfTransform;
return _gdalDatasetMetaDataCached.padfTransform;
}
IODescription GdalRawTileDataReader::getIODescription(const TileIndex& tileIndex) const {
@@ -142,8 +128,7 @@ IODescription GdalRawTileDataReader::getIODescription(const TileIndex& tileIndex
_initData.dimensionsWithoutPadding().x, _initData.dimensionsWithoutPadding().y);
io.read.overview = 0;
io.read.fullRegion = gdalPixelRegion(
_dataset->GetRasterBand(1));
io.read.fullRegion = fullPixelRegion();
// For correct sampling in dataset, we need to pad the texture tile
PixelRegion scaledPadding = padding;
@@ -169,18 +154,35 @@ void GdalRawTileDataReader::initialize() {
_dataset = openGdalDataset(_datasetFilePath);
// Assume all raster bands have the same data type
_gdalType = tiledatatype::getGdalDataType(_initData.glType());
_gdalDatasetMetaDataCached.rasterCount = _dataset->GetRasterCount();
_gdalDatasetMetaDataCached.scale = _dataset->GetRasterBand(1)->GetScale();
_gdalDatasetMetaDataCached.offset = _dataset->GetRasterBand(1)->GetOffset();
_gdalDatasetMetaDataCached.rasterXSize = _dataset->GetRasterXSize();
_gdalDatasetMetaDataCached.rasterYSize = _dataset->GetRasterYSize();
_gdalDatasetMetaDataCached.noDataValue = _dataset->GetRasterBand(1)->GetNoDataValue();
_gdalDatasetMetaDataCached.dataType = tiledatatype::getGdalDataType(_initData.glType());
CPLErr err = _dataset->GetGeoTransform(&_gdalDatasetMetaDataCached.padfTransform[0]);
if (err == CE_Failure) {
_gdalDatasetMetaDataCached.padfTransform = RawTileDataReader::getGeoTransform();
}
_depthTransform = calculateTileDepthTransform();
_cached._tileLevelDifference =
calculateTileLevelDifference(_initData.dimensionsWithoutPadding().x);
int numOverviews = _dataset->GetRasterBand(1)->GetOverviewCount();
_cached._maxLevel = -_cached._tileLevelDifference;
if (numOverviews > 0) {
_cached._maxLevel += numOverviews - 1;
}
}
void GdalRawTileDataReader::readImageData(
IODescription& io, RawTile::ReadError& worstError, char* imageDataDest) const {
// Only read the minimum number of rasters
int nRastersToRead = std::min(_dataset->GetRasterCount(),
int nRastersToRead = std::min(_gdalDatasetMetaDataCached.rasterCount,
static_cast<int>(_initData.nRasters()));
switch (_initData.ghoulTextureFormat()) {
@@ -270,7 +272,8 @@ RawTile::ReadError GdalRawTileDataReader::rasterRead(
dataDest += io.write.region.start.x * _initData.bytesPerPixel();
GDALRasterBand* gdalRasterBand = _dataset->GetRasterBand(rasterBand);
CPLErr readError = gdalRasterBand->RasterIO(
CPLErr readError = CE_Failure;
readError = gdalRasterBand->RasterIO(
GF_Read,
io.read.region.start.x, // Begin read x
io.read.region.start.y, // Begin read y
@@ -279,7 +282,7 @@ RawTile::ReadError GdalRawTileDataReader::rasterRead(
dataDest, // Where to put data
io.write.region.numPixels.x, // width to write x in destination
io.write.region.numPixels.y, // width to write y in destination
_gdalType, // Type
_gdalDatasetMetaDataCached.dataType, // Type
_initData.bytesPerPixel(), // Pixel spacing
-io.write.bytesPerLine // Line spacing
);
@@ -314,7 +317,7 @@ GDALDataset* GdalRawTileDataReader::openGdalDataset(const std::string& filePath)
return dataset;
}
int GdalRawTileDataReader::calculateTileLevelDifference(int minimumPixelSize) {
int GdalRawTileDataReader::calculateTileLevelDifference(int minimumPixelSize) const {
GDALRasterBand* firstBand = _dataset->GetRasterBand(1);
GDALRasterBand* maxOverview;
int numOverviews = firstBand->GetOverviewCount();
@@ -330,52 +333,6 @@ int GdalRawTileDataReader::calculateTileLevelDifference(int minimumPixelSize) {
return diff;
}
bool GdalRawTileDataReader::gdalHasOverviews() const {
return _dataset->GetRasterBand(1)->GetOverviewCount() > 0;
}
int GdalRawTileDataReader::gdalOverview(
const PixelRegion::PixelRange& regionSizeOverviewZero) const {
GDALRasterBand* firstBand = _dataset->GetRasterBand(1);
int minNumPixels0 = glm::min(regionSizeOverviewZero.x, regionSizeOverviewZero.y);
int overviews = firstBand->GetOverviewCount();
GDALRasterBand* maxOverview =
overviews ? firstBand->GetOverview(overviews - 1) : firstBand;
int sizeLevel0 = maxOverview->GetXSize();
// The dataset itself may not have overviews but even if it does not, an overview
// for the data region can be calculated and possibly be used to sample greater
// Regions of the original dataset.
int ov = std::log2(minNumPixels0) - std::log2(sizeLevel0 + 1) -
_cached._tileLevelDifference;
ov = glm::clamp(ov, 0, overviews - 1);
return ov;
}
int GdalRawTileDataReader::gdalOverview(const TileIndex& tileIndex) const {
int overviews = _dataset->GetRasterBand(1)->GetOverviewCount();
int ov = overviews - (tileIndex.level + _cached._tileLevelDifference + 1);
return glm::clamp(ov, 0, overviews - 1);
}
int GdalRawTileDataReader::gdalVirtualOverview(const TileIndex& tileIndex) const {
int overviews = _dataset->GetRasterBand(1)->GetOverviewCount();
int ov = overviews - (tileIndex.level + _cached._tileLevelDifference + 1);
return ov;
}
PixelRegion GdalRawTileDataReader::gdalPixelRegion(GDALRasterBand* rasterBand) const {
PixelRegion gdalRegion;
gdalRegion.start.x = 0;
gdalRegion.start.y = 0;
gdalRegion.numPixels.x = rasterBand->GetXSize();
gdalRegion.numPixels.y = rasterBand->GetYSize();
return gdalRegion;
}
} // namespace globebrowsing
} // namespace openspace

View File

@@ -40,7 +40,9 @@
#include <ghoul/opengl/texture.h>
#include <gdal.h>
#include <string>
#include <mutex>
class GDALDataset;
class GDALRasterBand;
@@ -73,7 +75,7 @@ public:
// Public virtual function overloading
virtual void reset() override;
virtual int maxChunkLevel() override;
virtual int maxChunkLevel() const override;
virtual float noDataValueAsFloat() const override;
virtual int rasterXSize() const override;
virtual int rasterYSize() const override;
@@ -101,19 +103,34 @@ private:
// GDAL Helper methods
GDALDataset* openGdalDataset(const std::string& filePath);
int calculateTileLevelDifference(int minimumPixelSize);
bool gdalHasOverviews() const;
int gdalOverview(const PixelRegion::PixelRange& baseRegionSize) const;
int gdalOverview(const TileIndex& tileIndex) const;
int gdalVirtualOverview(const TileIndex& tileIndex) const;
PixelRegion gdalPixelRegion(GDALRasterBand* rasterBand) const;
/**
* Use as a helper function when determining the maximum tile level. This function
* returns the negated number of overviews requred to downscale the highest overview
* dataset so that it fits within minimumPixelSize pixels in the x-dimension.
*/
int calculateTileLevelDifference(int minimumPixelSize) const;
// Member variables
std::string _initDirectory;
std::string _datasetFilePath;
GDALDataset* _dataset;
GDALDataType _gdalType;
struct GdalDatasetMetaDataCached {
int rasterCount;
float scale;
float offset;
int rasterXSize;
int rasterYSize;
float noDataValue;
std::array<double, 6> padfTransform;
GDALDataType dataType;
} _gdalDatasetMetaDataCached;
mutable std::mutex _datasetLock;
};
} // namespace globebrowsing

View File

@@ -68,21 +68,13 @@ RawTileDataReader::RawTileDataReader(const TileTextureInitData& initData,
, _hasBeenInitialized(false)
{}
void RawTileDataReader::ensureInitialized() {
if (!_hasBeenInitialized) {
initialize();
_hasBeenInitialized = true;
}
}
std::shared_ptr<RawTile> RawTileDataReader::defaultTileData() {
std::shared_ptr<RawTile> RawTileDataReader::defaultTileData() const {
return std::make_shared<RawTile>(RawTile::createDefault(_initData));
}
std::shared_ptr<RawTile> RawTileDataReader::readTileData(TileIndex tileIndex,
char* dataDestination, char* pboMappedDataDestination)
char* dataDestination, char* pboMappedDataDestination) const
{
ensureInitialized();
IODescription io = getIODescription(tileIndex);
RawTile::ReadError worstError = RawTile::ReadError::None;
@@ -136,6 +128,15 @@ const PixelRegion::PixelRange RawTileDataReader::fullPixelSize() const {
return glm::uvec2(geodeticToPixel(Geodetic2(90, 180)));
}
PixelRegion RawTileDataReader::fullPixelRegion() const {
PixelRegion fullRegion;
fullRegion.start.x = 0;
fullRegion.start.y = 0;
fullRegion.numPixels.x = rasterXSize();
fullRegion.numPixels.y = rasterYSize();
return fullRegion;
}
std::array<double, 6> RawTileDataReader::getGeoTransform() const {
std::array<double, 6> padfTransform;
@@ -310,9 +311,8 @@ RawTile::ReadError RawTileDataReader::repeatedRasterRead(
}
std::shared_ptr<TileMetaData> RawTileDataReader::getTileMetaData(
std::shared_ptr<RawTile> rawTile, const PixelRegion& region)
std::shared_ptr<RawTile> rawTile, const PixelRegion& region) const
{
ensureInitialized();
size_t bytesPerLine = _initData.bytesPerPixel() * region.numPixels.x;
TileMetaData* preprocessData = new TileMetaData();

View File

@@ -58,7 +58,7 @@ public:
* which gets returned.
*/
std::shared_ptr<RawTile> readTileData(TileIndex tileIndex,
char* dataDestination, char* pboMappedDataDestination);
char* dataDestination, char* pboMappedDataDestination) const;
TileDepthTransform getDepthTransform() const;
const TileTextureInitData& tileTextureInitData() const;
const PixelRegion::PixelRange fullPixelSize() const;
@@ -67,7 +67,7 @@ public:
* \returns the maximum chunk level available in the dataset. Should be a value
* between 2 and 31.
*/
virtual int maxChunkLevel() = 0;
virtual int maxChunkLevel() const = 0;
/**
* Reset the dataset to its initial state. This is the place to clear any cache used.
@@ -78,11 +78,12 @@ public:
virtual int rasterYSize() const = 0;
virtual float depthOffset() const;
virtual float depthScale() const;
PixelRegion fullPixelRegion() const;
/**
* Returns a single channeled empty <code>RawTile</code> of size 16 * 16 pixels.
*/
std::shared_ptr<RawTile> defaultTileData();
std::shared_ptr<RawTile> defaultTileData() const;
/// Padding around all tiles to read to make sure edge blending works.
const static PixelRegion padding; // same as the two above
@@ -98,7 +99,7 @@ protected:
/**
* Call this in the constructor of the class extending <code>RawTileDataReader</code>
*/
void ensureInitialized();
//void ensureInitialized();
/**
* The function returns a transform to map
@@ -155,7 +156,7 @@ protected:
int rasterBand, const IODescription& io, char* dst, int depth = 0) const;
std::shared_ptr<TileMetaData> getTileMetaData(
std::shared_ptr<RawTile> result, const PixelRegion& region);
std::shared_ptr<RawTile> result, const PixelRegion& region) const;
TileDepthTransform calculateTileDepthTransform();
RawTile::ReadError postProcessErrorCheck(std::shared_ptr<const RawTile> ioResult) const;

View File

@@ -50,14 +50,14 @@ SimpleRawTileDataReader::SimpleRawTileDataReader(const std::string& filePath,
: RawTileDataReader(initData, preprocess)
{
_datasetFilePath = filePath;
ensureInitialized();
initialize();
}
void SimpleRawTileDataReader::reset() {
initialize();
}
int SimpleRawTileDataReader::maxChunkLevel() {
int SimpleRawTileDataReader::maxChunkLevel() const {
return 2;
}

View File

@@ -54,7 +54,7 @@ public:
// Public virtual function overloading
virtual void reset() override;
virtual int maxChunkLevel() override;
virtual int maxChunkLevel() const override;
virtual float noDataValueAsFloat() const override;
virtual int rasterXSize() const override;
virtual int rasterYSize() const override;

View File

@@ -653,19 +653,11 @@ void RenderableFov::computeIntercepts(const UpdateData& data, const std::string&
break;
}
case ThisIntersect:
{
break;
}
case NextIntersect:
{
break;
}
case BothIntersect:
{
break;
}
default:
ghoul_assert(false, "Missing case label");
throw ghoul::MissingCaseException();
}
}
}

View File

@@ -27,6 +27,7 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake)
set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/gui.h
${CMAKE_CURRENT_SOURCE_DIR}/include/guicomponent.h
${CMAKE_CURRENT_SOURCE_DIR}/include/guifilepathcomponent.h
${CMAKE_CURRENT_SOURCE_DIR}/include/guihelpcomponent.h
${CMAKE_CURRENT_SOURCE_DIR}/include/guiorigincomponent.h
${CMAKE_CURRENT_SOURCE_DIR}/include/guiperformancecomponent.h
@@ -42,6 +43,7 @@ set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/gui.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/gui_lua.inl
${CMAKE_CURRENT_SOURCE_DIR}/src/guicomponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guifilepathcomponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guihelpcomponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guiorigincomponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guiperformancecomponent.cpp

View File

@@ -26,6 +26,7 @@
#define __OPENSPACE_MODULE_ONSCREENGUI___GUI___H__
#include <modules/onscreengui/include/guicomponent.h>
#include <modules/onscreengui/include/guifilepathcomponent.h>
#include <modules/onscreengui/include/guihelpcomponent.h>
#include <modules/onscreengui/include/guiperformancecomponent.h>
#include <modules/onscreengui/include/guipropertycomponent.h>
@@ -65,6 +66,7 @@ public:
//protected:
GuiHelpComponent _help;
GuiFilePathComponent _filePath;
GuiOriginComponent _origin;
GuiPerformanceComponent _performance;
GuiPropertyComponent _globalProperty;

View File

@@ -0,0 +1,43 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_MODULE_ONSCREENGUI___GUIFILEPATHCOMPONENT___H__
#define __OPENSPACE_MODULE_ONSCREENGUI___GUIFILEPATHCOMPONENT___H__
#include <modules/onscreengui/include/guicomponent.h>
namespace openspace {
namespace gui {
class GuiFilePathComponent : public GuiComponent {
public:
GuiFilePathComponent();
void render() override;
};
} // namespace gui
} // namespace openspace
#endif // __OPENSPACE_MODULE_ONSCREENGUI___GUIFILEPATHCOMPONENT___H__

View File

@@ -210,12 +210,9 @@ void addScreenSpaceRenderable(std::string texturePath) {
return;
}
texturePath = absPath(texturePath);
texturePath = FileSys.convertPathSeparator(texturePath, '/');
std::string luaTable =
"{Type = 'ScreenSpaceImage', TexturePath = '" + texturePath + "' }";
std::string script = "openspace.registerScreenSpaceRenderable(" + luaTable + ");";
const std::string luaTable =
"{Type = 'ScreenSpaceImage', TexturePath = openspace.absPath('" + texturePath + "') }";
const std::string script = "openspace.registerScreenSpaceRenderable(" + luaTable + ");";
OsEng.scriptEngine().queueScript(script, openspace::scripting::ScriptEngine::RemoteScripting::Yes);
}
} // namespace
@@ -238,6 +235,7 @@ GUI::GUI()
addPropertySubOwner(_property);
addPropertySubOwner(_screenSpaceProperty);
addPropertySubOwner(_virtualProperty);
addPropertySubOwner(_filePath);
addPropertySubOwner(_time);
addPropertySubOwner(_iswa);
}
@@ -321,6 +319,7 @@ void GUI::initialize() {
_globalProperty.initialize();
_globalProperty.setHasRegularProperties(true);
_virtualProperty.initialize();
_filePath.initialize();
_performance.initialize();
_help.initialize();
_parallel.initialize();
@@ -337,6 +336,7 @@ void GUI::deinitialize() {
_globalProperty.deinitialize();
_screenSpaceProperty.deinitialize();
_virtualProperty.deinitialize();
_filePath.deinitialize();
_property.deinitialize();
delete iniFileBuffer;
@@ -364,7 +364,8 @@ void GUI::initializeGL() {
_fontTexture->setDataOwnership(ghoul::opengl::Texture::TakeOwnership::No);
_fontTexture->uploadTexture();
GLuint id = *_fontTexture;
ImGui::GetIO().Fonts->TexID = reinterpret_cast<void*>(id);
uint64_t tmp = id;
ImGui::GetIO().Fonts->TexID = reinterpret_cast<void*>(tmp);
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
@@ -488,6 +489,9 @@ void GUI::endFrame() {
if (_iswa.isEnabled()) {
_iswa.render();
}
if (_filePath.isEnabled()) {
_filePath.render();
}
}
ImGui::Render();
@@ -583,6 +587,10 @@ void GUI::render() {
ImGui::Checkbox("Virtual Properties", &virtualProperty);
_virtualProperty.setEnabled(virtualProperty);
bool filePath = _filePath.isEnabled();
ImGui::Checkbox("File Paths", &filePath);
_filePath.setEnabled(filePath);
#ifdef OPENSPACE_MODULE_ISWA_ENABLED
bool iswa = _iswa.isEnabled();
ImGui::Checkbox("iSWA", &iswa);

View File

@@ -0,0 +1,62 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <modules/onscreengui/include/guifilepathcomponent.h>
#include <ghoul/filesystem/filesystem.h>
#include "imgui.h"
namespace openspace {
namespace gui {
GuiFilePathComponent::GuiFilePathComponent()
: GuiComponent("File Path")
{}
void GuiFilePathComponent::render() {
bool v = _isEnabled;
ImGui::Begin("File Path", &v);
ImGui::Text(
"%s",
"These are file paths registered in the current OpenSpace instance."
);
ImGui::Separator();
ImGui::Columns(2);
ImGui::Separator();
std::vector<std::string> tokens = FileSys.tokens();
for (const std::string& t : tokens) {
ImGui::Text("%s", t.c_str());
ImGui::NextColumn();
ImGui::Text("%s", absPath(t).c_str());
ImGui::NextColumn();
ImGui::Separator();
}
ImGui::End();
}
} // gui
} // openspace

View File

@@ -38,7 +38,7 @@
namespace {
using json = nlohmann::json;
const ImVec2 size = ImVec2(350, 500);
const ImVec2 WindowSize = ImVec2(350, 500);
} // namespace
namespace openspace {
@@ -59,7 +59,7 @@ void GuiIswaComponent::render() {
bool e = _isEnabled;
ImGui::Begin("ISWA", &e, size, 0.5f);
ImGui::Begin("ISWA", &e, WindowSize, 0.5f);
_isEnabled = e;

View File

@@ -31,9 +31,11 @@
#include <chrono>
#include <fstream>
#include <vector>
#include <system_error>
namespace {
const char* KeyFile = "File";
const char* KeyLineNum = "LineNum";
// The list of leap years only goes until 2056 as we need to touch this file then
// again anyway ;)
@@ -183,7 +185,8 @@ namespace {
// 3
using namespace std::chrono;
int SecondsPerDay = static_cast<int>(seconds(hours(24)).count());
double nSecondsSince2000 = (daysSince2000 + daysInYear) * SecondsPerDay;
//Need to subtract 1 from daysInYear since it is not a zero-based count
double nSecondsSince2000 = (daysSince2000 + daysInYear - 1) * SecondsPerDay;
// 4
// We need to remove additionbal leap seconds past 2000 and add them prior to
@@ -244,6 +247,12 @@ documentation::Documentation TLETranslation::Documentation() {
new StringVerifier,
"Specifies the filename of the Two-Line-Element file",
Optional::No
},
{
KeyLineNum,
new DoubleGreaterVerifier(0),
"Specifies the line number within the file where the group of 3 TLE lines begins (1-based)",
Optional::No
}
},
Exhaustive::No
@@ -261,10 +270,11 @@ TLETranslation::TLETranslation(const ghoul::Dictionary& dictionary)
);
std::string file = dictionary.value<std::string>(KeyFile);
readTLEFile(file);
int lineNum = dictionary.value<double>(KeyLineNum);
readTLEFile(file, lineNum);
}
void TLETranslation::readTLEFile(const std::string& filename) {
void TLETranslation::readTLEFile(const std::string& filename, int lineNum) {
ghoul_assert(FileSys.fileExists(filename), "The filename must exist");
std::ifstream file;
@@ -283,101 +293,87 @@ void TLETranslation::readTLEFile(const std::string& filename) {
double epoch = 0.0;
} keplerElements;
enum class State {
Initial = 0,
ReadFirstLine,
ReadSecondLine,
Finished = ReadSecondLine
};
State state = State::Initial;
std::string line;
while (std::getline(file, line)) {
if (line[0] == '1') {
// First line
// Field Columns Content
// 1 01-01 Line number
// 2 03-07 Satellite number
// 3 08-08 Classification (U = Unclassified)
// 4 10-11 International Designator (Last two digits of launch year)
// 5 12-14 International Designator (Launch number of the year)
// 6 15-17 International Designator(piece of the launch) A
// 7 19-20 Epoch Year(last two digits of year)
// 8 21-32 Epoch(day of the year and fractional portion of the day)
// 9 34-43 First Time Derivative of the Mean Motion divided by two
// 10 45-52 Second Time Derivative of Mean Motion divided by six
// 11 54-61 BSTAR drag term(decimal point assumed)[10] - 11606 - 4
// 12 63-63 The "Ephemeris type"
// 13 65-68 Element set number.Incremented when a new TLE is generated
// 14 69-69 Checksum (modulo 10)
keplerElements.epoch = epochFromSubstring(line.substr(18, 14));
state = State::ReadFirstLine;
}
else if (line[0] == '2') {
if (state != State::ReadFirstLine) {
throw ghoul::RuntimeError(
"Malformed TLE file: '" + filename + "'. Line 2 before line 1",
"TLETranslation"
);
}
// Second line
//Field Columns Content
// 1 01-01 Line number
// 2 03-07 Satellite number
// 3 09-16 Inclination (degrees)
// 4 18-25 Right ascension of the ascending node (degrees)
// 5 27-33 Eccentricity (decimal point assumed)
// 6 35-42 Argument of perigee (degrees)
// 7 44-51 Mean Anomaly (degrees)
// 8 53-63 Mean Motion (revolutions per day)
// 9 64-68 Revolution number at epoch (revolutions)
// 10 69-69 Checksum (modulo 10)
std::stringstream stream;
stream.exceptions(std::ios::failbit);
// Get inclination
stream.str(line.substr(8, 8));
stream >> keplerElements.inclination;
stream.clear();
// Get Right ascension of the ascending node
stream.str(line.substr(17, 8));
stream >> keplerElements.ascendingNode;
stream.clear();
//Loop through and throw out lines until getting to the linNum of interest
for (unsigned int i = 1; i < lineNum; ++i)
std::getline(file, line);
std::getline(file, line); //Throw out the TLE title line (1st)
// Get Eccentricity
stream.str("0." + line.substr(26, 7));
stream >> keplerElements.eccentricity;
stream.clear();
// Get argument of periapsis
stream.str(line.substr(34, 8));
stream >> keplerElements.argumentOfPeriapsis;
stream.clear();
// Get mean anomaly
stream.str(line.substr(43, 8));
stream >> keplerElements.meanAnomaly;
stream.clear();
// Get mean motion
stream.str(line.substr(52, 11));
stream >> keplerElements.meanMotion;
state = State::ReadSecondLine;
break;
}
std::getline(file, line); //Get line 1 of TLE format
if (line[0] == '1') {
// First line
// Field Columns Content
// 1 01-01 Line number
// 2 03-07 Satellite number
// 3 08-08 Classification (U = Unclassified)
// 4 10-11 International Designator (Last two digits of launch year)
// 5 12-14 International Designator (Launch number of the year)
// 6 15-17 International Designator(piece of the launch) A
// 7 19-20 Epoch Year(last two digits of year)
// 8 21-32 Epoch(day of the year and fractional portion of the day)
// 9 34-43 First Time Derivative of the Mean Motion divided by two
// 10 45-52 Second Time Derivative of Mean Motion divided by six
// 11 54-61 BSTAR drag term(decimal point assumed)[10] - 11606 - 4
// 12 63-63 The "Ephemeris type"
// 13 65-68 Element set number.Incremented when a new TLE is generated
// 14 69-69 Checksum (modulo 10)
keplerElements.epoch = epochFromSubstring(line.substr(18, 14));
} else {
throw ghoul::RuntimeError("File " + filename + " @ line "
+ std::to_string(lineNum + 1) + " doesn't have '1' header");
}
if (state != State::Finished) {
throw ghoul::RuntimeError(
"Malformed TLE file: Line 1 or 2 missing",
"TLETranslation"
);
std::getline(file, line); //Get line 2 of TLE format
if (line[0] == '2') {
// Second line
//Field Columns Content
// 1 01-01 Line number
// 2 03-07 Satellite number
// 3 09-16 Inclination (degrees)
// 4 18-25 Right ascension of the ascending node (degrees)
// 5 27-33 Eccentricity (decimal point assumed)
// 6 35-42 Argument of perigee (degrees)
// 7 44-51 Mean Anomaly (degrees)
// 8 53-63 Mean Motion (revolutions per day)
// 9 64-68 Revolution number at epoch (revolutions)
// 10 69-69 Checksum (modulo 10)
std::stringstream stream;
stream.exceptions(std::ios::failbit);
// Get inclination
stream.str(line.substr(8, 8));
stream >> keplerElements.inclination;
stream.clear();
// Get Right ascension of the ascending node
stream.str(line.substr(17, 8));
stream >> keplerElements.ascendingNode;
stream.clear();
// Get Eccentricity
stream.str("0." + line.substr(26, 7));
stream >> keplerElements.eccentricity;
stream.clear();
// Get argument of periapsis
stream.str(line.substr(34, 8));
stream >> keplerElements.argumentOfPeriapsis;
stream.clear();
// Get mean anomaly
stream.str(line.substr(43, 8));
stream >> keplerElements.meanAnomaly;
stream.clear();
// Get mean motion
stream.str(line.substr(52, 11));
stream >> keplerElements.meanMotion;
} else {
throw ghoul::RuntimeError("File " + filename + " @ line "
+ std::to_string(lineNum + 2) + " doesn't have '2' header");
}
file.close();
// Calculate the semi major axis based on the mean motion using kepler's laws
keplerElements.semiMajorAxis = calculateSemiMajorAxis(keplerElements.meanMotion);

View File

@@ -38,6 +38,11 @@ namespace openspace {
*/
class TLETranslation : public KeplerTranslation {
public:
struct FileFormatError : public ghoul::RuntimeError {
explicit FileFormatError(std::string offense);
std::string offense;
};
/**
* Constructor for the TLETranslation class. The \p dictionary must contain a key for
* the file that contains the TLE information. The ghoul::Dictionary will be tested
@@ -61,13 +66,14 @@ private:
* disallowed values (see KeplerTranslation::setKeplerElements), a
* KeplerTranslation::RangeError is thrown.
* \param filename The path to the file that contains the TLE file.
* \param lineNum The line number in the file where the set of 3 TLE lines starts
* \throw std::system_error if the TLE file is malformed (does not contain at least
* two lines that start with \c 1 and \c 2.
* \throw KeplerTranslation::RangeError If the Keplerian elements are outside of
* the valid range supported by Kepler::setKeplerElements
* \pre The \p filename must exist
*/
void readTLEFile(const std::string& filename);
void readTLEFile(const std::string& filename, int lineNum);
};
} // namespace openspace

View File

@@ -41,8 +41,8 @@ RenderableToyVolume::RenderableToyVolume(const ghoul::Dictionary& dictionary)
, _stepSize("stepSize", "Step Size", 0.02, 0.01, 1)
, _scaling("scaling", "Scaling", glm::vec3(1.0, 1.0, 1.0), glm::vec3(0.0), glm::vec3(10.0))
, _translation("translation", "Translation", glm::vec3(0.0, 0.0, 0.0), glm::vec3(0.0), glm::vec3(10.0))
, _rotation("rotation", "Euler rotation", glm::vec3(0.0, 0.0, 0.0), glm::vec3(0), glm::vec3(6.28))
, _color("color", "Color", glm::vec4(1.0, 0.0, 0.0, 0.1), glm::vec4(0.0), glm::vec4(1.0)) {
, _rotation("rotation", "Euler rotation", glm::vec3(0.f, 0.f, 0.f), glm::vec3(0), glm::vec3(6.28f))
, _color("color", "Color", glm::vec4(1.f, 0.f, 0.f, 0.1f), glm::vec4(0.f), glm::vec4(1.f)) {
float scalingExponent, stepSize;
glm::vec3 scaling, translation, rotation;

View File

@@ -9,8 +9,6 @@ return {
-- A regular 1280x720 window
--SGCTConfig = sgct.config.single{},
-- SGCTConfig = sgct.config.single{res={1920, 1080}, shared=true},
-- A regular 1920x1080 window
SGCTConfig = sgct.config.single{1920, 1080},
@@ -20,6 +18,10 @@ return {
-- A 4k fisheye rendering in a 1024x1024 window
--SGCTConfig = sgct.config.fisheye{1024, 1024, res={4096, 4096}, quality="2k", tilt=27},
-- Streaming OpenSpace via Spout to OBS
-- SGCTConfig = sgct.config.single{2560, 1440, shared=true, name="WV_OBS_SPOUT1"},
--SGCTConfig = "${SGCT}/openvr_oculusRiftCv1.xml",
--SGCTConfig = "${SGCT}/openvr_htcVive.xml",
@@ -78,7 +80,7 @@ return {
-- OnScreenTextScaling = "framebuffer",
-- PerSceneCache = true,
-- DisableRenderingOnMaster = true,
KeyDisableSceneOnMaster = true,
-- DisableSceneOnMaster = true,
DownloadRequestURL = "http://data.openspaceproject.com/request.cgi",
RenderingMethod = "Framebuffer",
OpenGLDebugContext = {

View File

@@ -0,0 +1,23 @@
--[[ OpenSpace keybinding script loaded from the satellites.scene file ]]--
-- Load the common helper functions
dofile(openspace.absPath('${SCRIPTS}/common.lua'))
dofile(openspace.absPath('${SCRIPTS}/bind_common_keys.lua'))
-- Set focuses
openspace.bindKey(
"p" ,
"if gpsVis then gpsVis = false; else gpsVis = true; end; openspace.setPropertyValue('gps-ops*.renderable.enabled', not gpsVis)",
"Toggles visibility of gps satellites."
)
openspace.bindKey(
"s" ,
"if stVis then stVis = false; else stVis = true; end; openspace.setPropertyValue('station*.renderable.enabled', not stVis)",
"Toggles visibility of stations."
)
openspace.bindKey(
"g" ,
"if geoVis then geoVis = false; else geoVis = true; end; openspace.setPropertyValue('geo*.renderable.enabled', not geoVis)",
"Toggles visibility of geostationary."
)

View File

@@ -80,7 +80,8 @@ std::string to_string(openspace::documentation::TestResult::Offense::Reason reas
case openspace::documentation::TestResult::Offense::Reason::WrongType:
return "Wrong type";
default:
ghoul_assert(false, "Missing case label");
throw ghoul::MissingCaseException();
}
}
@@ -89,7 +90,7 @@ std::string to_string(openspace::documentation::TestResult::Warning::Reason reas
case openspace::documentation::TestResult::Warning::Reason::Deprecated:
return "Deprecated";
default:
ghoul_assert(false, "Missing case label");
throw ghoul::MissingCaseException();
}
}

View File

@@ -298,6 +298,7 @@ std::string DocumentationEngine::generateJson() const {
void DocumentationEngine::addDocumentation(Documentation doc) {
for (const DocumentationEntry& e : doc.entries) {
(void)e; // Unused variable in Release mode
ghoul_assert(
e.documentation.find('"') == std::string::npos,
"Documentation cannot contain \" character"

View File

@@ -52,6 +52,7 @@ DocumentationGenerator::DocumentationGenerator(std::string name,
ghoul_precondition(!_name.empty(), "name must not be empty");
ghoul_precondition(!_jsonName.empty(), "jsonName must not be empty");
for (const HandlebarTemplate& t : _handlebarTemplates) {
(void)t; // Unused variable in Release mode
ghoul_precondition(!t.name.empty(), "name must not be empty");
ghoul_precondition(!t.filename.empty(), "filename must not be empty");
}

View File

@@ -158,6 +158,7 @@ DownloadManager::DownloadManager(std::string requestURL, int applicationVersion,
std::shared_ptr<DownloadManager::FileFuture> DownloadManager::downloadFile(
const std::string& url, const ghoul::filesystem::File& file, bool overrideFile,
bool failOnError, unsigned int timeout_secs,
DownloadFinishedCallback finishedCallback, DownloadProgressCallback progressCallback)
{
if (!overrideFile && FileSys.fileExists(file))
@@ -168,27 +169,39 @@ std::shared_ptr<DownloadManager::FileFuture> DownloadManager::downloadFile(
#ifdef WIN32
FILE* fp;
errno_t error = fopen_s(&fp, file.path().c_str(), "wb");
ghoul_assert(
error == 0,
"Could not open/create file:" + file.path() + ". Errno: " + std::to_string(errno)
);
if (error != 0) {
LERROR(
"Could not open/create file:" + file.path() +
". Errno: " + std::to_string(errno)
);
}
#else
FILE* fp = fopen(file.path().c_str(), "wb"); // write binary
#endif // WIN32
ghoul_assert(
fp != nullptr,
"Could not open/create file:" + file.path() + ". Errno: " + std::to_string(errno)
);
//LDEBUG("Start downloading file: '" << url << "' into file '" << file.path() << "'");
if (!fp) {
LERROR(
"Could not open/create file:" + file.path() +
". Errno: " + std::to_string(errno)
);
}
auto downloadFunction = [url, finishedCallback, progressCallback, future, fp]() {
auto downloadFunction = [url,
failOnError,
timeout_secs,
finishedCallback,
progressCallback,
future,
fp]() {
CURL* curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeData);
if (timeout_secs)
curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout_secs);
if (failOnError)
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
ProgressInformation p = {
future,
@@ -337,6 +350,8 @@ std::vector<std::shared_ptr<DownloadManager::FileFuture>> DownloadManager::downl
line,
destination.path() + "/" + file,
overrideFiles,
false,
0,
[](const FileFuture& f) { LDEBUG("Finished: " << f.filePath); }
);
if (future)
@@ -349,6 +364,8 @@ std::vector<std::shared_ptr<DownloadManager::FileFuture>> DownloadManager::downl
fullRequest,
requestFile,
true,
false,
0,
callback
);

View File

@@ -212,7 +212,9 @@ std::unique_ptr<ghoul::logging::Log> createLog(const ghoul::Dictionary& dictiona
);
}
}
ghoul_assert(false, "Missing case in the documentation for LogFactory");
else {
throw ghoul::MissingCaseException();
}
}
} // namespace openspace

View File

@@ -953,7 +953,7 @@ void OpenSpaceEngine::initializeGL() {
LDEBUGC(category, std::string(message));
break;
default:
ghoul_assert(false, "Missing case label");
throw ghoul::MissingCaseException();
}
};
ghoul::opengl::debug::setDebugCallback(callback);
@@ -1242,6 +1242,12 @@ scripting::LuaLibrary OpenSpaceEngine::luaLibrary() {
"",
"Writes out documentation files"
},
{
"downloadFile",
&luascriptfunctions::downloadFile,
"",
"Downloads a file from Lua scope"
},
{
"addVirtualProperty",
&luascriptfunctions::addVirtualProperty,
@@ -1302,7 +1308,7 @@ void OpenSpaceEngine::registerModuleCallback(OpenSpaceEngine::CallbackOption opt
_moduleCallbacks.postDraw.push_back(std::move(function));
break;
default:
ghoul_assert(false, "Missing case label");
throw ghoul::MissingCaseException();
}
}

View File

@@ -139,6 +139,31 @@ int removeAllVirtualProperties(lua_State* L) {
return 0;
}
/**
* \ingroup LuaScripts
* downloadFile():
* Downloads a file from Lua interpreter
*/
int downloadFile(lua_State* L) {
int nArguments = lua_gettop(L);
if (nArguments != 2)
return luaL_error(L, "Expected %i arguments, got %i", 2, nArguments);
std::string uri = luaL_checkstring(L, -2);
std::string savePath = luaL_checkstring(L, -1);
const std::string _loggerCat = "OpenSpaceEngine";
LINFO("Downloading file from " << uri);
DownloadManager dm = openspace::DownloadManager("", 1, false);
std::shared_ptr<openspace::DownloadManager::FileFuture> future =
dm.downloadFile(uri, absPath("${SCENE}/" + savePath), true, true, 5);
if (!future || (future && !future->isFinished)) {
std::string errorMsg = "Download failed";
if (future)
errorMsg += ": " + future->errorMessage;
return luaL_error(L, errorMsg.c_str());
}
return 1;
}
} // namespace luascriptfunctions
} // namespace openspace

View File

@@ -158,6 +158,7 @@ int SGCTWindowWrapper::currentNumberOfAaSamples() const {
bool SGCTWindowWrapper::isRegularRendering() const {
sgct::SGCTWindow* w = sgct::Engine::instance()->getCurrentWindowPtr();
std::size_t nViewports = w->getNumberOfViewports();
(void)nViewports; // Unused in Release mode
ghoul_assert(nViewports > 0, "At least one viewport must exist at this time");
sgct_core::Viewport* vp = w->getViewport(0);
sgct_core::NonLinearProjection* nlp = vp->getNonLinearProjectionPtr();

View File

@@ -94,9 +94,9 @@ ParallelConnection::ParallelConnection()
, _address("address", "Address", "localhost")
, _name("name", "Connection name", "Anonymous")
, _bufferTime("bufferTime", "Buffer Time", 1, 0.5, 10)
, _timeKeyframeInterval("timeKeyframeInterval", "Time keyframe interval", 0.1, 0, 1)
, _cameraKeyframeInterval("cameraKeyframeInterval", "Camera Keyframe interval", 0.1, 0, 1)
, _timeTolerance("timeTolerance", "Time tolerance", 1, 0.5, 5)
, _timeKeyframeInterval("timeKeyframeInterval", "Time keyframe interval", 0.1f, 0.f, 1.f)
, _cameraKeyframeInterval("cameraKeyframeInterval", "Camera Keyframe interval", 0.1f, 0.f, 1.f)
, _timeTolerance("timeTolerance", "Time tolerance", 1.f, 0.5f, 5.f)
, _lastTimeKeyframeTimestamp(0)
, _lastCameraKeyframeTimestamp(0)
, _clientSocket(INVALID_SOCKET)

View File

@@ -70,9 +70,11 @@ std::unique_ptr<Renderable> Renderable::createFromDictionary(
const ghoul::Dictionary& dictionary)
{
// The name is passed down from the SceneGraphNode
std::string name;
bool success = dictionary.getValue(SceneGraphNode::KeyName, name);
ghoul_assert(success, "The SceneGraphNode did not set the 'name' key");
ghoul_assert(
dictionary.hasKeyAndValue<std::string>(SceneGraphNode::KeyName),
"The SceneGraphNode did not set the 'name' key"
);
std::string name = dictionary.value<std::string>(SceneGraphNode::KeyName);
documentation::testSpecificationAndThrow(Documentation(), dictionary, "Renderable");

View File

@@ -179,7 +179,9 @@ int property_setValueSingle(lua_State* L) {
for (properties::Property* prop : allProperties()) {
std::string propFullId = prop->fullyQualifiedIdentifier();
//Look for a match in the uri with the group name (first term) removed
int propMatchLength = propFullId.length() - pathRemainderToMatch.length();
int propMatchLength =
static_cast<int>(propFullId.length()) -
static_cast<int>(pathRemainderToMatch.length());
if (propMatchLength >= 0) {
std::string thisPropMatchId = propFullId.substr(propMatchLength);
@@ -289,7 +291,7 @@ int property_setValueRegex(lua_State* L) {
}
catch (const std::regex_error& e) {
LERRORC("property_setValueRegex", "Malformed regular expression: '"
<< regex << "'");
<< regex << "':" << e.what());
}
return 0;

View File

@@ -200,6 +200,7 @@ int absolutePath(lua_State* L) {
std::string path = luaL_checkstring(L, -1);
path = absPath(path);
path = FileSys.convertPathSeparator(path, '/');
lua_pushstring(L, path.c_str());
return 1;
}

View File

@@ -129,7 +129,7 @@ std::string to_string(openspace::Key key) {
return p.first;
}
}
ghoul_assert(false, "Missing key in KeyMapping");
throw ghoul::MissingCaseException();
}
std::string to_string(openspace::KeyModifier mod) {

View File

@@ -75,7 +75,8 @@ namespace {
case openspace::SpiceManager::FieldOfViewMethod::Point:
return "POINT";
default:
ghoul_assert(false, "Missing case label");
throw ghoul::MissingCaseException();
}
}
@@ -86,7 +87,8 @@ namespace {
case openspace::SpiceManager::TerminatorType::Penumbral:
return "PENUMBRAL";
default:
ghoul_assert(false, "Missing case label");
throw ghoul::MissingCaseException();
}
}
}
@@ -148,7 +150,7 @@ SpiceManager::AberrationCorrection::operator const char*() const {
case Type::ConvergedNewtonianStellar:
return (direction == Direction::Reception) ? "CN+S" : "XCN+S";
default:
ghoul_assert(false, "Missing case label");
throw ghoul::MissingCaseException();
}
}

View File

@@ -247,7 +247,7 @@ function (handle_applications)
if (WIN32)
copy_files(
ghl_copy_files(
${APPLICATION_NAME}
"${CURL_ROOT_DIR}/lib/libcurl.dll"
"${CURL_ROOT_DIR}/lib/libeay32.dll"
@@ -293,7 +293,7 @@ function (handle_option_vld)
target_include_directories(libOpenSpace PUBLIC ${OPENSPACE_EXT_DIR}/vld)
foreach (app ${OPENSPACE_APPLCATIONS})
copy_files(${app} "${OPENSPACE_EXT_DIR}/vld/bin/vld_x64.dll")
ghl_copy_files(${app} "${OPENSPACE_EXT_DIR}/vld/bin/vld_x64.dll")
endforeach ()
endif ()
endfunction ()
@@ -503,7 +503,7 @@ function (handle_internal_modules)
if (WIN32)
foreach (application ${OPENSPACE_APPLICATIONS})
foreach (dll ${dll_list})
copy_files(${application} ${dll})
ghl_copy_files(${application} ${dll})
endforeach ()
endforeach ()
endif ()
@@ -511,7 +511,7 @@ endfunction ()
function (copy_dynamic_libraries)
if (WIN32)
copy_files(OpenSpace "${CURL_ROOT_DIR}/lib/libcurl.dll")
ghl_copy_files(OpenSpace "${CURL_ROOT_DIR}/lib/libcurl.dll")
# Copy DLLs needed by Ghoul into the executable directory
ghl_copy_shared_libraries(OpenSpace ${OPENSPACE_EXT_DIR}/ghoul)