nasal::Ghost tweaking and to_nasal_helper for SGGeod.
This commit is contained in:
@@ -278,6 +278,14 @@ namespace nasal
|
|||||||
return *getSingletonPtr();
|
return *getSingletonPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether ghost type has already been initialized.
|
||||||
|
*/
|
||||||
|
static bool isInit()
|
||||||
|
{
|
||||||
|
return getSingletonPtr();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a base class for this ghost. The base class needs to be
|
* Register a base class for this ghost. The base class needs to be
|
||||||
* registers on its own before it can be used as base class.
|
* registers on its own before it can be used as base class.
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ int main(int argc, char* argv[])
|
|||||||
.member("base", &DoubleDerived2::getBase)
|
.member("base", &DoubleDerived2::getBase)
|
||||||
.method("doIt", &DoubleDerived2::doSomeBaseWork);
|
.method("doIt", &DoubleDerived2::doSomeBaseWork);
|
||||||
|
|
||||||
|
VERIFY( Ghost<BasePtr>::isInit() );
|
||||||
nasal::to_nasal(c, DoubleDerived2Ptr());
|
nasal::to_nasal(c, DoubleDerived2Ptr());
|
||||||
|
|
||||||
BasePtr d( new Derived );
|
BasePtr d( new Derived );
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <simgear/nasal/cppbind/NasalHash.hxx>
|
#include <simgear/nasal/cppbind/NasalHash.hxx>
|
||||||
#include <simgear/nasal/cppbind/Ghost.hxx>
|
#include <simgear/nasal/cppbind/Ghost.hxx>
|
||||||
|
|
||||||
|
#include <simgear/math/SGMath.hxx>
|
||||||
#include <simgear/misc/sg_path.hxx>
|
#include <simgear/misc/sg_path.hxx>
|
||||||
|
|
||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
@@ -52,6 +53,16 @@ namespace nasal
|
|||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
naRef to_nasal_helper(naContext c, const SGGeod& pos)
|
||||||
|
{
|
||||||
|
nasal::Hash hash(c);
|
||||||
|
hash.set("lat", pos.getLatitudeDeg());
|
||||||
|
hash.set("lon", pos.getLongitudeDeg());
|
||||||
|
hash.set("elevation", pos.getElevationM());
|
||||||
|
return hash.get_naRef();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
naRef to_nasal_helper(naContext c, const SGPath& path)
|
naRef to_nasal_helper(naContext c, const SGPath& path)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
class SGGeod;
|
||||||
class SGPath;
|
class SGPath;
|
||||||
|
|
||||||
namespace nasal
|
namespace nasal
|
||||||
@@ -63,6 +64,8 @@ namespace nasal
|
|||||||
*/
|
*/
|
||||||
naRef to_nasal_helper(naContext c, const naRef& ref);
|
naRef to_nasal_helper(naContext c, const naRef& ref);
|
||||||
|
|
||||||
|
naRef to_nasal_helper(naContext c, const SGGeod& pos);
|
||||||
|
|
||||||
naRef to_nasal_helper(naContext c, const SGPath& path);
|
naRef to_nasal_helper(naContext c, const SGPath& path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user