local transforms = asset.require("scene/solarsystem/sun/transforms")



local GalacticBand = {
    Identifier = "GalacticBand",
    Parent = transforms.SolarSystemBarycenter.Name,
    Transform = {
        Scale = {
          Type = "StaticScale",
          Scale = 9.46377307652E18
        }
    },
    Renderable = {
        Type = "RenderableRadialGrid",
        Opacity = 0.8,
        Color = { 1.0, 1.0, 1.0 },
        LineWidth = 3.0,
        GridSegments = { 1, 1 },
        Radii = { 0.5, 0.5 },
        Enabled = asset.enabled
    },
    GUI = {
        Name = "Galactic Equator Line",
        Path = "/Other/Lines"
    }
}


local ShowGalacticBand = {
  Identifier = "os.nightsky.ShowGalacticBand",
  Name = "Show galactic band",
  Command = [[
    openspace.fadeIn("Scene.GalacticBand.Renderable")
  ]],
  Documentation = "Shows the galactic band",
  GuiPath = "/Night Sky/Lines and Grids/Show and Hide",
  IsLocal = false
}

local HideGalacticBand = {
  Identifier = "os.nightsky.HideGalacticBand",
  Name = "Hide galactic band",
  Command = [[
    openspace.fadeOut("Scene.GalacticBand.Renderable")
  ]],
  Documentation = "Hides the galactic band",
  GuiPath = "/Night Sky/Lines and Grids/Show and Hide",
  IsLocal = false
}

local ToggleGalacticBand = {
  Identifier = "os.nightsky.ToggleGalacticBand",
  Name = "Toggle galactic equator line",
  Command = "openspace.toggleFade('Scene.GalacticBand.Renderable')",
  Documentation = "Toggles the galactic equator line visibilty",
  GuiPath = "/Night Sky/Lines and Grids",
  IsLocal = false
}

asset.onInitialize(function()
  openspace.addSceneGraphNode(GalacticBand)
  openspace.action.registerAction(ShowGalacticBand)
  openspace.action.registerAction(HideGalacticBand)
end)

asset.onDeinitialize(function()
  openspace.action.removeAction(HideGalacticBand)
  openspace.action.removeAction(ShowGalacticBand)
  openspace.removeSceneGraphNode(GalacticBand)
end)

asset.export(GalacticBand)
asset.export("ShowGalacticBand", ShowGalacticBand.Identifier)
asset.export("HideGalacticBand", HideGalacticBand.Identifier)
