mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-03 09:20:26 -05:00
Added unit tests for conversion from profile to scene
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2020 *
|
||||
* *
|
||||
* 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 "catch2/catch.hpp"
|
||||
#include "test_common.h"
|
||||
|
||||
#include "openspace/scene/profile.h"
|
||||
#include "openspace/scene/profilefile.h"
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/misc/exception.h>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
using namespace openspace;
|
||||
|
||||
namespace {
|
||||
}
|
||||
|
||||
testProfileFormat buildTestProfile1() {
|
||||
testProfileFormat tp1;
|
||||
tp1.tsv.push_back("#Version");
|
||||
tp1.tsv.push_back("123.4");
|
||||
tp1.tsm.push_back("#Module");
|
||||
tp1.tsm.push_back("globebrowsing\t\t");
|
||||
tp1.tsm.push_back("gaia\tprint(\"success.\")\t");
|
||||
tp1.tsm.push_back("volume\t\tquit");
|
||||
tp1.tsa.push_back("#Asset");
|
||||
tp1.tsa.push_back("scene/solarsystem/planets/earth/moon/moon\trequired");
|
||||
tp1.tsa.push_back("scene/solarsystem/missions/apollo/apollo8\trequested");
|
||||
tp1.tsa.push_back("scene/solarsystem/planets/earth/earth\t");
|
||||
tp1.tsp.push_back("#Property");
|
||||
tp1.tsp.push_back("setPropertyValue\tNavigationHandler.OrbitalNavigator.FollowAnchorNodeRotationDistance\t20.000000");
|
||||
tp1.tsp.push_back("setPropertyValueSingle\tScene.Pluto.Renderable.Enabled\tfalse");
|
||||
tp1.tsp.push_back("setPropertyValue\tScene.Charon.Renderable.Enabled\tfalse");
|
||||
tp1.tsp.push_back("setPropertyValueSingle\tScene.PlutoBarycenterTrail.Renderable.Enabled\tfalse");
|
||||
tp1.tsk.push_back("#Keybinding");
|
||||
tp1.tsk.push_back("F8\tSets the time to the approach at Bennu.\tSet Bennu approach time\t/Missions/Osiris Rex\tfalse\t\"openspace.printInfo('Set time: Approach'); openspace.time.setTime('2018-SEP-11 21:31:01.183')\"");
|
||||
tp1.tsk.push_back("F9\tSets the time to the preliminary survey of Bennu.\tSet Bennu survey time\t/Missions/Osiris Rex\tfalse\t\"openspace.printInfo('Set time: Preliminary Survey'); openspace.time.setTime('2018-NOV-20 01:13:12.183')\"");
|
||||
tp1.tsk.push_back("F10\tSets the time to the orbital B event.\tSet orbital B event time\t/Missions/Osiris Rex\tfalse\t\"openspace.printInfo('Set time: Orbital B'); openspace.time.setTime('2019-APR-08 10:35:27.186')\"");
|
||||
tp1.tsk.push_back("F11\tSets the time to the recon event.\tSet recon event time\t/Missions/Osiris Rex\tfalse\t\"openspace.printInfo('Set time: Recon'); openspace.time.setTime('2019-MAY-25 03:50:31.195')\"");
|
||||
tp1.tst.push_back("#Time");
|
||||
tp1.tst.push_back("absolute\t1977-12-21T12:51:51.0");
|
||||
tp1.tsc.push_back("#Camera");
|
||||
tp1.tsc.push_back("setNavigationState\t\"NewHorizons\"\t\t\"Root\"\t-6.572656E1, -7.239404E1, -2.111890E1\t0.102164, -0.362945, 0.926193\t\t");
|
||||
tp1.tsn.push_back("#MarkNodes");
|
||||
tp1.tsn.push_back("Pluto");
|
||||
tp1.tsn.push_back("NewHorizons");
|
||||
tp1.tsn.push_back("Charon");
|
||||
|
||||
return tp1;
|
||||
}
|
||||
|
||||
std::string stringFromSingleProfileSection(std::vector<std::string>& section,
|
||||
bool blankLineSeparator)
|
||||
{
|
||||
std::string result;
|
||||
for (std::string s : section) {
|
||||
result += s + "\n";
|
||||
}
|
||||
if (blankLineSeparator) {
|
||||
result += "\n";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string stringFromTestProfileFormat(testProfileFormat& tpf) {
|
||||
std::string fullProfile;
|
||||
|
||||
fullProfile += stringFromSingleProfileSection(tpf.tsv, true);
|
||||
fullProfile += stringFromSingleProfileSection(tpf.tsm, true);
|
||||
fullProfile += stringFromSingleProfileSection(tpf.tsa, true);
|
||||
fullProfile += stringFromSingleProfileSection(tpf.tsp, true);
|
||||
fullProfile += stringFromSingleProfileSection(tpf.tsk, true);
|
||||
fullProfile += stringFromSingleProfileSection(tpf.tst, true);
|
||||
fullProfile += stringFromSingleProfileSection(tpf.tsc, true);
|
||||
fullProfile += stringFromSingleProfileSection(tpf.tsn, false);
|
||||
|
||||
return fullProfile;
|
||||
}
|
||||
|
||||
ProfileFile makeProfileFromString(std::string s) {
|
||||
std::istringstream iss(s);
|
||||
|
||||
ProfileFile pf;
|
||||
pf.readLines([&iss](std::string& line) {
|
||||
if (getline(iss, line))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
});
|
||||
|
||||
return pf;
|
||||
}
|
||||
|
||||
StringPerLineReader::StringPerLineReader(std::string s) : _iss(s) {
|
||||
}
|
||||
|
||||
bool StringPerLineReader::getNextLine(std::string& line) {
|
||||
if (getline(_iss, line))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,437 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2020 *
|
||||
* *
|
||||
* 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_TEST___PROFILE_COMMON___H__
|
||||
#define __OPENSPACE_TEST___PROFILE_COMMON___H__
|
||||
|
||||
#include "catch2/catch.hpp"
|
||||
#include "openspace/scene/profile.h"
|
||||
#include "openspace/scene/profilefile.h"
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/misc/exception.h>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
using namespace openspace;
|
||||
|
||||
namespace {
|
||||
}
|
||||
|
||||
struct testProfileFormat {
|
||||
std::vector<std::string> tsv;
|
||||
std::vector<std::string> tsm;
|
||||
std::vector<std::string> tsa;
|
||||
std::vector<std::string> tsp;
|
||||
std::vector<std::string> tsk;
|
||||
std::vector<std::string> tst;
|
||||
std::vector<std::string> tsc;
|
||||
std::vector<std::string> tsn;
|
||||
};
|
||||
|
||||
const std::string newHorizonsProfileInput ="\
|
||||
#Version\n\
|
||||
1.0\n\
|
||||
\n\
|
||||
#Asset\n\
|
||||
scene/solarsystem/missions/newhorizons/newhorizons\trequired\n\
|
||||
scene/solarsystem/missions/newhorizons/model\trequired\n\
|
||||
\n\
|
||||
#Property\n\
|
||||
setPropertyValueSingle\tNavigationHandler.OrbitalNavigator.FollowAnchorNodeRotationDistance\t20.000000\n\
|
||||
setPropertyValueSingle\tScene.Pluto.Renderable.Enabled\tfalse\n\
|
||||
setPropertyValueSingle\tScene.Charon.Renderable.Enabled\tfalse\n\
|
||||
setPropertyValueSingle\tScene.PlutoBarycenterTrail.Renderable.Enabled\tfalse\n\
|
||||
\n\
|
||||
#Keybinding\n\
|
||||
a\tSets the focus of the camera on 'NewHorizons'.\tFocus on New Horizons\t/New Horizons\tfalse\t\"openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Anchor', 'NewHorizons');openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Aim', '');openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.RetargetAnchor', nil)\"\n\
|
||||
SHIFT+a\tSets the focus of the camera on 'NewHorizons'.\tAnchor at New Horizons, Aim at Pluto\t/New Horizons\tfalse\t\"openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Anchor', 'NewHorizons');openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Aim', 'Pluto');openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.RetargetAnchor', nil)\"\n\
|
||||
s\tSets the focus of the camera on 'Pluto'\tFocus on Pluto\t/New Horizons\tfalse\t\"openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Anchor', 'Pluto') ;openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Aim', ''); openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.RetargetAnchor', nil)\"\n\
|
||||
d\tSets the focus of the camera on 'Charon'.\tFocus on New Charon\t/New Horizons\tfalse\t\"openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Anchor', 'Charon');openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Aim', '');openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.RetargetAnchor', nil)\"\n\
|
||||
F7\tToggles New Horizons image projection.\tToggle NH Image Projection\t/New Horizons\tfalse\t[[local enabled = openspace.getPropertyValue('Scene.PlutoProjection.Renderable.ProjectionComponent.PerformProjection'); openspace.setPropertyValue('Scene.PlutoProjection.Renderable.ProjectionComponent.PerformProjection', not enabled); openspace.setPropertyValue('Scene.CharonProjection.Renderable.ProjectionComponent.PerformProjection', not enabled)]]\n\
|
||||
F8\tRemoves all image projections from Pluto and Charon.\tClear image projections\t/New Horizons\tfalse\t\"openspace.setPropertyValue('Scene.PlutoProjection.Renderable.ProjectionComponent.ClearAllProjections', true); openspace.setPropertyValue('Scene.CharonProjection.Renderable.ProjectionComponent.ClearAllProjections', true)\"\n\
|
||||
F9\tJumps to the 14th of July 2015 at 0900 UTC and clears all projections.\tReset time and projections\t/New Horizons\tfalse\t\"openspace.time.setTime('2015-07-14T09:00:00.00');openspace.setPropertyValue('Scene.PlutoProjection.Renderable.ProjectionComponent.ClearAllProjections', true);openspace.setPropertyValue('Scene.CharonProjection.Renderable.ProjectionComponent.ClearAllProjections', true)\"\n\
|
||||
KP_8\tIncreases the height map exaggeration on Pluto.\tPluto HeightExaggeration +\t/New Horizons\tfalse\tpropertyHelper.increment('Scene.PlutoProjection.Renderable.HeightExaggeration', 5000)\n\
|
||||
CTRL+I\tIncreases the height map exaggeration on Pluto.\tPluto HeightExaggeration +\t/New Horizons\tfalse\tpropertyHelper.increment('Scene.PlutoProjection.Renderable.HeightExaggeration', 5000)\n\
|
||||
KP_2\tDecreases the height map exaggeration on Pluto.\tPluto HeightExaggeration -\t/New Horizons\tfalse\tpropertyHelper.decrement('Scene.PlutoProjection.Renderable.HeightExaggeration', 5000)\n\
|
||||
CTRL+K\tDecreases the height map exaggeration on Pluto.\tPluto HeightExaggeration -\t/New Horizons\tfalse\tpropertyHelper.decrement('Scene.PlutoProjection.Renderable.HeightExaggeration', 5000)\n\
|
||||
KP_9\tIncreases the height map exaggeration on Charon.\tCharon HeightExaggeration +\t/New Horizons\tfalse\tpropertyHelper.increment('Scene.CharonProjection.Renderable.HeightExaggeration', 5000)\n\
|
||||
CTRL+O\tIncreases the height map exaggeration on Charon.\tCharon HeightExaggeration +\t/New Horizons\tfalse\tpropertyHelper.increment('Scene.CharonProjection.Renderable.HeightExaggeration', 5000)\n\
|
||||
KP_3\tDecreases the height map exaggeration on Charon.\tCharon HeightExaggeration -\t/New Horizons\tfalse\tpropertyHelper.decrement('Scene.CharonProjection.Renderable.HeightExaggeration', 5000)\n\
|
||||
CTRL+L\tDecreases the height map exaggeration on Charon.\tCharon HeightExaggeration -\t/New Horizons\tfalse\tpropertyHelper.decrement('Scene.CharonProjection.Renderable.HeightExaggeration', 5000)\n\
|
||||
o\tToggles the visibility of the trail behind Pluto.\tToggle Pluto Trail\t/New Horizons\tfalse\tpropertyHelper.invert('Scene.PlutoBarycentricTrail.Renderable.Enabled')\n\
|
||||
j\tToggles the visibility of the text labels of Pluto, Charon, Hydra, Nix, Kerberos, and Styx.\tToggle Pluto Labels\t/New Horizons\tfalse\trenderableHelper.toggle('Scene.PlutoText') .. renderableHelper.toggle('Scene.CharonText') .. renderableHelper.toggle('Scene.HydraText') .. renderableHelper.toggle('Scene.NixText') .. renderableHelper.toggle('Scene.KerberosText') .. renderableHelper.toggle('Scene.StyxText')\n\
|
||||
l\tToggles the visibility of the labels for the New Horizons instruments.\tToggle New Horizons Labels\t/New Horizons\tfalse\tpropertyHelper.fadeInOut('Scene.Labels.Renderable.Opacity', 2.0)\n\
|
||||
m\tDraws the instrument field of views in a solid color or as lines.\tToggle instrument FOVs\t/New Horizons\tfalse\tpropertyHelper.invert('Scene.NH_LORRI.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_RALPH_LEISA.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_RALPH_MVIC_PAN1.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_RALPH_MVIC_PAN2.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_RALPH_MVIC_RED.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_RALPH_MVIC_BLUE.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_RALPH_MVIC_FT.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_RALPH_MVIC_METHANE.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_RALPH_MVIC_NIR.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_ALICE_AIRGLOW.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_ALICE_SOC.Renderable.SolidDraw')\n\
|
||||
Shift+t\tToggles the visibility of the shadow visualization of Pluto and Charon.\tToggle Shadows\t/New Horizons\tfalse\trenderableHelper.toggle('Scene.PlutoShadow') .. renderableHelper.toggle('Scene.CharonShadow')\n\
|
||||
t\tToggles the trail of New Horizons.\tToggle NH Trail\t/New Horizons\tfalse\trenderableHelper.toggle('Scene.NewHorizonsTrailPluto')\n\
|
||||
h\tDisables visibility of the trails\tHide Trails\t/Rendering\tfalse\t\"local list = openspace.getProperty('*Trail.Renderable.Enabled'); for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end\"\n\
|
||||
1\tSetting the simulation speed to 1 seconds per realtime second\tSet sim speed 1\t/Simulation Speed\tfalse\t\"openspace.time.interpolateDeltaTime(1)\"\n\
|
||||
2\tSetting the simulation speed to 5 seconds per realtime second\tSet sim speed 5\t/Simulation Speed\tfalse\t\"openspace.time.interpolateDeltaTime(5)\"\n\
|
||||
3\tSetting the simulation speed to 10 seconds per realtime second\tSet sim speed 10\t/Simulation Speed\tfalse\t\"openspace.time.interpolateDeltaTime(10)\"\n\
|
||||
4\tSetting the simulation speed to 20 seconds per realtime second\tSet sim speed 20\t/Simulation Speed\tfalse\t\"openspace.time.interpolateDeltaTime(20)\"\n\
|
||||
5\tSetting the simulation speed to 40 seconds per realtime second\tSet sim speed 40\t/Simulation Speed\tfalse\t\"openspace.time.interpolateDeltaTime(40)\"\n\
|
||||
6\tSetting the simulation speed to 60 seconds per realtime second\tSet sim speed 60\t/Simulation Speed\tfalse\t\"openspace.time.interpolateDeltaTime(60)\"\n\
|
||||
7\tSetting the simulation speed to 120 seconds per realtime second\tSet sim speed 120\t/Simulation Speed\tfalse\t\"openspace.time.interpolateDeltaTime(120)\"\n\
|
||||
8\tSetting the simulation speed to 360 seconds per realtime second\tSet sim speed 360\t/Simulation Speed\tfalse\t\"openspace.time.interpolateDeltaTime(360)\"\n\
|
||||
9\tSetting the simulation speed to 540 seconds per realtime second\tSet sim speed 540\t/Simulation Speed\tfalse\t\"openspace.time.interpolateDeltaTime(540)\"\n\
|
||||
0\tSetting the simulation speed to 1080 seconds per realtime second\tSet sim speed 1080\t/Simulation Speed\tfalse\t\"openspace.time.interpolateDeltaTime(1080)\"\n\
|
||||
Shift+1\tSetting the simulation speed to 2160 seconds per realtime second\tSet sim speed 2160\t/Simulation Speed\tfalse\t\"openspace.time.interpolateDeltaTime(2160)\"\n\
|
||||
Shift+2\tSetting the simulation speed to 4320 seconds per realtime second\tSet sim speed 4320\t/Simulation Speed\tfalse\t\"openspace.time.interpolateDeltaTime(4320)\"\n\
|
||||
Shift+3\tSetting the simulation speed to 8640 seconds per realtime second\tSet sim speed 8640\t/Simulation Speed\tfalse\t\"openspace.time.interpolateDeltaTime(8640)\"\n\
|
||||
\n\
|
||||
#Time\n\
|
||||
absolute\t2015-07-14T08:00:00.00\n\
|
||||
\n\
|
||||
#Camera\n\
|
||||
setNavigationState\t\"NewHorizons\"\t\t\"Root\"\t-6.572656E1, -7.239404E1, -2.111890E1\t0.102164, -0.362945, 0.926193\t\t\n\
|
||||
\n\
|
||||
#MarkNodes\n\
|
||||
Pluto\n\
|
||||
NewHorizons\n\
|
||||
Charon";
|
||||
|
||||
const std::string newHorizonsExpectedSceneOutput = "\
|
||||
\n\
|
||||
asset.require(\"base\");\n\
|
||||
local assetHelper = asset.require(\"util/asset_helper\")\n\
|
||||
local propertyHelper = asset.require(\"util/property_helper\")\n\
|
||||
local sceneHelper = asset.require(\"util/scene_helper\")\n\
|
||||
local renderableHelper = asset.require(\"util/renderable_helper\")\n\
|
||||
asset.require(\"scene/solarsystem/missions/newhorizons/newhorizons\")\n\
|
||||
asset.require(\"scene/solarsystem/missions/newhorizons/model\")\n\
|
||||
\n\
|
||||
local Keybindings = {\n\
|
||||
{\n\
|
||||
Key = \"a\",\n\
|
||||
Documentation = \"Sets the focus of the camera on 'NewHorizons'.\",\n\
|
||||
Name = \"Focus on New Horizons\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Anchor', 'NewHorizons');openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Aim', '');openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.RetargetAnchor', nil)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"SHIFT+a\",\n\
|
||||
Documentation = \"Sets the focus of the camera on 'NewHorizons'.\",\n\
|
||||
Name = \"Anchor at New Horizons, Aim at Pluto\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Anchor', 'NewHorizons');openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Aim', 'Pluto');openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.RetargetAnchor', nil)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"s\",\n\
|
||||
Documentation = \"Sets the focus of the camera on 'Pluto'\",\n\
|
||||
Name = \"Focus on Pluto\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Anchor', 'Pluto') ;openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Aim', ''); openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.RetargetAnchor', nil)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"d\",\n\
|
||||
Documentation = \"Sets the focus of the camera on 'Charon'.\",\n\
|
||||
Name = \"Focus on New Charon\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Anchor', 'Charon');openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.Aim', '');openspace.setPropertyValue('NavigationHandler.OrbitalNavigator.RetargetAnchor', nil)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"F7\",\n\
|
||||
Documentation = \"Toggles New Horizons image projection.\",\n\
|
||||
Name = \"Toggle NH Image Projection\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = [[local enabled = openspace.getPropertyValue('Scene.PlutoProjection.Renderable.ProjectionComponent.PerformProjection'); openspace.setPropertyValue('Scene.PlutoProjection.Renderable.ProjectionComponent.PerformProjection', not enabled); openspace.setPropertyValue('Scene.CharonProjection.Renderable.ProjectionComponent.PerformProjection', not enabled)]]\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"F8\",\n\
|
||||
Documentation = \"Removes all image projections from Pluto and Charon.\",\n\
|
||||
Name = \"Clear image projections\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.setPropertyValue('Scene.PlutoProjection.Renderable.ProjectionComponent.ClearAllProjections', true); openspace.setPropertyValue('Scene.CharonProjection.Renderable.ProjectionComponent.ClearAllProjections', true)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"F9\",\n\
|
||||
Documentation = \"Jumps to the 14th of July 2015 at 0900 UTC and clears all projections.\",\n\
|
||||
Name = \"Reset time and projections\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.time.setTime('2015-07-14T09:00:00.00');openspace.setPropertyValue('Scene.PlutoProjection.Renderable.ProjectionComponent.ClearAllProjections', true);openspace.setPropertyValue('Scene.CharonProjection.Renderable.ProjectionComponent.ClearAllProjections', true)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"KP_8\",\n\
|
||||
Documentation = \"Increases the height map exaggeration on Pluto.\",\n\
|
||||
Name = \"Pluto HeightExaggeration +\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = propertyHelper.increment('Scene.PlutoProjection.Renderable.HeightExaggeration', 5000)\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"CTRL+I\",\n\
|
||||
Documentation = \"Increases the height map exaggeration on Pluto.\",\n\
|
||||
Name = \"Pluto HeightExaggeration +\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = propertyHelper.increment('Scene.PlutoProjection.Renderable.HeightExaggeration', 5000)\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"KP_2\",\n\
|
||||
Documentation = \"Decreases the height map exaggeration on Pluto.\",\n\
|
||||
Name = \"Pluto HeightExaggeration -\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = propertyHelper.decrement('Scene.PlutoProjection.Renderable.HeightExaggeration', 5000)\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"CTRL+K\",\n\
|
||||
Documentation = \"Decreases the height map exaggeration on Pluto.\",\n\
|
||||
Name = \"Pluto HeightExaggeration -\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = propertyHelper.decrement('Scene.PlutoProjection.Renderable.HeightExaggeration', 5000)\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"KP_9\",\n\
|
||||
Documentation = \"Increases the height map exaggeration on Charon.\",\n\
|
||||
Name = \"Charon HeightExaggeration +\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = propertyHelper.increment('Scene.CharonProjection.Renderable.HeightExaggeration', 5000)\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"CTRL+O\",\n\
|
||||
Documentation = \"Increases the height map exaggeration on Charon.\",\n\
|
||||
Name = \"Charon HeightExaggeration +\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = propertyHelper.increment('Scene.CharonProjection.Renderable.HeightExaggeration', 5000)\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"KP_3\",\n\
|
||||
Documentation = \"Decreases the height map exaggeration on Charon.\",\n\
|
||||
Name = \"Charon HeightExaggeration -\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = propertyHelper.decrement('Scene.CharonProjection.Renderable.HeightExaggeration', 5000)\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"CTRL+L\",\n\
|
||||
Documentation = \"Decreases the height map exaggeration on Charon.\",\n\
|
||||
Name = \"Charon HeightExaggeration -\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = propertyHelper.decrement('Scene.CharonProjection.Renderable.HeightExaggeration', 5000)\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"o\",\n\
|
||||
Documentation = \"Toggles the visibility of the trail behind Pluto.\",\n\
|
||||
Name = \"Toggle Pluto Trail\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = propertyHelper.invert('Scene.PlutoBarycentricTrail.Renderable.Enabled')\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"j\",\n\
|
||||
Documentation = \"Toggles the visibility of the text labels of Pluto, Charon, Hydra, Nix, Kerberos, and Styx.\",\n\
|
||||
Name = \"Toggle Pluto Labels\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = renderableHelper.toggle('Scene.PlutoText') .. renderableHelper.toggle('Scene.CharonText') .. renderableHelper.toggle('Scene.HydraText') .. renderableHelper.toggle('Scene.NixText') .. renderableHelper.toggle('Scene.KerberosText') .. renderableHelper.toggle('Scene.StyxText')\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"l\",\n\
|
||||
Documentation = \"Toggles the visibility of the labels for the New Horizons instruments.\",\n\
|
||||
Name = \"Toggle New Horizons Labels\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = propertyHelper.fadeInOut('Scene.Labels.Renderable.Opacity', 2.0)\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"m\",\n\
|
||||
Documentation = \"Draws the instrument field of views in a solid color or as lines.\",\n\
|
||||
Name = \"Toggle instrument FOVs\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = propertyHelper.invert('Scene.NH_LORRI.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_RALPH_LEISA.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_RALPH_MVIC_PAN1.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_RALPH_MVIC_PAN2.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_RALPH_MVIC_RED.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_RALPH_MVIC_BLUE.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_RALPH_MVIC_FT.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_RALPH_MVIC_METHANE.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_RALPH_MVIC_NIR.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_ALICE_AIRGLOW.Renderable.SolidDraw') .. propertyHelper.invert('Scene.NH_ALICE_SOC.Renderable.SolidDraw')\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"Shift+t\",\n\
|
||||
Documentation = \"Toggles the visibility of the shadow visualization of Pluto and Charon.\",\n\
|
||||
Name = \"Toggle Shadows\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = renderableHelper.toggle('Scene.PlutoShadow') .. renderableHelper.toggle('Scene.CharonShadow')\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"t\",\n\
|
||||
Documentation = \"Toggles the trail of New Horizons.\",\n\
|
||||
Name = \"Toggle NH Trail\",\n\
|
||||
GuiPath = \"/New Horizons\",\n\
|
||||
Local = false,\n\
|
||||
Command = renderableHelper.toggle('Scene.NewHorizonsTrailPluto')\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"h\",\n\
|
||||
Documentation = \"Disables visibility of the trails\",\n\
|
||||
Name = \"Hide Trails\",\n\
|
||||
GuiPath = \"/Rendering\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"local list = openspace.getProperty('*Trail.Renderable.Enabled'); for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"1\",\n\
|
||||
Documentation = \"Setting the simulation speed to 1 seconds per realtime second\",\n\
|
||||
Name = \"Set sim speed 1\",\n\
|
||||
GuiPath = \"/Simulation Speed\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.time.interpolateDeltaTime(1)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"2\",\n\
|
||||
Documentation = \"Setting the simulation speed to 5 seconds per realtime second\",\n\
|
||||
Name = \"Set sim speed 5\",\n\
|
||||
GuiPath = \"/Simulation Speed\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.time.interpolateDeltaTime(5)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"3\",\n\
|
||||
Documentation = \"Setting the simulation speed to 10 seconds per realtime second\",\n\
|
||||
Name = \"Set sim speed 10\",\n\
|
||||
GuiPath = \"/Simulation Speed\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.time.interpolateDeltaTime(10)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"4\",\n\
|
||||
Documentation = \"Setting the simulation speed to 20 seconds per realtime second\",\n\
|
||||
Name = \"Set sim speed 20\",\n\
|
||||
GuiPath = \"/Simulation Speed\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.time.interpolateDeltaTime(20)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"5\",\n\
|
||||
Documentation = \"Setting the simulation speed to 40 seconds per realtime second\",\n\
|
||||
Name = \"Set sim speed 40\",\n\
|
||||
GuiPath = \"/Simulation Speed\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.time.interpolateDeltaTime(40)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"6\",\n\
|
||||
Documentation = \"Setting the simulation speed to 60 seconds per realtime second\",\n\
|
||||
Name = \"Set sim speed 60\",\n\
|
||||
GuiPath = \"/Simulation Speed\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.time.interpolateDeltaTime(60)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"7\",\n\
|
||||
Documentation = \"Setting the simulation speed to 120 seconds per realtime second\",\n\
|
||||
Name = \"Set sim speed 120\",\n\
|
||||
GuiPath = \"/Simulation Speed\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.time.interpolateDeltaTime(120)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"8\",\n\
|
||||
Documentation = \"Setting the simulation speed to 360 seconds per realtime second\",\n\
|
||||
Name = \"Set sim speed 360\",\n\
|
||||
GuiPath = \"/Simulation Speed\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.time.interpolateDeltaTime(360)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"9\",\n\
|
||||
Documentation = \"Setting the simulation speed to 540 seconds per realtime second\",\n\
|
||||
Name = \"Set sim speed 540\",\n\
|
||||
GuiPath = \"/Simulation Speed\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.time.interpolateDeltaTime(540)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"0\",\n\
|
||||
Documentation = \"Setting the simulation speed to 1080 seconds per realtime second\",\n\
|
||||
Name = \"Set sim speed 1080\",\n\
|
||||
GuiPath = \"/Simulation Speed\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.time.interpolateDeltaTime(1080)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"Shift+1\",\n\
|
||||
Documentation = \"Setting the simulation speed to 2160 seconds per realtime second\",\n\
|
||||
Name = \"Set sim speed 2160\",\n\
|
||||
GuiPath = \"/Simulation Speed\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.time.interpolateDeltaTime(2160)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"Shift+2\",\n\
|
||||
Documentation = \"Setting the simulation speed to 4320 seconds per realtime second\",\n\
|
||||
Name = \"Set sim speed 4320\",\n\
|
||||
GuiPath = \"/Simulation Speed\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.time.interpolateDeltaTime(4320)\"\n\
|
||||
},\n\
|
||||
{\n\
|
||||
Key = \"Shift+3\",\n\
|
||||
Documentation = \"Setting the simulation speed to 8640 seconds per realtime second\",\n\
|
||||
Name = \"Set sim speed 8640\",\n\
|
||||
GuiPath = \"/Simulation Speed\",\n\
|
||||
Local = false,\n\
|
||||
Command = \"openspace.time.interpolateDeltaTime(8640)\"\n\
|
||||
},\n\
|
||||
}\n\
|
||||
\n\
|
||||
asset.onInitialize(function ()\n\
|
||||
openspace.time.setTime(\"2015-07-14T08:00:00.00\")\n\
|
||||
\n\
|
||||
sceneHelper.bindKeys(Keybindings)\n\
|
||||
\n\
|
||||
openspace.markInterestingNodes({\"Pluto\", \"NewHorizons\", \"Charon\", })\n\
|
||||
\n\
|
||||
openspace.setPropertyValueSingle(\"NavigationHandler.OrbitalNavigator.FollowAnchorNodeRotationDistance\", 20.000000)\n\
|
||||
openspace.setPropertyValueSingle(\"Scene.Pluto.Renderable.Enabled\", false)\n\
|
||||
openspace.setPropertyValueSingle(\"Scene.Charon.Renderable.Enabled\", false)\n\
|
||||
openspace.setPropertyValueSingle(\"Scene.PlutoBarycenterTrail.Renderable.Enabled\", false)\n\
|
||||
\n\
|
||||
openspace.navigation.setNavigationState({Anchor = \"NewHorizons\", ReferenceFrame = \"Root\", Position = {-6.572656E1, -7.239404E1, -2.111890E1}, Up = {0.102164, -0.362945, 0.926193}, })\n\
|
||||
end)";
|
||||
|
||||
testProfileFormat buildTestProfile1();
|
||||
std::string stringFromSingleProfileSection(std::vector<std::string>& section,
|
||||
bool blankLineSeparator);
|
||||
std::string stringFromTestProfileFormat(testProfileFormat& tpf);
|
||||
ProfileFile makeProfileFromString(std::string s);
|
||||
|
||||
class StringPerLineReader {
|
||||
public:
|
||||
StringPerLineReader(std::string s);
|
||||
bool getNextLine(std::string& line);
|
||||
|
||||
private:
|
||||
std::istringstream _iss;
|
||||
};
|
||||
|
||||
#endif //__OPENSPACE_TEST___PROFILE_COMMON___H__
|
||||
@@ -0,0 +1,79 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2020 *
|
||||
* *
|
||||
* 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 "catch2/catch.hpp"
|
||||
#include "test_common.h"
|
||||
|
||||
#include "openspace/scene/profile.h"
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/misc/exception.h>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
using namespace openspace;
|
||||
|
||||
namespace {
|
||||
}
|
||||
|
||||
static void addLineHeaderForFailureMessage(std::string& s, size_t lineNumber) {
|
||||
s = "@line " + std::to_string(lineNumber) + ": '" + s + "'";
|
||||
}
|
||||
|
||||
TEST_CASE("profile: Convert profileFile to asset", "[profile]") {
|
||||
testProfileFormat test = buildTestProfile1();
|
||||
std::string testFull_string = stringFromTestProfileFormat(test);
|
||||
|
||||
ProfileFile pf = makeProfileFromString(testFull_string);
|
||||
|
||||
Profile p;
|
||||
REQUIRE_NOTHROW(
|
||||
p.convertToAsset(pf)
|
||||
);
|
||||
}
|
||||
|
||||
TEST_CASE("profile: Verify conversion to scene", "[profile]") {
|
||||
ProfileFile pf = makeProfileFromString(newHorizonsProfileInput);
|
||||
|
||||
Profile p;
|
||||
std::string result;
|
||||
REQUIRE_NOTHROW(
|
||||
result = p.convertToAsset(pf)
|
||||
);
|
||||
|
||||
std::string testing, comparing;
|
||||
StringPerLineReader sr_result(result);
|
||||
StringPerLineReader sr_standard(newHorizonsExpectedSceneOutput);
|
||||
|
||||
size_t lineN = 1;
|
||||
while (sr_result.getNextLine(testing)) {
|
||||
sr_standard.getNextLine(comparing);
|
||||
addLineHeaderForFailureMessage(testing, lineN);
|
||||
addLineHeaderForFailureMessage(comparing, lineN);
|
||||
REQUIRE(testing == comparing);
|
||||
lineN++;
|
||||
}
|
||||
//If this fails there are extra lines in the comparison string that weren't in result
|
||||
REQUIRE(sr_standard.getNextLine(comparing) == false);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "catch2/catch.hpp"
|
||||
|
||||
#include "openspace/scene/profilefile.h"
|
||||
#include "test_common.h"
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/misc/exception.h>
|
||||
#include <iostream>
|
||||
@@ -35,79 +36,6 @@ using namespace openspace;
|
||||
namespace {
|
||||
}
|
||||
|
||||
struct testProfileFormat {
|
||||
std::vector<std::string> tsv;
|
||||
std::vector<std::string> tsm;
|
||||
std::vector<std::string> tsa;
|
||||
std::vector<std::string> tsp;
|
||||
std::vector<std::string> tsk;
|
||||
std::vector<std::string> tst;
|
||||
std::vector<std::string> tsc;
|
||||
std::vector<std::string> tsn;
|
||||
};
|
||||
|
||||
testProfileFormat buildTestProfile1() {
|
||||
testProfileFormat tp1;
|
||||
tp1.tsv.push_back("#Version");
|
||||
tp1.tsv.push_back("123.4");
|
||||
tp1.tsm.push_back("#Module");
|
||||
tp1.tsm.push_back("globebrowsing\t\t");
|
||||
tp1.tsm.push_back("gaia\tprint(\"success.\")\t");
|
||||
tp1.tsm.push_back("volume\t\tquit");
|
||||
tp1.tsa.push_back("#Asset");
|
||||
tp1.tsa.push_back("scene/solarsystem/planets/earth/moon/moon\trequired");
|
||||
tp1.tsa.push_back("scene/solarsystem/missions/apollo/apollo8\trequested");
|
||||
tp1.tsa.push_back("scene/solarsystem/planets/earth/earth\t");
|
||||
tp1.tsp.push_back("#Property");
|
||||
tp1.tsp.push_back("setPropertyValue\tNavigationHandler.OrbitalNavigator.FollowAnchorNodeRotationDistance\t20.000000");
|
||||
tp1.tsp.push_back("setPropertyValueSingle\tScene.Pluto.Renderable.Enabled\tfalse");
|
||||
tp1.tsp.push_back("setPropertyValue\tScene.Charon.Renderable.Enabled\tfalse");
|
||||
tp1.tsp.push_back("setPropertyValueSingle\tScene.PlutoBarycenterTrail.Renderable.Enabled\tfalse");
|
||||
tp1.tsk.push_back("#Keybinding");
|
||||
tp1.tsk.push_back("F8\tSets the time to the approach at Bennu.\tSet Bennu approach time\t/Missions/Osiris Rex\tfalse\t\"openspace.printInfo('Set time: Approach'); openspace.time.setTime('2018-SEP-11 21:31:01.183')\"");
|
||||
tp1.tsk.push_back("F9\tSets the time to the preliminary survey of Bennu.\tSet Bennu survey time\t/Missions/Osiris Rex\tfalse\t\"openspace.printInfo('Set time: Preliminary Survey'); openspace.time.setTime('2018-NOV-20 01:13:12.183')\"");
|
||||
tp1.tsk.push_back("F10\tSets the time to the orbital B event.\tSet orbital B event time\t/Missions/Osiris Rex\tfalse\t\"openspace.printInfo('Set time: Orbital B'); openspace.time.setTime('2019-APR-08 10:35:27.186')\"");
|
||||
tp1.tsk.push_back("F11\tSets the time to the recon event.\tSet recon event time\t/Missions/Osiris Rex\tfalse\t\"openspace.printInfo('Set time: Recon'); openspace.time.setTime('2019-MAY-25 03:50:31.195')\"");
|
||||
tp1.tst.push_back("#Time");
|
||||
tp1.tst.push_back("absolute\t1977-12-21T12:51:51.0");
|
||||
tp1.tsc.push_back("#Camera");
|
||||
tp1.tsc.push_back("setNavigationState\t\"NewHorizons\"\t\t\"Root\"\t-6.572656E1, -7.239404E1, -2.111890E1\t0.102164, -0.362945, 0.926193\t\t");
|
||||
tp1.tsn.push_back("#MarkNodes");
|
||||
tp1.tsn.push_back("Pluto");
|
||||
tp1.tsn.push_back("NewHorizons");
|
||||
tp1.tsn.push_back("Charon");
|
||||
|
||||
return tp1;
|
||||
}
|
||||
|
||||
std::string stringFromSingleProfileSection(std::vector<std::string>& section,
|
||||
bool blankLineSeparator)
|
||||
{
|
||||
std::string result;
|
||||
for (std::string s : section) {
|
||||
result += s + "\n";
|
||||
}
|
||||
if (blankLineSeparator) {
|
||||
result += "\n";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string stringFromTestProfileFormat(testProfileFormat& tpf) {
|
||||
std::string fullProfile;
|
||||
|
||||
fullProfile += stringFromSingleProfileSection(tpf.tsv, true);
|
||||
fullProfile += stringFromSingleProfileSection(tpf.tsm, true);
|
||||
fullProfile += stringFromSingleProfileSection(tpf.tsa, true);
|
||||
fullProfile += stringFromSingleProfileSection(tpf.tsp, true);
|
||||
fullProfile += stringFromSingleProfileSection(tpf.tsk, true);
|
||||
fullProfile += stringFromSingleProfileSection(tpf.tst, true);
|
||||
fullProfile += stringFromSingleProfileSection(tpf.tsc, true);
|
||||
fullProfile += stringFromSingleProfileSection(tpf.tsn, false);
|
||||
|
||||
return fullProfile;
|
||||
}
|
||||
|
||||
TEST_CASE("profileFile: Simple read and verify", "[profileFile]") {
|
||||
testProfileFormat test = buildTestProfile1();
|
||||
std::string testFull_string = stringFromTestProfileFormat(test);
|
||||
|
||||
Reference in New Issue
Block a user