AnyLogic
Expand
Font size
All Implemented Interfaces:
com.anylogic.engine.internal.Child, Locatable2D, Locatable3D, AggregatableAnimationElement, HasLevel, LevelElement, SVGElement, UsdElement, Serializable, Cloneable

public class Shape3DObject
extends Shape3D
implements com.anylogic.engine.internal.Child
3D object shape loaded from COLLADA (.dae) file. Also visible on 2D animation (in the form of top-view).
This shape enables AnyLogic users to import ready-to-use 3D objects created in some third-party 3D graphics packets into their models.
COLLADA format is the XML-based file format for representing 3D computer graphics.
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Field Summary

Modifier and TypeFieldDescription
static final Object3DAxisOrderXYZ_AXIS_ORDER
Deprecated.
static final Object3DAxisOrderYZX_AXIS_ORDER
Deprecated.
static final Object3DAxisOrderZXY_AXIS_ORDER
Deprecated.

Fields inherited from class com.anylogic.engine.presentation.Shape3D

UNKNOWN_NAME

Fields inherited from interface com.anylogic.engine.presentation.UsdElement

ID_NOT_SET

Constructor Summary

ConstructorDescription
Shape3DObject(Presentable presentable, boolean ispublic, double x, double y, double z, double rotation, double scale, String packagePrefix, String fileName, Object3DAxisOrder axisOrder, boolean applyShading, double topLeftX, double topLeftY, double width, double height)
Deprecated.
this constructor is deprecated and will be removed in future releases
Shape3DObject(Presentable presentable, ShapeDrawMode drawMode, boolean ispublic, double x, double y, double z, double rotation, double scale, boolean autoScale, String packagePrefix, String fileName, Object3DAxisOrder axisOrder, boolean applyShading, double topLeftX, double topLeftY, double width, double height)
Deprecated.
this constructor is deprecated and will be removed in future releases
Shape3DObject(Presentable presentable, ShapeDrawMode drawMode, boolean ispublic, double x, double y, double z, double rotation, double scale, boolean autoScale, String packagePrefix, String fileName, Object3DAxisOrder axisOrder, boolean applyShading, double topLeftX, double topLeftY, double width, double height, Long imageFileId, Pair<String,Color>... customColors)
Deprecated.
this constructor is deprecated and will be deleted in future releases
Shape3DObject(Presentable presentable, ShapeDrawMode drawMode, boolean ispublic, double x, double y, double z, double rotation, double scale, boolean autoScale, String packagePrefix, String fileName, Object3DAxisOrder axisOrder, double topLeftX, double topLeftY, double width, double height)
Constructs a 3D shape with specific attributes.
Shape3DObject(Presentable presentable, ShapeDrawMode drawMode, boolean ispublic, double x, double y, double z, double rotation, double scale, boolean autoScale, String packagePrefix, String fileName, Object3DAxisOrder axisOrder, Object3DInternalLighting internalLighting, boolean ignoreSceneLights, double topLeftX, double topLeftY, double width, double height, Long imageFileId, boolean visible, Pair<String,Color>... customColors)
Constructs a 3D shape with specific attributes.

Method Summary

