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 |
LIGHT_SHAPE_PREFIX
Shape3D user data prefix for lights. |
static java.lang.String |
MIRROR_SHAPE_PREFIX
Shape3D user data prefix for mirror shapes. |
static java.lang.String |
WINDOW_PANE_SHAPE_PREFIX
Shape3D user data prefix for window pane shapes. |
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 textures.
|
Node |
cloneNode(Node node)
Returns a clone of the given
node . |
java.awt.geom.Area |
getAreaOnFloor(HomePieceOfFurniture staircase)
Returns the area on the floor of the given staircase.
|
java.awt.geom.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 . |
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 . |
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. |
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. |
Vector3f |
getSize(Node node)
Returns the size of 3D shapes of
node . |
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 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 ModelManager getInstance()
public void clear()
public 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.public 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.public 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.public 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.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 node.width
- the width of the boxpublic 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 node.width
- the width of the boxpublic 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 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 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 void checkAppearancesName(Node node)
node
have a name.public HomeMaterial[] getMaterials(Node node)
node
.public java.awt.geom.Area getAreaOnFloor(Node node)
node
projected on the floor (plan y = 0).public java.awt.geom.Area getAreaOnFloor(HomePieceOfFurniture staircase)
© Copyrights 2006-2014 eTeks - All rights reserved
Distributed under GNU General Public License