OCC Main Page | DataExchange | Toolkits | Packages | Class Hierarchy | Data Structures | File List | Data Fields | Globals

DataExchange
TKVRML
VrmlData


VrmlData_Scene Class Reference

#include <VrmlData_Scene.hxx>


Public Types

typedef VrmlData_ListOfNode::Iterator Iterator

Public Member Functions

Standard_EXPORT VrmlData_Scene (const Handle(NCollection_IncAllocator)&=0L)
VrmlData_ErrorStatus Status () const
Standard_EXPORT void SetVrmlDir (const TCollection_ExtendedString &)
void SetLinearScale (const Standard_Real theScale)
NCollection_List< TCollection_ExtendedString
>::Iterator 
VrmlDirIterator () const
Iterator GetIterator () const
VrmlData_MapOfNode::Iterator NamedNodesIterator () const
const Handle (NCollection_IncAllocator)&Allocator() const
Standard_EXPORT const Handle (VrmlData_Node)&AddNode(const Handle(VrmlData_Node)&theN
Standard_EXPORT Handle (VrmlData_Node) FindNode(const char *theName
Standard_EXPORT const Handle (Standard_Type)&theType=0L) const
Standard_EXPORT Handle (VrmlData_Node) FindNode(const char *theName
Standard_EXPORT VrmlData_Sceneoperator<< (Standard_IStream &theInput)
Standard_EXPORT operator TopoDS_Shape () const
Standard_EXPORT TopoDS_Shape GetShape (VrmlData_DataMapOfShapeAppearance &M)
Standard_EXPORT const Handle_VrmlData_WorldInfo & WorldInfo () const
Standard_EXPORT void Dump (Standard_OStream &theStream) const
Standard_EXPORT VrmlData_ErrorStatus ReadReal (VrmlData_InBuffer &theBuffer, Standard_Real &theResult, Standard_Boolean isApplyScale, Standard_Boolean isOnlyPositive) const
Standard_EXPORT VrmlData_ErrorStatus ReadXYZ (VrmlData_InBuffer &theBuffer, gp_XYZ &theXYZ, Standard_Boolean isApplyScale, Standard_Boolean isOnlyPositive) const
Standard_EXPORT VrmlData_ErrorStatus ReadXY (VrmlData_InBuffer &theBuffer, gp_XY &theXYZ, Standard_Boolean isApplyScale, Standard_Boolean isOnlyPositive) const
Standard_EXPORT VrmlData_ErrorStatus ReadArrIndex (VrmlData_InBuffer &theBuffer, const Standard_Integer **&theArr, Standard_Size &theNBl) const
Standard_Integer GetLineError () const
void SetIndent (const Standard_Integer nSpc)
Standard_EXPORT VrmlData_ErrorStatus WriteXYZ (const gp_XYZ &theXYZ, const Standard_Boolean isScale, const char *thePostfix=0L) const
Standard_EXPORT VrmlData_ErrorStatus WriteArrIndex (const char *thePrefix, const Standard_Integer **theArr, const Standard_Size theNbBl) const
Standard_EXPORT VrmlData_ErrorStatus WriteLine (const char *theLine0, const char *theLine1=0L, const Standard_Integer theIndent=0) const
Standard_EXPORT VrmlData_ErrorStatus WriteNode (const char *thePrefix, const Handle_VrmlData_Node &) const
Standard_Boolean IsDummyWrite () const

Static Public Member Functions

static Standard_EXPORT VrmlData_ErrorStatus ReadLine (VrmlData_InBuffer &theBuffer)
static Standard_EXPORT VrmlData_ErrorStatus ReadWord (VrmlData_InBuffer &theBuffer, TCollection_AsciiString &theStr)

Data Fields

Standard_EXPORT const const
Standard_Boolean 
isTopLevel = Standard_True)
Standard_EXPORT gp_Trsf &theLocation const

Protected Member Functions

Standard_EXPORT VrmlData_ErrorStatus createNode (VrmlData_InBuffer &theBuffer, Handle(VrmlData_Node)&theNode, const Handle(Standard_Type)&Type)

Static Protected Member Functions

static Standard_EXPORT VrmlData_ErrorStatus readLine (VrmlData_InBuffer &theBuffer)
static Standard_EXPORT VrmlData_ErrorStatus readHeader (VrmlData_InBuffer &theBuffer)
static Standard_EXPORT void createShape (TopoDS_Shape &outShape, const VrmlData_ListOfNode &, VrmlData_DataMapOfShapeAppearance *)

Private Member Functions

 VrmlData_Scene (const VrmlData_Scene &)
VrmlData_Sceneoperator= (const VrmlData_Scene &)

Private Attributes

Standard_Real myLinearScale
VrmlData_ListOfNode myLstNodes
VrmlData_ListOfNode myAllNodes
 ! top-level nodes
VrmlData_ErrorStatus myStatus
 ! all nodes
Handle_NCollection_IncAllocator myAllocator
Handle_VrmlData_WorldInfo myWorldInfo
VrmlData_MapOfNode myNamedNodes
NCollection_List< TCollection_ExtendedString > myVrmlDir
Standard_Mutex myMutex
Standard_Integer myLineError
Standard_OStream * myOutput
 ! #0 if error
Standard_Integer myIndent
Standard_Integer myCurrentIndent
VrmlData_MapOfNode myNamedNodesOut
NCollection_Map< Standard_Address > myUnnamedNodesOut
Standard_Integer myAutoNameCounter

Friends

Standard_EXPORT Standard_OStream & operator<< (Standard_OStream &theOutput, const VrmlData_Scene &theScene)


Detailed Description

Block of comments describing class VrmlData_Scene


Member Typedef Documentation

typedef VrmlData_ListOfNode::Iterator VrmlData_Scene::Iterator
 

Iterator type to get all contained Nodes one-by-one.


Constructor & Destructor Documentation

Standard_EXPORT VrmlData_Scene::VrmlData_Scene const Handle(NCollection_IncAllocator)&  = 0L  ) 
 

