NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: FancySSCell and DirectManipulationRenderer

Hi Mathias,

This NullPointerException comes from deep inside Java3D and is probably
a Java3D problem. Line 662 of DisplayRendererJ3D.java is not a call to
draw() in the current VisAD, but there may be a line numbering difference
in your JVM.

I was however able to get direct manipulation in the SpreadSheet by
temporarily editting the BasicSSCell.setMaps() method, changing:

  VDisplay.addReference(dr[i], cmaps[i]);

to:

  VDisplay.addReferences(new DirectManipulationRendererJ3D(), dr[i], cmaps[i]);

Note this causes Exception messages in the 3-D window if the data's
MathType is not compatible with DirectManipulationRendererJ3D, but I
was able to drag the data for data with a RealType.

Changing the BasicSSCell.addReferenceImpl() method did not have any
affect for me.

Cheers,
Bill

> A few weeks ago I asked if there is a possibility to add data to a SSCell 
> with an alternativ DataRenderer especially a
> DirectManipulationRendererJ3D. Curtis told me to extend FancySSCell. Now I 
> found the time to do this and got some problems. Below are the two
> methods that extend the FancySSCell to allow the addition of a DataReference 
> with an alternative renderer:
> 
>   public String addReference(DataReferenceImpl ref, DataRenderer renderer, 
> ConstantMap[] cmaps)
>       throws VisADException, java.rmi.RemoteException {
>     SSCellData cellData;
>     synchronized (CellData) {
>       cellData = addReferenceImpl(0, ref, cmaps, "", DIRECT_SOURCE, true, 
> true, renderer);
>     }
>     return cellData.getVariableName();
>   }
> 
>   protected SSCellData addReferenceImpl(int id, DataReferenceImpl ref,
>     ConstantMap[] cmaps, String source, int type, boolean notify,
>     boolean checkErrors, DataRenderer renderer)
>       throws VisADException, java.rmi.RemoteException {
>     if (id == 0) id = getFirstFreeId();
>     if (ref == null) ref = new DataReferenceImpl(Name);
>     if (notify) sendMessage(ADD_DATA, source, ref.getData());
>     SSCellData cellData
>       new SSCellData(id, this, ref, cmaps, source, type, checkErrors);
>     CellData.add(cellData);
>     if (!IsRemote) {
>       if (HasMappings) VDisplay.addReferences(renderer, ref, cmaps);
>       synchronized (Servers) {
>         RemoteDataReferenceImpl remoteRef
>           (RemoteDataReferenceImpl) cellData.getRemoteReference();
>         int len = Servers.size();
>         for (int i=0; i<len; i++) {
>           RemoteServerImpl rs = (RemoteServerImpl) Servers.elementAt(i);
>           rs.addDataReference(remoteRef);
>         }
>       }
>     }
>     return cellData;
>   }
> 
> The addition (with a DirectManipulationRendererJ3D) of the data works without 
> problems. But if I try to move my datapoints with the right
> mouse button I get this exception:
> 
> Exception occurred during Canvas3D callback:
> java.lang.NullPointerException: null component
>  at sun.awt.windows.WDrawingSurfaceInfo.lock(Native Method)
>  at 
> javax.media.j3d.DrawingSurfaceObjectDSI.renderLock(DrawingSurfaceObjectDSI.java:60)
>  at javax.media.j3d.GraphicsContext3D.doDraw(GraphicsContext3D.java:1821)
>  at javax.media.j3d.GraphicsContext3D.draw(GraphicsContext3D.java:2059)
>  at 
> visad.java3d.DisplayRendererJ3D.drawCursorStringVector(DisplayRendererJ3D.java:662)
>  at visad.java3d.VisADCanvasJ3D.renderField(VisADCanvasJ3D.java:76)
>  at javax.media.j3d.Renderer.doWork(Renderer.java:940)
>  at javax.media.j3d.J3dThread.run(J3dThread.java:256)
> I was not able to locate the error. I'm not sure if I forget anything to 
> implement in my methods. Perhaps I should extend the SSCellData-class
> too. But then I would lose all the compatibility to any other SSCell. Are 
> there any ideas what to do?
> 
> Thanks in advance, Mathias

-- 
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: