GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Private Member Functions | Private Attributes | List of all members
GLC_StructOccurence Class Reference

GLC_StructOccurence : A scene graph occurence node. More...

#include <glc_structoccurence.h>

Public Member Functions

Constructor / Destructor
 GLC_StructOccurence ()
 Default constructor.
 
 GLC_StructOccurence (GLC_StructInstance *pStructInstance, GLC_WorldHandle *pWorldHandle=NULL, GLuint shaderId=0)
 Create Occurence of the specified instance.
 
 GLC_StructOccurence (GLC_StructInstance *pStructInstance, GLC_uint id, GLC_WorldHandle *pWorldHandle=NULL, GLuint shaderId=0)
 Create Occurence of the specified instance and Uid.
 
 GLC_StructOccurence (GLC_3DRep *pRep)
 Construct Occurence with the specified GLC_3DRep.
 
 GLC_StructOccurence (GLC_3DRep *pRep, GLC_uint id)
 Construct Occurence from the given GLC_3DRep and Uid.
 
 GLC_StructOccurence (GLC_WorldHandle *, const GLC_StructOccurence &, bool shareInstance)
 Copy constructor.
 
virtual ~GLC_StructOccurence ()
 Destructor.
 
Set Functions
void setName (const QString name)
 Set Occurence instance Name.
 
GLC_StructOccurenceupdateAbsoluteMatrix ()
 Update the absolute matrix.
 
GLC_StructOccurenceupdateChildrenAbsoluteMatrix ()
 Update children obsolute Matrix.
 
void addChild (GLC_StructOccurence *)
 Add Child.
 
void insertChild (int index, GLC_StructOccurence *pChild)
 insert Child at the given position
 
GLC_StructOccurenceaddChild (GLC_StructInstance *)
 Add Child instance and returns the newly created occurence.
 
GLC_StructOccurenceinsertChild (int index, GLC_StructInstance *pInstance)
 Insert Child instance and returns the newly created occurence.
 
void makeOrphan ()
 make the occurence orphan
 
bool removeChild (GLC_StructOccurence *pChild)
 Remove the specified child.
 
void reverseNormals ()
 Reverse Normals of this Occurence and childs.
 
bool create3DViewInstance (GLuint shaderId=0)
 Create the 3DViewInstance of this occurence if there is a valid 3DRep.
 
bool remove3DViewInstance ()
 Remove the 3DViewInstance of this occurence.
 
void setWorldHandle (GLC_WorldHandle *)
 Set this occurence world Handle.
 
bool loadRepresentation ()
 Load the representation and return true if success.
 
bool unloadRepresentation ()
 UnLoad the representation and return true if success.
 
void setOccurenceNumber (unsigned int n)
 Set the occurence number of this occurence.
 
unsigned int updateOccurenceNumber (unsigned int n)
 Update the occurence number of this occurence branch.
 
void setVisibility (bool visibility)
 Set this occurence and children visibility.
 
void setRenderProperties (const GLC_RenderProperties &renderProperties)
 set the renderProperties of this occurence
 
void removeEmptyChildren ()
 Remove empty children.
 
void setReference (GLC_StructReference *pRef)
 Set the given reference to this occurence.
 
void setAutomatic3DViewInstanceCreationUsage (bool usage)
 Set the automatic creation of 3DViewInstance usage.
 
void makeFlexible (const GLC_Matrix4x4 &relativeMatrix)
 Make this occurence a flexible occurence.
 
void makeRigid ()
 Make this occurence rigid.
 
void swap (int i, int j)
 Exchange the occurrence at index position i with the occurrence at index position j.
 

Private Member Functions

void detach ()
 Detach the occurence from the GLC_World.
 
void doCreateOccurrenceFromInstance (GLuint shaderId)
 Create occurrence from instance and given shader id.
 

Private Attributes

GLC_uint m_Uid
 Occurence Unique ID.
 
GLC_WorldHandlem_pWorldHandle
 the occurence's World Handle
 
int * m_pNumberOfOccurence
 Number of this Occurence.
 
GLC_StructInstancem_pStructInstance
 The struct instance of this occurence.
 
GLC_StructOccurencem_pParent
 The parent of this occurence.
 
