use of artisynth.core.modelbase.PropertyChangeEvent in project artisynth_core by artisynth.
the class Main method componentChanged.
public void componentChanged(ComponentChangeEvent e) {
if (e.getCode() == ComponentChangeEvent.Code.STRUCTURE_CHANGED || e.getCode() == ComponentChangeEvent.Code.DYNAMIC_ACTIVITY_CHANGED) {
boolean invalidateWaypoints = false;
RootModel root = getRootModel();
ModelComponent c = e.getComponent();
if (myFrame != null && c != null && (c == root || c.getParent() == root)) {
updateApplicationMenuPresent(root);
}
if (root != null) {
invalidateWaypoints = changeAffectsWaypoints(root, e);
if (invalidateWaypoints) {
root.getWayPoints().invalidateAfterTime(0);
}
}
if (myTimeline != null) {
if (root != null && c == root.getWayPoints()) {
myTimeline.requestUpdateWidgets();
} else {
// update timeline display regardless
myTimeline.requestUpdateDisplay();
}
}
if (e.getCode() == ComponentChangeEvent.Code.STRUCTURE_CHANGED) {
if (c != null && c instanceof CompositeComponent && myFrame != null) {
myFrame.getNavPanel().updateStructure(c);
if (root != null && (c == root.getInputProbes() || c == root.getOutputProbes())) {
myTimeline.updateProbes(root);
}
}
if (!getScheduler().isPlaying()) {
rerender();
}
}
// if (invalidateWaypoints) && !myScheduler.isPlaying()) {
if (invalidateWaypoints) {
myScheduler.invalidateInitialState();
}
} else if (e.getCode() == ComponentChangeEvent.Code.NAME_CHANGED) {
ModelComponent c = e.getComponent();
if (myFrame != null) {
if (c.getParent() != null) {
myFrame.getNavPanel().updateStructure(c.getParent());
} else {
myFrame.getNavPanel().updateStructure(c);
}
}
} else if (e.getCode() == ComponentChangeEvent.Code.PROPERTY_CHANGED) {
PropertyChangeEvent pe = (PropertyChangeEvent) e;
ModelComponent c = e.getComponent();
if (c == getRootModel()) {
if (pe.getPropertyName().equals("maxStepSize")) {
doSetMaxStep(getRootModel().getMaxStepSize());
} else if (pe.getPropertyName().equals("defaultViewOrientation")) {
if (myViewerManager != null) {
myViewerManager.resetViewers(getDefaultViewOrientation(getRootModel()));
}
}
} else if (pe.getPropertyName().startsWith("navpanel")) {
if (myFrame != null) {
myFrame.getNavPanel().updateStructure(e.getComponent());
}
}
} else if (e.getCode() == ComponentChangeEvent.Code.GEOMETRY_CHANGED) {
// myTimeline.requestUpdateDisplay();
if (!getScheduler().isPlaying()) {
rerender();
}
}
}
use of artisynth.core.modelbase.PropertyChangeEvent in project artisynth_core by artisynth.
the class RootModel method setDefaultViewOrientation.
/**
* Sets the default orientation that should be used for viewing
* this model to <code>REW</code>. Setting a value of 0 indicates
* that no orientation is specified and so the viewer should
* use its default view.
*
* @param REW rotational transform from eye to world coordinates
*/
public void setDefaultViewOrientation(AxisAngle REW) {
if (!myDefaultViewOrientation.equals(REW)) {
myDefaultViewOrientation.set(REW);
componentChanged(new PropertyChangeEvent(this, "defaultViewOrientation"));
}
}
use of artisynth.core.modelbase.PropertyChangeEvent in project artisynth_core by artisynth.
the class RootModel method setMaxStepSize.
public void setMaxStepSize(double step) {
if (step <= 0) {
throw new IllegalArgumentException("step size must be positive");
}
super.setMaxStepSize(step);
componentChanged(new PropertyChangeEvent(this, "maxStepSize"));
}
Aggregations