vgp.tutor.firstProject
Class MyProject
java.lang.Object
|
+--jv.object.PsObject
|
+--jv.project.PjProject
|
+--vgp.tutor.firstProject.MyProject
- All Implemented Interfaces:
- java.lang.Cloneable, PsTimeListenerIf, PsUpdateIf, PvPickListenerIf, java.io.Serializable
- public class MyProject
- extends PjProject
Demo project for working with JavaView projects and for subclassing of PgElementSet.
This sample project shows how to handle timer events and supplies an own computation
method for creating the coordinates of an (animated) surface.
In this project a classes is embedded in a JavaView project. Nearly all applications
in JavaView are embedded into projects, each with a special functionality. Such
projects can be reused as a building blocks in other cirumstances, similar to a class.
In fact, a project is a subclass of jv.project.PjProject
which allows to manage a set of geometries, a display(s), and other projects, and
to react on animation and pick events.
This project also shows how to work with animations. Here an instance of class
PsAnimation is created where the current project registers
itself as dynamic object to be able to receive time events. Whenever the time changes
the animation manager invokes the method setTime(PsTimeEvent) of
this project.
- Version:
- 25.02.01, 1.51 revised (kp) Obsolete call to method setAnimation() removed.
28.11.00, 1.50 revised (kp) Applet simplified for beginners.
05.08.99, 1.00 created (kp)
- Author:
- Konrad Polthier
- See Also:
PsAnimation,
PgElementSet,
PjProject, Serialized Form
| Fields inherited from class jv.object.PsObject |
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_MATERIAL_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_SELECTED, IS_USED, m_infoPanel, m_name, m_panelList, m_parent, m_tag, m_updateList, NUM_TAGS |
|
Constructor Summary |
MyProject()
Constructor, without arguments to allow loading of project from menu. |
|
Method Summary |
void |
init()
Do initialization of data structures; method is also used to reset instances. |
boolean |
setTime(PsTimeEvent timeEvent)
Method is called from animation(-panel) whenever time has changed
since this project is registered as dynamic object in the animation.
|
void |
start()
Start project, e.g. start an animation. |
boolean |
update(java.lang.Object event)
Update method of project to react on changes in its panel or of its children.
|
| Methods inherited from class jv.project.PjProject |
addDisplay, addGeometry, addGeometry, dispose, dragDisplay, dragInitial, dragVertex, fitDisplays, getAnimation, getDisplay, getDisplays, getGeometry, getGeometry, getNumGeometries, getParameter, getViewer, hasAnimation, hasDisplay, isEnabledAutoFit, markVertices, pickDisplay, pickInitial, pickVertex, removeDisplay, removeGeometries, removeGeometry, selectDisplay, selectGeometry, setAnimation, setDisplay, setEnabledAutoFit, setParameter, setViewer, stop, unmarkVertices |
| Methods inherited from class jv.object.PsObject |
addInspector, addUpdateListener, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, removeInspector, removeUpdateListener, setName, setParent, setTag, toString, updatePanels |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
m_geom
protected MySurface m_geom
m_numULines
protected PuInteger m_numULines
m_numVLines
protected PuInteger m_numVLines
MyProject
public MyProject()
- Constructor, without arguments to allow loading of project from menu.
init
public void init()
- Do initialization of data structures; method is also used to reset instances.
- Overrides:
init in class PjProject
start
public void start()
- Start project, e.g. start an animation. Method is called once when project is
selected in PvViewer#selectProject(). Method is optional. For example, if an
applet calls the start() method of PvViewer, then PvViewer tries to invoke
the start() method of the currently selected project.
- Overrides:
start in class PjProject
- Following copied from class:
jv.project.PjProject
- See Also:
PvViewerIf.start(),
#isEnabledAutoFit(boolean)
setTime
public boolean setTime(PsTimeEvent timeEvent)
- Method is called from animation(-panel) whenever time has changed
since this project is registered as dynamic object in the animation.
Method is optional, but allows a project to update geometry to new current time.
- Overrides:
setTime in class PjProject
update
public boolean update(java.lang.Object event)
- Update method of project to react on changes in its panel or of its children.
This method is optional, but required if project is parent of a child.
Project becomes parent if child calls
child.setParent(this) with
this project as argument. For example, see the constructor of MyProject.
Project must react on child events, or forward them to its superclass.
Catch events of integer children and recompute surface.
- Overrides:
update in class PsObject
- Following copied from interface:
jv.object.PsUpdateIf
- Parameters:
event - carries a lot of information- Returns:
- true if event has been handled, otherwise false
- See Also:
PsObject,
PsUpdateIf.getFather(),
PsUpdateIf.setParent(PsUpdateIf)
The software JavaView® is copyright protected. All Rights Reserved.