QList< GLC_StructOccurence * > m_Childs
 The Child of this occurence.
 
GLC_Matrix4x4 m_AbsoluteMatrix
 The absolute matrix of the occurence.
 
unsigned int m_OccurenceNumber
 The occurence number.
 
bool m_IsVisible
 Flag to know if a occurence without instance is visible.
 
GLC_RenderPropertiesm_pRenderProperties
 The occurence rendering properties.
 
bool m_AutomaticCreationOf3DViewInstance
 Automatique crŽation of 3DViewInstance.
 
GLC_Matrix4x4m_pRelativeMatrix
 The relative matrix of this occurence if this occurence is flexible.
 

Get Functions

GLC_uint id () const
 Return this Occurence id.
 
const QString name () const
 Return the instance name of this occurence.
 
GLC_Matrix4x4 absoluteMatrix () const
 Return the absolute matrix of this occurence.
 
GLC_Matrix4x4 occurrenceRelativeMatrix () const
 Return the surcharged relative matrix.
 
bool isOrphan () const
 Return true if this occurence is orphan.
 
bool hasParent () const
 Return true if this occurence has parent.
 
bool hasRepresentation () const
 Return true if this occurence has a representation.
 
bool has3DViewInstance () const
 Return true if this occurence has 3DViewInstance.
 
GLC_StructInstancestructInstance () const
 Return the instance of this occurence.
 
GLC_StructReferencestructReference () const
 Return the reference of this occurence.
 
int childCount () const
 Return the number of childs.
 
bool hasChild () const
 Return true if the occurence has child.
 
bool canBeAddedToChildren (GLC_StructOccurence *pOccurence) const
 Return true if the given occurence can be added to this occurence children.
 
GLC_StructOccurenceparent () const
 Return The parent of this occurence.
 
QList< GLC_StructOccurence * > ancestorList () const
 Return return all ancestor of this occurrence.
 
GLC_StructOccurencechild (const int index) const
 Return a child of this occurence.
 
QList< GLC_StructOccurence * > children () const
 Return the list of children of this occurence.
 
QList< GLC_StructOccurence * > subOccurenceList () const
 Return the list of all accurence under this occurence.
 
unsigned int numberOfFaces () const
 Return the number of faces of the representation of this occurence.
 
unsigned int numberOfVertex () const
 Return the number of vertex of the representation of this occurence.
 
unsigned int numberOfMaterials () const
 Return the number of materials of the representation of this occurence.
 
QSet< GLC_Material * > materialSet () const
 Return the materials List of the representation of this occurence.
 
GLC_StructOccurenceclone (GLC_WorldHandle *, bool shareInstance) const
 Return a clone this occurence.
 
bool isVisible () const
 Return true if this occurence is visible.
 
GLC_BoundingBox boundingBox () const
 Return the occurence Bounding Box.
 
unsigned int occurenceNumber () const
 Return the occurence number of this occurence.
 
GLC_RenderPropertiesrenderPropertiesHandle () const
 Return an handle of the renderProperties of this occurence.
 
unsigned int nodeCount () const
 Return the number of node of this branch.
 
GLC_WorldHandleworldHandle () const
 Return the world handle of this occurence.
 
QSet< GLC_StructReference * > childrenReferences () const
 Return the Set of children references of this occurence.
 
bool useAutomatic3DViewInstanceCreation () const
 Return true if the automatic creation of 3DViewInstance is used.
 
bool isFlexible () const
 Return true if this occurence is flexible.
 
int indexOf (const GLC_StructOccurence *pOcc) const
 Return the index position of the given occurrence.
 
bool containsChild (const GLC_StructOccurence *pOcc) const
 Return true if this occurence contains the given occurence has child.
 
static QSet
< GLC_StructReference * > 
parentsReferences (const GLC_StructOccurence *pOccurence)
 Return the set of parents references of the given occurence.
 

Detailed Description

GLC_StructOccurence : A scene graph occurence node.

Definition at line 43 of file glc_structoccurence.h.

Constructor & Destructor Documentation

GLC_StructOccurence::GLC_StructOccurence ( )

Default constructor.

Definition at line 31 of file glc_structoccurence.cpp.

References m_pStructInstance, and GLC_StructInstance::structOccurenceCreated().

