Interface DrawingPanel3D
- All Superinterfaces:
InteractionSource
- All Known Implementing Classes:
DrawingPanel3D
Title: DrawingPanel3D
Description: DrawingPanel3D is the basic 3D drawing panel
- Version:
- March 2005
- Author:
- Francisco Esquembre
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
Message box locationstatic final int
Message box locationstatic final int
static final int
Axis Modesstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
The panel itself as the only target of the panelstatic final int
Message box locationstatic final int
Message box location -
Method Summary
Modifier and TypeMethodDescriptionvoid
addElement
(Element element) Adds an Element to this DrawingPanel3D.int
Returns the axes modeReturns the background imageProvides the Camera object used to project the scene in 3D modes.Getting the pointer to the real JPanel in itGets the (cloned) list of Elements.double
Gets the preferred maximum in the X coordinatedouble
Gets the preferred maximum in the Y coordinatedouble
Gets the preferred maximum in the Z coordinatedouble
Gets the preferred minimum in the X coordinatedouble
Gets the preferred minimum in the Y coordinatedouble
Gets the preferred minimum in the Z coordinatedouble
Gets the scale factor in the X axisdouble
Gets the scale factor in the Y axisdouble
Gets the scale factor in the Z axisGets the video capture tool.Provides the list of visualization hints that the panel uses to display the 3D sceneboolean
Whether the panel tries to keep a square aspect.void
Removes all Elements from this DrawingPanel3Dvoid
removeElement
(Element element) Removes an Element from this DrawingPanel3Drender()
Paints the panel immediately from within the calling thread.render
(BufferedImage image) Paints the scene using the graphic context of the provided imagevoid
repaint()
Repaints the panel using the event queue.void
setAxesMode
(int mode) Sets the axes modevoid
setBackgroundImage
(String imageFile) Sets the background imagevoid
setLightEnabled
(boolean _state, int nlight) Enable disable a lightvoid
setPreferredMinMax
(double minX, double maxX, double minY, double maxY, double minZ, double maxZ) Sets the preferred extrema for the panel.void
setScaleFactor
(double factorX, double factorY, double factorZ) Sets the scale factor of the scene in X,Y,Z axis.void
setSquareAspect
(boolean square) Whether the panel should try to keep a square aspect.void
setVideoTool
(VideoTool videoTool) Sets the video capture tool.void
Sets the preferred min and max in each dimension so that all elements currently in the panel are visible.Methods inherited from interface org.opensourcephysics.display3d.core.interaction.InteractionSource
addInteractionListener, getInteractionTarget, removeInteractionListener
-
Field Details
-
TARGET_PANEL
static final int TARGET_PANELThe panel itself as the only target of the panel- See Also:
-
BOTTOM_LEFT
static final int BOTTOM_LEFTMessage box location- See Also:
-
BOTTOM_RIGHT
static final int BOTTOM_RIGHTMessage box location- See Also:
-
TOP_RIGHT
static final int TOP_RIGHTMessage box location- See Also:
-
TOP_LEFT
static final int TOP_LEFTMessage box location- See Also:
-
MODE_XYZ
static final int MODE_XYZAxis Modes- See Also:
-
MODE_YXZ
static final int MODE_YXZ- See Also:
-
MODE_XZY
static final int MODE_XZY- See Also:
-
MODE_YZX
static final int MODE_YZX- See Also:
-
MODE_ZYX
static final int MODE_ZYX- See Also:
-
MODE_ZXY
static final int MODE_ZXY- See Also:
-
BACKGROUND
static final int BACKGROUND- See Also:
-
AMBIENT_LIGHT
static final int AMBIENT_LIGHT- See Also:
-
DIRECTIONAL_LIGHT
static final int DIRECTIONAL_LIGHT- See Also:
-
POINT_LIGHT
static final int POINT_LIGHT- See Also:
-
SPOT_LIGHT
static final int SPOT_LIGHT- See Also:
-
-
Method Details
-
getComponent
Component getComponent()Getting the pointer to the real JPanel in it- Returns:
- JFrame
-
setBackgroundImage
Sets the background image- Parameters:
imageFile
-
-
getBackgroundImage
String getBackgroundImage()Returns the background image -
setPreferredMinMax
void setPreferredMinMax(double minX, double maxX, double minY, double maxY, double minZ, double maxZ) Sets the preferred extrema for the panel. This resets the camera of the panel to its default.- Parameters:
minX
- doublemaxX
- doubleminY
- doublemaxY
- doubleminZ
- doublemaxZ
- double- See Also:
-
getPreferredMinX
double getPreferredMinX()Gets the preferred minimum in the X coordinate- Returns:
- double
-
getPreferredMaxX
double getPreferredMaxX()Gets the preferred maximum in the X coordinate- Returns:
- double
-
getPreferredMinY
double getPreferredMinY()Gets the preferred minimum in the Y coordinate- Returns:
- double
-
getPreferredMaxY
double getPreferredMaxY()Gets the preferred maximum in the Y coordinate- Returns:
- double
-
getPreferredMinZ
double getPreferredMinZ()Gets the preferred minimum in the Z coordinate- Returns:
- double
-
getPreferredMaxZ
double getPreferredMaxZ()Gets the preferred maximum in the Z coordinate- Returns:
- double
-
setScaleFactor
void setScaleFactor(double factorX, double factorY, double factorZ) Sets the scale factor of the scene in X,Y,Z axis.- Parameters:
factorX
- doublefactorY
- doublefactorZ
- double
-
getScaleFactorX
double getScaleFactorX()Gets the scale factor in the X axis- Returns:
- double
-
getScaleFactorY
double getScaleFactorY()Gets the scale factor in the Y axis- Returns:
- double
-
getScaleFactorZ
double getScaleFactorZ()Gets the scale factor in the Z axis- Returns:
- double
-
setAxesMode
void setAxesMode(int mode) Sets the axes mode- Parameters:
mode
- int
-
getAxesMode
int getAxesMode()Returns the axes mode -
zoomToFit
void zoomToFit()Sets the preferred min and max in each dimension so that all elements currently in the panel are visible. -
setSquareAspect
void setSquareAspect(boolean square) Whether the panel should try to keep a square aspect. Default value is true.- Parameters:
square
- boolean
-
isSquareAspect
boolean isSquareAspect()Whether the panel tries to keep a square aspect.- Returns:
- boolean
-
getVisualizationHints
VisualizationHints getVisualizationHints()Provides the list of visualization hints that the panel uses to display the 3D scene- Returns:
- VisualizationHints
- See Also:
-
getCamera
Camera getCamera()Provides the Camera object used to project the scene in 3D modes.- Returns:
- Camera
- See Also:
-
getVideoTool
VideoTool getVideoTool()Gets the video capture tool. May be null.- Returns:
- the video capture tool
-
setVideoTool
Sets the video capture tool. May be set to null.- Parameters:
videoCap
- the video capture tool
-
render
BufferedImage render()Paints the panel immediately from within the calling thread.- Returns:
- BufferedImage the generated image
-
render
Paints the scene using the graphic context of the provided image- Parameters:
image
- Image- Returns:
- Image the generated image
-
repaint
void repaint()Repaints the panel using the event queue. -
addElement
Adds an Element to this DrawingPanel3D.- Parameters:
element
- Element- See Also:
-
removeElement
Removes an Element from this DrawingPanel3D- Parameters:
element
- Element- See Also:
-
removeAllElements
void removeAllElements()Removes all Elements from this DrawingPanel3D- See Also:
-
getElements
Gets the (cloned) list of Elements. (Should be synchronized.)- Returns:
- cloned list
-
setLightEnabled
void setLightEnabled(boolean _state, int nlight) Enable disable a light- Parameters:
_state
-nlight
-
-