Coin Logo http://www.coin3d.org/
http://www.kongsberg.com/kogt/

Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
SoSTLFileKit Class Reference

SoSTLFileKit is a class for using STL files with Coin. More...

#include <ForeignFiles/SoSTLFileKit.h>

Inheritance diagram for SoSTLFileKit:
SoForeignFileKit SoBaseKit SoNode SoFieldContainer SoBase

Public Types

enum  Colorization { GREY, MATERIALISE, TNO_VISICAM }

Public Member Functions

virtual SoType getTypeId (void) const
 Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and "downward" casting.
virtual const SoNodekitCataloggetNodekitCatalog (void) const
 SoSTLFileKit (void)
virtual SbBool canReadFile (const char *filename=NULL) const
virtual SbBool readFile (const char *filename)
virtual SbBool canWriteFile (const char *filename=NULL) const
virtual SbBool writeFile (const char *filename)
SbBool canReadScene (void) const
SbBool readScene (SoNode *scene)
virtual SoSeparatorconvert ()

Static Public Member Functions

static SoType getClassTypeId (void)
 This static method returns the SoType object associated with objects of this class.
static const SoNodekitCataloggetClassNodekitCatalog (void)
static void initClass (void)
static SbBool identify (const char *filename)
- Static Public Member Functions inherited from SoForeignFileKit
static SbBool isFileSupported (SoInput *in, SbBool exhaust=FALSE)
static SbBool isFileSupported (const char *filename, SbBool exhaust=FALSE)
static SoForeignFileKitcreateForeignFileKit (SoInput *in, SbBool exhaust=FALSE)
static SoForeignFileKitcreateForeignFileKit (const char *filename, SbBool exhaust=FALSE)
- Static Public Member Functions inherited from SoBaseKit
static SbBool isSearchingChildren (void)
static void setSearchingChildren (const SbBool newval)
- Static Public Member Functions inherited from SoNode
static uint32_t getCompatibilityTypes (const SoType &nodetype)
static SoNodegetByName (const SbName &name)
static int getByName (const SbName &name, SoNodeList &l)
static uint32_t getNextNodeId (void)
static int getActionMethodIndex (const SoType type)
static void getBoundingBoxS (SoAction *action, SoNode *node)
static void GLRenderS (SoAction *action, SoNode *node)
static void callbackS (SoAction *action, SoNode *node)
static void getMatrixS (SoAction *action, SoNode *node)
static void handleEventS (SoAction *action, SoNode *node)
static void pickS (SoAction *action, SoNode *node)
static void rayPickS (SoAction *action, SoNode *node)
static void searchS (SoAction *action, SoNode *node)
static void writeS (SoAction *action, SoNode *node)
static void audioRenderS (SoAction *action, SoNode *node)
static void getPrimitiveCountS (SoAction *action, SoNode *node)
- Static Public Member Functions inherited from SoFieldContainer
static void cleanupClass (void)
static void initCopyDict (void)
static void addCopy (const SoFieldContainer *orig, const SoFieldContainer *copy)
static SoFieldContainercheckCopy (const SoFieldContainer *orig)
static SoFieldContainerfindCopy (const SoFieldContainer *orig, const SbBool copyconnections)
static void copyDone (void)
- Static Public Member Functions inherited from SoBase
static void addName (SoBase *const base, const char *const name)
static void removeName (SoBase *const base, const char *const name)
static void incrementCurrentWriteCounter (void)
static void decrementCurrentWriteCounter (void)
static SoBasegetNamedBase (const SbName &name, SoType type)
static int getNamedBases (const SbName &name, SoBaseList &baselist, SoType type)
static SbBool read (SoInput *input, SoBase *&base, SoType expectedtype)
static void setInstancePrefix (const SbString &c)
static void setTraceRefs (SbBool trace)
static SbBool getTraceRefs (void)
static SbBool connectRoute (SoInput *input, const SbName &fromnodename, const SbName &fromfieldname, const SbName &tonodename, const SbName &tofieldname)
static SbBool readRoute (SoInput *input)

Public Attributes

SoSFString info
SoSFBool binary
SoSFEnum colorization

Protected Member Functions

virtual const SoFieldDatagetFieldData (void) const
virtual ~SoSTLFileKit (void)
void reset (void)
SbBool addFacet (const SbVec3f &v1, const SbVec3f &v2, const SbVec3f &v3, const SbVec3f &normal)
void organizeModel (void)

Static Protected Member Functions

static const SoFieldData ** getFieldDataPtr (void)
static const SoNodekitCatalog ** getClassNodekitCatalogPtr (void)
- Static Protected Member Functions inherited from SoForeignFileKit
static void initClasses (void)
static SbBool registerFileExtension (SoType handler, SbName extension, SoForeignFileIdentifyFunc *identify)

Protected Attributes

SoSFNode shapehints
SoSFNode texture
SoSFNode normalbinding
SoSFNode normals
SoSFNode materialbinding
SoSFNode material
SoSFNode coordinates
SoSFNode facets
- Protected Attributes inherited from SoForeignFileKit
SoSFNode topSeparator
- Protected Attributes inherited from SoBaseKit
SoSFNode callbackList
SoChildListchildren
SbBool connectionsSetUp
- Protected Attributes inherited from SoNode
uint32_t uniqueId
- Protected Attributes inherited from SoFieldContainer
SbBool isBuiltIn