Referenced by addChild(), clone(), and insertChild().

GLC_StructOccurence::GLC_StructOccurence ( GLC_StructInstance pStructInstance,
GLC_WorldHandle pWorldHandle = NULL,
GLuint  shaderId = 0 
)

Create Occurence of the specified instance.

Definition at line 49 of file glc_structoccurence.cpp.

References doCreateOccurrenceFromInstance().

GLC_StructOccurence::GLC_StructOccurence ( GLC_StructInstance pStructInstance,
GLC_uint  id,
GLC_WorldHandle pWorldHandle = NULL,
GLuint  shaderId = 0 
)

Create Occurence of the specified instance and Uid.

Definition at line 66 of file glc_structoccurence.cpp.

References doCreateOccurrenceFromInstance().

GLC_StructOccurence::GLC_StructOccurence ( GLC_3DRep pRep)

Construct Occurence with the specified GLC_3DRep.

Definition at line 83 of file glc_structoccurence.cpp.

References m_pStructInstance, and GLC_StructInstance::structOccurenceCreated().

GLC_StructOccurence::GLC_StructOccurence ( GLC_3DRep pRep,
GLC_uint  id 
)

Construct Occurence from the given GLC_3DRep and Uid.

Definition at line 103 of file glc_structoccurence.cpp.

References m_pStructInstance, and GLC_StructInstance::structOccurenceCreated().

GLC_StructOccurence::GLC_StructOccurence ( GLC_WorldHandle pWorldHandle,
const GLC_StructOccurence structOccurence,
bool  shareInstance 
)
GLC_StructOccurence::~GLC_StructOccurence ( )
virtual

Member Function Documentation

GLC_Matrix4x4 GLC_StructOccurence::absoluteMatrix ( ) const
inline

Return the absolute matrix of this occurence.

Definition at line 86 of file glc_structoccurence.h.

Referenced by GLC_WorldTo3ds::createNodeFromOccurrence(), and updateAbsoluteMatrix().

void GLC_StructOccurence::addChild ( GLC_StructOccurence pChild)
GLC_StructOccurence * GLC_StructOccurence::addChild ( GLC_StructInstance pInstance)

Add Child instance and returns the newly created occurence.

Definition at line 604 of file glc_structoccurence.cpp.

References addChild(), GLC_StructOccurence(), and m_pWorldHandle.

QList< GLC_StructOccurence * > GLC_StructOccurence::ancestorList ( ) const

Return return all ancestor of this occurrence.

Definition at line 303 of file glc_structoccurence.cpp.

References ancestorList(), and m_pParent.

Referenced by ancestorList().

GLC_BoundingBox GLC_StructOccurence::boundingBox ( void  ) const
bool GLC_StructOccurence::canBeAddedToChildren ( GLC_StructOccurence pOccurence) const

Return true if the given occurence can be added to this occurence children.

Definition at line 282 of file glc_structoccurence.cpp.

References childrenReferences(), GLC_StructInstance::hasStructOccurence(), m_pStructInstance, parentsReferences(), and structReference().

GLC_StructOccurence* GLC_StructOccurence::child ( const int  index) const
inline
int GLC_StructOccurence::childCount ( ) const
inline
QList<GLC_StructOccurence*> GLC_StructOccurence::children ( ) const
inline

Return the list of children of this occurence.

Definition at line 141 of file glc_structoccurence.h.

Referenced by boundingBox(), and GLC_World::mergeWithAnotherWorld().

QSet< GLC_StructReference * > GLC_StructOccurence::childrenReferences ( ) const

Return the Set of children references of this occurence.

Definition at line 471 of file glc_structoccurence.cpp.

References childCount(), m_Childs, structInstance(), and structReference().

Referenced by canBeAddedToChildren().

GLC_StructOccurence * GLC_StructOccurence::clone ( GLC_WorldHandle pWorldHandle,
bool  shareInstance 
) const

Return a clone this occurence.

Definition at line 401 of file glc_structoccurence.cpp.

References GLC_StructOccurence().

Referenced by doCreateOccurrenceFromInstance(), GLC_StructOccurence(), GLC_World::mergeWithAnotherWorld(), and setReference().

bool GLC_StructOccurence::containsChild ( const GLC_StructOccurence pOcc) const

