From e4be76f1ad90d30b28f5b7083c6cf16d1c54a8da Mon Sep 17 00:00:00 2001 From: Jason Beverage Date: Fri, 31 Jan 2025 10:11:56 -0500 Subject: [PATCH] Minor updates --- src/osgEarthImGui/NodeGraphGUI | 20 +--------- src/osgEarthProcedural/NodeGraph | 68 ++++---------------------------- 2 files changed, 9 insertions(+), 79 deletions(-) diff --git a/src/osgEarthImGui/NodeGraphGUI b/src/osgEarthImGui/NodeGraphGUI index 2214a48054..a771826b8c 100644 --- a/src/osgEarthImGui/NodeGraphGUI +++ b/src/osgEarthImGui/NodeGraphGUI @@ -201,25 +201,7 @@ namespace osgEarth } ImGui::EndMenu(); - } - - if (ImGui::MenuItem("Export Features")) - { - NodeGraphContext context; - context.map = _mapNode->getMap(); - context.tileKey = TileKey(14, 9091, 5773, osgEarth::Registry::instance()->getGlobalGeodeticProfile()); - NodeGraphResult* result = _proceduralModelLayer->getNodeGraph()->execute(context); - if (result) - { - for (auto& f : result->featuresValue) - { - f->transform(osgEarth::SpatialReference::create("wgs84")); - f->getGeometry()->close(); - } - std::ofstream out("H:/dev/osgearth/tests/features.json"); - out << osgEarth::Feature::featuresToGeoJSON(result->featuresValue); - } - } + } } ImGui::EndMenuBar(); diff --git a/src/osgEarthProcedural/NodeGraph b/src/osgEarthProcedural/NodeGraph index 414dda2d11..5c39af30e7 100644 --- a/src/osgEarthProcedural/NodeGraph +++ b/src/osgEarthProcedural/NodeGraph @@ -106,10 +106,16 @@ namespace osgEarth } int getId() const { return _id; } + const std::string& getName() const { return _name; } + void setName(const std::string& name) + { + _name = name; + } + AttributeType getType() const { return _type; } @@ -1303,20 +1309,7 @@ namespace osgEarth // These are modified in place, this is faster but is destructive to the features from the input set_output("Points", points->featuresValue); } - } - - unsigned int getCount() const - { - return _count; - } - - void setCount(unsigned int count) - { - _count = count; - } - - unsigned int _count = 10; - Random _prng; + } }; @@ -1753,51 +1746,6 @@ namespace osgEarth class OSGEARTHPROCEDURAL_EXPORT NodeGraph { public: -#if 0 - virtual void execute(const NodeGraphContext& context) - { - // The NodeGraph can be ran multiple times during threaded loading for each load. Maybe it needs cloned or something for reach - // execution - // Lock it for now. - std::lock_guard< std::mutex > lk(_mutex); - - NodeOutputOperation* outputNode = nullptr; - // First reset all the operations and find the output node. - for (auto& op : operations) - { - op->reset(); - - if (!outputNode) - { - outputNode = dynamic_cast(op.get()); - } - } - - if (!outputNode) - { - OE_NOTICE << "No NodeOutputOperation found" << std::endl; - return; - } - - - // Build the dependencies. We could do this at connect/disconnect time instead but this should be fast enough. - for (auto& op : operations) - { - for (auto& link : op->getLinks()) - { - // Add a dependency for the destination - link._destination->addDependency(op.get()); - } - } - - // Execute only the output node with it's dependencies - outputNode->executeWithDependencies(context); - - // In theory there is a final node now. - _output = outputNode->result.get(); - } -#endif - template NodeGraphResult* execute(const NodeGraphContext& context) { @@ -1884,7 +1832,7 @@ namespace osgEarth } TileKey _tileKey; - const Map* _map; + const Map* _map = nullptr; std::shared_ptr< NodeGraph > _nodeGraph; }; } }