RE: your mail

Hi,

The 3D image shows up, but I was still wondering about where the current
mappings get assigned. I walked through MappingDialog.java and
BasicSSCell.java and I couldn't find anything specific for where current
mappings get assigned. Does anyone know where I can find that?

Thanks!
Michelle

Michelle Kam           (408) 742-2881
Lockheed Martin Space Systems Co. SSM/ATC/MSIS
B/153 O/L922 
1111 Lockheed Martin Way, Sunnyvale, CA 94089




-----Original Message-----
From: Ugo Taddei [mailto:p6taug@xxxxxxxxxxx]
Sent: Tuesday, June 10, 2003 12:06 AM
To: Kam, Michelle C
Subject: Re: your mail


Hi,

Sorry, I'm a bit late on this, but perhaps some help:

> The most likely cause is that you need to "escape" the "\" marks in your
> path:
> 
> DisplayCells[0][0].addDataSource("D:\visad\unzipped\visad\ss\small.v5d");
> 
> should probably be written as:
> 
>
DisplayCells[0][0].addDataSource("D:\\visad\\unzipped\\visad\\ss\\small.v5d"
); 

or, better still, substitute "/", "\", "\\" or by File.Separator, e.g.

DisplayCells[0][0].addDataSource("D:+File.Separator+visad+File.Separator+unz
ipped...

or

String s = File.Separator;
DisplayCells[0][0].addDataSource("D:"+s+"visad"+s+"unzipped...

You can get a list of root drives with File.listRoots(), to get rid of 
that "d:". But it would be even better to a file chooser dialog, as your 
app is gui-based. Something like

// not tested!
public String chooseFile(String currentDir){
      // open dialog
     JFileChooser fc = new JFileChooser();
      // chosse file
     fc.setCurrentDirectory(new File(currentDir));

     int returnVal = fc.showOpenDialog(new JFrame());

     if (returnVal == JFileChooser.APPROVE_OPTION) {
         java.io.File file = fc.getSelectedFile();
         System.out.println("Opening: " + file.getAbsolutePath() );

         try {
           String fileName = file.getAbsolutePath();
        
          return filename;

         }catch (Exception ex) {
           // something went wrong
           ex.printStackTrace();
         }
     } else {
         System.out.println("Open command cancelled by user.");
     }
     return null;
   }


and then, in your app:

String file = chooseFile("d:\\visad\\...");
(I think chooseFile(".") might work)

if( file != null)
   DisplayCells[0][0].addDataSource(file);


Hope this helps a little.

Cheers,

Ugo


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