Skip to content

Commit

Permalink
LayersGUI: add ContourMap to add-layer menu
Browse files Browse the repository at this point in the history
  • Loading branch information
gwaldron committed Jan 21, 2025
1 parent 1d3167d commit 92c36dd
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/osgEarthImGui/LayersGUI
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,16 @@ namespace osgEarth
if (ramp.empty())
ramp = xfer->getColorMap();

ImGui::BeginTable("contours", 3, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_BordersV | ImGuiTableFlags_BordersOuterH | ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg | ImGuiTableFlags_NoBordersInBody);
ImGui::BeginTable("contours", 3, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_BordersV |
ImGuiTableFlags_BordersOuterH | ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg | ImGuiTableFlags_NoBordersInBody);
float to_remove = FLT_MAX;
float to_add = FLT_MAX;
osg::Vec4f to_add_color;

ImGui::TableSetupScrollFreeze(0, 1); // Make top row always visible
ImGui::TableSetupColumn("Elevation", ImGuiTableColumnFlags_None, 200.0f);
ImGui::TableSetupColumn("Color", ImGuiTableColumnFlags_None, 400.0f);
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_None, 20.0f);
ImGui::TableSetupColumn("Elevation", ImGuiTableColumnFlags_WidthFixed, 200.0f);
ImGui::TableSetupColumn("Color", ImGuiTableColumnFlags_WidthFixed, 400.0f);
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed, 20.0f);
ImGui::TableHeadersRow();

for (auto& item : ramp)
Expand Down Expand Up @@ -1201,16 +1202,29 @@ namespace osgEarth
}
}

// Contourmap
if (_mapNode->getMap()->getLayer<ContourMapLayer>() == nullptr)
{
if (ImGui::MenuItem("Contour Map"))
{
auto* layer = new ContourMapLayer();
layer->setName("Contour Map");
_mapNode->getMap()->addLayer(layer);
}
}

// Debug tiles
if (_mapNode->getMap()->getLayer<DebugImageLayer>() == nullptr)
{
if (ImGui::MenuItem("Debug"))
if (ImGui::MenuItem("Debug Tiles"))
{
DebugImageLayer* debugImage = new DebugImageLayer;
debugImage->setName("Debug");
_mapNode->getMap()->addLayer(debugImage);
}
}


//ImGui::EndMenu();
}
}
Expand Down

0 comments on commit 92c36dd

Please sign in to comment.