Constructor.

VrmlData_Scene::VrmlData_Scene const VrmlData_Scene  )  [private]
 


Member Function Documentation

Standard_EXPORT VrmlData_ErrorStatus VrmlData_Scene::createNode VrmlData_InBuffer theBuffer,
Handle(VrmlData_Node)&  theNode,
const Handle(Standard_Type)&  Type
[protected]
 

Create the node.

Parameters:
theBuffer Input buffer from where the node is created
theNode Output parameter, contains the created node on exit
Type Node type to be checked. If it is NULL no type checking is done. Otherwise the created node is matched and an error is returned if no match detected.

static Standard_EXPORT void VrmlData_Scene::createShape TopoDS_Shape &  outShape,
const VrmlData_ListOfNode ,
VrmlData_DataMapOfShapeAppearance
[static, protected]
 

Create a single Shape object from all geometric nodes in the list.

Standard_EXPORT void VrmlData_Scene::Dump Standard_OStream &  theStream  )  const
 

Diagnostic dump of the contents

Iterator VrmlData_Scene::GetIterator  )  const [inline]
 

Iterator of Nodes

Standard_Integer VrmlData_Scene::GetLineError  )  const [inline]
 

Query the line where the error occurred (if the status is not OK)

Standard_EXPORT TopoDS_Shape VrmlData_Scene::GetShape VrmlData_DataMapOfShapeAppearance M  ) 
 

Convert the scene to a Shape, with the information on materials defined for each sub-shape. This method should be used instead of TopoDS_Shape explicit conversion operator when you need to retrieve the material aspect for each face or edge in the returned topological object.

Parameters:
M Data Map that binds an Appearance instance to each created TFace or TEdge if the Appearance node is defined in VRML scene for that geometry.
Returns:
TopoDS_Shape (Compound) holding all the scene, similar to the result of explicit TopoDS_Shape conversion operator.

Standard_EXPORT VrmlData_Scene::Handle VrmlData_Node   )  const
 

Find a node by its name.

Parameters:
theName Name of the node to search for.
theLocation Location of the found node with respect to the whole VRML shape.

Standard_EXPORT const VrmlData_Scene::Handle Standard_Type   )  const [pure virtual]
 

Standard_EXPORT VrmlData_Scene::Handle VrmlData_Node   )  const
 

Find a node by its name.

Parameters:
theName Name of the node to find.
theType Type to match. If this value is NULL, the first found node with the given name is returned. If theType is given, only the node that has that type is returned.

Standard_EXPORT const VrmlData_Scene::Handle VrmlData_Node   )  const
 

Add a Node. If theN belongs to another Scene, it is cloned.

VrmlData_WorldInfo cannot be added, in this case the method returns a NULL handle.

