net.algart.model3d.common.movement.view
Class SphereShapingRule

java.lang.Object
  extended by net.algart.model3d.common.movement.view.SphereShapingRule
All Implemented Interfaces:
ShapingRule

public class SphereShapingRule
extends java.lang.Object
implements ShapingRule

Shaping rule, which converts a sperical item to a drawable 3D sphere.

More precisely, in this class:

This class is immutable and thread-safe: there are no ways to modify settings of the created instance.

AlgART Laboratory 2010

Since:
JDK 1.5
Version:
1.0
Author:
Daniel Alievsky

Constructor Summary
Constructor and Description
SphereShapingRule()
           
 
Method Summary
Modifier and Type Method and Description
 Shape3D getShape(java.lang.Object item)
          Returns the newly created shape of the specified 3D object.
 boolean isApplicable(java.lang.Object item)
          Checks whether this shaping rule is applicable to the given object (item), i.e. this shaping rule "knows" which 3D shape describes this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SphereShapingRule

public SphereShapingRule()
Method Detail

isApplicable

public boolean isApplicable(java.lang.Object item)
Description copied from interface: ShapingRule
Checks whether this shaping rule is applicable to the given object (item), i.e. this shaping rule "knows" which 3D shape describes this object. If this method returns false, you should not call ShapingRule.getShape(Object) method of this interface for this object: it can throw an exception. If this method returns true, you can freely use ShapingRule.getShape(Object) method.

If this method returns false for the given item for all shaping rules, available in Drawer3D object, and if this item does not implement Shape3D interface itself, then this item is not drawn by the Drawer3D.draw(java.util.Collection) method.

The argument of this method can be null; in this case, this method returns false.

Specified by:
isApplicable in interface ShapingRule
Parameters:
item - the object which you want to draw; can be null, then this method returns false.
Returns:
true if this shaping rule can be used for this item.

getShape

public Shape3D getShape(java.lang.Object item)
Description copied from interface: ShapingRule
Returns the newly created shape of the specified 3D object. If ShapingRule.isApplicable(Object) returns false, this method usually throws ClassCastException, but other runtime exceptions are also possible.

Specified by:
getShape in interface ShapingRule
Parameters:
item - some 3D object.
Returns:
shape of this item.


Hot at AlgART: HTML для чайников | Trinity for non-Christians | Диалог с Богом | Religion and Geometry