Package heronarts.lx.structure
Class LXFixture
java.lang.Object
heronarts.lx.LXComponent
heronarts.lx.structure.LXFixture
- All Implemented Interfaces:
LXComponent.Renamable,LXPath,LXSerializable,LXParameterListener,LXFixtureContainer
- Direct Known Subclasses:
JsonFixture,LXProtocolFixture
public abstract class LXFixture
extends LXComponent
implements LXFixtureContainer, LXComponent.Renamable
An LXFixture is a rich LXComponent representing a physical lighting fixture which may
be addressed by output packets. This class encapsulates the ability to configure the
dimensions and location of the lighting fixture as well as to specify its output modes
and protocol.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classClass which defines a LXFixture output.static enumOutput protocolsprotected classClass which represents a segment of the pixels in this fixture object (and its children), with a starting point, number and stride length all relative to this fixture's size.classHelper class to ensure that Submodels are *only* constructed using the points from the produced LXModel array.static classstatic enumNested classes/interfaces inherited from class heronarts.lx.LXComponent
LXComponent.Description, LXComponent.Hidden, LXComponent.Name, LXComponent.Placeholder, LXComponent.PluginRequired, LXComponent.RenamableNested classes/interfaces inherited from interface heronarts.lx.LXSerializable
LXSerializable.Utils -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal BoundedParameterfinal BooleanParameterstatic final intstatic final intfinal BooleanParameterfinal BooleanParameterfinal BooleanParameterprotected static final LXFixture.Submodel[]protected final List<LXFixture.OutputDefinition> Publicly accessible list of the outputs that should be sent to this fixturefinal BoundedParameterPublicly accessible immutable view of the points in this fixture.static final doublefinal BoundedParameterfinal BoundedParameterfinal BooleanParameterfinal BooleanParameterfinal StringParameterfinal BoundedParameterfinal BoundedParameterfinal BoundedParameterfinal BoundedParameterFields inherited from class heronarts.lx.LXComponent
childArrays, internalParameters, KEY_CHILDREN, KEY_CLASS, KEY_COMPONENT_ID, KEY_ID, KEY_INTERNAL, KEY_PARAMETER_PATH, KEY_PARAMETERS, KEY_PATH, KEY_RESET, label, legacyInternalParameters, legacyParameters, lx, modulationColor, modulationControlsExpanded, modulationsExpanded, parameters, presetFileFields inherited from interface heronarts.lx.LXPath
DEFAULT_SEPARATOR, ROOT, ROOT_PREFIX, ROOT_SLASH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected LXFixtureaddGeometryParameter(String path, LXParameter parameter) Adds a parameter which impacts the position of points in the fixture.protected LXFixtureaddMetricsParameter(String path, LXParameter parameter) Adds a parameter which impacts the number of LEDs that are in the fixture.protected voidaddModelMetaData(Map<String, String> metaData) Subclasses may override to add additiona metadata fields for inclusion in the modelprotected voidThis method adds an output definition to the fixtureprotected voidaddOutputDirect(LXOutput output) Subclasses call this method to add a direct output to this fixture.protected LXFixtureaddOutputParameter(String path, LXParameter parameter) Adds a parameter which impacts the outputs of the fixture.protected LXComponentaddParameter(String path, LXParameter parameter) Adds a parameter to the component at a fixed path.protected LXFixtureaddTagParameter(String path, LXParameter parameter) Adds a parameter which impacts the tags of the fixture.protected voidaddTransform(LXFixture.Transform transform) protected voidSubclasses may override this method to do custom preparation work beforecomputeGeometryMatrix(LXMatrix)is called.protected abstract voidSubclasses must override this method to provide an implementation that produces the necessary set of outputs for this fixture to be sent.protected voidprotected voidcomputeGeometryMatrix(LXMatrix geometryMatrix) Subclasses may override this if they perform geometric transformations in a different order or using totally different parameters.protected abstract voidcomputePointGeometry(LXMatrix transform, List<LXPoint> points) This method should be implemented by subclasses to generate the geometry of the fixture any time its geometry parameters have changed.protected LXModelSubclasses may override this method to use custom model typeprotected LXPointconstructPoint(int localIndex) Subclasses may override this method to use custom point typesprotected LXPointSubclasses may override this method to use custom point typesvoiddispose()Invoked when a component is being removed from the system and will no longer be used at all.final voidfixtureGenerationChanged(LXFixture fixture) The generation of this fixture has changed, its metrics or hierarchy are now different.final voidfixtureGeometryChanged(LXFixture fixture) The geometry of this fixture has changed, its metrics and hierarchy are consistent but the point locations may have changed.final voidfixtureOutputChanged(LXFixture fixture) The output settings of this fixture has changed, the top level structure should re-consolidate all the outputs.final voidfixtureTagsChanged(LXFixture fixture) The tags of this fixture has changed, the container will need to take this into account.protected String[]Subclasses may override to return an array of default tag types for this fixture in the model hierarchyprotected intReturns a copy of the geometry matrix for this fixtureReturns the geometry transformation matrix, copied into the given matrixintgetIndex()final intReturns the offset of this fixture in the index bufferprotected List<LXModel.Mesh> getPath()Accessor for the path of this object.voidload(LX lx, JsonObject obj) Loads the LX component.voidSubclasses are free to override this if desired.protected final voidInvoked when this fixture has been loaded or added to some container.protected voidprotected voidSubclasses may override this method to update their outputs in the case that the point indexing of this fixture has changed.protected voidremoveChild(LXFixture child) protected voidprotected voidremoveOutputDirect(LXOutput output) Subclasses call this method to remove a output from the fixture.protected voidsetStructure(LXStructure structure) protected LXFixtureSet the string tag values for this fixtureprotected abstract intsize()Subclasses must implement to specify the number of points in the fixture.protected LXFixture.Submodel[]Subclasses may override when they specify submodelsfinal intTotal points in this model and all its submodelsMethods inherited from class heronarts.lx.LXComponent
addArray, addChild, addInternalParameter, addLegacyInternalParameter, addLegacyParameter, addParameter, addParameters, assertDisposed, contains, copyParameters, getCategory, getChild, getComponentDescription, getComponentName, getComponentName, getComponentName, getDescription, getId, getLabel, getLX, getOscAddress, getOscLabel, getOscPath, getParameter, getParameters, getParent, handleOscMessage, hasParameter, isValidOscParameter, loadParameters, loadPreset, removeParameter, removeParameter, removeParameter, removeParameter, save, savePreset, setDescription, setParent, toOscQuery, toOscQuery, toOscQuery, toString, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface heronarts.lx.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, isDescendant
-
Field Details
-
DEFAULT_OUTPUT_STRIDE
public static final int DEFAULT_OUTPUT_STRIDE- See Also:
-
DEFAULT_OUTPUT_REPEAT
public static final int DEFAULT_OUTPUT_REPEAT- See Also:
-
POSITION_RANGE
public static final double POSITION_RANGE- See Also:
-
selected
-
identify
-
x
-
y
-
z
-
yaw
-
pitch
-
roll
-
scale
-
deactivate
-
enabled
-
brightness
-
mute
-
solo
-
tags
-
children
-
outputsDirect
Publicly accessible list of the outputs that should be sent to this fixture -
outputDefinitions
-
tagList
-
metaData
-
points
Publicly accessible immutable view of the points in this fixture. Should not be directly modified. Only contains this fixture's direct points, not any of its children. -
NO_SUBMODELS
-
-
Constructor Details
-
LXFixture
-
LXFixture
-
-
Method Details
-
addParameter
Description copied from class:LXComponentAdds a parameter to the component at a fixed path. The parameter will be registered in the LX hierarchy, and if it is of a listenable type will also send and receive OSC messages. Listenable parameters will also be automatically registered with their parent component as a listener for notifications upon any change of value.- Overrides:
addParameterin classLXComponent- Parameters:
path- String key path to the parameter, must be uniqueparameter- Parameter to add to the component- Returns:
- this
-
getPath
Description copied from class:LXComponentAccessor for the path of this object. Returns the path this component was registered with. Some subclasses may override this if path structure is dynamic.- Specified by:
getPathin interfaceLXPath- Overrides:
getPathin classLXComponent- Returns:
- path of this component relative to its parent
-
getIndex
public int getIndex() -
getFirstPointIndex
protected int getFirstPointIndex() -
setStructure
-
addChild
-
removeChild
-
fixtureGenerationChanged
Description copied from interface:LXFixtureContainerThe generation of this fixture has changed, its metrics or hierarchy are now different. The container will need to take this into account.- Specified by:
fixtureGenerationChangedin interfaceLXFixtureContainer- Parameters:
fixture- Fixture that has changed
-
fixtureGeometryChanged
Description copied from interface:LXFixtureContainerThe geometry of this fixture has changed, its metrics and hierarchy are consistent but the point locations may have changed.- Specified by:
fixtureGeometryChangedin interfaceLXFixtureContainer- Parameters:
fixture- Fixture that has changed
-
fixtureOutputChanged
Description copied from interface:LXFixtureContainerThe output settings of this fixture has changed, the top level structure should re-consolidate all the outputs.- Specified by:
fixtureOutputChangedin interfaceLXFixtureContainer- Parameters:
fixture- Fixture that has changed
-
fixtureTagsChanged
Description copied from interface:LXFixtureContainerThe tags of this fixture has changed, the container will need to take this into account.- Specified by:
fixtureTagsChangedin interfaceLXFixtureContainer- Parameters:
fixture- Fixture that has changed
-
addMetricsParameter
Adds a parameter which impacts the number of LEDs that are in the fixture. Changes to these parameters require re-generating the whole points array.- Parameters:
path- Path to parameterparameter- Parameter- Returns:
- this
-
addGeometryParameter
Adds a parameter which impacts the position of points in the fixture. Changes to these parameters do not require rebuilding the points array, but the point positions are updated and model change notifications are required.- Parameters:
path- Path to parameterparameter- Parameter- Returns:
- this
-
addOutputParameter
Adds a parameter which impacts the outputs of the fixture. Whenever one is changed, the outputs will be regenerated.- Parameters:
path- Path to parameterparameter- Parameter- Returns:
- this
-
addTagParameter
Adds a parameter which impacts the tags of the fixture. Whenever one is changed, the model will be regenerated with new tags.- Parameters:
path- Path to parameterparameter- Parameter- Returns:
- this
-
onParameterChanged
Description copied from class:LXComponentSubclasses are free to override this if desired. It will automatically fire for any listenable parameter that is registered with this component.- Specified by:
onParameterChangedin interfaceLXParameterListener- Overrides:
onParameterChangedin classLXComponent- Parameters:
p- Parameter that has a value change
-
regenerateOutputs
protected void regenerateOutputs() -
buildOutputs
protected abstract void buildOutputs()Subclasses must override this method to provide an implementation that produces the necessary set of outputs for this fixture to be sent. The subclass should calladdOutputDefinition(OutputDefinition)oraddOutputDirect(LXOutput)for each output. -
reindexOutputs
protected void reindexOutputs()Subclasses may override this method to update their outputs in the case that the point indexing of this fixture has changed. Outputs may be removed and re-added inside this method if necessary. -
addOutputDefinition
This method adds an output definition to the fixture- Parameters:
output- Output definition to add to the fixture
-
removeOutputDefinition
-
addOutputDirect
Subclasses call this method to add a direct output to this fixture. This may only be called from within the buildOutputs() function. Generally, usage of this method is strongly discouraged in favor of addOutput(), which enables merging of packets across multiple fixtures.- Parameters:
output- Output to add directly to this fixture
-
removeOutputDirect
Subclasses call this method to remove a output from the fixture. This may only be performed from within the reindexOutputs or buildOutputs methods.- Parameters:
output- Output to remove
-
clearTransforms
protected void clearTransforms() -
addTransform
-
regenerate
protected final void regenerate()Invoked when this fixture has been loaded or added to some container. Will rebuild the points and the metrics, and notify container of the change to this fixture's generation -
beforeRegenerate
protected void beforeRegenerate()Subclasses may override this method to do custom preparation work beforecomputeGeometryMatrix(LXMatrix)is called. -
computeGeometryMatrix
Subclasses may override this if they perform geometric transformations in a different order or using totally different parameters. The supplied parameter is a mutable matrix which will initially hold the value of the parent transformation matrix. It can then be further manipulated based upon the parameters.- Parameters:
geometryMatrix- The geometry transformation matrix for this object
-
computePointGeometry
This method should be implemented by subclasses to generate the geometry of the fixture any time its geometry parameters have changed. The correct number of points will have already been computed, and merely need to have their positions set.- Parameters:
transform- A transform matrix representing the fixture's positionpoints- The list of points that need to have their positions set
-
constructModel
protected LXModel constructModel(List<LXPoint> modelPoints, List<? extends LXModel> childModels, List<String> tags) Subclasses may override this method to use custom model type- Parameters:
modelPoints- Points in the modelchildModels- Child modelstags- Model tags- Returns:
- LXModel instance, or concrete subclass
-
constructPoint
Subclasses may override this method to use custom point types- Parameters:
localIndex- Index of the point relative to this fixture- Returns:
- LXPoint or concrete subclass
-
copyPoint
Subclasses may override this method to use custom point types- Parameters:
copy- Point to make a copy of- Returns:
- LXPoint or concrete subclass, should be deep copy of the original
-
addModelMetaData
Subclasses may override to add additiona metadata fields for inclusion in the model- Parameters:
metaData- Map to add meta-data fields to
-
getDefaultTags
Subclasses may override to return an array of default tag types for this fixture in the model hierarchy- Returns:
- List of model tag types for this fixture
-
setTags
Set the string tag values for this fixture- Parameters:
tags- Tag values- Returns:
- this
-
getModelMeshes
-
toSubmodels
Subclasses may override when they specify submodels- Returns:
- Array of submodel objects
-
size
protected abstract int size()Subclasses must implement to specify the number of points in the fixture. This does not include the number of points that are in children.- Returns:
- number of points immediately in the fixture
-
getIndexBufferOffset
public final int getIndexBufferOffset()Returns the offset of this fixture in the index buffer- Returns:
- Offset into the index buffer
-
getGeometryMatrix
Returns a copy of the geometry matrix for this fixture- Returns:
- Copy of geometry matrix
-
getGeometryMatrix
Returns the geometry transformation matrix, copied into the given matrix- Parameters:
m- LXMatrix object to copy into- Returns:
- Geometric transformation matrix, copied into parameter value
-
totalSize
public final int totalSize()Total points in this model and all its submodels- Returns:
- Total number of points in this model and all submodels
-
dispose
public void dispose()Description copied from class:LXComponentInvoked when a component is being removed from the system and will no longer be used at all. This unregisters the component and should free up any resources and parameter listeners. Ideally after this method is called the object should be eligible for garbage collection. Subclasses are generally expected to override this method to handle their particular cleanup work. They should also generally callsuper.dispose()at the appropriate time to perform the basic cleanup, which may need to happen either before or after cleaning up other objects.- Overrides:
disposein classLXComponent
-
load
Description copied from class:LXComponentLoads the LX component. Restores the ID of the component, as well as its internal and user-facing parameters. Any explicitly registered children will be automatically loaded, so long as they are direct descendants. Dynamic arrays will not be automatically loaded, this is left to subclasses to implement.- Specified by:
loadin interfaceLXSerializable- Overrides:
loadin classLXComponent- Parameters:
lx- LX instanceobj- Object to deserialize
-