Changed hardcoded filepaths to use user folder

This commit is contained in:
lundkvistarn
2024-11-14 14:20:59 -05:00
parent 105f61f265
commit 2f48c8253f
30 changed files with 38 additions and 174759 deletions

View File

@@ -30,4 +30,4 @@ asset.require("./actions")
--asset.require("./northernViewline")
--asset.require("./southernViewline")
--asset.require("./mission")
--asset.require("./storm")
asset.require("./storm")

View File

@@ -1,355 +0,0 @@
local earth = asset.require("scene/solarsystem/planets/earth/earth")
local notSeenAuroraIcon3997 = {
Identifier = "notSeenAuroraIcon3997",
Parent = earth.Earth.Identifier,
TimeFrame = {
Type = "TimeFrameInterval",
Start = "2024 May 12 22:45:00",
End = "2024 May 12 23:30:00"
},
Transform = {
Translation = {
Type = "GlobeTranslation",
Globe = earth.Earth.Identifier,
Latitude = 53.31583556755319,
Longitude = -1.6365926625630527,
Altitude = 95000,
UseHeightmap = false
}
},
Renderable = {
Type = "RenderablePlaneImageLocal",
Size = 75000,
Origin = "Center",
Billboard = true,
Texture = "${USER_ASSETS}/aurorasaurus/icons/grayIcon.png",
Opacity = 1.0,
Enabled = true
},
GUI = {
Path = "/Aurorasaurus",
Name = "Aurora not seen 3997"
}
}
local AuroraGreenPinkRed3998 = {
Identifier = "AuroraGreenPinkRed3998",
Parent = earth.Earth.Identifier,
TimeFrame = {
Type = "TimeFrameInterval",
Start = "2024 May 11 02:00:00",
End = "2024 May 11 04:00:00"
},
Transform = {
Translation = {
Type = "GlobeTranslation",
Globe = earth.Earth.Identifier,
Latitude = 34.62354389575096,
Longitude = -86.29359909040306,
Altitude = 120000,
UseHeightmap = false
}
},
Renderable = {
Type = "RenderableSwitch",
Renderable1 = {
Type = "RenderablePlaneImageLocal",
Size = 75000,
Origin = "Center",
Billboard = true,
Texture = "C:/Users/alundkvi/Documents/work/data/auroraData/mayImagesCompressed/image_3998.jpg",
Opacity = 1,
Enabled = true
},
Renderable2 = {
Type = "RenderablePlaneImageLocal",
Size = 75000,
Origin = "Center",
Billboard = true,
Texture = "${USER_ASSETS}/aurorasaurus/icons/newIcons2/greenRedPinkCamera.png",
Opacity = 1,
Enabled = true
},
DistanceThreshold = 1000000
},
GUI = {
Path = "/Aurorasaurus",
Name = "Aurora Image 3998"
}
}
local notSeenAuroraIcon3999 = {
Identifier = "notSeenAuroraIcon3999",
Parent = earth.Earth.Identifier,
TimeFrame = {
Type = "TimeFrameInterval",
Start = "2024 May 12 23:00:00",
End = "2024 May 12 23:30:00"
},
Transform = {
Translation = {
Type = "GlobeTranslation",
Globe = earth.Earth.Identifier,
Latitude = 51.28942210363611,
Longitude = 1.0417401624862959,
Altitude = 95000,
UseHeightmap = false
}
},
Renderable = {
Type = "RenderablePlaneImageLocal",
Size = 75000,
Origin = "Center",
Billboard = true,
Texture = "${USER_ASSETS}/aurorasaurus/icons/grayIcon.png",
Opacity = 1.0,
Enabled = true
},
GUI = {
Path = "/Aurorasaurus",
Name = "Aurora not seen 3999"
}
}
local notSeenAuroraIcon4000 = {
Identifier = "notSeenAuroraIcon4000",
Parent = earth.Earth.Identifier,
TimeFrame = {
Type = "TimeFrameInterval",
Start = "2024 May 12 21:45:00",
End = "2024 May 12 23:45:00"
},
Transform = {
Translation = {
Type = "GlobeTranslation",
Globe = earth.Earth.Identifier,
Latitude = 53.10005720754886,
Longitude = -1.125139789746984,
Altitude = 95000,
UseHeightmap = false
}
},
Renderable = {
Type = "RenderablePlaneImageLocal",
Size = 75000,
Origin = "Center",
Billboard = true,
Texture = "${USER_ASSETS}/aurorasaurus/icons/grayIcon.png",
Opacity = 1.0,
Enabled = true
},
GUI = {
Path = "/Aurorasaurus",
Name = "Aurora not seen 4000"
}
}
local notSeenAuroraIcon4001 = {
Identifier = "notSeenAuroraIcon4001",
Parent = earth.Earth.Identifier,
TimeFrame = {
Type = "TimeFrameInterval",
Start = "2024 May 12 23:45:00",
End = "2024 May 13 00:00:00"
},
Transform = {
Translation = {
Type = "GlobeTranslation",
Globe = earth.Earth.Identifier,
Latitude = 52.3912327325193,
Longitude = 0.238438744710565,
Altitude = 95000,
UseHeightmap = false
}
},
Renderable = {
Type = "RenderablePlaneImageLocal",
Size = 75000,
Origin = "Center",
Billboard = true,
Texture = "${USER_ASSETS}/aurorasaurus/icons/grayIcon.png",
Opacity = 1.0,
Enabled = true
},
GUI = {
Path = "/Aurorasaurus",
Name = "Aurora not seen 4001"
}
}
local notSeenAuroraIcon4002 = {
Identifier = "notSeenAuroraIcon4002",
Parent = earth.Earth.Identifier,
TimeFrame = {
Type = "TimeFrameInterval",
Start = "2024 May 12 23:00:00",
End = "2024 May 12 23:45:00"
},
Transform = {
Translation = {
Type = "GlobeTranslation",
Globe = earth.Earth.Identifier,
Latitude = 52.13388471773215,
Longitude = -0.4856795164493719,
Altitude = 95000,
UseHeightmap = false
}
},
Renderable = {
Type = "RenderablePlaneImageLocal",
Size = 75000,
Origin = "Center",
Billboard = true,
Texture = "${USER_ASSETS}/aurorasaurus/icons/grayIcon.png",
Opacity = 1.0,
Enabled = true
},
GUI = {
Path = "/Aurorasaurus",
Name = "Aurora not seen 4002"
}
}
local notSeenAuroraIcon4003 = {
Identifier = "notSeenAuroraIcon4003",
Parent = earth.Earth.Identifier,
TimeFrame = {
Type = "TimeFrameInterval",
Start = "2024 May 12 23:45:00",
End = "2024 May 13 00:00:00"
},
Transform = {
Translation = {
Type = "GlobeTranslation",
Globe = earth.Earth.Identifier,
Latitude = 58.667247475098975,
Longitude = 17.047855454073645,
Altitude = 95000,
UseHeightmap = false
}
},
Renderable = {
Type = "RenderablePlaneImageLocal",
Size = 75000,
Origin = "Center",
Billboard = true,
Texture = "${USER_ASSETS}/aurorasaurus/icons/grayIcon.png",
Opacity = 1.0,
Enabled = true
},
GUI = {
Path = "/Aurorasaurus",
Name = "Aurora not seen 4003"
}
}
local notSeenAuroraIcon4004 = {
Identifier = "notSeenAuroraIcon4004",
Parent = earth.Earth.Identifier,
TimeFrame = {
Type = "TimeFrameInterval",
Start = "2024 May 12 23:00:00",
End = "2024 May 12 23:15:00"
},
Transform = {
Translation = {
Type = "GlobeTranslation",
Globe = earth.Earth.Identifier,
Latitude = 52.53882441644673,
Longitude = -1.527877906533233,
Altitude = 95000,
UseHeightmap = false
}
},
Renderable = {
Type = "RenderablePlaneImageLocal",
Size = 75000,
Origin = "Center",
Billboard = true,
Texture = "${USER_ASSETS}/aurorasaurus/icons/grayIcon.png",
Opacity = 1.0,
Enabled = true
},
GUI = {
Path = "/Aurorasaurus",
Name = "Aurora not seen 4004"
}
}
local notSeenAuroraIcon4005 = {
Identifier = "notSeenAuroraIcon4005",
Parent = earth.Earth.Identifier,
TimeFrame = {
Type = "TimeFrameInterval",
Start = "2024 May 12 23:45:00",
End = "2024 May 13 00:00:00"
},
Transform = {
Translation = {
Type = "GlobeTranslation",
Globe = earth.Earth.Identifier,
Latitude = 51.309025792387146,
Longitude = 0.673219821421318,
Altitude = 95000,
UseHeightmap = false
}
},
Renderable = {
Type = "RenderablePlaneImageLocal",
Size = 75000,
Origin = "Center",
Billboard = true,
Texture = "${USER_ASSETS}/aurorasaurus/icons/grayIcon.png",
Opacity = 1.0,
Enabled = true
},
GUI = {
Path = "/Aurorasaurus",
Name = "Aurora not seen 4005"
}
}
asset.onInitialize(function()
openspace.addSceneGraphNode(notSeenAuroraIcon3997)
openspace.addSceneGraphNode(AuroraGreenPinkRed3998)
openspace.addSceneGraphNode(notSeenAuroraIcon3999)
openspace.addSceneGraphNode(notSeenAuroraIcon4000)
openspace.addSceneGraphNode(notSeenAuroraIcon4001)
openspace.addSceneGraphNode(notSeenAuroraIcon4002)
openspace.addSceneGraphNode(notSeenAuroraIcon4003)
openspace.addSceneGraphNode(notSeenAuroraIcon4004)
openspace.addSceneGraphNode(notSeenAuroraIcon4005)
end)
asset.onDeinitialize(function()
openspace.removeSceneGraphNode(notSeenAuroraIcon3997)
openspace.removeSceneGraphNode(AuroraGreenPinkRed3998)
openspace.removeSceneGraphNode(notSeenAuroraIcon3999)
openspace.removeSceneGraphNode(notSeenAuroraIcon4000)
openspace.removeSceneGraphNode(notSeenAuroraIcon4001)
openspace.removeSceneGraphNode(notSeenAuroraIcon4002)
openspace.removeSceneGraphNode(notSeenAuroraIcon4003)
openspace.removeSceneGraphNode(notSeenAuroraIcon4004)
openspace.removeSceneGraphNode(notSeenAuroraIcon4005)
end)
asset.export(notSeenAuroraIcon3997)
asset.export(AuroraGreenPinkRed3998)
asset.export(notSeenAuroraIcon3999)
asset.export(notSeenAuroraIcon4000)
asset.export(notSeenAuroraIcon4001)
asset.export(notSeenAuroraIcon4002)
asset.export(notSeenAuroraIcon4003)
asset.export(notSeenAuroraIcon4004)
asset.export(notSeenAuroraIcon4005)