Return true if this occurence contains the given occurence has child.

Definition at line 521 of file glc_structoccurence.cpp.

References parent().

bool GLC_StructOccurence::create3DViewInstance ( GLuint  shaderId = 0)
void GLC_StructOccurence::detach ( )
private
void GLC_StructOccurence::doCreateOccurrenceFromInstance ( GLuint  shaderId)
private
bool GLC_StructOccurence::has3DViewInstance ( ) const
bool GLC_StructOccurence::hasChild ( ) const
inline
bool GLC_StructOccurence::hasParent ( ) const
inline

Return true if this occurence has parent.

Definition at line 97 of file glc_structoccurence.h.

bool GLC_StructOccurence::hasRepresentation ( ) const
GLC_uint GLC_StructOccurence::id ( ) const
inline
int GLC_StructOccurence::indexOf ( const GLC_StructOccurence pOcc) const

Return the index position of the given occurrence.

Return -1 if the given occurence is not a child of this occurence

Definition at line 503 of file glc_structoccurence.cpp.

References childCount(), and m_Childs.

void GLC_StructOccurence::insertChild ( int  index,
GLC_StructOccurence pChild 
)

insert Child at the given position

The new child must be orphan and index >= childcount

Definition at line 586 of file glc_structoccurence.cpp.

References isOrphan(), m_Childs, m_pParent, m_pWorldHandle, setWorldHandle(), and updateChildrenAbsoluteMatrix().

Referenced by insertChild().

GLC_StructOccurence * GLC_StructOccurence::insertChild ( int  index,
GLC_StructInstance pInstance 
)

Insert Child instance and returns the newly created occurence.

Definition at line 614 of file glc_structoccurence.cpp.

References GLC_StructOccurence(), insertChild(), and m_pWorldHandle.

bool GLC_StructOccurence::isFlexible ( ) const
inline

Return true if this occurence is flexible.

Definition at line 194 of file glc_structoccurence.h.

Referenced by GLC_WorldTo3dxml::exportAssemblyFromOccurence(), and GLC_WorldTo3dxml::writeOccurenceDefaultViewProperty().

bool GLC_StructOccurence::isOrphan ( ) const
inline
bool GLC_StructOccurence::isVisible ( ) const
bool GLC_StructOccurence::loadRepresentation ( )
void GLC_StructOccurence::makeFlexible ( const GLC_Matrix4x4 relativeMatrix)

Make this occurence a flexible occurence.

Definition at line 883 of file glc_structoccurence.cpp.

References m_pRelativeMatrix, and updateChildrenAbsoluteMatrix().

Referenced by GLC_3dxmlToWorld::applyV4Attribute().

void GLC_StructOccurence::makeOrphan ( )

make the occurence orphan

Definition at line 624 of file glc_structoccurence.cpp.

References detach(), isOrphan(), m_pParent, and removeChild().

Referenced by GLC_World::takeRootOccurrence(), and ~GLC_StructOccurence().

void GLC_StructOccurence::makeRigid ( )

Make this occurence rigid.

Definition at line 891 of file glc_structoccurence.cpp.

References m_pRelativeMatrix, and updateChildrenAbsoluteMatrix().

QSet< GLC_Material * > GLC_StructOccurence::materialSet ( ) const

Return the materials List of the representation of this occurence.

Definition at line 384 of file glc_structoccurence.cpp.

References hasRepresentation(), m_Childs, GLC_StructReference::materialSet(), structInstance(), and GLC_StructInstance::structReference().

Referenced by numberOfMaterials().

const QString GLC_StructOccurence::name ( ) const
inline

Return the instance name of this occurence.

Definition at line 82 of file glc_structoccurence.h.

Referenced by create3DViewInstance(), GLC_3dxmlToWorld::createUnfoldedTree(), and GLC_3dxmlToWorld::loadProductStructure().

unsigned int GLC_StructOccurence::nodeCount ( ) const

Return the number of node of this branch.

Definition at line 460 of file glc_structoccurence.cpp.

References m_Childs.

unsigned int GLC_StructOccurence::numberOfFaces ( ) const

Return the number of faces of the representation of this occurence.

Definition at line 332 of file glc_structoccurence.cpp.