Additional Inherited Members

- Protected Types inherited from SoBase
enum  BaseFlags { IS_ENGINE = 0x01, IS_GROUP = 0x02 }
- Static Protected Attributes inherited from SoNode
static uint32_t nextUniqueId = 1
static int nextActionMethodIndex = 0

Detailed Description

SoSTLFileKit is a class for using STL files with Coin.

Class for using STL files with Coin. You can use it to read and write STL files, and convert back and forth between Open Inventor scene graphs and SoSTLFileKits.

STL files are 3D models intended for 3D printers, and is a format supported by a wide variety of computer-aided design programs. STL models are, because of their intended purpose, always representations of solid objects. STL is short for Stereolithography, the process used for 3D printing.

Ordinary STL models do not contain color information. There are, however, two extensions to the binary file format for specifying color. Currently neither extension is supported. This is caused by lack of sample models using the extensions and will be added as soon as such models are found. We have the specs on the extensions, and it should be pretty straight-forwards to implement, but we want to get it right at once since we have write support (we don't want to inadvertently create a third color extension ;).

When writing STL files, certain STL model criterias are not enforced by SoSTLFileKit. These are:

Since the color extensions are not supported yet, color information is not collected either when converting Open Inventor scene graphs to SoSTLFileKits.

Be aware that this class is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

Since
Coin 3.0

Constructor & Destructor Documentation

SoSTLFileKit::SoSTLFileKit ( void  )

Constructor.

SoSTLFileKit::~SoSTLFileKit ( void  )
protectedvirtual

Destructor.

Member Function Documentation

SoType SoSTLFileKit::getTypeId ( void  ) const
virtual

Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and "downward" casting.

Usage example:

void foo(SoNode * node)
{
if (node->getTypeId() == SoFile::getClassTypeId()) {
SoFile * filenode = (SoFile *)node; // safe downward cast, knows the type
}
}

For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overridden in all subclasses. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through for instance Inventor/nodes/SoSubNode.h (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine.h (for engine classes) and so on.

For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups.

Reimplemented from SoForeignFileKit.

const SoFieldData ** SoSTLFileKit::getFieldDataPtr ( void  )
staticprotected

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.

Reimplemented from SoForeignFileKit.

const SoFieldData * SoSTLFileKit::getFieldData ( void  ) const
protectedvirtual

Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL.

Reimplemented from SoForeignFileKit.

const SoNodekitCatalog * SoSTLFileKit::getClassNodekitCatalog ( void  )
static

Returns the nodekit catalog which defines the layout of this class' kit.

Reimplemented from SoForeignFileKit.

const SoNodekitCatalog * SoSTLFileKit::getNodekitCatalog ( void  ) const
virtual

Returns the nodekit catalog which defines the layout of this class' kit.

Reimplemented from SoForeignFileKit.

const SoNodekitCatalog ** SoSTLFileKit::getClassNodekitCatalogPtr ( void  )
staticprotected

Returns the pointer to the pointer of the nodekit catalog for this class.

Reimplemented from SoForeignFileKit.

void SoSTLFileKit::initClass ( void  )
static

Initializes class and registers file identification functions.

Reimplemented from SoForeignFileKit.

SbBool SoSTLFileKit::identify ( const char *  filename)
static

Returns wether or not filename is identified as an STL file.

SbBool SoSTLFileKit::canReadFile ( const char *  filename = NULL) const
virtual

Checks if this concrete class can read the given file.

Reimplemented from SoForeignFileKit.

SbBool SoSTLFileKit::readFile ( const char *  filename)
virtual

Reads in an STL file. Both ascii and binary files are supported. For binary files, the color extensions are not implemented yet.

Returns FALSE if filename could not be opened or parsed correctly.

See Also
canReadFile

Reimplemented from SoForeignFileKit.

SbBool SoSTLFileKit::canWriteFile ( const char *  filename = NULL) const
virtual

Checks if this concrete class can write to the given file.

Reimplemented from SoForeignFileKit.

SbBool SoSTLFileKit::writeFile ( const char *  filename)
virtual

Writes the STL model to an STL file.

See Also
binary, info, canWriteFile, canReadScene

Reimplemented from SoForeignFileKit.

SbBool SoSTLFileKit::readScene ( SoNode scene)

Converts a scene graph into an SoSTLFileKit. Useful for creating STL files.

See Also
canReadScene, canWriteFile, writeFile
SoSeparator * SoSTLFileKit::convert ( )
virtual

Converts (if necessary) the internal representation of the foreign file to a pure Coin scenegraph. Returns the root node with a refcount of 0.

Implements SoForeignFileKit.

void SoSTLFileKit::reset ( void  )
protected

Resets the STL model so it contains nothing.

SbBool SoSTLFileKit::addFacet ( const SbVec3f v1,
const SbVec3f v2,
const SbVec3f v3,
const SbVec3f n 
)
protected

Adds one triangle to the STL model.

See Also
reset, organizeModel
void SoSTLFileKit::organizeModel ( void  )
protected

Should be called after the STL model is completely set up in the SoSTLFileKit through import from a file or from a scene graph. The model will then be optimized for fast rendering.

See Also
addFacet, reset

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

Copyright © by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Sat Oct 12 2013 06:27:58 for Coin by Doxygen 1.8.1.2.