From: Eric W. <ewi...@sb...> - 2004-10-18 15:13:20
|
# The following was supposedly scribed by # Huub Peters # on Monday 18 October 2004 03:08 am: >The wxPython distribution has a little demo program called > "pySketch". This is where I got the basic drawing functions from. >I rewrote the whole thing in wxPerl and improved it to my needs. >Unfortunatly for you this does not show how to use zooming and > rotating so you have to figure that out yourself or wait till I > have created something usefull to release. Yes, I've gotten that far. The trouble is, it looks like I would have to implement the zooming directly in my perl code by scaling the canvas contents. I'm dealing with sizable amounts of cad data here, so scaling 1000 items per mouse-wheel-roll with perl code is going to get very cpu intensive very quickly. Ok, so can anyone explain this to me? Here is the wx doc: wxDC::SetUserScale void SetUserScale(double xScale, double yScale) Sets the user scaling factor, useful for applications which require 'zooming'. That seems to imply that it would have a functionality similar to that of the Tk canvas: $canvas->scale(tagOrId, xOrigin, yOrigin, xScale, yScale) Rescale all of the items given by tagOrId in canvas coordinate space. XOrigin and yOrigin identify the origin for the scaling operation and xScale and yScale identify the scale factors for x- and y-coordinates, respectively (a scale factor of 1.0 implies no change to that coordinate). For each of the points defining each item, the x-coordinate is adjusted to change the distance from xOrigin by a factor of xScale. Similarly, each y-coordinate is adjusted to change the distance from yOrigin by a factor of yScale. This method returns an empty string. Is this not possible in Wx? The existence of the python wx.lib.floatcanvas implies that the answer is no. I was looking at Wx because I thought it might be able to give "free" text and image zooming (which Tk does not.) At this point, it looks like it doesn't even give free line/circle zooming. What would it take to make this happen in C++? Here's the code that I've been using to evaluate it. http://ericwilhelm.homeip.net/svn/CAD-Drawing/trunk/data/notes/wx-canvas.pl --Eric -- As an old bass player friend of mine used to say: throw money, don't clap. --Tony Parisi |