vmm.core3D
Class View3DWithLightSettings

java.lang.Object
  extended by vmm.core.View
      extended by vmm.core3D.View3D
          extended by vmm.core3D.View3DWithLightSettings
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.ChangeListener, Decorateable, Parameterizable
Direct Known Subclasses:
SurfaceImplicit.ImplicitSurfaceView, View3DLit

public class View3DWithLightSettings
extends View3D

A 3D view, with associated light settings. This class is the base class for View3DLit, which adds a varitey of other lighting controls. A View3DWithLightSettings was introduced for use with implicit surfaces, where many of the lighting controls in View3DLit are not appropriate.


Field Summary
protected  ToggleAction lightingEnabledToggle
          ToggleAction for enabling/disabling lighting.
protected  AbstractActionVMM lightSettingsCommand
          Command for displaying a light settings dialog.
 
Fields inherited from class vmm.core3D.View3D
CROSS_EYE_STEREO_VIEW, leftStereographOSI, MONOCULAR_VIEW, projectionCommands, RED_GREEN_STEREO_VIEW, rightStereographOSI, set3DViewOptionsAction, setViewpointAction, stereoComposite, STEREOGRAPH_VIEW, transform3D, viewStyleCommands
 
Fields inherited from class vmm.core.View
backgroundCommands, buildAnimation, buildingImageForFilmstrip, currentGraphics, decorations, directOffscreenDrawing, fullOSI, needsRedraw, offscreenImageType, parameters, showAxesAction
 
Constructor Summary
View3DWithLightSettings()
          Create the view, with a default LightSettings object.
 
Method Summary
 void addExtraXML(org.w3c.dom.Document containingDocument, org.w3c.dom.Element viewElement)
          Overridden to add light settings info.
 boolean getLightingEnabled()
          Check whether lighting is currently enabled.
 LightSettings getLightSettings()
          Retrieve the current LightSettings for this view.
 ActionList getSettingsCommands()
          Adds a checkbox for setting the lighting and dragAsSurface commands to any settings contributed by the superclass.
 void readExtraXML(org.w3c.dom.Element viewInfo)
          Overridden to read back the light settings info.
protected  void setAnaglyphLightSettings(LightSettings lightSettings)
          Set the light setting object that is used for anaglyph view style.
 void setLightingEnabled(boolean lightingEnabled)
          Set whether lighting is currently enabled.
 void setLightSettings(LightSettings lightSettings)
          Sets the current light settings for this view.
protected  void setNonAnaglyphLightSettings(LightSettings lightSettings)
          Set the light setting object that is used for non-anaglyph view styles.
 void setViewStyle(int viewStyle)
          Overridden in this subclass to swap in the anaglyph or non-anaglph light settings, as appropriate.
 
Methods inherited from class vmm.core3D.View3D
clearOSI, clip, createAxes, createOSI, drawCollaredCurve, drawCollaredCurve, drawCollaredCurve, drawCurve, drawCurve, drawCurve, drawDot, drawLine, drawPixel, drawPixelDirect, drawPixels, drawString, drawWireframeSurface, finish, finishOSIDraw, finishStereoView, getDefaultMouseTask, getEnableThreeD, getOrthographicProjection, getSavedAuxiliaryTransformForEnableThreeD, getTransform3D, getViewCommands, getViewPoint, getViewStyle, getViewUp, moveStereographImages, needsNewOSI, prepareOSIForDrawing, putOSI, setBackground, setDisplay, setEnableThreeD, setExhibit, setOrthographicProjection, setSavedAuxiliaryTransformForEnableThreeD, setTransform, setUpForLeftEye, setUpForRightEye, setViewPoint, setViewUp, setWindowForUseWhileThreeDDisabled, stateChanged, stereographLeftEyeRect, stereographRightEyeRect, takeExhibit
 
Methods inherited from class vmm.core.View
addDecoration, addParameter, beginDrawToOffscreenImage, clearDecorations, doDraw, drawCurve, drawCurve, drawCurve, drawDot, drawLine, drawLine, drawLineDirect, drawPixel, drawPixel, drawPixels, drawString, drawString, endDrawToOffscreenImage, fillRectDirect, forceRedraw, getActions, getActionsForViewAndExhibit, getAdditionalAnimations, getAdditionalAnimationsForViewAndExhibit, getAntialiased, getApplyGraphics2DTransform, getBackground, getColor, getDecorations, getDisplay, getExhibit, getFastDrawing, getForeground, getImage, getName, getParameterByName, getParameters, getPreserveAspect, getRequestedWindow, getSettingsCommandsForViewAndExhibit, getShowAxes, getStatusText, getTitle, getTransform, getViewAndExhibitParameters, getWindow, parameterChanged, removeDecoration, removeParameter, render, setAntialiased, setApplyGraphics2DTransform, setColor, setFastDrawing, setFastDrawing, setForeground, setName, setPreserveAspect, setShowAxes, setStrokeSizeMultiplier, setWindow, setWindow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lightSettingsCommand