Modifier and TypeMethodDescription
final Shape3DObjectclone()
Creates and returns a copy of this shape (i.e.
booleancontains(double px, double py)
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e.
voiddispose()
Releases resources allocated by this object, should be called on agent destroy.
doublegetAgentScalingFactor()
Returns additional scaling factor for sizing accordingly to the Scale element on the Agent.
Object3DAxisOrdergetAxisOrder() 
StringgetFilename()
Returns the name of 3D object file
StringgetFilePath_xjal()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
PresentablegetPresentable()
Returns the Presentable object (Agent or Experiment) where this shape belongs to, or null.
voidpostSVGShapeSpecificAttributes(List<String> att, List<String> val, boolean publicOnly)
Posts general properties specific to a particular shape class.
voidrestoreOwner(Object owner)
Deprecated.
voidsetColor(String materialName, Color color)
Changes custom color for the shape material with the given name.
Current implementation updates object on the 3D scene only, it doesn't update the 2D picture - this will be implemented in future releases.

Methods inherited from class com.anylogic.engine.presentation.Shape3D

canHandleClick, getDrawMode, getScaleZ, getZ, getZOffset, setDrawMode, setPos, setPos, setPos, setRotation, setScale, setScale, setScaleZ, setZ

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement

initializeInternal, postInitialize

Methods inherited from interface com.anylogic.engine.Locatable2D

getX, getY

Field Details

XYZ_AXIS_ORDER

@Deprecated
public static final Object3DAxisOrder XYZ_AXIS_ORDER
Deprecated.

YZX_AXIS_ORDER

@Deprecated
public static final Object3DAxisOrder YZX_AXIS_ORDER
Deprecated.

ZXY_AXIS_ORDER

@Deprecated
public static final Object3DAxisOrder ZXY_AXIS_ORDER
Deprecated.

Constructor Details

Shape3DObject

@Deprecated
public Shape3DObject(Presentable presentable,
 boolean ispublic,
 double x,
 double y,
 double z,
 double rotation,
 double scale,
 String packagePrefix,
 String fileName,
 Object3DAxisOrder axisOrder,
 boolean applyShading,
 double topLeftX,
 double topLeftY,
 double width,
 double height)
Deprecated.
this constructor is deprecated and will be removed in future releases

Shape3DObject

@Deprecated
public Shape3DObject(Presentable presentable,
 ShapeDrawMode drawMode,
 boolean ispublic,
 double x,
 double y,
 double z,
 double rotation,
 double scale,
 boolean autoScale,
 String packagePrefix,
 String fileName,
 Object3DAxisOrder axisOrder,
 boolean applyShading,
 double topLeftX,
 double topLeftY,
 double width,
 double height)
Deprecated.
this constructor is deprecated and will be removed in future releases

Shape3DObject

public Shape3DObject(Presentable presentable,
 ShapeDrawMode drawMode,
 boolean ispublic,
 double x,
 double y,
 double z,
 double rotation,
 double scale,
 boolean autoScale,
 String packagePrefix,
 String fileName,
 Object3DAxisOrder axisOrder,
 double topLeftX,
 double topLeftY,
 double width,
 double height)
Constructs a 3D shape with specific attributes.
Parameters:
presentable - the presentable object owning this object
drawMode - where to draw this shape: 2D, 3D or 2D+3D
ispublic - if true, the shape is visible on container's presentation
x - the x coordinate of the object
y - the y coordinate of the object
z - the z coordinate of the object
rotation - the rotation of the object in radians
scale - the scale of the object
autoScale - if true, shape will be additionally resized to match the scale of the agent this shape is located on. Please note that in this case generated 2D image file should be rendered using the final, multiplied scale
packagePrefix - the package name of original agent where this object is defined, formatted using '/' characters; with '/' character at the beginning and at the end
fileName - the name of the 3D object file
axisOrder - axis order of this figure, may be used for orientation correction for objects obtained from different 3D editors
topLeftX - the x coordinate of the top-left corner of XY-projection of object in local object coordinates
topLeftY - the y coordinate of the top-left corner of XY-projection of object in local object coordinates
width - the width of the XY-projection of object in local object coordinates
height - the height of the XY-projection of object in local object coordinates
imageFileId - internal id used to find generated png image
customColors - array of pairs: material name, color

Shape3DObject

@SafeVarargs
@Deprecated
public Shape3DObject(Presentable presentable,
 ShapeDrawMode drawMode,
 boolean ispublic,
 double x,
 double y,
 double z,
 double rotation,
 double scale,
 boolean autoScale,
 String packagePrefix,
 String fileName,
 Object3DAxisOrder axisOrder,
 boolean applyShading,
 double topLeftX,
 double topLeftY,
 double width,
 double height,
 Long imageFileId,
 Pair<String,Color>... customColors)
Deprecated.
this constructor is deprecated and will be deleted in future releases

Shape3DObject

@SafeVarargs
public Shape3DObject(Presentable presentable,
 ShapeDrawMode drawMode,
 boolean ispublic,
 double x,
 double y,
 double z,
 double rotation,
 double scale,
 boolean autoScale,
 String packagePrefix,
 String fileName,
 Object3DAxisOrder axisOrder,
 Object3DInternalLighting internalLighting,
 boolean ignoreSceneLights,
 double topLeftX,
 double topLeftY,
 double width,
 double height,
 Long imageFileId,
 boolean visible,
 Pair<String,Color>... customColors)
Constructs a 3D shape with specific attributes.
Parameters:
presentable - the presentable object owning this object
drawMode - where to draw this shape: 2D, 3D or 2D+3D
ispublic - if true, the shape is visible on container's presentation
x - the x coordinate of the object
y - the y coordinate of the object
z - the z coordinate of the object
rotation - the rotation of the object in radians
scale - the scale of the object
autoScale - if true, shape will be additionally resized to match the scale of the agent this shape is located on. Please note that in this case generated 2D image file should be rendered using the final, multiplied scale
packagePrefix - the package name of original agent where this object is defined, formatted using '/' characters; with '/' character at the beginning and at the end
fileName - the name of the 3D object file
axisOrder - axis order of this figure, may be used for orientation correction for objects obtained from different 3D editors
internalLighting - defines how the internal lights (which this 3D object may contain) will operate on the scene: turned off, lighting this 3D object only (self lighting), or lighting on the global level (like headlamp of the car).
ignoreSceneLights - allows to disable lighting of this 3D object by other lights located on the model scene - useful when 3D object contains internal lights and shouldn't be double-lighted.
topLeftX - the x coordinate of the top-left corner of XY-projection of object in local object coordinates
topLeftY - the y coordinate of the top-left corner of XY-projection of object in local object coordinates
width - the width of the XY-projection of object in local object coordinates
height - the height of the XY-projection of object in local object coordinates
imageFileId - internal id used to find generated png image
customColors - array of pairs: material name, color

Method Details

getFilename

public String getFilename()
Returns the name of 3D object file
Returns:
the name of 3D object file

setColor

public void setColor(String materialName,
 Color color)
Changes custom color for the shape material with the given name.
Current implementation updates object on the 3D scene only, it doesn't update the 2D picture - this will be implemented in future releases.
Parameters:
materialName - the name of the material. Please refer to Properties View of this 3D object in AnyLogic.
color - new color, or null to reset the color to default value
Since:
8.3

getFilePath_xjal

@AnyLogicInternalAPI
public String getFilePath_xjal()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.

getAgentScalingFactor

public double getAgentScalingFactor()
Returns additional scaling factor for sizing accordingly to the Scale element on the Agent.

getAxisOrder

public Object3DAxisOrder getAxisOrder()

contains

public boolean contains(double px,
 double py)
Description copied from class: Shape
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e. in the same system with the coordinates of this shape, x and y)
Specified by:
contains in class Shape
Parameters:
px - the x coordinate relative to this shape's container
py - the y coordinate relative to this shape's container
Returns:
true if the shape contains the point with the given coordinates

