Module org.jfree.chart3d
Package org.jfree.chart3d.graphics3d

# Class DefaultDrawable3D

java.lang.Object
org.jfree.chart3d.graphics3d.DefaultDrawable3D

All Implemented Interfaces:
  `Drawable3D`

public class DefaultDrawable3D extends Object implements Drawable3D
Provides a default implementation of the `Drawable3D` interface. This is not used directly in Orson Charts, since the `Chart3D` class implements the `Drawable3D` interface itself. However, it is used in testing to ensure that the `org.jfree.chart3d.graphics3d` package can function on a stand-alone basis.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final double`
`DEFAULT_PROJ_DIST`
The default projection distance.

## Constructor Summary

Constructors
Constructor
Description
`DefaultDrawable3D(World world)`
Creates a new instance to display the content of the specified `world`.

## Method Summary

Modifier and Type
Method
Description
`RenderingInfo`
`draw(Graphics2D g2, Rectangle2D bounds)`
Draws the current view to a `Graphics2D` instance.
`Dimension3D`
`getDimensions()`
Returns the dimensions of the 3D object.
`double`
`getProjDistance()`
Returns the projection distance.
`Offset2D`
`getTranslate2D()`
Returns the 2D offset for the scene.
`ViewPoint3D`
`getViewPoint()`
Returns the view point.
`void`
`setProjDistance(double dist)`
Sets the projection distance.
`void`
`setTranslate2D(Offset2D offset)`
Sets the translation offset.
`void`
`setViewPoint(ViewPoint3D viewPoint)`
Sets the view point.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DEFAULT_PROJ_DIST

public static final double DEFAULT_PROJ_DIST
The default projection distance.

Since:
  1.2
See Also:
  - Constant Field Values

## Constructor Details

### DefaultDrawable3D

public DefaultDrawable3D(World world)
Creates a new instance to display the content of the specified `world`.

Parameters:
  `world` - the world to view (`null` not permitted).

## Method Details

### getDimensions

public Dimension3D getDimensions()
Returns the dimensions of the 3D object.

Specified by:
  `getDimensions` in interface `Drawable3D`
Returns:
  The dimensions.

### getViewPoint

public ViewPoint3D getViewPoint()
Returns the view point.

Specified by:
  `getViewPoint` in interface `Drawable3D`
Returns:
  The view point (never `null`).

### setViewPoint

public void setViewPoint(ViewPoint3D viewPoint)
Sets the view point.

Specified by:
  `setViewPoint` in interface `Drawable3D`
Parameters:
  `viewPoint` - the view point (`null` not permitted).

### getProjDistance

public double getProjDistance()
Returns the projection distance. The default value is `DEFAULT_PROJ_DIST`, higher numbers flatten out the perspective and reduce distortion in the projected image.

Specified by:
  `getProjDistance` in interface `Drawable3D`
Returns:
  The projection distance.
Since:
  1.2

### setProjDistance

public void setProjDistance(double dist)
Sets the projection distance.

Specified by:
  `setProjDistance` in interface `Drawable3D`
Parameters:
  `dist` - the distance.
Since:
  1.2

### getTranslate2D

public Offset2D getTranslate2D()
Description copied from interface: `Drawable3D`
Returns the 2D offset for the scene. Normally this will default to `(0, 0)`.

Specified by:
  `getTranslate2D` in interface `Drawable3D`
Returns:
  The translation offset (never `null`).

### setTranslate2D

public void setTranslate2D(Offset2D offset)
Description copied from interface: `Drawable3D`
Sets the translation offset. This is typically used to allow the user to modify the offset of a 2D projection on-screen by dragging with the mouse.

Specified by:
  `setTranslate2D` in interface `Drawable3D`
Parameters:
  `offset` - the translation offset (`null` not permitted).

### draw

public RenderingInfo draw(Graphics2D g2, Rectangle2D bounds)
Draws the current view to a `Graphics2D` instance.

Specified by:
  `draw` in interface `Drawable3D`
Parameters:
  `g2` - the graphics target (`null` not permitted).
  `bounds` - the bounds (`null` not permitted).
Returns:
  The rendering state.