References hasRepresentation(), m_Childs, GLC_StructReference::numberOfFaces(), structInstance(), and GLC_StructInstance::structReference().

unsigned int GLC_StructOccurence::numberOfMaterials ( ) const

Return the number of materials of the representation of this occurence.

Definition at line 365 of file glc_structoccurence.cpp.

References hasRepresentation(), m_Childs, materialSet(), GLC_StructReference::numberOfMaterials(), structInstance(), and GLC_StructInstance::structReference().

unsigned int GLC_StructOccurence::numberOfVertex ( ) const

Return the number of vertex of the representation of this occurence.

Definition at line 349 of file glc_structoccurence.cpp.

References hasRepresentation(), m_Childs, GLC_StructReference::numberOfVertex(), structInstance(), and GLC_StructInstance::structReference().

unsigned int GLC_StructOccurence::occurenceNumber ( ) const
inline

Return the occurence number of this occurence.

Definition at line 169 of file glc_structoccurence.h.

GLC_Matrix4x4 GLC_StructOccurence::occurrenceRelativeMatrix ( ) const

Return the surcharged relative matrix.

Definition at line 254 of file glc_structoccurence.cpp.

References m_pRelativeMatrix.

Referenced by GLC_WorldTo3dxml::writeOccurenceDefaultViewProperty().

GLC_StructOccurence* GLC_StructOccurence::parent ( ) const
inline
QSet< GLC_StructReference * > GLC_StructOccurence::parentsReferences ( const GLC_StructOccurence pOccurence)
static

Return the set of parents references of the given occurence.

Definition at line 487 of file glc_structoccurence.cpp.

References parent(), structInstance(), and structReference().

Referenced by canBeAddedToChildren().

bool GLC_StructOccurence::remove3DViewInstance ( )

Remove the 3DViewInstance of this occurence.

Definition at line 684 of file glc_structoccurence.cpp.

References GLC_WorldHandle::collection(), m_pWorldHandle, m_Uid, and GLC_3DViewCollection::remove().

bool GLC_StructOccurence::removeChild ( GLC_StructOccurence pChild)

Remove the specified child.

The removed child will not be deleted

Definition at line 636 of file glc_structoccurence.cpp.

References detach(), m_Childs, and m_pParent.

Referenced by makeOrphan(), and ~GLC_StructOccurence().

void GLC_StructOccurence::removeEmptyChildren ( )

Remove empty children.

Definition at line 824 of file glc_structoccurence.cpp.

References m_Childs, and removeEmptyChildren().

Referenced by GLC_ColladaToWorld::createSceneGraph(), and removeEmptyChildren().

GLC_RenderProperties* GLC_StructOccurence::renderPropertiesHandle ( ) const
inline

Return an handle of the renderProperties of this occurence.

Definition at line 173 of file glc_structoccurence.h.

void GLC_StructOccurence::reverseNormals ( )
void GLC_StructOccurence::setAutomatic3DViewInstanceCreationUsage ( bool  usage)
inline

Set the automatic creation of 3DViewInstance usage.

Definition at line 278 of file glc_structoccurence.h.

void GLC_StructOccurence::setName ( const QString  name)
inline

Set Occurence instance Name.

Definition at line 211 of file glc_structoccurence.h.

Referenced by GLC_3dsToWorld::createMeshes().

void GLC_StructOccurence::setOccurenceNumber ( unsigned int  n)
inline

Set the occurence number of this occurence.

Definition at line 259 of file glc_structoccurence.h.

void GLC_StructOccurence::setReference ( GLC_StructReference pRef)
void GLC_StructOccurence::setRenderProperties ( const GLC_RenderProperties renderProperties)
void GLC_StructOccurence::setVisibility ( bool  visibility)
void GLC_StructOccurence::setWorldHandle ( GLC_WorldHandle pWorldHandle)
GLC_StructInstance* GLC_StructOccurence::structInstance ( ) const
inline
GLC_StructReference* GLC_StructOccurence::structReference ( ) const
inline
QList< GLC_StructOccurence * > GLC_StructOccurence::subOccurenceList ( ) const

Return the list of all accurence under this occurence.

Definition at line 315 of file glc_structoccurence.cpp.

References childCount(), hasChild(), m_Childs, and subOccurenceList().

