AGX Dynamics  2.35.0.1
agxTerrain::ExternalTerrainDataSource Class Reference

This class provides a concrete, serializable base class which classes written in other languages can inherit from to create data sources. More...

#include <TerrainDataSource.h>

+ Inheritance diagram for agxTerrain::ExternalTerrainDataSource:

Public Member Functions

 ExternalTerrainDataSource ()
 Constructor. More...
 
virtual TerrainHeightType fetchTerrainTile (const TileSpecification &ts, agxTerrain::TileId id) override
 Overload of TerrainDataSource::fetchTerrainTile for fetching terrain data. More...
 
const char * getClassName () const override
 
agxStream::StorageAgent * getStorageAgent () const override
 
virtual bool raycast (agx::Vec3 start, agx::Vec3 end, agx::Vec3 &raycastResult) override
 Overload of TerrainDataSource::raycast for performing raycast against the data source. More...
 
virtual void restore (agxStream::InputArchive &in) override
 
virtual void store (agxStream::OutputArchive &out) const override
 
- Public Member Functions inherited from agxTerrain::TerrainDataSource
 AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agxTerrain::TerrainDataSource)
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor. More...
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting. More...
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match. More...
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test. More...
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object. More...
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings. More...
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object. More...
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object. More...
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive. More...
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object. More...
 

Static Public Member Functions

static agxStream::Serializable * create ()
 
static agxStream::Serializable * create (agxStream::InputArchive &)
 
static const char * getConstructClassId ()
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled. More...
 

Protected Member Functions

 ~ExternalTerrainDataSource ()
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor. More...
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor. More...
 
 Serializable (const Serializable &other)
 Copy constructor. More...
 
void generateUuid ()
 

Additional Inherited Members

- Public Types inherited from agxTerrain::TerrainDataSource
typedef agx::RealVector TerrainHeightType
 Datatype used for returning height values. More...
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More...
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

This class provides a concrete, serializable base class which classes written in other languages can inherit from to create data sources.

This class NOT meant to be used in C++ code or instantiated, only to provide an interface to child classes.

The need for this class arises from the TerrainDataSource class being an abstract class which in turn is not serializable, meaning that simulations containing external data source classes inheriting from TerrainDataSource fails during serialization.

The solution is to instead inherit from this class which disables serialization of the data source.

Definition at line 199 of file TerrainDataSource.h.

Constructor & Destructor Documentation

◆ ExternalTerrainDataSource()

agxTerrain::ExternalTerrainDataSource::ExternalTerrainDataSource ( )

Constructor.

Note that class should not be instantiated, only inherited

◆ ~ExternalTerrainDataSource()

agxTerrain::ExternalTerrainDataSource::~ExternalTerrainDataSource ( )
inlineprotected

Definition at line 229 of file TerrainDataSource.h.

Member Function Documentation

◆ create() [1/2]

static agxStream::Serializable* agxTerrain::ExternalTerrainDataSource::create ( )
inlinestatic

Definition at line 226 of file TerrainDataSource.h.

◆ create() [2/2]

static agxStream::Serializable* agxTerrain::ExternalTerrainDataSource::create ( agxStream::InputArchive &  )
inlinestatic

Definition at line 226 of file TerrainDataSource.h.

◆ fetchTerrainTile()

virtual TerrainHeightType agxTerrain::ExternalTerrainDataSource::fetchTerrainTile ( const TileSpecification &  ts,
agxTerrain::TileId  id 
)
overridevirtual

Overload of TerrainDataSource::fetchTerrainTile for fetching terrain data.

Parameters
ts- The specification of how new tiles are created by the data source
id- The id or position of the tile relative to other paged terrain tiles
Returns
A vector containing the height data for the new tile

Implements agxTerrain::TerrainDataSource.

◆ getClassName()

const char* agxTerrain::ExternalTerrainDataSource::getClassName ( ) const
inlineoverridevirtual
Returns
the class name of this class.

Reimplemented from agxStream::Serializable.

Definition at line 226 of file TerrainDataSource.h.

◆ getConstructClassId()

static const char* agxTerrain::ExternalTerrainDataSource::getConstructClassId ( )
inlinestatic

Definition at line 226 of file TerrainDataSource.h.

◆ getStorageAgent()

agxStream::StorageAgent* agxTerrain::ExternalTerrainDataSource::getStorageAgent ( ) const
inlineoverridevirtual
Returns
the storage agent

Implements agxStream::Serializable.

Definition at line 226 of file TerrainDataSource.h.

◆ raycast()

virtual bool agxTerrain::ExternalTerrainDataSource::raycast ( agx::Vec3  start,
agx::Vec3  end,
agx::Vec3 &  raycastResult 
)
overridevirtual

Overload of TerrainDataSource::raycast for performing raycast against the data source.

Parameters
start- The start position of the raycast
end- The end position of the raycast
raycastResult- A reference to a Vec3 in which to store the point where the raycast hits the data source,
Returns
true if terrain is hit and raycastResult is then updated with position for the hit.

Reimplemented from agxTerrain::TerrainDataSource.

◆ restore()

virtual void agxTerrain::ExternalTerrainDataSource::restore ( agxStream::InputArchive &  in)
overridevirtual

Reimplemented from agxTerrain::TerrainDataSource.

◆ store()

virtual void agxTerrain::ExternalTerrainDataSource::store ( agxStream::OutputArchive &  out) const
overridevirtual

Reimplemented from agxTerrain::TerrainDataSource.


The documentation for this class was generated from the following file: