public class ModelManager
extends java.lang.Object
Loader
interface may be
specified in the com.eteks.sweethome3d.j3d.additionalLoaderClasses
(separated by a space or a colon :) to enable the support of other formats.Modifier and Type | Class and Description |
---|---|
static interface |
ModelManager.ModelObserver
An observer that receives model loading notifications.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ARM_ON_BALL_PREFIX |
static java.lang.String |
BALL_PREFIX
Node user data prefix for ball / rotating joints. |
static java.lang.String |
DEFORMABLE_TRANSFORM_GROUP_SUFFIX
Deformable group suffix.
|
static java.lang.String |
EDGE_COLOR_MATERIAL_PREFIX |
static java.lang.String |
HINGE_PREFIX
Node user data prefix for hinge / rotating opening joints. |
static java.lang.String |
LIGHT_SHAPE_PREFIX
Shape3D user data prefix for lights. |
static java.lang.String |
MANNEQUIN_ABDOMEN_CHEST_PREFIX |
static java.lang.String |
MANNEQUIN_ABDOMEN_PELVIS_PREFIX |
static java.lang.String |
MANNEQUIN_ABDOMEN_PREFIX
Node user data prefix for mannequin parts. |
static java.lang.String |
MANNEQUIN_CHEST_PREFIX |
static java.lang.String |
MANNEQUIN_HEAD_PREFIX |
static java.lang.String |
MANNEQUIN_LEFT_ANKLE_PREFIX |
static java.lang.String |
MANNEQUIN_LEFT_ARM_PREFIX |
static java.lang.String |
MANNEQUIN_LEFT_ELBOW_PREFIX |
static java.lang.String |
MANNEQUIN_LEFT_FOOT_PREFIX |
static java.lang.String |
MANNEQUIN_LEFT_FOREARM_PREFIX |
static java.lang.String |
MANNEQUIN_LEFT_HAND_PREFIX |
static java.lang.String |
MANNEQUIN_LEFT_HIP_PREFIX |
static java.lang.String |
MANNEQUIN_LEFT_KNEE_PREFIX |
static java.lang.String |
MANNEQUIN_LEFT_LEG_PREFIX |
static java.lang.String |
MANNEQUIN_LEFT_SHOULDER_PREFIX |
static java.lang.String |
MANNEQUIN_LEFT_THIGH_PREFIX |
static java.lang.String |
MANNEQUIN_LEFT_WRIST_PREFIX |
static java.lang.String |
MANNEQUIN_NECK_PREFIX |
static java.lang.String |
MANNEQUIN_PELVIS_PREFIX |
static java.lang.String |
MANNEQUIN_RIGHT_ANKLE_PREFIX |
static java.lang.String |
MANNEQUIN_RIGHT_ARM_PREFIX |
static java.lang.String |
MANNEQUIN_RIGHT_ELBOW_PREFIX |
static java.lang.String |
MANNEQUIN_RIGHT_FOOT_PREFIX |
static java.lang.String |
MANNEQUIN_RIGHT_FOREARM_PREFIX |
static java.lang.String |
MANNEQUIN_RIGHT_HAND_PREFIX |
static java.lang.String |
MANNEQUIN_RIGHT_HIP_PREFIX |
static java.lang.String |
MANNEQUIN_RIGHT_KNEE_PREFIX |
static java.lang.String |
MANNEQUIN_RIGHT_LEG_PREFIX |
static java.lang.String |
MANNEQUIN_RIGHT_SHOULDER_PREFIX |
static java.lang.String |
MANNEQUIN_RIGHT_THIGH_PREFIX |
static java.lang.String |
MANNEQUIN_RIGHT_WRIST_PREFIX |
static java.lang.String |
MIRROR_ON_HINGE_PREFIX |
static java.lang.String |
MIRROR_ON_RAIL_PREFIX |
static java.lang.String |
MIRROR_SHAPE_PREFIX
Shape3D user data prefix for mirror shapes. |
static java.lang.String |
OPENING_ON_HINGE_PREFIX |
static java.lang.String |
OPENING_ON_RAIL_PREFIX |
static java.lang.String |
RAIL_PREFIX |
static java.lang.String |
SPECIAL_SHAPE_PREFIX
Special shapes prefix;
|
static java.lang.String |
SUB_TRANSFORMATION_SEPARATOR
Node user data separator for sub transformations. |
static java.lang.String |
UNIQUE_RAIL_PREFIX
Node user data prefix for rail / sliding opening joints. |
static java.lang.String |
WINDOW_PANE_ON_HINGE_PREFIX |
static java.lang.String |
WINDOW_PANE_ON_RAIL_PREFIX |
static java.lang.String |
WINDOW_PANE_SHAPE_PREFIX
Shape3D user data prefix for window pane shapes. |
Modifier and Type | Method and Description |
---|---|
void |
checkAppearancesName(javax.media.j3d.Node node)
Ensures that all the appearance of the children shapes of the
given
node have a name. |
void |
clear()
Shutdowns the multithreaded service that load models and clears loaded models cache.
|
javax.media.j3d.Node |
cloneNode(javax.media.j3d.Node node)
Returns a clone of the given
node . |
boolean |
containsDeformableNode(javax.media.j3d.Node node)
Returns
true if the given node or its children contains at least a deformable group. |
boolean |
containsNode(javax.media.j3d.Node node,
java.lang.String prefix)
Returns
true if the given node or a node in its hierarchy
contains a node which name, stored in user data, starts with prefix . |
java.awt.geom.Area |
getAreaOnFloor(HomePieceOfFurniture staircase)
Returns the area on the floor of the given staircase.
|
java.awt.geom.Area |
getAreaOnFloor(javax.media.j3d.Node node)
Returns the 2D area of the 3D shapes children of the given
node
projected on the floor (plan y = 0). |
javax.media.j3d.BoundingBox |
getBounds(javax.media.j3d.Node node)
Returns the bounds of the 3D shapes of
node . |
javax.media.j3d.BoundingBox |
getBounds(javax.media.j3d.Node node,
javax.media.j3d.Transform3D transformation)
Returns the bounds of the 3D shapes of
node with an additional transformation . |
javax.vecmath.Point3f |
getCenter(javax.media.j3d.Node node)
Returns the center of the bounds of
node 3D shapes. |
static ModelManager |
getInstance()
Returns an instance of this singleton.
|
HomeMaterial[] |
getMaterials(javax.media.j3d.Node node)
Returns the materials used by the children shapes of the given
node . |
HomeMaterial[] |
getMaterials(javax.media.j3d.Node node,
boolean ignoreEdgeColorMaterial,
java.lang.String creator)
Returns the materials used by the children shapes of the given
node ,
attributing their creator to them. |
HomeMaterial[] |
getMaterials(javax.media.j3d.Node node,
java.lang.String creator)
Returns the materials used by the children shapes of the given
node ,
attributing their creator to them. |
javax.media.j3d.Transform3D |
getNormalizedTransform(javax.media.j3d.Node node,
float[][] modelRotation,
float width)
Returns a transform that will transform the model
node
to let it fill a box of the given width centered on the origin. |
javax.media.j3d.Transform3D |
getNormalizedTransform(javax.media.j3d.Node node,
float[][] modelRotation,
float width,
boolean modelCenteredAtOrigin)
Returns a transform that will transform the model
node
to let it fill a box of the given width centered on the origin. |
javax.media.j3d.TransformGroup |
getNormalizedTransformGroup(javax.media.j3d.Node node,
float[][] modelRotation,
float width)
Returns a transform group that will transform the model
node
to let it fill a box of the given width centered on the origin. |
javax.media.j3d.TransformGroup |
getNormalizedTransformGroup(javax.media.j3d.Node node,
float[][] modelRotation,
float width,
boolean modelCenteredAtOrigin)
Returns a transform group that will transform the model
node
to let it fill a box of the given width centered on the origin. |
java.awt.Shape |
getShape(java.lang.String svgPathShape)
Returns the AWT shape matching the given SVG path shape.
|
javax.vecmath.Vector3f |
getSize(javax.media.j3d.Node node)
Returns the size of 3D shapes of
node . |
javax.vecmath.Vector3f |
getSize(javax.media.j3d.Node node,
javax.media.j3d.Transform3D transformation)
Returns the size of 3D shapes of
node after an additional transformation . |
javax.media.j3d.BranchGroup |
loadModel(Content content)
Returns the node loaded synchronously from
content with supported loaders. |
void |
loadModel(Content content,
boolean synchronous,
ModelManager.ModelObserver modelObserver)
Reads a 3D node from
content with supported loaders
and notifies the loaded model to the given modelObserver once available. |
void |
loadModel(Content content,
ModelManager.ModelObserver modelObserver)
Reads asynchronously a 3D node from
content with supported loaders
and notifies the loaded model to the given modelObserver once available. |
public static final java.lang.String SPECIAL_SHAPE_PREFIX
public static final java.lang.String WINDOW_PANE_SHAPE_PREFIX
Shape3D
user data prefix for window pane shapes.public static final java.lang.String MIRROR_SHAPE_PREFIX
Shape3D
user data prefix for mirror shapes.public static final java.lang.String LIGHT_SHAPE_PREFIX
Shape3D
user data prefix for lights.public static final java.lang.String MANNEQUIN_ABDOMEN_PREFIX
Node
user data prefix for mannequin parts.public static final java.lang.String MANNEQUIN_CHEST_PREFIX
public static final java.lang.String MANNEQUIN_PELVIS_PREFIX
public static final java.lang.String MANNEQUIN_NECK_PREFIX
public static final java.lang.String MANNEQUIN_HEAD_PREFIX
public static final java.lang.String MANNEQUIN_LEFT_SHOULDER_PREFIX
public static final java.lang.String MANNEQUIN_LEFT_ARM_PREFIX
public static final java.lang.String MANNEQUIN_LEFT_ELBOW_PREFIX
public static final java.lang.String MANNEQUIN_LEFT_FOREARM_PREFIX
public static final java.lang.String MANNEQUIN_LEFT_WRIST_PREFIX
public static final java.lang.String MANNEQUIN_LEFT_HAND_PREFIX
public static final java.lang.String MANNEQUIN_LEFT_HIP_PREFIX
public static final java.lang.String MANNEQUIN_LEFT_THIGH_PREFIX
public static final java.lang.String MANNEQUIN_LEFT_KNEE_PREFIX
public static final java.lang.String MANNEQUIN_LEFT_LEG_PREFIX
public static final java.lang.String MANNEQUIN_LEFT_ANKLE_PREFIX
public static final java.lang.String MANNEQUIN_LEFT_FOOT_PREFIX
public static final java.lang.String MANNEQUIN_RIGHT_SHOULDER_PREFIX
public static final java.lang.String MANNEQUIN_RIGHT_ARM_PREFIX
public static final java.lang.String MANNEQUIN_RIGHT_ELBOW_PREFIX
public static final java.lang.String MANNEQUIN_RIGHT_FOREARM_PREFIX
public static final java.lang.String MANNEQUIN_RIGHT_WRIST_PREFIX
public static final java.lang.String MANNEQUIN_RIGHT_HAND_PREFIX
public static final java.lang.String MANNEQUIN_RIGHT_HIP_PREFIX
public static final java.lang.String MANNEQUIN_RIGHT_THIGH_PREFIX
public static final java.lang.String MANNEQUIN_RIGHT_KNEE_PREFIX
public static final java.lang.String MANNEQUIN_RIGHT_LEG_PREFIX
public static final java.lang.String MANNEQUIN_RIGHT_ANKLE_PREFIX
public static final java.lang.String MANNEQUIN_RIGHT_FOOT_PREFIX
public static final java.lang.String MANNEQUIN_ABDOMEN_CHEST_PREFIX
public static final java.lang.String MANNEQUIN_ABDOMEN_PELVIS_PREFIX
public static final java.lang.String BALL_PREFIX
Node
user data prefix for ball / rotating joints.public static final java.lang.String ARM_ON_BALL_PREFIX
public static final java.lang.String HINGE_PREFIX
Node
user data prefix for hinge / rotating opening joints.public static final java.lang.String OPENING_ON_HINGE_PREFIX
public static final java.lang.String WINDOW_PANE_ON_HINGE_PREFIX
public static final java.lang.String MIRROR_ON_HINGE_PREFIX
public static final java.lang.String UNIQUE_RAIL_PREFIX
Node
user data prefix for rail / sliding opening joints.public static final java.lang.String RAIL_PREFIX
public static final java.lang.String OPENING_ON_RAIL_PREFIX
public static final java.lang.String WINDOW_PANE_ON_RAIL_PREFIX
public static final java.lang.String MIRROR_ON_RAIL_PREFIX
public static final java.lang.String SUB_TRANSFORMATION_SEPARATOR
Node
user data separator for sub transformations.public static final java.lang.String DEFORMABLE_TRANSFORM_GROUP_SUFFIX
public static final java.lang.String EDGE_COLOR_MATERIAL_PREFIX
public static ModelManager getInstance()
public void clear()
public javax.vecmath.Vector3f getSize(javax.media.j3d.Node node)
node
.
This method computes the exact box that contains all the shapes,
contrary to node.getBounds()
that returns a bounding
sphere for a scene.node
- the root of a modelpublic javax.vecmath.Vector3f getSize(javax.media.j3d.Node node, javax.media.j3d.Transform3D transformation)
node
after an additional transformation
.
This method computes the exact box that contains all the shapes,
contrary to node.getBounds()
that returns a bounding
sphere for a scene.node
- the root of a modeltransformation
- the transformation applied to the model
or null
if no transformation should be applied to node.public javax.vecmath.Point3f getCenter(javax.media.j3d.Node node)
node
3D shapes.node
- the root of a modelpublic javax.media.j3d.BoundingBox getBounds(javax.media.j3d.Node node)
node
.
This method computes the exact box that contains all the shapes,
contrary to node.getBounds()
that returns a bounding
sphere for a scene.node
- the root of a modelpublic javax.media.j3d.BoundingBox getBounds(javax.media.j3d.Node node, javax.media.j3d.Transform3D transformation)
node
with an additional transformation
.
This method computes the exact box that contains all the shapes, contrary to node.getBounds()
that returns a bounding sphere for a scene.node
- the root of a modeltransformation
- the transformation applied to the model
or null
if no transformation should be applied to node.public javax.media.j3d.TransformGroup getNormalizedTransformGroup(javax.media.j3d.Node node, float[][] modelRotation, float width)
node
to let it fill a box of the given width
centered on the origin.node
- the root of a model with any size and locationmodelRotation
- the rotation applied to the model before normalization
or null
if no transformation should be applied to nodewidth
- the width of the boxpublic javax.media.j3d.TransformGroup getNormalizedTransformGroup(javax.media.j3d.Node node, float[][] modelRotation, float width, boolean modelCenteredAtOrigin)
node
to let it fill a box of the given width
centered on the origin.node
- the root of a model with any size and locationmodelRotation
- the rotation applied to the model before normalization
or null
if no transformation should be applied to nodewidth
- the width of the boxmodelCenteredAtOrigin
- if true
center will be moved to match the origin
after the model rotation is appliedpublic javax.media.j3d.Transform3D getNormalizedTransform(javax.media.j3d.Node node, float[][] modelRotation, float width)
node
to let it fill a box of the given width
centered on the origin.node
- the root of a model with any size and locationmodelRotation
- the rotation applied to the model before normalization
or null
if no transformation should be applied to nodewidth
- the width of the boxpublic javax.media.j3d.Transform3D getNormalizedTransform(javax.media.j3d.Node node, float[][] modelRotation, float width, boolean modelCenteredAtOrigin)
node
to let it fill a box of the given width
centered on the origin.node
- the root of a model with any size and locationmodelRotation
- the rotation applied to the model before normalization
or null
if no transformation should be applied to nodewidth
- the width of the boxmodelCenteredAtOrigin
- if true
center will be moved to match the origin
after the model rotation is appliedpublic void loadModel(Content content, ModelManager.ModelObserver modelObserver)
content
with supported loaders
and notifies the loaded model to the given modelObserver
once available.content
- an object containing a modelmodelObserver
- the observer that will be notified once the model is available
or if an error happensjava.lang.IllegalStateException
- if the current thread isn't the Event Dispatch Thread.public void loadModel(Content content, boolean synchronous, ModelManager.ModelObserver modelObserver)
content
with supported loaders
and notifies the loaded model to the given modelObserver
once available.content
- an object containing a modelsynchronous
- if true
, this method will return only once model content is loadedmodelObserver
- the observer that will be notified once the model is available
or if an error happens. When the model is loaded synchronously, the observer will be notified
in the same thread as the caller, otherwise the observer will be notified in the Event
Dispatch Thread and this method must be called in Event Dispatch Thread too.java.lang.IllegalStateException
- if synchronous is false
and the current thread isn't
the Event Dispatch Thread.public javax.media.j3d.Node cloneNode(javax.media.j3d.Node node)
node
.
All the children and the attributes of the given node are duplicated except the geometries
and the texture images of shapes.public javax.media.j3d.BranchGroup loadModel(Content content) throws java.io.IOException
content
with supported loaders.
This method is threadsafe and may be called from any thread.content
- an object containing a modeljava.io.IOException
public boolean containsNode(javax.media.j3d.Node node, java.lang.String prefix)
true
if the given node
or a node in its hierarchy
contains a node which name, stored in user data, starts with prefix
.public boolean containsDeformableNode(javax.media.j3d.Node node)
true
if the given node
or its children contains at least a deformable group.node
- the root of a modelpublic void checkAppearancesName(javax.media.j3d.Node node)
node
have a name.public HomeMaterial[] getMaterials(javax.media.j3d.Node node)
node
.public HomeMaterial[] getMaterials(javax.media.j3d.Node node, java.lang.String creator)
node
,
attributing their creator
to them.public HomeMaterial[] getMaterials(javax.media.j3d.Node node, boolean ignoreEdgeColorMaterial, java.lang.String creator)
node
,
attributing their creator
to them.public java.awt.geom.Area getAreaOnFloor(javax.media.j3d.Node node)
node
projected on the floor (plan y = 0).public java.awt.geom.Area getAreaOnFloor(HomePieceOfFurniture staircase)
public java.awt.Shape getShape(java.lang.String svgPathShape)
© Copyright 2024 Space Mushrooms
Distributed under GNU General Public License