From: Alan W. I. <ir...@be...> - 2005-03-01 02:41:24
|
On 2005-02-28 17:42-0700 R. V. Urvashi wrote: > Hi > > I'm using the C++ API for PLPLOT, and trying to use "GetCursor" to record > the world co-ordinates and subwindow index from a cursor event. Following > this event, I need to 'advance' to the chosen subwindow, and overlay a > plot. This entire process needs to be done repeatedly. > > Given a valid subwindow 'n', I am able to get the overlay plot on the > correct subwindow by doing the following > > pls->adv(n) > pls->vpor(...) > pls->wind(...) > ...plot > > However, when this is put into a loop and done repeatedly, the > 'subwindow' member returned via GetCursor does NOT always have the correct > subwindow index. Could someone please tell me if I'm missing something, or > if this could this be a bug ? The underlying C plGetCursor ultimately calls plcalc_world to get all the required information. That latter routine is documented at http://plplot.sourceforge.net/docbook-manual/plplot-html-5.3.1/plcalc_world.html. Note, the documentation there of the returned window index. You may be violating one of the many documented assumptions in obtaining that index. Also, please look at http://plplot.sourceforge.net/docbook-manual/plplot-html-5.3.1/viewport_window.html for an explanation of the hierarchy of viewing surfaces, (sub-)pages, viewports, and windows. I believe your above logic should work if you create sub-pages with plssub (note in CVS I have just changed that documentation to refer to the proper subpage term rather than sub-window) with one viewport and corresponding window on each, and if you mouse click _inside_ the viewport/window and not in the outer areas where the text labels go which is outside the viewport/window for the subpage. If after this explanation and reading the documentation you are still having difficulty understanding the results from GetCursor, try as a simple test calling calc_world, the C++ wrapped version of plcalc_world using appropriate relative device coordinate that are inside/outside the window of each sub-page. What window indices are returned by such an experiment? If you are not getting the indices you expect from that experiment, please post the complete simple test code here. Alan __________________________ Alan W. Irwin email: ir...@be... phone: 250-727-2902 Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ |