Package mgui.interfaces.shapes.util
Class ShapeEngine
java.lang.Object
mgui.interfaces.shapes.util.ShapeEngine
- All Implemented Interfaces:
AttributeObject
,NamedObject
,Engine
public class ShapeEngine extends java.lang.Object implements Engine
Engine class for general shape functions.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Constructor Summary
Constructors Constructor Description ShapeEngine()
-
Method Summary
Modifier and Type Method Description boolean
callMethod(java.lang.String operation, java.lang.String method, java.util.ArrayList<?> params, ProgressUpdater progress)
Calls the specified operation/method pair.boolean
callMethod(java.lang.String operation, java.lang.String method, ProgressUpdater progress)
Calls the specified operation/method pair.boolean
computeConvexHull(Shape3DInt shape, java.lang.String method, ProgressUpdater progress)
Computes a convex hull forshape
.Attribute<?>
getAttribute(java.lang.String attrName)
Returns a specific attribute for this object.AttributeList
getAttributes()
Returns the list of current attributes for this object.AttributeList
getAttributes(java.lang.String key)
AttributeList
getAttributes(java.lang.String operation, java.lang.String method)
Returns the attributes list corresponding to theoperation
andmethod
.java.lang.Object
getAttributeValue(java.lang.String name)
Gets the value of attributename
, ornull
if it does not exist.java.util.ArrayList<java.lang.String>
getMethods(java.lang.String operation)
Returns a list of methods implementing a particularoperation
.java.lang.String
getName()
Gets the name for this object.java.util.ArrayList<java.lang.String>
getOperations()
Returns a list of the operations available for thisEngine
.boolean
normalizeColumn(InterfaceShape shape, ProgressUpdater progress)
Normalizes the values in a column.boolean
normalizeColumnWithMask(InterfaceShape shape, ProgressUpdater progress)
Normalize values insource_column
by thestatistic
of values innormalize_column
which lie in the maskmask_column
.protected boolean
rotateShapeYPR(Shape3D shape)
void
setAttribute(java.lang.String attrName, java.lang.Object newValue)
Sets a value for a specific attribute.void
setAttributes(AttributeList thisList)
Sets the list of attributes for this object.void
setName(java.lang.String name)
Sets the name for this object.boolean
transformShape3D(Shape3DInt shape, java.lang.String method, ProgressUpdater progress)
Transformsshape
according tomethod
.protected boolean
translateShape(Shape3D shape)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
ShapeEngine
public ShapeEngine()
-
-
Method Details
-
getAttributes
-
getAttributes
Description copied from interface:Engine
Returns the attributes list corresponding to theoperation
andmethod
.- Specified by:
getAttributes
in interfaceEngine
- Returns:
- The corresponding attributes, or
null
if no such combination ofoperation
/method
exists.
-
getOperations
public java.util.ArrayList<java.lang.String> getOperations()Description copied from interface:Engine
Returns a list of the operations available for thisEngine
. Operations signify a general operation, which can be implemented through any number of "methods".- Specified by:
getOperations
in interfaceEngine
- Returns:
-
getMethods
public java.util.ArrayList<java.lang.String> getMethods(java.lang.String operation)Description copied from interface:Engine
Returns a list of methods implementing a particularoperation
.- Specified by:
getMethods
in interfaceEngine
- Returns:
-
callMethod
public boolean callMethod(java.lang.String operation, java.lang.String method, ProgressUpdater progress)Description copied from interface:Engine
Calls the specified operation/method pair. Returnstrue
if the operation was successful.- Specified by:
callMethod
in interfaceEngine
- Parameters:
operation
- Operation to perform.method
- Method with which to perform operation. Can benull
if this operation has no sub-methodsprogress
- Optional progress updater (can benull
)- Returns:
-
callMethod
public boolean callMethod(java.lang.String operation, java.lang.String method, java.util.ArrayList<?> params, ProgressUpdater progress)Description copied from interface:Engine
Calls the specified operation/method pair. Returnstrue
if the operation was successful.- Specified by:
callMethod
in interfaceEngine
- Parameters:
operation
- Operation to perform.method
- Method with which to perform operation. Can benull
if this operation has no sub-methodsparams
- A list of additional parameters (not in the attributes) for this methodprogress
- Optional progress updater (can benull
)- Returns:
-
transformShape3D
public boolean transformShape3D(Shape3DInt shape, java.lang.String method, ProgressUpdater progress)Transformsshape
according tomethod
. The parameters are specified in the attribute list corresponding to the method. This can be one of either:- Translate: performs a simple translation based upon the attributes
- Matrix Transform: performs an affine transform based upon the matrix specified in the attributes
If
shape
is an instance ofShapeSet3DInt
, this method will transform all its members (including subsets) recursively.- Parameters:
shape
- Shape to be transformedmethod
- Method to use; one of either "Translate" or "Matrix Transform"progress
- Optional progress updater- Returns:
true
if successful
-
translateShape
-
rotateShapeYPR
-
computeConvexHull
public boolean computeConvexHull(Shape3DInt shape, java.lang.String method, ProgressUpdater progress)Computes a convex hull forshape
.- Parameters:
shape
-progress
-- Returns:
-
normalizeColumn
Normalizes the values in a column. This method depends on the attribute list "Normalize (Values)". Attributes are:- source_column - Column containing the values to normalize
- target_column - Column to store results; if this column doesn't exist it will be created with the same data type as the source column. Can also be the same as the source column (in which case the original values will be overwritten).
- source_min - Minimum of the source; use "min" to compute from the data, or enter a value to specify a specific minimum.
- source_max - Maximum of the source; use "max" to compute from the data, or enter a value to specify a specific maximum.
- source_min - Minimum of the target distribution
- source_max - Maximum of the target distribution
- Parameters:
shape
-progress
-- Returns:
-
normalizeColumnWithMask
Normalize values insource_column
by thestatistic
of values innormalize_column
which lie in the maskmask_column
.source_column
andnormalize_column
can be the same. Elements are considered to in the mask if their value inmask_column
is >= zero.Returned values are of the same type as
source_column
.Valid values of
statistic
are:- mean
- max
- min
- sum
Note that these parameters are contained in the
AttributeList
called "Normalize With Mask", which must be set prior to calling the method.- Parameters:
volume
-source_column
-normalize_column
-mask_column
-statistic
-- Returns:
-
getAttribute
Description copied from interface:AttributeObject
Returns a specific attribute for this object.- Specified by:
getAttribute
in interfaceAttributeObject
- Returns:
-
getAttributes
Description copied from interface:AttributeObject
Returns the list of current attributes for this object.- Specified by:
getAttributes
in interfaceAttributeObject
- Returns:
-
getAttributeValue
public java.lang.Object getAttributeValue(java.lang.String name)Description copied from interface:AttributeObject
Gets the value of attributename
, ornull
if it does not exist.- Specified by:
getAttributeValue
in interfaceAttributeObject
- Parameters:
name
- Name of the attribute- Returns:
- the value of attribute
name
, ornull
if it does not exist
-
getName
public java.lang.String getName()Description copied from interface:NamedObject
Gets the name for this object.- Specified by:
getName
in interfaceNamedObject
- Returns:
-
setName
public void setName(java.lang.String name)Description copied from interface:NamedObject
Sets the name for this object.- Specified by:
setName
in interfaceNamedObject
-
setAttribute
public void setAttribute(java.lang.String attrName, java.lang.Object newValue)Description copied from interface:AttributeObject
Sets a value for a specific attribute.- Specified by:
setAttribute
in interfaceAttributeObject
-
setAttributes
Description copied from interface:AttributeObject
Sets the list of attributes for this object.- Specified by:
setAttributes
in interfaceAttributeObject
-