protected AbstractActionVMM lightSettingsCommand
Command for displaying a light settings dialog.


lightingEnabledToggle

protected ToggleAction lightingEnabledToggle
ToggleAction for enabling/disabling lighting. This ToggleAction is not added to the settings commands in this class, but is added in View3DLit.getSettingsCommands().

Constructor Detail

View3DWithLightSettings

public View3DWithLightSettings()
Create the view, with a default LightSettings object.

Method Detail

getLightSettings

public LightSettings getLightSettings()
Retrieve the current LightSettings for this view. The return value can depend on whether the current view style is anaglyph. By default, the same light settings object is used for both; this can only change if either setAnaglyphLightSettings(LightSettings) or setNonAnaglyphLightSettings(LightSettings) is called in a subclass.


setLightSettings

public void setLightSettings(LightSettings lightSettings)
Sets the current light settings for this view. Note that calling this method does not automatically force a redraw; it simply replaces the current light settings in the view. If setAnaglyphLightSettings(LightSettings) or setNonAnaglyphLightSettings(LightSettings) has been called, then this only affects the light settings for the current view style; otherwise, the new light settings replaces the light settings that are used for all view styles.

Parameters:
lightSettings - the new light settings; if this is null, the current light settings are not changed.

setAnaglyphLightSettings

protected void setAnaglyphLightSettings(LightSettings lightSettings)
Set the light setting object that is used for anaglyph view style. After this method is called, separate objects will be used for anaglyph and non-anaglyph view styles.

Parameters:
lightSettings - the new lidht settings object; if this is null, nothing is done.

setNonAnaglyphLightSettings

protected void setNonAnaglyphLightSettings(LightSettings lightSettings)
Set the light setting object that is used for non-anaglyph view styles. After this method is called, separate objects will be used for anaglyph and non-anaglyph view styles.

Parameters:
lightSettings - the new lidht settings object; if this is null, nothing is done.

getLightingEnabled

public boolean getLightingEnabled()
Check whether lighting is currently enabled.

See Also:
setLightingEnabled(boolean)

setLightingEnabled

public void setLightingEnabled(boolean lightingEnabled)
Set whether lighting is currently enabled. When lighting is enabled, surface colors are computed based on intrinsic color plus illumination. When it is disabled, surface patches are drawn using intrinsic color only (leading to a completely flat appearance). The default value is true.

Parameters:
lightingEnabled -

setViewStyle

public void setViewStyle(int viewStyle)
Overridden in this subclass to swap in the anaglyph or non-anaglph light settings, as appropriate. See setAnaglyphLightSettings(LightSettings) and setNonAnaglyphLightSettings(LightSettings).

Overrides:
setViewStyle in class View3D
Parameters:
viewStyle - the new view style. This is ignored if it is not one of the four legal options.

getSettingsCommands

public ActionList getSettingsCommands()
Adds a checkbox for setting the lighting and dragAsSurface commands to any settings contributed by the superclass.

Overrides:
getSettingsCommands in class View3D
See Also:
View.getSettingsCommands()

addExtraXML

public void addExtraXML(org.w3c.dom.Document containingDocument,
                        org.w3c.dom.Element viewElement)
Overridden to add light settings info.

Overrides:
addExtraXML in class View3D
Parameters:
containingDocument - The overall XML document that contains the view Element that is being created. This parameter is necessary because it is needed to create any nested subelements that are to be added to the view element.
viewElement - The XML element that is being constructed. This element already exists; the purpose of this method to add any extra information that would be needed to reconstruct this view object from the XML represenation.
See Also:
View.readExtraXML(Element)

readExtraXML

public void readExtraXML(org.w3c.dom.Element viewInfo)
                  throws java.io.IOException
Overridden to read back the light settings info.

Overrides:
readExtraXML in class View3D
Parameters:
viewInfo - The <view> element from the XML file that contains the information about this view. Some methods from the SaveAndRestore class might be useful for getting the data.
Throws:
java.io.IOException - If an error is found, an exception of type IOException should be thrown. This will abort the whole processing of the XML file.