#include <Main/globals.hxx>
#include <Main/util.hxx>
-#include <Scripting/NasalSys.hxx>
+#include <Network/HTTPClient.hxx>
#include <Viewer/renderer.hxx>
#include <osgDB/ReadFile>
//----------------------------------------------------------------------------
void FGCanvasSystemAdapter::removeCamera(osg::Camera* camera) const
{
- globals->get_renderer()->removeCamera(camera);
+ if( globals->get_renderer() )
+ globals->get_renderer()->removeCamera(camera);
}
//----------------------------------------------------------------------------
return 0;
}
- /**
- * Get current FGNasalSys instance.
- */
- static FGNasalSys* getNasalSys()
- {
- static FGNasalSys* nasal_sys = 0;
- // TODO if Nasal is able to be removed and/or recreated at runtime we need
- // to ensure that always the current instance is used
- if( !nasal_sys )
- {
- nasal_sys = dynamic_cast<FGNasalSys*>(globals->get_subsystem("nasal"));
- if( !nasal_sys )
- throw std::runtime_error("FGCanvasSystemAdapter: no NasalSys");
- }
-
- return nasal_sys;
- }
-
- //----------------------------------------------------------------------------
- naContext FGCanvasSystemAdapter::getNasalContext() const
- {
- return getNasalSys()->context();
- }
-
//----------------------------------------------------------------------------
- int FGCanvasSystemAdapter::gcSave(naRef r)
+ simgear::HTTP::Client* FGCanvasSystemAdapter::getHTTPClient() const
{
- return getNasalSys()->gcSave(r);
- }
+ FGHTTPClient* http =
+ static_cast<FGHTTPClient*>(globals->get_subsystem("http"));
- //----------------------------------------------------------------------------
- void FGCanvasSystemAdapter::gcRelease(int key)
- {
- getNasalSys()->gcRelease(key);
- }
+ if( http )
+ return http->client();
- //------------------------------------------------------------------------------
- naRef FGCanvasSystemAdapter::callMethod( naRef code,
- naRef self,
- int argc,
- naRef* args,
- naRef locals )
- {
- return getNasalSys()->callMethod(code, self, argc, args, locals);
+ SG_LOG( SG_IO,
+ SG_ALERT,
+ "FGCanvasSystemAdapter: Failed to get HTTP subsystem" );
+ return 0;
}
}