![]() |
|
#1
|
|||
|
|||
Difficult drawing taskHello,
I'm new to Fltk and my C++ knowledge is rather basic. So I've problems finding out if the following task can be solved with Fltk by just reading the documentation and examples code. (I use 1.1.9 with Dev-C++.) What we are trying to do is writing a program for data display in our lab. The data sets are arrays of 1 Mio points and more. We would like to draw them at an acceptable speed (I'm aware that I don't have 1 Mio pixels, so there must be some sort of averaging involved, is there an automatic picture/buffer scaling function?). Overlayed should be several horizontal lines that the user can change without the data being redrawn every time. I'd also be able to zoom and scroll. (I managed to draw some lines in a drawing box derived from Sean Ho's ScribbleBox. But I suppose that method would be too slow for the actual application. Offline drawing is a little beyond me, I managed to create a buffer, put the content in an FL_RGB_Buffer, but when I try to display it as a Fl_Box->value, all is see is black.) Is what I describe above in princible possible with Fltk or are we wasting our time here that we should better use with another toolkit? Thanks in advance, Indra |
|||
|
#2
|
|||
|
|||
Re: Difficult drawing taskOkay, I found this, which seems to be what I want:
Code:
But now I have another problem. Because I want to have several graphs in Tabs, I made a subclass of Fl_Group to hold the a canvas and the axes, see below. The code compiles and I can display the empty graph in Fl_Tabs. The problem is, that I can only draw things inside the constructor, not when I call the normal drawing function. However, the drawing function perfectly rescales the axes according to the data I loaded, it just doesn't plot them. What am I doing wrong here? Header: CPP / C++ / C Code:
Constructor: CPP / C++ / C Code:
Drawing function: CPP / C++ / C Code:
|
|
#3
|
|||
|
|||
Re: Difficult drawing taskI'll just keep talking to myself, in case someone with a similar problem
comes across this site and finds my ramblings useful. I've overcome my sub-classing problem above by simply not doing it. Instead I just made three idential groups with each a Ca_Canvas, two axes and some other stuff. Not very elegant, but it works. So, the Cartesian library indeed can plot several hundred thousand of data points at once. It even looks pretty. But I can easily go and brew myself a cup of tea while I wait for it to happen. Apperently, Fltk is not meant for extensive data drawing, just for gui drawing. I set my hopes now on OpenGl. I read some more tutorials and switched my canvas to a subclass of Fl_Gl_Window. The problem I'm stuck now with is that I can only plot as many points as there are pixels in the window. How can I squeeze more in? Cartesian did this automatically somehow. I suspect it has to do something with CPP / C++ / C Code:
|
|
#4
|
|||
|
|||
Re: Difficult drawing taski don't understand any thing
simply what is problem ? look these links may help you http://www.kiwacan.co.nz/fltk/Fl_PlotXY.html http://eetorres.googlepages.com/contour |
|
#5
|
|||
|
|||
Re: Difficult drawing taskThe problem was, that I was looking for a built-in function to magically scale my data into pixel coordinates to fit on the screen. Once I turned on my brain, I realized that this required about two lines of code for a simple linear transformation .
But thanks for looking up the links for me anyway. :-) |
Recent GIDBlog
Problems with the Navy (Chiefs) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Drawing order | Z_guy | FLTK Forum | 6 | 09-Sep-2007 13:57 |
| Drawing an image over the CSliderCtrl | Reva | MS Visual C++ / MFC Forum | 0 | 16-Aug-2007 02:22 |
| Task Manager not COMING up | insaneSNIPE | Computer Software Forum - Windows | 0 | 08-Oct-2006 23:45 |
| How to save a drawing to the file | amgturk | MS Visual C++ / MFC Forum | 2 | 25-Jul-2005 01:29 |
| Undo Drawing | Nelly | MS Visual C++ / MFC Forum | 3 | 10-May-2004 22:14 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The