Modified Files:
interpolater.cxx interpolater.hxx: Enable reading tables directly from our dom like tree.
This commit is contained in:
parent
a4b28e5737
commit
aef2a1c484
@ -29,6 +29,7 @@
|
||||
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/misc/sgstream.hxx>
|
||||
#include <simgear/props/props.hxx>
|
||||
|
||||
#include "interpolater.hxx"
|
||||
|
||||
@ -39,6 +40,15 @@ SGInterpTable::SGInterpTable()
|
||||
{
|
||||
}
|
||||
|
||||
SGInterpTable::SGInterpTable(const SGPropertyNode* interpolation)
|
||||
{
|
||||
if (!interpolation)
|
||||
return;
|
||||
std::vector<SGPropertyNode_ptr> entries = interpolation->getChildren("entry");
|
||||
for (unsigned i = 0; i < entries.size(); ++i)
|
||||
addEntry(entries[i]->getDoubleValue("ind", 0.0),
|
||||
entries[i]->getDoubleValue("dep", 0.0));
|
||||
}
|
||||
|
||||
// Constructor -- loads the interpolation table from the specified
|
||||
// file
|
||||
|
@ -42,6 +42,8 @@
|
||||
#include STL_STRING
|
||||
SG_USING_STD(string);
|
||||
|
||||
class SGPropertyNode;
|
||||
|
||||
/**
|
||||
* A class that provids a simple linear 2d interpolation lookup table.
|
||||
* The actual table is expected to be loaded from a file. The
|
||||
@ -56,6 +58,13 @@ public:
|
||||
*/
|
||||
SGInterpTable();
|
||||
|
||||
/**
|
||||
* Constructor. Loads the interpolation table from an interpolation
|
||||
* property node.
|
||||
* @param interpolation property node having entry children
|
||||
*/
|
||||
SGInterpTable(const SGPropertyNode* interpolation);
|
||||
|
||||
/**
|
||||
* Constructor. Loads the interpolation table from the specified file.
|
||||
* @param file name of interpolation file
|
||||
|
Loading…
Reference in New Issue
Block a user