const VrmlData_Scene::Handle NCollection_IncAllocator   )  const [inline]
 

Allocator used by all nodes contained in the Scene.

Standard_Boolean VrmlData_Scene::IsDummyWrite  )  const [inline]
 

Query if the current write operation is dummy, i.e., for the purpose of collecting information before the real write is commenced.

VrmlData_MapOfNode::Iterator VrmlData_Scene::NamedNodesIterator  )  const [inline]
 

Get the iterator of named nodes.

Standard_EXPORT VrmlData_Scene::operator TopoDS_Shape  )  const
 

Convert the scene to a Shape.

Standard_EXPORT VrmlData_Scene& VrmlData_Scene::operator<< Standard_IStream &  theInput  ) 
 

Import from text stream (file or else). This method is protected by Mutex, it is not allowed to read/write two VRML streams concurrently.

VrmlData_Scene& VrmlData_Scene::operator= const VrmlData_Scene  )  [private]
 

Standard_EXPORT VrmlData_ErrorStatus VrmlData_Scene::ReadArrIndex VrmlData_InBuffer theBuffer,
const Standard_Integer **&  theArr,
Standard_Size &  theNBl
const
 

Read an array of integer indices, for IndexedfaceSet and IndexedLineSet.

static Standard_EXPORT VrmlData_ErrorStatus VrmlData_Scene::readHeader VrmlData_InBuffer theBuffer  )  [static, protected]
 

Read and verify the VRML header (the 1st line of the file)

static Standard_EXPORT VrmlData_ErrorStatus VrmlData_Scene::readLine VrmlData_InBuffer theBuffer  )  [static, protected]
 

Read whatever line from the input checking the istream flags.

static Standard_EXPORT VrmlData_ErrorStatus VrmlData_Scene::ReadLine VrmlData_InBuffer theBuffer  )  [static]
 

Read a VRML line. Empty lines and comments are skipped. The processing starts here from theBuffer.LinePtr; if there is at least one non-empty character (neither space nor comment), this line is used without reading the next one.

Parameters:
theLine Buffer receiving the input line
theInput Input stream
theLen Length of the input buffer (maximal line length)

Standard_EXPORT VrmlData_ErrorStatus VrmlData_Scene::ReadReal VrmlData_InBuffer theBuffer,
Standard_Real &  theResult,
Standard_Boolean  isApplyScale,
Standard_Boolean  isOnlyPositive
const
 

Read one real value.

static Standard_EXPORT VrmlData_ErrorStatus VrmlData_Scene::ReadWord VrmlData_InBuffer theBuffer,
TCollection_AsciiString &  theStr
[static]
 

Read a singel word from the input stream, delimited by whitespace.

Standard_EXPORT VrmlData_ErrorStatus VrmlData_Scene::ReadXY VrmlData_InBuffer theBuffer,
gp_XY &  theXYZ,
Standard_Boolean  isApplyScale,
Standard_Boolean  isOnlyPositive
const
 

Read one doublet of real values.

Standard_EXPORT VrmlData_ErrorStatus VrmlData_Scene::ReadXYZ VrmlData_InBuffer theBuffer,
gp_XYZ &  theXYZ,
Standard_Boolean  isApplyScale,
Standard_Boolean  isOnlyPositive
const
 

Read one triplet of real values.

void VrmlData_Scene::SetIndent const Standard_Integer  nSpc  )  [inline]
 

Store the indentation for VRML output.

Parameters:
nSpc number of spaces to insert at every indentation level

void VrmlData_Scene::SetLinearScale const Standard_Real  theScale  )  [inline]
 

Set the scale factor that would be further used in methods ReadReal, ReadXYZ and ReadXY. All coordinates, distances and sized are multiplied by this factor during reading the data.

Standard_EXPORT void VrmlData_Scene::SetVrmlDir const TCollection_ExtendedString &   ) 
 

Add the given directory path to the list of VRML file search directories. This method forms the list of directories ordered according to the sequence of this method calls. When an Inline node is found, the URLs in that node are matched with these directories. The last (implicit) search directory is the current process directory ("."). It takes effect if the list is empty or if there is no match with exisiting directories.

VrmlData_ErrorStatus VrmlData_Scene::Status  )  const [inline]
 

Query the status of the previous operation. Normally it should be equal to VrmlData_StatusOK (no error).

