cz.cuni.jagrlib.piece
Class Features

java.lang.Object
  extended by cz.cuni.jagrlib.DefaultProperty
      extended by cz.cuni.jagrlib.Piece
          extended by cz.cuni.jagrlib.piece.Features
All Implemented Interfaces:
Breakable, FeatureStore, Property, Template

public class Features
extends Piece
implements FeatureStore

Data store for "features" (for feature-based warping/morphing).

Since:
0.24
See Also:
Features.java

Field Summary
protected static java.lang.String CATEGORY
          Object category.
protected  java.util.ArrayList<cz.cuni.jagrlib.piece.Features.Feature> features
          Array of all registered features.
static RegPiece reg
          Static registration instance for this class.
protected static java.lang.String TEMPLATE_NAME
          Object template identifier.
 
Fields inherited from class cz.cuni.jagrlib.Piece
channels, info, pl, plugs, TEMPLATE_TYPE, userBreak
 
Fields inherited from interface cz.cuni.jagrlib.iface.FeatureStore
FEATURE_ARROW, FEATURE_POINT, FEATURE_TRIANGLE, NULL
 
Fields inherited from interface cz.cuni.jagrlib.iface.Property
LOGGING, STATISTICS, TEXT_DESCRIPTION
 
Fields inherited from interface cz.cuni.jagrlib.Template
ALL_PLUGS, C_1D, C_2D, C_3D, C_ALPHA, C_BINARY, C_BREP, C_CAMERA, C_CIRCLE, C_CLIP, C_COMPRESSION, C_CURVE, C_DATA, C_DRAW, C_EDITOR, C_ELLIPSE, C_FILL, C_FILTER, C_FLOAT, C_FUNCTION, C_IMAGE, C_INTEGER, C_IO, C_LIGHT, C_LINE, C_METRIC, C_POLYGON, C_PROJECTION, C_RADIOSITY, C_RASTER, C_RENDER, C_SAMPLE, C_SCENE, C_SET, C_SOLID, C_TEXT, C_TRANSFORM, C_VECTOR, C_VIEWER, C_WORKER, CAT_EMPTY, EMPTY, IFACE, JAGRLIB, JAGRLIB2, MANIPULATOR_COMBO, MANIPULATOR_CUSTOM, MANIPULATOR_DEFAULT, MANIPULATOR_MULTILINE, PL_ALPHAMASK, PL_BITMASK, PL_CAUSTIC, PL_CODEC, PL_COLORMAP, PL_COMPARE, PL_DATA, PL_DIRECT, PL_EDITOR, PL_FILTER, PL_FUNCTION, PL_IMAGE, PL_IMPORT, PL_INPUT, PL_INTERSECTION, PL_LIGHTSOURCE, PL_ORDER, PL_OUTPUT, PL_PALETTE, PL_PHOTON, PL_PROPERTY, PL_QUANTIZER, PL_RASTER, PL_RENDER, PL_SHADOW, PL_STREAM, PL_TRANSFORM, PL_TRIGGER, PL_VOLUME, PL_WINDOW, TYPE_BOOLEAN, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INTEGER, TYPE_LONG, TYPE_OBJECT, TYPE_STRING
 
Constructor Summary
Features()
           
 
Method Summary
protected  cz.cuni.jagrlib.piece.Features.Feature feature(int id)
           
protected  cz.cuni.jagrlib.piece.Features.Feature feature(int id, int time)
           
 int featureEnd(int id)
          Returns Time of death of the given feature.
 int featureStart(int id)
          Returns Birth-time of the given feature.
 int featureType(int id)
          Reads feature-type (FeatureStore.FEATURE_POINT, FeatureStore.FEATURE_ARROW or FeatureStore.FEATURE_TRIANGLE).
protected  java.lang.Object getAttr(int id, double time, java.lang.String name)
           
 double[] getCoords(int id, double time, double[] coords)
          Reads feature coordinates of the given feature in the given time.
 java.lang.Object getParam(int id, double time, java.lang.String name)
          Reads the given general parametr in the given time.
 double getParamDouble(int id, double time, java.lang.String name)
          Reads the given floating-point parametr in the given time.
 int getParamInt(int id, double time, java.lang.String name)
          Reads the given integer parametr in the given time.
 int insertFeature(int timeFrom, int timeTo, int type)
          Inserts a new feature of the given type.
 int nextFeature(int id, double time)
          Finds the next feature in the database.
 void removeFeature(int id)
          Removes the given feature from the database.
protected  void setAttr(int id, int time, java.lang.String name, java.lang.Object value)
           
 void setCoords(int id, int time, double[] coords)
          Sets feature coordinates of the given feature in the given keyframe-time.
 void setParam(int id, int time, java.lang.String name, java.lang.Object value)
          Sets feature's general parameter in the given keyframe-time.
static int setTemplate(Template t, int ord)
          General-purpose registration routine.
 void setTimes(int id, int timeFrom, int timeTo)
          Sets feature life-time.
 
Methods inherited from class cz.cuni.jagrlib.Piece
className, connect, findPlug, findPlug, getInfo, getInterface, getInterface, getPlug, getReg, init, isCompatible, isCompatible, isConnected, logError, logWarning, myInterface, newInputPlug, newOptOutputPlug, newOutputPlug, newPlug, noTemplates, propBegin, propBounds, propDefault, propEnd, propEnum, propManipulator, propManipulator, setProgressListener, setRegStrings, setTemplateDynamic, stop
 
Methods inherited from class cz.cuni.jagrlib.DefaultProperty
booleanProperty, booleanProperty, colorDoubleProperty, colorProperty, commit, doubleProperty, doubleProperty, doubleProperty, enumProperty, floatProperty, floatProperty, floatProperty, get, intProperty, intProperty, intProperty, longProperty, longProperty, longProperty, set, set, stringProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cz.cuni.jagrlib.iface.Property
commit, get, set
 

