Re: VisAD library update

Hi, Don Murray,

The following two JPG file is the streamline with the previous 
version(stream-1.jpg) and the new version(stream-2.jpg).

     FlowControl cFlow = (FlowControl)streamUMap.getControl();
     cFlow.setStreamlineDensity( 1.0 );
     cFlow.setStepFactor( 0.5 );
The stream-1.jpg is what I want, but I have no idea about the stream-2.jpg

When I run the following code, there is something wrong. I paste the code and 
errors:

/////############### code begin ################//

import java.util.*;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.*;

import javax.swing.*;
import javax.swing.event.*;
import visad.*;
import visad.util.*;
import visad.java2d.DisplayImplJ2D;
import visad.java3d.DisplayImplJ3D;
import visad.java3d.DefaultRendererJ3D;
import java.rmi.RemoteException;

public class GEam3DView extends JTabbedPane
{
   public GEam3DView() throws RemoteException, VisADException
   {
      super();

      setupComponent();
   }

   private void setupComponent()
   {
      JPanel p = new JPanel();
      p.setLayout( new BorderLayout() );
      add( "3D", p );

      try
      {
         DisplayImpl display = new DisplayImplJ3D( "3D" );
         p.add( display.getComponent(), BorderLayout.CENTER );

         RealType x = RealType.getRealType( "X" );
         RealType y = RealType.getRealType( "Y" );
         RealType z = RealType.getRealType( "Z" );
         RealType pixel = RealType.getRealType( "pixel" );

         ScalarMap xMap3D = new ScalarMap( x, Display.XAxis );
         ScalarMap yMap3D = new ScalarMap( y, Display.YAxis );
         ScalarMap zMap3D = new ScalarMap( z, Display.ZAxis );
         ScalarMap pixMap3D = new ScalarMap( pixel, Display.RGB );
         ScalarMap areaMap3D = new ScalarMap( pixel, Display.IsoContour );

         RealTupleType xyz_domain = new RealTupleType( z, y, x );

         visad.Set xyz_domain_set = new Linear3DSet( xyz_domain,
                -1000, -800, 3, 0, 1000, 20, 0, 1500, 30 );

         FunctionType xyz_func_pixel = new FunctionType(
                xyz_domain, pixel );

         FlatField xyz_pixel_ff = new FlatField( xyz_func_pixel, xyz_domain_set 
);
//         xyz_pixel_ff.setSamples(
         DataReferenceImpl xyz_pixel_ref =
                new DataReferenceImpl( "xyz_pixel" );
         display.addReference( xyz_pixel_ref );
         xyz_pixel_ref.setData( xyz_pixel_ff );

         display.addMap( xMap3D );
         display.addMap( yMap3D );
         display.addMap( zMap3D );
         display.addMap( pixMap3D );
         display.addMap( areaMap3D );
      }
      catch( RemoteException re ) { }
      catch( VisADException v5de ) { }
   }

   public static void main( String[] argv )
   {
      try
      {
         JFrame f = new JFrame();
         f.add( new GEam3DView() );
         f.setSize( 400, 400 );
         f.setVisible( true );
      }
      catch( java.rmi.RemoteException re ) { }
      catch( visad.VisADException ve ) { }
   }
}
/////// end of the code //////////////////////

errors as following:

java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
 at java.util.Vector.elementAt(Vector.java:427)
 at 
visad.java3d.ShadowFunctionOrSetTypeJ3D.doTransform(ShadowFunctionOrSetTypeJ3D.java:124)
 at visad.java3d.DefaultRendererJ3D.doTransform(DefaultRendererJ3D.java:133)
 at visad.java3d.RendererJ3D.doAction(RendererJ3D.java:181)
 at visad.DisplayImpl.doAction(DisplayImpl.java:1709)
 at visad.ActionImpl.run(ActionImpl.java:364)
 at visad.util.ThreadPool$ThreadMinnow.run(ThreadPool.java:95)


thanks

lizhi



----- Original Message ----- 
From: "Don Murray" <dmurray@xxxxxxxxxxxxxxxx>
To: "Wang Lizhi" <wlz@xxxxxxxxx>
Cc: "Tom Whittaker" <tomw@xxxxxxxxxxxxx>; <visad@xxxxxxxxxxxxxxxx>
Sent: Tuesday, January 30, 2007 10:34 PM
Subject: Re: VisAD library update


> Hi-
> 
> Wang Lizhi wrote:
> 
>>   When I use the updated version, my application do not display correctly
>> 
>>   Firstly, the Stream is very strange when I use
>>         streamUMap = new ScalarMap( ux, Display.Flow1X );
>>         streamVMap = new ScalarMap( vy, Display.Flow1Y );
> 
> The streamline code was revamped to be more "realistic" so it
> will look different than the previous version.  When you say
> "strange" does that mean different or inaccurate?  If the latter,
> can you provide a screen shot with the old visad.jar and the new one?
> 
>>   Secondly,  some error message is displayed as following:
>>      java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
>>          at java.util.Vector.elementAt( Vector.java:427 )
>>          at visad.java3d.ShadowFunctionOrSetTypeJ3D.doTransform( 
>> ShadowFunctionOrSetTypeJ3D.java:124 )
>>          at visad.java3d.DefaultRendererJ3D.doTransform( 
>> defaultRendererJ3D.java:133 )
>>          at visad.java3d.RednererJ3D.doAction( RendererJ3D.java:181 )
>>          at visad.DisplayImpl.doAction( DisplayImpl.java:1709 )
>>          at visad.ActionImpl.run( ActionImpl.java:364 )
>>          at visad.util.ThreadPool$ThreadMinnow.run( ThreadPool.java:95 )
>>     Can I get some idea where I can deal with the error?
> 
> Can you provide some code which produces this problem?  What is
> the data type of the field?
> 
> Don Murray
> *************************************************************
> Don Murray                               UCAR Unidata Program
> dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
> (303) 497-8628                              Boulder, CO 80307
> http://www.unidata.ucar.edu/staff/donm
> *************************************************************
> 
> 
> ===============================================================================
> To unsubscribe visad, visit:
> http://www.unidata.ucar.edu/mailing-list-delete-form.html
> ===============================================================================

Attachment: stream-1.jpg
Description: JPEG image

Attachment: stream-2.jpg
Description: JPEG image

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