public class PwSeeds extends PjWorkshop implements PsTimeListenerIf
HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS
MODE_BUG, MODE_STANDARD, MODE_VALIDATE
Constructor and Description |
---|
PwSeeds() |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancel operation of this workshop by resetting the assigned geometry,
and finally close this workshop.
|
PsAnimation |
getAnimation()
Get the animation manager where this listener is registered.
|
int |
getNumSeeds() |
double |
getStepSize() |
int |
getVectorFieldIndex() |
boolean |
hasAnimation()
Check whether this object is registered as listener of an animation manager.
|
void |
init()
Initialize and reset project, stops the running animation if any.
|
void |
ok()
Accept current version of the geometry as new version.
|
void |
removeGeometry()
Remove the assigned geometry and its backup clone.
|
void |
removeSeeds() |
void |
reset()
Reset this workshop to its initial state from which computations
can start.
|
void |
setAnimation(PsAnimation anAnimation)
Assign the animation manager where this listener is registered.
|
void |
setDisplay(PvDisplayIf display)
Set the active display when this workshop was launched.
|
void |
setFirstOrder(boolean firstOrder) |
void |
setGeometry(PgGeometry geom)
Assign a geometry on which this workshop operates,
and create a backup clone of the geometry.
|
void |
setNumSeeds(int numSeeds) |
void |
setStepSize(double h) |
boolean |
setTime(PsTimeEvent timeEvent)
Animation updates the dynamic object through this method whenever time has changed.
|
static void |
setToRandomPosition(PgPointSetOnElementSet seeds)
Set all points to random positions.
|
static void |
setToRandomPosition(PgPointSetOnElementSet seeds,
int startIndex,
int endIndex)
Set the vertices from startIndex to endIndex-1 to a random position in a
(almost) random element.
|
void |
setVectorFieldIndex(int fieldIndex) |
boolean |
update(java.lang.Object event)
Updates the geometry if this workshop has changed,
i.e. if the event is
this or null . |
boolean |
usesFirstOrder() |
close, getDisplay, getDisplays, getGeometry, getMode, getSavedGeometry, getViewer, isModal, isStandalone, openDialog, setDisplays, setModal, setMode, setStandalone, setViewer
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getName
getFather, getName, setParent
public void init()
PjWorkshop
init
in class PjWorkshop
public void setGeometry(PgGeometry geom)
PjWorkshop
Subclasses frequently overwrite this method but are advised to call this method.
setGeometry
in interface PjWorkshopIf
setGeometry
in class PjWorkshop
geom
- the workshop modifies this geometry.public boolean hasAnimation()
PsTimeListenerIf
hasAnimation
in interface PsTimeListenerIf
PsTimeListenerIf.getAnimation()
,
PsTimeListenerIf.setAnimation(PsAnimation)
public PsAnimation getAnimation()
PsTimeListenerIf
setAnimation(PsAnimation)
.getAnimation
in interface PsTimeListenerIf
PsTimeListenerIf.hasAnimation()
,
PsTimeListenerIf.setAnimation(PsAnimation)
public void setAnimation(PsAnimation anAnimation)
PsTimeListenerIf
Only one animation manager may be assigned to this listener. Subsequent assignments will replace the previous assignment.
setAnimation
in interface PsTimeListenerIf
PsTimeListenerIf.getAnimation()
,
PsTimeListenerIf.hasAnimation()
public boolean setTime(PsTimeEvent timeEvent)
PsTimeListenerIf
setTime
in interface PsTimeListenerIf
public int getVectorFieldIndex()
public void setVectorFieldIndex(int fieldIndex)
public int getNumSeeds()
public void setNumSeeds(int numSeeds)
public double getStepSize()
public void setStepSize(double h)
public boolean usesFirstOrder()
public void setFirstOrder(boolean firstOrder)
public void ok()
PjWorkshop
Implementation in this class calls close()
.
ok
in class PjWorkshop
public void reset()
PjWorkshop
A subclass may also want to reset a geometry to some initial state useful for this workshop, although, not always is the initial state of the geometry equivalent to the original state of the geometry, for example, if material properties of the geometry must be set specifically for this workshop. Therefore, this superclass does not restore the original duplicate of the geometry.
The reset method often is different from the init() method of a workshop since often the workshop needs information about the registered geometry to get into a working initial state.
reset
in class PjWorkshop
public void cancel()
PjWorkshop
If necessary, the duplicate of the original geometry is restored into the geometry. The update method of the geometry is called.
cancel
in class PjWorkshop
public void removeSeeds()
public void removeGeometry()
removeGeometry
in class PjWorkshop
public void setDisplay(PvDisplayIf display)
setDisplay
in interface PjWorkshopIf
setDisplay
in class PjWorkshop
public boolean update(java.lang.Object event)
this
or null
.
Also propagates update() to superclass with the original argument event.
Some subclasses may register themself as update listener of the geometry of this workshop. In order to prevent an update loop, this method savely uses isUpdateSender() when updating the geometry.
update
in interface PsUpdateIf
update
in class PjWorkshop
event
- sender of this update.PsObject.setParent(PsUpdateIf)
,
PsObject.getFather()
,
PsObject.addUpdateListener(PsUpdateIf)
public static void setToRandomPosition(PgPointSetOnElementSet seeds, int startIndex, int endIndex)
The positions inside a triangle are equally distributed, and the number of points in a triangle is proportional to the area of the triangle.
startIndex
- Index of the first vertex to be changed.endIndex
- Upper limit of indices to be changed.public static void setToRandomPosition(PgPointSetOnElementSet seeds)
"