public class ModelManager extends 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 | Method and Description |
|---|---|
void |
checkAppearancesName(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.
|
Node |
cloneNode(Node node)
Returns a clone of the given
node. |
boolean |
containsDeformableNode(Node node)
Return
true if the given node or its children contains at least a deformable group. |
boolean |
containsNode(Node node,
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. |
Area |
getAreaOnFloor(HomePieceOfFurniture staircase)
Returns the area on the floor of the given staircase.
|
Area |
getAreaOnFloor(Node node)
Returns the 2D area of the 3D shapes children of the given
node
projected on the floor (plan y = 0). |
BoundingBox |
getBounds(Node node)
Returns the bounds of the 3D shapes of
node. |
BoundingBox |
getBounds(Node node,
Transform3D transformation)
Returns the bounds of the 3D shapes of
node with an additional transformation. |
javax.vecmath.Point3f |
getCenter(Node node)
Returns the center of the bounds of
node 3D shapes. |
static ModelManager |
getInstance()
Returns an instance of this singleton.
|
HomeMaterial[] |
getMaterials(Node node)
Returns the materials used by the children shapes of the given
node. |
HomeMaterial[] |
getMaterials(Node node,
String creator)
Returns the materials used by the children shapes of the given
node,
attributing their creator to them. |
Transform3D |
getNormalizedTransform(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. |
Transform3D |
getNormalizedTransform(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. |
TransformGroup |
getNormalizedTransformGroup(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. |
TransformGroup |
getNormalizedTransformGroup(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. |
Shape |
getShape(String svgPathShape)
Returns the AWT shape matching the given SVG path shape.
|
javax.vecmath.Vector3f |
getSize(Node node)
Returns the size of 3D shapes of
node. |
javax.vecmath.Vector3f |
getSize(Node node,
Transform3D transformation)
Returns the size of 3D shapes of
node after an additional transformation. |
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 String WINDOW_PANE_SHAPE_PREFIX
Shape3D user data prefix for window pane shapes.public static final String MIRROR_SHAPE_PREFIX
Shape3D user data prefix for mirror shapes.public static final String LIGHT_SHAPE_PREFIX
Shape3D user data prefix for lights.public static final String MANNEQUIN_ABDOMEN_PREFIX
Node user data prefix for mannequin parts.public static final String MANNEQUIN_CHEST_PREFIX
public static final String MANNEQUIN_PELVIS_PREFIX
public static final String MANNEQUIN_NECK_PREFIX
public static final String MANNEQUIN_HEAD_PREFIX
public static final String MANNEQUIN_LEFT_SHOULDER_PREFIX
public static final String MANNEQUIN_LEFT_ARM_PREFIX
public static final String MANNEQUIN_LEFT_ELBOW_PREFIX
public static final String MANNEQUIN_LEFT_FOREARM_PREFIX
public static final String MANNEQUIN_LEFT_WRIST_PREFIX
public static final String MANNEQUIN_LEFT_HAND_PREFIX
public static final String MANNEQUIN_LEFT_HIP_PREFIX
public static final String MANNEQUIN_LEFT_THIGH_PREFIX
public static final String MANNEQUIN_LEFT_KNEE_PREFIX
public static final String MANNEQUIN_LEFT_LEG_PREFIX
public static final String MANNEQUIN_LEFT_ANKLE_PREFIX
public static final String MANNEQUIN_LEFT_FOOT_PREFIX
public static final String MANNEQUIN_RIGHT_SHOULDER_PREFIX
public static final String MANNEQUIN_RIGHT_ARM_PREFIX
public static final String MANNEQUIN_RIGHT_ELBOW_PREFIX
public static final String MANNEQUIN_RIGHT_FOREARM_PREFIX
public static final String MANNEQUIN_RIGHT_WRIST_PREFIX
public static final String MANNEQUIN_RIGHT_HAND_PREFIX
public static final String MANNEQUIN_RIGHT_HIP_PREFIX
public static final String MANNEQUIN_RIGHT_THIGH_PREFIX
public static final String MANNEQUIN_RIGHT_KNEE_PREFIX
public static final String MANNEQUIN_RIGHT_LEG_PREFIX
public static final String MANNEQUIN_RIGHT_ANKLE_PREFIX
public static final String MANNEQUIN_RIGHT_FOOT_PREFIX
public static final String MANNEQUIN_ABDOMEN_CHEST_PREFIX
public static final String MANNEQUIN_ABDOMEN_PELVIS_PREFIX
public static final String BALL_PREFIX
Node user data prefix for ball / rotating joints.public static final String ARM_ON_BALL_PREFIX
public static final String HINGE_PREFIX
Node user data prefix for hinge / rotating opening joints.public static final String OPENING_ON_HINGE_PREFIX
public static final String WINDOW_PANE_ON_HINGE_PREFIX
public static final String MIRROR_ON_HINGE_PREFIX
public static final String UNIQUE_RAIL_PREFIX
Node user data prefix for rail / sliding opening joints.public static final String RAIL_PREFIX
public static final String OPENING_ON_RAIL_PREFIX
public static final String WINDOW_PANE_ON_RAIL_PREFIX
public static final String MIRROR_ON_RAIL_PREFIX
public static final String DEFORMABLE_TRANSFORM_GROUP_SUFFIX
public static ModelManager getInstance()
public void clear()
public javax.vecmath.Vector3f getSize(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(Node node, 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(Node node)
node 3D shapes.node - the root of a modelpublic BoundingBox getBounds(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 BoundingBox getBounds(Node node, 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 TransformGroup getNormalizedTransformGroup(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 TransformGroup getNormalizedTransformGroup(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 Transform3D getNormalizedTransform(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 Transform3D getNormalizedTransform(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 happensIllegalStateException - 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.IllegalStateException - if synchronous is false and the current thread isn't
the Event Dispatch Thread.public Node cloneNode(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 BranchGroup loadModel(Content content) throws IOException
content with supported loaders.
This method is threadsafe and may be called from any thread.content - an object containing a modelIOExceptionpublic boolean containsNode(Node node, 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(Node node)
true if the given node or its children contains at least a deformable group.node - the root of a modelpublic void checkAppearancesName(Node node)
node have a name.public HomeMaterial[] getMaterials(Node node)
node.public HomeMaterial[] getMaterials(Node node, String creator)
node,
attributing their creator to them.public Area getAreaOnFloor(Node node)
node
projected on the floor (plan y = 0).public Area getAreaOnFloor(HomePieceOfFurniture staircase)
public Shape getShape(String svgPathShape)

© Copyrights 2006-2019 Emmanuel PUYBARET / eTeks
Distributed under GNU General Public License