16 Apr 18:29
Re: Help with understanding QwtRasterData needed
From: Uwe Rathmann <Uwe.Rathmann <at> tigertal.de>
Subject: Re: Help with understanding QwtRasterData needed
Newsgroups: gmane.comp.graphics.qwt.general
Date: 2008-04-16 16:29:46 GMT
Subject: Re: Help with understanding QwtRasterData needed
Newsgroups: gmane.comp.graphics.qwt.general
Date: 2008-04-16 16:29:46 GMT
On Wednesday 16 April 2008 15:54, Matthias Pospiech wrote: > In my problem the data however has to be delivered to the plot as a > double array (2D Array). QwtRasterData ( similar to QwtData ) is the link between the application data and the QwtRasterItem ( guess here a spectrogram ), that is responsible for displaying the data. When the raster item needs to render its image it calculates the position of each pixel and asks the raster data object for a value at this position. This value is mapped into a color using the value range, that is also provided by the data object. You need to implement a raster data object, that can access your 2d array: a) YourRasterData::range() If you have a color map from blue to red you also need to define which value means blue and which means red. Values above or below are mapped to the borders of the color map. Range is what we call "Wertebereich" in German. b) YourRasterData::value() Here you have to return the value at a specific position. Usually your 2D array will have a different raster, so you have to do some resampling here ( f.e. next neighbour ). The following methods are optional, but might speedup the process of rendering a lot: c) YourRasterData::initRaster() The item tells the data object in advance about the raster it is going to render. F.e. if you have a huge number of samples in a file, you can resample and load it into memory here. d) YourRasterData::discardRaster() The item tells the data object, that the rendering of the image is complete. So you can do some cleanups here. e) YourData::rasterHint Here you can return the resolution of your 2D matrix and limit the resolution of the image, that is rendered. ( There is no need to render an image in a higher resolution than the data has ). On screen this is not so important, but for printing ( f.e 1200dpi on a A0 plotter ) it can be substantial. Uwe ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
RSS Feed