SoBaseKit.h
#ifndef COIN_SOBASEKIT_H
#define COIN_SOBASEKIT_H
/**************************************************************************\
* Copyright (c) Kongsberg Oil & Gas Technologies AS
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\**************************************************************************/
#include <Inventor/nodekits/SoSubKit.h>
#include <Inventor/nodes/SoNode.h>
#ifdef COIN_INTERNAL
class SoNodeKitPath;
#else // !COIN_INTERNAL
// Include these header files for better Open Inventor compatibility.
#include <Inventor/SoNodeKitPath.h>
#include <Inventor/misc/SoChildList.h>
#endif // !COIN_INTERNAL
class SoGroup;
class SoNodekitParts;
class SoNodekitCatalog;
class SoPath;
// Convenience macros. FIXME: document. 20000113 mortene.
#define SO_GET_PART(_kit_, _name_, _classname_) \
((_classname_ *)_kit_->getPart(_name_, TRUE))
#define SO_CHECK_PART(_kit_, _name_, _classname_) \
(static_cast<_classname_ *>(_kit_->getPart(_name_, FALSE)))
#define SO_GET_ANY_PART(_kit_, _name_, _classname_) \
(static_cast<_classname_ *>(_kit_->getAnyPart(_name_, TRUE, FALSE, FALSE)))
#define SO_CHECK_ANY_PART(_kit_, _name_, _classname_) \
(static_cast<_classname_ *>(_kit_->getAnyPart(_name_, FALSE, FALSE, FALSE)))
class COIN_DLL_API SoBaseKit : public SoNode {
typedef SoNode inherited;
SO_NODE_HEADER(SoBaseKit);
SO_KIT_CATALOG_ENTRY_HEADER(callbackList);
public:
static void initClass(void);
SoBaseKit(void);
static const SoNodekitCatalog * getClassNodekitCatalog(void);
virtual const SoNodekitCatalog * getNodekitCatalog(void) const;
virtual SoNode * getPart(const SbName & partname, SbBool makeifneeded);
SbString getPartString(const SoBase * part);
virtual SoNodeKitPath * createPathToPart(const SbName & partname,
SbBool makeifneeded,
const SoPath * pathtoextend = NULL);
virtual SbBool setPart(const SbName & partname, SoNode * from);
SbBool set(const char * namevaluepairliststring);
SbBool set(const char * partnamestring, const char * parameterstring);
virtual void doAction(SoAction * action);
virtual void callback(SoCallbackAction * action);
virtual void GLRender(SoGLRenderAction * action);
virtual void getBoundingBox(SoGetBoundingBoxAction * action);
virtual void getMatrix(SoGetMatrixAction * action);
virtual void handleEvent(SoHandleEventAction * action);
virtual void rayPick(SoRayPickAction * action);
virtual void search(SoSearchAction * action);
virtual void write(SoWriteAction * action);
virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
virtual SoChildList * getChildren(void) const;
void printDiagram(void);
void printSubDiagram(const SbName & rootname, int level);
void printTable(void);
virtual void addWriteReference(SoOutput * out, SbBool isfromfield = FALSE);
SbBool forceChildDrivenWriteRefs(SoOutput * out);
static SbBool isSearchingChildren(void);
static void setSearchingChildren(const SbBool newval);
protected:
virtual ~SoBaseKit();
static const SoNodekitCatalog ** getClassNodekitCatalogPtr(void);
virtual SoNode * addToCopyDict(void) const;
virtual void copyContents(const SoFieldContainer * fromfc,
SbBool copyconnections);
SoGroup * getContainerNode(const SbName & listname,
SbBool makeifneeded = TRUE);
virtual SoNode * getAnyPart(const SbName & partname, SbBool makeifneeded,
SbBool leafcheck = FALSE,
SbBool publiccheck = FALSE);
virtual SoNodeKitPath * createPathToAnyPart(const SbName & partname,
SbBool makeifneeded,
SbBool leafcheck = FALSE,
SbBool publiccheck = FALSE,
const SoPath * pathtoextend = NULL);
virtual SbBool setAnyPart(const SbName & partname, SoNode * from,
SbBool anypart = TRUE);
void createNodekitPartsList(void); // not part of Coin
void createFieldList(void); // replaces above method
virtual void createDefaultParts(void);
const SoNodekitParts * getNodekitPartsList(void) const; // not part of Coin
const SbList<SoSFNode*> & getCatalogInstances(void) const; // replaces above method
void catalogError(void);
virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways = FALSE);
virtual SbBool readInstance(SoInput * in, unsigned short flags);
virtual void setDefaultOnNonWritingFields(void);
void countMyFields(SoOutput * out);
virtual SbBool setPart(const int partNum, SoNode * node);
SoChildList * children;
SbBool connectionsSetUp;
private:
friend class SoInteractionKit;
static SbBool findPart(const SbString & partname, SoBaseKit *& kit,
int & partnum, SbBool & islist, int & listidx,
const SbBool makeifneeded, SoPath * path = NULL,
const SbBool recsearch = FALSE);
static void atexit_cleanupkit(void);
SbBool makePart(const int partnum);
int getRightSiblingIndex(const int partnum);
int findNodeInThisKit(SoNode *node, const int parentnum = -1) const;
static SoNodekitCatalog * classcatalog;
static const SoNodekitCatalog ** parentcatalogptr;
static SbBool searchchildren;
class SoBaseKitP * pimpl;
friend class SoBaseKitP;
};
#endif // !COIN_SOBASEKIT_H
SbList
The SbList class is a template container class for lists.
Definition SbList.h:70
SbName
The SbName class stores strings by reference.
Definition SbName.h:40
SbString
The SbString class is a string class with convenience functions for string operations.
Definition SbString.h:52
SoAction
The SoAction class is the base class for all traversal actions.
Definition SoAction.h:77
SoBaseKit::getClassNodekitCatalog
static const SoNodekitCatalog * getClassNodekitCatalog(void)
Definition SoBaseKit.cpp:589
SoBaseKit::printTable
void printTable(void)
Definition SoBaseKit.cpp:1489
SoBaseKit::getNodekitCatalog
virtual const SoNodekitCatalog * getNodekitCatalog(void) const
Definition SoBaseKit.cpp:589
SoBaseKit::connectionsSetUp
SbBool connectionsSetUp
Definition SoBaseKit.h:148
SoBaseKit::createDefaultParts
virtual void createDefaultParts(void)
Definition SoBaseKit.cpp:1985
SoBaseKit::createNodekitPartsList
void createNodekitPartsList(void)
Definition SoBaseKit.cpp:1950
SoBaseKit::printDiagram
void printDiagram(void)
Definition SoBaseKit.cpp:1417
SoBaseKit::SoBaseKit
SoBaseKit(void)
Definition SoBaseKit.cpp:630
SoBaseKit::createPathToPart
virtual SoNodeKitPath * createPathToPart(const SbName &partname, SbBool makeifneeded, const SoPath *pathtoextend=NULL)
Definition SoBaseKit.cpp:785
SoBaseKit::getAnyPart
virtual SoNode * getAnyPart(const SbName &partname, SbBool makeifneeded, SbBool leafcheck=FALSE, SbBool publiccheck=FALSE)
Definition SoBaseKit.cpp:1696
SoBaseKit::catalogError
void catalogError(void)
Definition SoBaseKit.cpp:2034
SoBaseKit::getContainerNode
SoGroup * getContainerNode(const SbName &listname, SbBool makeifneeded=TRUE)
Definition SoBaseKit.cpp:1641
SoBaseKit::createFieldList
void createFieldList(void)
Definition SoBaseKit.cpp:1963
SoBaseKit::setDefaultOnNonWritingFields
virtual void setDefaultOnNonWritingFields(void)
Definition SoBaseKit.cpp:1278
SoBaseKit::isSearchingChildren
static SbBool isSearchingChildren(void)
Definition SoBaseKit.cpp:1528
SoBaseKit::getClassNodekitCatalogPtr
static const SoNodekitCatalog ** getClassNodekitCatalogPtr(void)
Definition SoBaseKit.cpp:589
SoBaseKit::getCatalogInstances
const SbList< SoSFNode * > & getCatalogInstances(void) const
Definition SoBaseKit.cpp:2024
SoBaseKit::setPart
virtual SbBool setPart(const SbName &partname, SoNode *from)
Definition SoBaseKit.cpp:794
SoBaseKit::countMyFields
void countMyFields(SoOutput *out)
Definition SoBaseKit.cpp:1181
SoBaseKit::getNodekitPartsList
const SoNodekitParts * getNodekitPartsList(void) const
Definition SoBaseKit.cpp:2013
SoBaseKit::setSearchingChildren
static void setSearchingChildren(const SbBool newval)
Definition SoBaseKit.cpp:1538
SoBaseKit::createPathToAnyPart
virtual SoNodeKitPath * createPathToAnyPart(const SbName &partname, SbBool makeifneeded, SbBool leafcheck=FALSE, SbBool publiccheck=FALSE, const SoPath *pathtoextend=NULL)
Definition SoBaseKit.cpp:1788
SoBaseKit::setUpConnections
virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways=FALSE)
Definition SoBaseKit.cpp:2050
SoBaseKit::getPartString
SbString getPartString(const SoBase *part)
Definition SoBaseKit.cpp:710
SoBaseKit::printSubDiagram
void printSubDiagram(const SbName &rootname, int level)
Definition SoBaseKit.cpp:1431
SoBaseKit::getPart
virtual SoNode * getPart(const SbName &partname, SbBool makeifneeded)
Definition SoBaseKit.cpp:700
SoBaseKit::children
SoChildList * children
Definition SoBaseKit.h:147
SoBaseKit::forceChildDrivenWriteRefs
SbBool forceChildDrivenWriteRefs(SoOutput *out)
Definition SoBaseKit.cpp:1330
SoBaseKit::setAnyPart
virtual SbBool setAnyPart(const SbName &partname, SoNode *from, SbBool anypart=TRUE)
Definition SoBaseKit.cpp:1877
SoBase::SoBase
SoBase(void)
Definition SoBase.cpp:190
SoCallbackAction
The SoCallbackAction class invokes callbacks at specific nodes.
Definition SoCallbackAction.h:80
SoChildList
The SoChildList class is a container for node children.
Definition SoChildList.h:42
SoFieldContainer::SoFieldContainer
SoFieldContainer(void)
Definition SoFieldContainer.cpp:133
SoFieldContainer::set
SbBool set(const char *const fielddata)
Definition SoFieldContainer.cpp:383
SoFieldContainer::addWriteReference
virtual void addWriteReference(SoOutput *out, SbBool isfromfield=FALSE)
Definition SoFieldContainer.cpp:698
SoGLRenderAction
The SoGLRenderAction class renders the scene graph with OpenGL calls.
Definition SoGLRenderAction.h:50
SoGetBoundingBoxAction
The SoGetBoundingBoxAction class calculates bounding boxes for nodes and subgraphs.
Definition SoGetBoundingBoxAction.h:45
SoGetMatrixAction
The SoGetMatrixAction class is an action for accumulating the transformation matrix of a subgraph.
Definition SoGetMatrixAction.h:46
SoGetPrimitiveCountAction
The SoGetPrimitiveCountAction class counts the primitives in a scene.
Definition SoGetPrimitiveCountAction.h:44
SoGroup
The SoGroup class is a node which managed other node instances.
Definition SoGroup.h:40
SoHandleEventAction
The SoHandleEventAction class distributes user events to the scene.
Definition SoHandleEventAction.h:46
SoInput
The SoInput class is an abstraction of file import functionality.
Definition SoInput.h:61
SoNodeKitPath
The SoNodeKitPath class is a path that contains only nodekit nodes.
Definition SoNodeKitPath.h:42
SoNode::getChildren
virtual SoChildList * getChildren(void) const
Definition SoNode.cpp:1366
SoNode::SoNode
SoNode(void)
Definition SoNode.cpp:417
SoNode::getPrimitiveCount
virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action)
Definition SoNode.cpp:943
SoNode::handleEvent
virtual void handleEvent(SoHandleEventAction *action)
Definition SoNode.cpp:1132
SoNode::getBoundingBox
virtual void getBoundingBox(SoGetBoundingBoxAction *action)
Definition SoNode.cpp:914
SoNode::doAction
virtual void doAction(SoAction *action)
Definition SoNode.cpp:858
SoNode::callback
virtual void callback(SoCallbackAction *action)
Definition SoNode.cpp:1075
SoNode::getMatrix
virtual void getMatrix(SoGetMatrixAction *action)
Definition SoNode.cpp:1102
SoNode::readInstance
virtual SbBool readInstance(SoInput *in, unsigned short flags)
Definition SoNode.cpp:1542
SoNode::addToCopyDict
virtual SoNode * addToCopyDict(void) const
Definition SoNode.cpp:1435
SoNode::rayPick
virtual void rayPick(SoRayPickAction *action)
Definition SoNode.cpp:1188
SoNode::copyContents
virtual void copyContents(const SoFieldContainer *from, SbBool copyconnections)
Definition SoNode.cpp:1483
SoNode::search
virtual void search(SoSearchAction *action)
Definition SoNode.cpp:1221
SoNode::write
virtual void write(SoWriteAction *action)
Definition SoNode.cpp:1290
SoNode::initClass
static void initClass(void)
Sets up initialization for data common to all instances of this class, like submitting necessary info...
Definition SoNode.cpp:573
SoNode::GLRender
virtual void GLRender(SoGLRenderAction *action)
Definition SoNode.cpp:1003
SoNodekitCatalog
The SoNodekitCatalog class is a container for nodekit layouts.
Definition SoNodekitCatalog.h:45
SoOutput
The SoOutput class is an abstraction of an output stream.
Definition SoOutput.h:51
SoPath
The SoPath class is a container class for traversal path descriptions.
Definition SoPath.h:52
SoRayPickAction
The SoRayPickAction class does ray intersection with scene graphs.
Definition SoRayPickAction.h:50
SoSearchAction
The SoSearchAction class provides methods for searching through scene graphs.
Definition SoSearchAction.h:44
SoWriteAction
The SoWriteAction class writes a scene graph to file.
Definition SoWriteAction.h:42
SO_NODE_HEADER
#define SO_NODE_HEADER(classname)
Definition Coin_macros.dox:50