View File

@@ -1,7 +1,7 @@
local earth = asset.require("scene/solarsystem/planets/earth/earth")
--ELON: change this to viewline/north_viewline
local geojsonPath = asset.resource("C:/Users/alundkvi/Documents/work/OpenSpace/user/data/assets/aurorasaurus/geojson/geojson_taken_from_master/viewline_geojsons/")
--TODO: Change this to user asset folder
local geojsonPath = asset.resource("C:/Users/alundkvi/Documents/work/OpenSpace/user/data/assets/aurorasaurus/geojson/northern_viewline_geojsons/")
local Viewline_1 = {

View File

@@ -1,19 +1,8 @@
local globe = asset.require("scene/solarsystem/planets/earth/earth")
--ELON: change this to oval_layer_images/north_images
local northPath = "C:/Users/alundkvi/Documents/work/scripts/oval_geojsons_north/combined_images/"
--ELON: change this to oval_layer_images/south_images
--local southPath = "C:/Users/alundkvi/Documents/work/scripts/oval_geojsons_south/combined_images/"
local southPath = "C:/Users/alundkvi/Documents/work/scripts/scriptTest/oval/combined_images/"
local northPathNameChange = "C:/Users/alundkvi/Documents/work/scripts/oval_geojsons_north/combined_images_namechange"
local southPathNameChange = "C:/Users/alundkvi/Documents/work/scripts/oval_geojsons_south/combined_images_namechange"
local northPath = "${USER_ASSETS}/aurorasaurus/oval_images/north/"
local southPath = "${USER_ASSETS}/aurorasaurus/oval_images/south/"
local NorthLayer = {
Identifier = "Oval_North",
@@ -57,50 +46,6 @@ local SouthLayer = {
Opacity = 1
}
local NorthLayerNameChange = {
Identifier = "North_Oval_LayerNameChange",
Parent = globe.Earth.Identifier,
Enabled = asset.disabled,
InteractionSphere = 6379137,
Renderable = {
Type = "RenderableTimeVaryingSphere",
Size = 6379137.0, -- Slightly bigger than the sun renderable,
Enabled = true,
TextureSource = northPathNameChange,
Opacity = 1,
Segments = 532
},
GUI = {
Name = "North Oval",
Path = "/test",
Description = [[Texture sequence of an extreme ultra violet (EUV) simulation, during
the CME. This asset contains data from 2000-07-14 08:38 to 2000-07-14 19:48]]
}
}
local SouthLayerNameChange = {
Identifier = "South_Oval_LayerNameChange",
Parent = globe.Earth.Identifier,
Enabled = asset.disabled,
InteractionSphere = 6379137,
Renderable = {
Type = "RenderableTimeVaryingSphere",
Size = 6379137.0, -- Slightly bigger than the sun renderable,
Enabled = true,
TextureSource = southPathNameChange,
Opacity = 1,
Segments = 532
},
GUI = {
Name = "South Oval",
Path = "/test",
Description = [[Texture sequence of an extreme ultra violet (EUV) simulation, during
the CME. This asset contains data from 2000-07-14 08:38 to 2000-07-14 19:48]]
}
}
local ToggleNorthLayer = {
Identifier = "os.ToggleNorthLayer",
Name = "Toggle North Oval Layer",
@@ -155,78 +100,15 @@ local ToggleSouthLayer = {
IsLocal = false
}
local ToggleNorthLayerNameChange = {
Identifier = "os.solarsystem.ToggleNorthLayerNameChange",
Name = "Toggle EUV layer",
Command = [[
if openspace.propertyValue("Scene.EUV-Layer-bastille-day-2000.Renderable.Enabled") then
openspace.setPropertyValueSingle(
"Scene.EUV-Layer-bastille-day-2000.Renderable.Fade",
0.0,
openspace.propertyValue("OpenSpaceEngine.FadeDuration"),
"Linear",
'openspace.setPropertyValueSingle("Scene.EUV-Layer-bastille-day-2000.Renderable.Enabled", false)'
)
else
openspace.setPropertyValueSingle("Scene.EUV-Layer-bastille-day-2000.Renderable.Enabled", true)
openspace.setPropertyValueSingle(
"Scene.EUV-Layer-bastille-day-2000.Renderable.Fade",
1.0,
openspace.propertyValue("OpenSpaceEngine.FadeDuration"),
"Linear"
)
end
]],
Documentation = "Toggle EUV layer of sun",
GuiPath = "/Bastille-Day 2000",
IsLocal = false
}
local ToggleSouthLayerNameChange = {
Identifier = "os.solarsystem.ToggleSouthLayerNameChange",
Name = "Toggle EUV layer",
Command = [[
if openspace.propertyValue("Scene.EUV-Layer-bastille-day-2000.Renderable.Enabled") then
openspace.setPropertyValueSingle(
"Scene.EUV-Layer-bastille-day-2000.Renderable.Fade",
0.0,
openspace.propertyValue("OpenSpaceEngine.FadeDuration"),
"Linear",
'openspace.setPropertyValueSingle("Scene.EUV-Layer-bastille-day-2000.Renderable.Enabled", false)'
)
else
openspace.setPropertyValueSingle("Scene.EUV-Layer-bastille-day-2000.Renderable.Enabled", true)
openspace.setPropertyValueSingle(
"Scene.EUV-Layer-bastille-day-2000.Renderable.Fade",
1.0,
openspace.propertyValue("OpenSpaceEngine.FadeDuration"),
"Linear"
)
end
]],
Documentation = "Toggle EUV layer of sun",
GuiPath = "/Bastille-Day 2000",
IsLocal = false
}
asset.onInitialize(function()
openspace.globebrowsing.addLayer(globe.Earth.Identifier, "ColorLayers", NorthLayer)
openspace.globebrowsing.addLayer(globe.Earth.Identifier, "ColorLayers", SouthLayer)
openspace.action.registerAction(ToggleNorthLayer)
openspace.action.registerAction(ToggleSouthLayer)
--[[ openspace.action.registerAction(ToggleNorthLayerNameChange)
openspace.action.registerAction(ToggleSouthLayerNameChange)
openspace.addSceneGraphNode(NorthLayerNameChange)
openspace.addSceneGraphNode(SouthLayerNameChange)
openspace.setPropertyValueSingle("Scene.North_Oval_LayerNameChange.Rotation.Rotation", {0.000000,0.000000,-3.140000})
openspace.setPropertyValueSingle("Scene.South_Oval_LayerNameChange.Rotation.Rotation", {0.000000,0.000000,-3.140000}) ]]
end)
asset.onDeinitialize(function()
--[[ openspace.action.removeAction(ToggleNorthLayerNameChange)
openspace.action.removeAction(ToggleSouthLayerNameChange)
openspace.removeSceneGraphNode(NorthLayerNameChange)
openspace.removeSceneGraphNode(SouthLayerNameChange) ]]
openspace.action.removeAction(ToggleNorthLayer)
openspace.action.removeAction(ToggleSouthLayer)
openspace.globebrowsing.deleteLayer(globe.Earth.Identifier, "ColorLayers", NorthLayer)
@@ -236,9 +118,4 @@ end)
asset.export("Prototype", NorthLayer)
asset.export("Prototype", SouthLayer)
asset.export("ToggleNorthLayer", ToggleNorthLayer.Identifier)
asset.export("ToggleSouthLayer", ToggleSouthLayer.Identifier)
--[[ asset.export("ToggleNorthLayerNameChange", ToggleNorthLayerNameChange.Identifier)
asset.export("ToggleSouthLayerNameChange", ToggleSouthLayerNameChange.Identifier)
asset.export(NorthLayerNameChange)
asset.export(SouthLayerNameChange) ]]
asset.export("ToggleSouthLayer", ToggleSouthLayer.Identifier)

View File

@@ -1,8 +1,7 @@
local earth = asset.require("scene/solarsystem/planets/earth/earth")
--ELON: change this to viewline/south_viewline
local geojsonPath = asset.resource("C:/Users/alundkvi/Documents/work/OpenSpace/user/data/assets/aurorasaurus/geojson/geojson_taken_from_master/southern_viewline_geojsons/")
--TODO: Change this to user asset folder
local geojsonPath = asset.resource("C:/Users/alundkvi/Documents/work/OpenSpace/user/data/assets/aurorasaurus/geojson/southern_viewline_geojsons/")
local southern_viewline_1 = {
Identifier = "southern_viewline_2024-05-10 15-00-00_1",

View File

@@ -16,6 +16,7 @@ local Dashboard = {
Identifier = "KPindexText",
GuiName = "Storm KP index",
Text = "",
DataFile = "${USER_ASSETS}/aurorasaurus/KPjson/observed_data.json",
FontSize = 72
}
}
@@ -26,8 +27,7 @@ local marker = {
Name = "ISWA Cygnets",
Type = "ScreenSpaceImageOnline",
FaceCamera = false,
--ELON: change this to magnetopause.json
URL = "C:/Users/alundkvi/Documents/work/OpenSpace/user/data/assets/aurorasaurus/ISWAcygnets/magnetopause.json"
JsonFilePath = "${USER_ASSETS}/aurorasaurus/ISWAcygnets/magnetopause.json"
}

View File

@@ -27,6 +27,8 @@
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
#include <openspace/engine/globals.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <openspace/util/timemanager.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
@@ -45,10 +47,17 @@ namespace {
"The text to be displayed.",
openspace::properties::Property::Visibility::User
};
constexpr openspace::properties::Property::PropertyInfo DataFileInfo = {
"DataFile",
"Data File Path",
"The file path to the JSON data.",
openspace::properties::Property::Visibility::User
};
struct [[codegen::Dictionary(DashboardItemText)]] Parameters {
// [[codegen::verbatim(TextInfo.description)]]
std::optional<std::string> text;
std::string dataFile;
};
#include "dashboarditemtext_codegen.cpp"
} // namespace
@@ -83,12 +92,14 @@ void DashboardItemText::loadDataFromJson(const std::string& filePath) {
DashboardItemText::DashboardItemText(const ghoul::Dictionary& dictionary)
: DashboardTextItem(dictionary)
, _text(TextInfo, "")
, _dataFile(DataFileInfo, "")
{
const Parameters p = codegen::bake<Parameters>(dictionary);
_text = p.text.value_or(_text);
addProperty(_text);
//ELON: change this to observed_data.json
loadDataFromJson("C:/Users/alundkvi/Documents/work/OpenSpace/user/data/assets/aurorasaurus/KPjson/observed_data.json");
_dataFile = absPath(p.dataFile).string();
addProperty(_dataFile);
loadDataFromJson(_dataFile);
}
std::string formatTimeForData(std::string_view timeStr) {

View File

@@ -53,8 +53,12 @@ public:
static documentation::Documentation Documentation();
protected:
private:
properties::StringProperty _text;
properties::StringProperty _dataFile;
std::unordered_map<std::string, double> _data;
mutable double _lastValue = 0.0;

View File

@@ -54,8 +54,17 @@ namespace {
openspace::properties::Property::Visibility::User
};
constexpr openspace::properties::Property::PropertyInfo DataFileInfo = {
"JsonFilePath",
"Json File Path",
"The file path to the JSON data.",
openspace::properties::Property::Visibility::User
};
struct [[codegen::Dictionary(ScreenSpaceImageOnline)]] Parameters {
std::optional<std::string> url [[codegen::key("URL")]];
std::string jsonFilePath;
};
#include "screenspaceimageonline_codegen.cpp"
} // namespace
@@ -85,7 +94,8 @@ namespace openspace {
setIdentifier(std::move(identifier));
_texturePath.onChange([this]() { _textureIsDirty = true; });
_texturePath = p.url.value_or(_texturePath);
//_texturePath = p.url.value_or(_texturePath);
_texturePath = absPath(p.jsonFilePath).string();
addProperty(_texturePath);
_lastCheckedSoftwareTimestamp = getCurrentTimestamp();