VRUT::ScriptScene Class Reference

The ScriptScene class accesses the Scene class. More...

#include <scriptscene.h>

List of all members.

Public Member Functions

 ScriptScene (ScriptSceneManager *_ssm, SCENE_ID id)
 ~ScriptScene ()
NODE_ID GetRootID () throw (SceneScriptException)
ScriptNodeGetNode (NODE_ID nodeID) throw (SceneScriptException)
NODE_ID GetNodeID (const wxString &uid) throw (SceneScriptException)
void GetNodeIDs (std::vector< NODE_ID > *nodes) throw (SceneScriptException)
void SetTransformation (NODE_ID nodeID, const MATRIX &m) throw (SceneScriptException)
void Transform (NODE_ID nodeID, const MATRIX &matrix) throw (SceneScriptException)
void UpdateTransformation (NODE_ID nodeID) throw (SceneScriptException)
void TranslateAbs (NODE_ID nodeID, const VECTOR3 &transl) throw (SceneScriptException)

Private Member Functions

ScenegetScene () throw (SceneScriptException)
 The method for getting SceneNode which this class accesses.
ScriptNodegetScriptNode (NODE_ID nedeID) throw (SceneScriptException)
 This method creates new ScriptNode instance or uses existed ScriptNode.
void deleteScriptNode (NODE_ID nodeID)
 This method delete node from list.

Private Attributes

ScriptSceneManagerssm
 The ScriptSceneManager pointer.
Kernelkernel
 The Kernel pointer.
SCENE_ID sceneID
 The scene ID.
std::map< NodeIdent, ScriptNode * > nodes
 ScriptNode instances.

Friends

class ScriptNode

Classes

class  NodeIdent
 Data type for Node identification. More...


Detailed Description

The ScriptScene class accesses the Scene class.

Definition at line 29 of file scriptscene.h.


Constructor & Destructor Documentation

VRUT::ScriptScene::ScriptScene ( ScriptSceneManager _ssm,
SCENE_ID  id 
) [inline]

Definition at line 76 of file scriptscene.h.

00076 : ssm(_ssm), kernel(_ssm->kernel), sceneID(id) {}

ScriptScene::~ScriptScene (  ) 

Definition at line 20 of file scriptscene.cpp.

00021 {
00022        for (map<NodeIdent, ScriptNode *>::iterator it = nodes.begin(); it != nodes.end(); it++)
00023               delete it->second;
00024 }


Member Function Documentation

Scene * ScriptScene::getScene (  )  throw (SceneScriptException) [private]

The method for getting SceneNode which this class accesses.

Definition at line 36 of file scriptscene.cpp.

00037 {
00038        Scene *scene = kernel->sceneManager->GetScene(sceneID);
00039        if (!scene)
00040        {
00041               map<SCENE_ID, ScriptScene *>::iterator sit = ssm->scenes.find(sceneID);
00042               if (sit != ssm->scenes.end())
00043               {
00044                      ssm->deleteScriptScene(sceneID);
00045 
00046                      map<NodeIdent, ScriptNode *>::iterator nit = nodes.begin(), nitTemp;
00047                      while (nit != nodes.end())
00048                      {
00049                             if (nit->first.sceneID == sceneID)
00050                             {
00051                                    delete nit->second;
00052                                    nitTemp = nit++;
00053                                    nodes.erase(nitTemp);
00054                             }
00055                             else
00056                                    nit++;
00057                      }
00058               }
00059               throw SceneScriptException();
00060        }
00061        return scene;
00062 }

ScriptNode * ScriptScene::getScriptNode ( NODE_ID  nedeID  )  throw (SceneScriptException) [private]

This method creates new ScriptNode instance or uses existed ScriptNode.

Definition at line 64 of file scriptscene.cpp.

00065 {
00066        Scene *scene = getScene();
00067 
00068        const SceneNode *node = scene->GetNode(nodeID);
00069        if (!node)
00070               return (ScriptNode *) NULL;
00071 
00072        NodeIdent ident(sceneID, nodeID);
00073        map<NodeIdent, ScriptNode *>::iterator it = nodes.find(ident);
00074        if (it == nodes.end())
00075        {
00076               ScriptNode *scriptNode = new ScriptNode(this, sceneID, nodeID);
00077               nodes.insert(pair<NodeIdent, ScriptNode *>(ident, scriptNode));
00078               return scriptNode;
00079        }
00080        else
00081               return it->second;
00082 }

void ScriptScene::deleteScriptNode ( NODE_ID  nodeID  )  [private]

This method delete node from list.

Definition at line 26 of file scriptscene.cpp.

00027 {
00028        map<NodeIdent, ScriptNode *>::iterator it = nodes.find(NodeIdent(sceneID, nodeID));
00029        if (it != nodes.end())
00030        {
00031               delete it->second;
00032               nodes.erase(it);
00033        }
00034 }

NODE_ID VRUT::ScriptScene::GetRootID (  )  throw (SceneScriptException) [inline]

Definition at line 80 of file scriptscene.h.

00081               {
00082                      return getScene()->GetRootID();
00083               }

ScriptNode* VRUT::ScriptScene::GetNode ( NODE_ID  nodeID  )  throw (SceneScriptException) [inline]

Definition at line 85 of file scriptscene.h.

00086               {
00087                      return getScriptNode(nodeID);
00088               }

NODE_ID VRUT::ScriptScene::GetNodeID ( const wxString &  uid  )  throw (SceneScriptException) [inline]

Definition at line 90 of file scriptscene.h.

00091               {
00092                      return getScene()->GetNodeID(uid);
00093               }

void VRUT::ScriptScene::GetNodeIDs ( std::vector< NODE_ID > *  nodes  )  throw (SceneScriptException) [inline]

Definition at line 95 of file scriptscene.h.

00096               {
00097                      getScene()->GetNodeIDs(nodes);
00098               }

void VRUT::ScriptScene::SetTransformation ( NODE_ID  nodeID,
const MATRIX m 
) throw (SceneScriptException) [inline]

Definition at line 100 of file scriptscene.h.

00101               {
00102                      getScene()->SetTransformation(nodeID, m);
00103               }

void VRUT::ScriptScene::Transform ( NODE_ID  nodeID,
const MATRIX matrix 
) throw (SceneScriptException) [inline]

Definition at line 105 of file scriptscene.h.

00106               {
00107                      getScene()->Transform(nodeID, matrix);
00108               }

void VRUT::ScriptScene::UpdateTransformation ( NODE_ID  nodeID  )  throw (SceneScriptException) [inline]

Definition at line 110 of file scriptscene.h.

00111               {
00112                      getScene()->UpdateTransformation(nodeID);
00113               }

void VRUT::ScriptScene::TranslateAbs ( NODE_ID  nodeID,
const VECTOR3 transl 
) throw (SceneScriptException) [inline]

Definition at line 115 of file scriptscene.h.

00116               {
00117                      getScene()->TranslateAbs(nodeID, transl);
00118               }


Friends And Related Function Documentation

friend class ScriptNode [friend]

Definition at line 120 of file scriptscene.h.


Member Data Documentation

The ScriptSceneManager pointer.

Definition at line 55 of file scriptscene.h.

The Kernel pointer.

Definition at line 58 of file scriptscene.h.

The scene ID.

Definition at line 61 of file scriptscene.h.

ScriptNode instances.

Definition at line 64 of file scriptscene.h.


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

Generated on Tue Mar 10 14:41:50 2009 for VRUT by  doxygen 1.5.5