Referenced by GLC_WorldHandle::select(), subOccurenceList(), and GLC_WorldHandle::unselect().

void GLC_StructOccurence::swap ( int  i,
int  j 
)

Exchange the occurrence at index position i with the occurrence at index position j.

This function assumes that both i and j are at least 0 but less than childCount().

Definition at line 899 of file glc_structoccurence.cpp.

References GLC_StructReference::listOfStructOccurence(), m_Childs, and structReference().

bool GLC_StructOccurence::unloadRepresentation ( )
GLC_StructOccurence * GLC_StructOccurence::updateAbsoluteMatrix ( )
GLC_StructOccurence * GLC_StructOccurence::updateChildrenAbsoluteMatrix ( )
unsigned int GLC_StructOccurence::updateOccurenceNumber ( unsigned int  n)

Update the occurence number of this occurence branch.

Definition at line 775 of file glc_structoccurence.cpp.

References childCount(), m_Childs, and m_OccurenceNumber.

Referenced by GLC_WorldTo3dxml::GLC_WorldTo3dxml(), and GLC_3dxmlToWorld::loadProductStructure().

bool GLC_StructOccurence::useAutomatic3DViewInstanceCreation ( ) const
inline

Return true if the automatic creation of 3DViewInstance is used.

Definition at line 190 of file glc_structoccurence.h.

Referenced by GLC_WorldHandle::addOccurence(), GLC_StructReference::loadRepresentation(), and GLC_StructReference::setRepresentation().

GLC_WorldHandle* GLC_StructOccurence::worldHandle ( ) const
inline

Return the world handle of this occurence.

Definition at line 180 of file glc_structoccurence.h.

Member Data Documentation

GLC_Matrix4x4 GLC_StructOccurence::m_AbsoluteMatrix
private

The absolute matrix of the occurence.

Definition at line 325 of file glc_structoccurence.h.

Referenced by updateAbsoluteMatrix().

bool GLC_StructOccurence::m_AutomaticCreationOf3DViewInstance
private

Automatique crŽation of 3DViewInstance.

Definition at line 337 of file glc_structoccurence.h.

Referenced by loadRepresentation().

QList<GLC_StructOccurence*> GLC_StructOccurence::m_Childs
private
bool GLC_StructOccurence::m_IsVisible
private

Flag to know if a occurence without instance is visible.

Definition at line 331 of file glc_structoccurence.h.

Referenced by create3DViewInstance(), isVisible(), setVisibility(), and setWorldHandle().

unsigned int GLC_StructOccurence::m_OccurenceNumber
private

The occurence number.

Definition at line 328 of file glc_structoccurence.h.

Referenced by updateOccurenceNumber().

int* GLC_StructOccurence::m_pNumberOfOccurence
private

Number of this Occurence.

Definition at line 313 of file glc_structoccurence.h.

Referenced by doCreateOccurrenceFromInstance(), GLC_StructOccurence(), setReference(), and ~GLC_StructOccurence().

GLC_StructOccurence* GLC_StructOccurence::m_pParent
private

The parent of this occurence.

Definition at line 319 of file glc_structoccurence.h.

Referenced by addChild(), ancestorList(), insertChild(), makeOrphan(), removeChild(), and updateAbsoluteMatrix().

GLC_Matrix4x4* GLC_StructOccurence::m_pRelativeMatrix
private

The relative matrix of this occurence if this occurence is flexible.

Definition at line 340 of file glc_structoccurence.h.

Referenced by GLC_StructOccurence(), makeFlexible(), makeRigid(), occurrenceRelativeMatrix(), updateAbsoluteMatrix(), and ~GLC_StructOccurence().

GLC_RenderProperties* GLC_StructOccurence::m_pRenderProperties
private

The occurence rendering properties.

Definition at line 334 of file glc_structoccurence.h.

Referenced by create3DViewInstance(), detach(), GLC_StructOccurence(), setRenderProperties(), and ~GLC_StructOccurence().

GLC_StructInstance* GLC_StructOccurence::m_pStructInstance
private
GLC_WorldHandle* GLC_StructOccurence::m_pWorldHandle
private
GLC_uint GLC_StructOccurence::m_Uid
private

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

©2005-2013 Laurent Ribon