Class SoProjection
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.misc.SoBase
-
- com.openinventor.inventor.fields.SoFieldContainer
-
- com.openinventor.inventor.nodes.SoNode
-
- com.openinventor.inventor.nodes.SoProjection
-
- All Implemented Interfaces:
SafeDisposable
- Direct Known Subclasses:
SoGeoProjection
,SoTransformProjection
public class SoProjection extends SoNode
Coordinate projection node. This property node defines a coordinate projection that will be applied to all subsequent shapes in the scene graph. Coordinate transform nodes likeSoTransform
can only apply transforms that can be expressed as a matrix. A coordinate projection can be any algorithm that takes a coordinate and returns a different coordinate. This is particularly useful for geospatial coordinate systems (seeSoGeoProjection
), but is also useful for using spherical, cylindrical and other coordinate systems directly.This node works together with projection classes derived from the
SbProjection
class. The projection classes implement the projection computations applied to 3D points. Applications can create new subclasses ofSbProjection
.To use a specific projection, call
setProjection()
with an instance of theSbProjection
class. Each instance ofSoProjection
can also store a list of projections, each one associated with a unique id. This is convenient for switching between different geospatial projections. Changing theprojTypeId
value activates the projection registered with the corresponding id.The default projection is spherical coordinates (
SbSphericalProjection
).The projection classes will use the string parameters and float parameters in the fields
parameters
andfloatParameters
respectively. See the projection class documentation for relevant parameters.Normal vectors
- If no normal vectors are given for the geometry (and normal vectors are needed), Open Inventor will automatically compute normal vectors using the projected vertices, i.e. the coordinates after projection has been applied. This is usually the desired result.
- If normal vectors are specified for the geometry, they are not projected. Therefore normal vectors must be specified in post-projection (world) coordinates.
LIMITATIONS
- Shapes
The following shapes are not supported bySoProjection
:- Text nodes (
SoAnnoText3
,SoAsciiText
,SoText2
,SoText3
) SoCylinder
,SoCube
,SoCone
- All classes inheriting from
SoAlgebraicShape
SoImage
- NURBS shapes
- All VolumeViz shapes except
SoVolumeRender
with some limitations (seeSoVolumeRender
doc for details)- Volume geometry nodes (e.g.
SoVolumeIndexedFaceSet
)
- Text nodes (
- Transform nodes
The projection mechanism is not compatible with transform and manipulator nodes. Using nodes derived fromSoTransformation
, for exampleSoTransform
orSoTabBoxManip
will give unexpected results. To apply a transformation matrix to projected shapes, set thematrix
field to the expected value. Shape vertices will be multiplied by the matrix before being projected. - Draggers
Because draggers are composed withSoTransformation
nodes, they can't be projected using anSoProjection
node. - Memory
Because shape coordinates must be duplicated, memory consumption will increase when using projections. - Picking
Projection is not applied when doing picking (SoRayPickAction
). Results may be incorrect.
File format/default:
Projection {
parameters "" matrix identity isOn true floatParameters 1 projTypeId 0 Action behavior:
Sets:
SoCoordinateElement
- See Also:
SbProjection
,SbSphericalProjection
,SoGeoProjection
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoNode
SoNode.RenderModes
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
Fields Modifier and Type Field Description SoMFFloat
floatParameters
Float parameters stored for projections.SoSFBool
isOn
If set to false, projection is inactive.SoSFMatrix
matrix
Matrix that can be applied before projecting a point.SoMFString
parameters
String parameters stored for projections.SoMFString
parametersIn
String parameters stored for projections.SoSFInt32
projTypeId
Current projection id.-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoProjection()
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
addProjection(SbProjection projection, int id)
Add a projection with the given name and id to the list.static SbVec3f[]
checkProjection(SoState state, SoNode node, SbVec3f[] coords)
Apply projection to given coordinates.SbProjection
getProjection()
Return current projection.void
setProjection(SbProjection projection)
Set the current projection.-
Methods inherited from class com.openinventor.inventor.nodes.SoNode
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
-
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
-
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
-
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
-
-
-
Field Detail
-
isOn
public final SoSFBool isOn
If set to false, projection is inactive. Default is true.
-
matrix
public final SoSFMatrix matrix
Matrix that can be applied before projecting a point. Set to Identity by default
-
projTypeId
public final SoSFInt32 projTypeId
Current projection id. Default is zero.
-
floatParameters
public final SoMFFloat floatParameters
Float parameters stored for projections.
-
parameters
public final SoMFString parameters
String parameters stored for projections.
-
parametersIn
public final SoMFString parametersIn
String parameters stored for projections.
-
-
Method Detail
-
checkProjection
public static SbVec3f[] checkProjection(SoState state, SoNode node, SbVec3f[] coords)
Apply projection to given coordinates. Store projected coordinates in currentSoCoordinate3
element.
-
addProjection
public java.lang.String addProjection(SbProjection projection, int id)
Add a projection with the given name and id to the list. The projection name is just for convenience. The projection id value should be greater than zero because the default spherical projection already uses this id. If multiple projections are assigned the same id, the first one added to the list will be used.
-
setProjection
public void setProjection(SbProjection projection)
Set the current projection. The specified projection is used regardless of whether it is in the list. In this case the value of the projTypeId field is not used.
-
getProjection
public SbProjection getProjection()
Return current projection.
-
-