Skip to content

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbeverage committed Jan 31, 2025
1 parent c891a82 commit e4be76f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 79 deletions.
20 changes: 1 addition & 19 deletions src/osgEarthImGui/NodeGraphGUI
Original file line number Diff line number Diff line change
Expand Up @@ -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<FeatureOutputOperation>(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();

Expand Down
68 changes: 8 additions & 60 deletions src/osgEarthProcedural/NodeGraph
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
};


Expand Down Expand Up @@ -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<NodeOutputOperation*>(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<typename T>
NodeGraphResult* execute(const NodeGraphContext& context)
{
Expand Down Expand Up @@ -1884,7 +1832,7 @@ namespace osgEarth
}

TileKey _tileKey;
const Map* _map;
const Map* _map = nullptr;
std::shared_ptr< NodeGraph > _nodeGraph;
};
} }

0 comments on commit e4be76f

Please sign in to comment.