Field Detail

features

protected java.util.ArrayList<cz.cuni.jagrlib.piece.Features.Feature> features
Array of all registered features. Access key = feature id.


TEMPLATE_NAME

protected static final java.lang.String TEMPLATE_NAME
Object template identifier.

See Also:
Constant Field Values

CATEGORY

protected static final java.lang.String CATEGORY
Object category.

See Also:
Constant Field Values

reg

public static final RegPiece reg
Static registration instance for this class. Automatically initialized in class-loading time.

Constructor Detail

Features

public Features()
Method Detail

feature

protected final cz.cuni.jagrlib.piece.Features.Feature feature(int id)

feature

protected final cz.cuni.jagrlib.piece.Features.Feature feature(int id,
                                                               int time)

getAttr

protected final java.lang.Object getAttr(int id,
                                         double time,
                                         java.lang.String name)

setAttr

protected final void setAttr(int id,
                             int time,
                             java.lang.String name,
                             java.lang.Object value)

insertFeature

public int insertFeature(int timeFrom,
                         int timeTo,
                         int type)
Inserts a new feature of the given type. Every feature exists in defined time interval (timeFrom - timeTo).

Specified by:
insertFeature in interface FeatureStore
Parameters:
type - Feature type (FeatureStore.FEATURE_POINT, FeatureStore.FEATURE_ARROW or FeatureStore.FEATURE_TRIANGLE).
Returns:
Feature handle (id). If succeeded, return value should be >= 0.
See Also:
removeFeature(int), setTimes(int, int, int), setCoords(int, int, double[]), setParam(int, int, java.lang.String, java.lang.Object)

removeFeature

public void removeFeature(int id)
Removes the given feature from the database.

Specified by:
removeFeature in interface FeatureStore
Parameters:
id - Handle of an existing feature.

nextFeature

public int nextFeature(int id,
                       double time)
Finds the next feature in the database. Iteration should start with id = FeatureStore.NULL. This function also returns FeatureStore.NULL if there is no other feature..

Specified by:
nextFeature in interface FeatureStore
Parameters:
id - Handle of previous feature (or FeatureStore.NULL if we are restaring an iteration).
time - Time of interest.
Returns:
Handle of a next feature in database (or FeatureStore.NULL if the previous was the last one).

featureType

public int featureType(int id)
Reads feature-type (FeatureStore.FEATURE_POINT, FeatureStore.FEATURE_ARROW or FeatureStore.FEATURE_TRIANGLE).

Specified by:
featureType in interface FeatureStore

setTimes

public void setTimes(int id,
                     int timeFrom,
                     int timeTo)
Sets feature life-time.

Specified by:
setTimes in interface FeatureStore
Parameters:
id - Handle of a feature.
timeFrom - Birth-time of the feature.
timeTo - Death-time of the feature.

featureStart

public int featureStart(int id)
Returns Birth-time of the given feature.

Specified by:
featureStart in interface FeatureStore

featureEnd

public int featureEnd(int id)
Returns Time of death of the given feature.

Specified by:
featureEnd in interface FeatureStore

setCoords

public void setCoords(int id,
                      int time,
                      double[] coords)
Sets feature coordinates of the given feature in the given keyframe-time.

Specified by:
setCoords in interface FeatureStore
Parameters:
id - Handle of a feature.
time - Keyframe-time.
coords - Coordinate array (e.g. double[4] for 2D arrow feature: [ x0, y0, x1, y1 ]).

getCoords

public double[] getCoords(int id,
                          double time,
                          double[] coords)
Reads feature coordinates of the given feature in the given time.

Specified by:
getCoords in interface FeatureStore
Parameters:
id - Handle of a feature.
time - Time of interest. Needs not be keyframe-time.
coords - Pre-allocated coordinate array to be filled (double[4] for 2D arrow feature: [ x0, y0, x1, y1 ]). Can be null.
Returns:
Coordinate array or null.

setParam

public void setParam(int id,
                     int time,
                     java.lang.String name,
                     java.lang.Object value)
Sets feature's general parameter in the given keyframe-time.

Specified by:
setParam in interface FeatureStore
Parameters:
id - Handle of a feature.
time - Keyframe-time (FeatureStore.NULL for time-independent parameter).
name - Parameter identifier.
value - New parameter value.

getParamInt

public int getParamInt(int id,
                       double time,
                       java.lang.String name)
Reads the given integer parametr in the given time.

Specified by:
getParamInt in interface FeatureStore
Parameters:
id - Handle of a feature.
time - Time of interest. Needs not be keyframe-time.
name - Parameter identifier.
Returns:
Integer value (interpolated in time if applicable).

getParamDouble

public double getParamDouble(int id,
                             double time,
                             java.lang.String name)
Reads the given floating-point parametr in the given time.

Specified by:
getParamDouble in interface FeatureStore
Parameters:
id - Handle of a feature.
time - Time of interest. Needs not be keyframe-time.
name - Parameter identifier.
Returns:
Floating-point value (interpolated in time if applicable).

getParam

public java.lang.Object getParam(int id,
                                 double time,
                                 java.lang.String name)
Reads the given general parametr in the given time.

Specified by:
getParam in interface FeatureStore
Parameters:
id - Handle of a feature.
time - Time of interest. Needs not be keyframe-time.
name - Parameter identifier.
Returns:
Parameter value (interpolated in time if applicable).

setTemplate

public static int setTemplate(Template t,
                              int ord)
General-purpose registration routine. Sets all plugs, strings, etc. to the given Template.