getPresentable

public Presentable getPresentable()
Description copied from class: Shape
Returns the Presentable object (Agent or Experiment) where this shape belongs to, or null.
Overrides:
getPresentable in class Shape
Returns:
the Presentable that owns this shape, or null

restoreOwner

@AnyLogicInternalCodegenAPI
@Deprecated
public void restoreOwner(Object owner)
Deprecated.
Description copied from class: Shape
This method normally should not be called by user
This method restores owner of this object
The method is used in snapshot saving/loading
Specified by:
restoreOwner in interface com.anylogic.engine.internal.Child
Overrides:
restoreOwner in class Shape
Parameters:
owner - owner of this object, usually Agent, Experiment or ShapeGroup

clone

public final Shape3DObject clone()
Description copied from class: Shape
Creates and returns a copy of this shape (i.e. new shape instance).
The returned shape is the object of the same class
The returned copy isn't automatically added to the group this shape belongs to.
The clone is created in the context of the same experiment or agent

Note that cloning of GIS shape, controls and charts is not supported
Overrides:
clone in class Shape

postSVGShapeSpecificAttributes

public void postSVGShapeSpecificAttributes(List<String> att,
 List<String> val,
 boolean publicOnly)
Description copied from class: Shape
Posts general properties specific to a particular shape class. Is triggered by SVG_DIRTY_SHAPE flag. Made public for occasional posting of additional SVG properties from outside engine (e.g. from libraries)
Overrides:
postSVGShapeSpecificAttributes in class Shape
Parameters:
att - attribute names
val - attribute values
publicOnly - TODO

dispose

@AnyLogicInternalCodegenAPI
public void dispose()
Releases resources allocated by this object, should be called on agent destroy.