Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.
> Are you using a DisplayImplJ2D? Erm, no. I have to use the 'makeDisplay(maps)' method in JyVisAD's subs.py scripts which uses a DisplayImpl and not a DisplayImplJ2D. Using 'makeDisplay2D(maps)' with the requisite DisplayImplJ2D causes the program to crash. > What method are you calling replace the image? See code excerpt below. Might be a tad confusing without a little background: The replaced image is a stretched version of the original image. So... I've defined a method that stretches the original image and displays both this (the stretched image) and everything that was previously displayed (makes a new JPanel for everything etc) Very memory intensive. Trying to fix. -------- start code ----------- displayPanel = JPanel(border=border.TitledBorder("Display Panel"), layout=GridLayout(1,2,5,5)) #add original image first displayPanel.add(disp.getComponent()) #add display plot panel displayPanel.add(plotd.getComponent()) pane.add("Center", displayPanel) #some program calls to add stretched image when buttons are clicked buttonPanel = JPanel(border=border.TitledBorder("Y-Stretch Controls"), layout=BorderLayout(0, 20)) stretchButton=JButton("x2", preferredSize=(100,20), actionPerformed=twist1) buttonPanel.add(stretchButton, BorderLayout.CENTER) #define a twist grid for stretching the image in pre-defined amounts (y direction only) def twist1(event): twist_grid = [ [w for h in xrange(height) for w in xrange(width)] , [(w-(h*0.5)) for h in xrange(height) for w in xrange(width)]] twist_set = Gridded2DSet(set.getType(), twist_grid, width, height, None, None, None, 0) twist = FlatField(img.getType(), twist_set) twist.setSamples(img.getValues(Boolean(0)),0) #some formatting to convert this into an image twistdom = getDomainType(twist) twistrng = getRangeType(twist) twist_maps = subs.makeMaps(twistdom[0],'x', twistdom[1],'y', twistrng[0],'red',twistrng[1],'green',twistrng[2],'blue') #make maps for it! dispt = subs.makeDisplay(twist_maps) dispt.addData("twisted",twist) dispt.setBoxSize(.5) #them make a display panel for it that overwrites the entire display displayPanel2 = JPanel(border=border.TitledBorder("Display Panel"), layout=GridLayout(1,2,5,5)) displayPanel2.add(dispt.getComponent()) displayPanel2.add(plotd.getComponent()) pane.add("Center", displayPanel2) -------- end code ----------- The above appears to work except that stretched image only updates on 'maximising' JFrame which holds all. What should I be doing? Many thanks, Chi-chi ----- Original Message ----- From: Bill Hibbard <billh@xxxxxxxxxxxxx> To: Chi-chi Ekweozor <cce100@xxxxxxxxxx> Sent: Thursday, May 15, 2003 12:59 PM Subject: Re: Repainting images in JyVisAD > Hi Chi-chi, > > > I wonder if anyone's come across this before. I'm trying to update a 2D display by replacing the image mapped onto it with another image. The only problem is the replacement image is not displayed unless I 'maximise' the JFrame containing the display. > > Are you using a DisplayImplJ2D? > > What method are you calling replace the image? > > Please send the relevant portion of code to visad-list. > > Cheers, > Bill > >
visad
archives: