SoPattern Class Reference
[Properties]

VSG extension Node that defines the pattern to use when rendering shapes. More...

#include <Inventor/nodes/SoPattern.h>

Inheritance diagram for SoPattern:
SoNode SoFieldContainer SoBase SoRefCounter SoTypedObject

List of all members.

Public Types

enum  FilterType {
  INCLUSIVE_FILTER,
  EXCLUSIVE_FILTER
}

Public Member Functions

virtual SoType getTypeId () const
 SoPattern ()
virtual void setOverride (const SbBool state)
virtual SbBool isOverride () const

Static Public Member Functions

static SoType getClassTypeId ()
static SoNONUNICODE SbBool loadPatterns (const char *fileName, int numFilters=0, const SbString *filterNames=NULL, FilterType filterType=INCLUSIVE_FILTER)
static SbBool loadPatterns (const SbString &fileName, int numFilters=0, const SbString *filterNames=NULL, FilterType filterType=INCLUSIVE_FILTER)
static void getPatternNames (int &number, SbString *&names, const char *category=NULL)
static SoNONUNICODE void addPattern (const char *category, const char *name, const unsigned char *bytes)
static void addPattern (const SbString &category, const SbString &name, const unsigned char *bytes)
static SoNONUNICODE void getPattern (const char *category, const char *name, unsigned char *&bytes)
static void getPattern (const SbString &category, const SbString &name, unsigned char *&bytes)

Public Attributes

SoSFString category
SoSFString name

Detailed Description

VSG extension Node that defines the pattern to use when rendering shapes.

This node specifies the current pattern for all subsequent shape nodes in a scene graph.

A pattern is a 32x32 bitmap that is interpreted as a mask of 0s and 1s. Where a 1 appears, the corresponding pixel in the polygon is drawn; where a 0 appears, nothing is drawn.

You can load a pattern file containing one or more patterns using the loadPatterns() method. You can also define and load patterns programmatically using the addPattern() method.

Here is a sample showing the pattern file format.

     "GEOLOGY"
     # The first string is the category name of the first pattern.
     # This is a comment !
     "PATTERN N1"
     # The second string is the name of the pattern.
     # To define the pattern, you must define a 32x32 sequence of
     # '1' and '0'.
     0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
     0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
     0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
     0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ...
     #============================================
     "PATTERN N2"
     0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
     0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
     0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
     0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ...
     

Note:

Usage Notes

FILE FORMAT/DEFAULT

SEE ALSO

SoMaterial

See related examples:

Pattern


Member Enumeration Documentation

Possible value of the filterType used by the method loadPatterns.

In the case INCLUSIVE_FILTER, we only load patterns of the file define by the list of patterns names. In the case EXCLUSIVE_FILTER, we load all patterns defined in the file without those define by the list of patterns names.

Enumerator:
INCLUSIVE_FILTER 

Load only the patterns that are in the list of pattern names.

EXCLUSIVE_FILTER 

Load all patterns except those specified in the list of pattern names.


Constructor & Destructor Documentation

SoPattern::SoPattern (  ) 

Constructor.


Member Function Documentation

static void SoPattern::addPattern ( const SbString category,
const SbString name,
const unsigned char *  bytes 
) [static]

Adds a new pattern specified as an array of 128 bytes.

A category and a name are specified for this pattern. If the category and name are already in the list of patterns, the new pattern will not be added. If either the category or the name is an empty string, no pattern is added.

static SoNONUNICODE void SoPattern::addPattern ( const char *  category,
const char *  name,
const unsigned char *  bytes 
) [static]

Adds a new pattern specified as an array of 128 bytes.

A category and a name are specified for this pattern. If the category and name are already in the list of patterns, the new pattern will not be added. If either the category or the name is an empty string, no pattern is added.

Non Unicode List:
This function should not be used in a Unicode application.
static SoType SoPattern::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoNode.

static void SoPattern::getPattern ( const SbString category,
const SbString name,
unsigned char *&  bytes 
) [static]

Retrieves a pattern bitmap (an array of 128 bytes) specified by its category and name.

the pattern data pointed to by bytes is read-only.

static SoNONUNICODE void SoPattern::getPattern ( const char *  category,
const char *  name,
unsigned char *&  bytes 
) [static]

Retrieves a pattern bitmap (an array of 128 bytes) specified by its category and name.

the pattern data pointed to by bytes is read-only.

Non Unicode List:
This function should not be used in a Unicode application.
static void SoPattern::getPatternNames ( int &  number,
SbString *&  names,
const char *  category = NULL 
) [static]

Gets the names of loaded patterns.

Category is optional. You are responsible for deleting the names array when it is no longer needed. For example, delete []names;

virtual SoType SoPattern::getTypeId (  )  const [virtual]

Returns the type identifier for this specific instance.

Reimplemented from SoNode.

virtual SbBool SoPattern::isOverride (  )  const [inline, virtual]

Returns the state of the override field.

Reimplemented from SoNode.

static SbBool SoPattern::loadPatterns ( const SbString fileName,
int  numFilters = 0,
const SbString filterNames = NULL,
FilterType  filterType = INCLUSIVE_FILTER 
) [static]

Loads a pattern file, with optional filtering of patterns.

You can specify the file name with or without a full path. If you specify the file name without the path, the file will be loaded from the directory $OIVHOME/data/patterns. If the file name is not found, a default pattern will be used.

filterNames is an array of pattern names. This will be an array of patterns to include (or exclude) depending on the FilterType. The size of this array is numFilters.

static SoNONUNICODE SbBool SoPattern::loadPatterns ( const char *  fileName,
int  numFilters = 0,
const SbString filterNames = NULL,
FilterType  filterType = INCLUSIVE_FILTER 
) [static]

Loads a pattern file, with optional filtering of patterns.

You can specify the file name with or without a full path. If you specify the file name without the path, the file will be loaded from the directory $OIVHOME/data/patterns. If the file name is not found, a default pattern will be used.

filterNames is an array of pattern names. This will be an array of patterns to include (or exclude) depending on the FilterType. The size of this array is numFilters.

Non Unicode List:
This function should not be used in a Unicode application.
virtual void SoPattern::setOverride ( const SbBool  state  )  [inline, virtual]

Set the state of the override field.

see SoNode::setOverride doc.

Reimplemented from SoNode.


Member Data Documentation

Specifies the name of a group of patterns.

If the category name is invalid or not found, the default pattern is used.

Specifies the name of a pattern within a category.

If the pattern name is invalid or not found, the default pattern is used.


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

Open Inventor Toolkit reference manual, generated on 15 Mar 2023
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/