NCollection_List<TCollection_ExtendedString>::Iterator VrmlData_Scene::VrmlDirIterator  )  const [inline]
 

Returns the directory iterator, to check the presence of requested VRML file in each iterated directory.

Standard_EXPORT const Handle_VrmlData_WorldInfo& VrmlData_Scene::WorldInfo  )  const
 

Query the WorldInfo member.

Standard_EXPORT VrmlData_ErrorStatus VrmlData_Scene::WriteArrIndex const char *  thePrefix,
const Standard_Integer **  theArr,
const Standard_Size  theNbBl
const
 

Write an array of integer indices, for IndexedFaceSet and IndexedLineSet.

Standard_EXPORT VrmlData_ErrorStatus VrmlData_Scene::WriteLine const char *  theLine0,
const char *  theLine1 = 0L,
const Standard_Integer  theIndent = 0
const
 

Write a string to the output stream respecting the indentation. The string can be defined as two substrings that will be separated by a space. Each of the substrings can be NULL, then it is ignored. If both are NULL, then a single newline is output (without indent).

Parameters:
theLine0 The first part of string to output
theLine1 The second part of string to output
theIndent 
  • 0 value ignored.
  • negative decreases the current indent and then outputs.
  • positive outputs and then increases the current indent.
Returns:
Error status of the stream, or a special error if myOutput == NULL.

Standard_EXPORT VrmlData_ErrorStatus VrmlData_Scene::WriteNode const char *  thePrefix,
const Handle_VrmlData_Node & 
const
 

Write the given node to output stream 'myOutput'.

Standard_EXPORT VrmlData_ErrorStatus VrmlData_Scene::WriteXYZ const gp_XYZ &  theXYZ,
const Standard_Boolean  isScale,
const char *  thePostfix = 0L
const
 

Write a triplet of real values on a separate line.

Parameters:
theXYZ The value to be output.
isScale If True, then each component is divided by myLinearScale.
thePostfix Optional string that is added before the end of the line.


Friends And Related Function Documentation

Standard_EXPORT Standard_OStream& operator<< Standard_OStream &  theOutput,
const VrmlData_Scene theScene
[friend]
 

Export to text stream (file or else). This method is protected by Mutex, it is not allowed to read/write two VRML streams concurrently. The stream should give as the first line the VRML header: #VRML V2.0 <encoding type=""> [optional comment] <line terminator="">


Field Documentation

Standard_EXPORT gp_Trsf& theLocation VrmlData_Scene::const
 

Standard_EXPORT const const Standard_Boolean VrmlData_Scene::isTopLevel = Standard_True)
 

VrmlData_ListOfNode VrmlData_Scene::myAllNodes [private]
 

Handle_NCollection_IncAllocator VrmlData_Scene::myAllocator [private]
 

Standard_Integer VrmlData_Scene::myAutoNameCounter [private]
 

Standard_Integer VrmlData_Scene::myCurrentIndent [private]
 

Standard_Integer VrmlData_Scene::myIndent [private]
 

Standard_Real VrmlData_Scene::myLinearScale [private]
 

Standard_Integer VrmlData_Scene::myLineError [private]
 

VrmlData_ListOfNode VrmlData_Scene::myLstNodes [private]
 

Standard_Mutex VrmlData_Scene::myMutex [private]
 

VrmlData_MapOfNode VrmlData_Scene::myNamedNodes [private]
 

VrmlData_MapOfNode VrmlData_Scene::myNamedNodesOut [private]
 

This map is used to avoid multiple storage of the same named node: each named node is added here when it is written the first time.

Standard_OStream* VrmlData_Scene::myOutput [private]
 

VrmlData_ErrorStatus VrmlData_Scene::myStatus [private]
 

NCollection_Map<Standard_Address> VrmlData_Scene::myUnnamedNodesOut [private]
 

This map allows to resolve multiple reference to any unnamed node. It is used during the dummy write (myOutput == 0L). When a node is processed the first time it is added to this map, the second time it is automatically assigned a name.

NCollection_List<TCollection_ExtendedString> VrmlData_Scene::myVrmlDir [private]
 

Handle_VrmlData_WorldInfo VrmlData_Scene::myWorldInfo [private]
 


The documentation for this class was generated from the following file:
Generated on Mon Aug 25 14:46:13 2008 for OpenCASCADE by  doxygen 1.4.1