Hello,
here is my refactored code.
Has anyone other suggestions to further improve
the drawing code?
pan_test.py (12 KB)
Hello,
here is my refactored code.
Has anyone other suggestions to further improve
the drawing code?
pan_test.py (12 KB)
here is my refactored code.
Has anyone other suggestions to further improve
the drawing code?
It looks pretty good -- my one suggestion is that if you will want o
add other modes, i.e. different ways to interact with the canvas, then
you might want to factor that out -- that is, all your on Mouse*
methods should be replaceable.
Then again, what you'd be doing in that case is re-writing
FloatCanvas. It sometimes makes sense to use your own code that you
understand and does just what you need and no more, rather than use a
library that does more than you need, but if you are going to end up
re-writing 80% of FloatCanvas, I'd suggest you take another look! (and
I'd love to have someone else actively tweaking it!)
-Chris
So if you'
re prtty much done, then it make
On Sat, Mar 9, 2013 at 3:17 AM, Ralf Werner <ralfwerner71@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
I need Layer support for Gerber Drawings. Printed Circuit Boards are composed of 1 - XX cooper layers. Thats why i have to draw
more then one gerber image on top of another. These layers should be double bufferd to.
I want some sort of See Trough Thing. Thats mean i want to make the top layers transparent.
Next i need Hit Testing with control on wich visible layer an object is selected.
These are some keypoints.
I have no clue how to tweak floatcanvas to support the above operations and more to come. Floatcanvas code looks nice and clean compared to mine.
But I dont understand all the code of Floatcanvas.
I post the last version of my code. The idee was to only redraw the doublebuffer, when the picture has changed. Thats the case on
new data and when zoomed. The rest of the time the buffer is translatet and then blitted to the panel.
I changed some names compared to the original version, to clearly state whats the function or object is for.
pan_test.py (14.8 KB)
Am Montag, 11. März 2013 17:09:16 UTC+1 schrieb Chris Barker - NOAA Federal:
I’d suggest you take another look! (and
I’d love to have someone else actively tweaking it!)
I need Layer support for Gerber Drawings. Printed Circuit Boards are
composed of 1 - XX cooper layers. Thats why i have to draw
more then one gerber image on top of another. These layers should be double
bufferd to.
do you necessarily need to buffer each layer? I didn't do that with
FloatCanvas, because at the time I started writing it, wx was VERY
slow at drawing transparent bitmaps on top of each other -- i.e. is
was almost guaranteed to be faster to re-draw lots of objects than to
blit a transparent buffer. The situation may have changed -- wx should
do alpha blending more natively now. Worth some experiments.
I want some sort of See Trough Thing. Thats mean i want to make the top
layers transparent.
so you need either a transparent buffer (one with alpha, probably) or
have the concept of layers be virtual -- i.e. re-draw all the layers
when you need to re-draw. If you are clever about when you re-draw,
this is likely to be fine.
FloatCanvas does have a "foreground" layer -- this layer isn't
buffered, but rather re-draws even time, but it give you a way to put
fast-chaning stuff on top, and not have to re-render the whole
background. I use it for animations, and for updating the view as the
user moves things with the mouse, etc.
in FloatCanvas, that would probably be a Group object -- or you could
write your own layer type.
Next i need Hit Testing with control on wich visible layer an object is
selected.
These are some keypoints.
FC has that, but you'd have to manage the hit-able state of your objects.
I have no clue how to tweak floatcanvas to support the above operations and
more to come. Floatcanvas code looks nice and clean compared to mine.
But I dont understand all the code of Floatcanvas.
well, it may be easier to learn it that to re-write it -- and you'll
get at least some help from teh floatcanvas list (there are one or two
others than me that are likely to help out).
I post the last version of my code. The idee was to only redraw the
doublebuffer, when the picture has changed. Thats the case on
new data and when zoomed. The rest of the time the buffer is translated and
then blitted to the panel.
yup -- that's what double buffering is about.
By the way, I've got another project that doe similar things, suing
OpenGL for the rendering -- in that case, it's a) really fast, and b)
does compositing of multiple rasters really fast.
But OpenGL is a pain.
-Chris
On Wed, Mar 13, 2013 at 2:13 PM, Ralf Werner <ralfwerner71@gmail.com> wrote:
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
Interesting, on my systemL OS-X, python2.7, wxPython 2.8.12.1, all I
get is black.
with a quick look, I can't see what this problem is though.
-Chris
On Wed, Mar 13, 2013 at 2:13 PM, Ralf Werner <ralfwerner71@gmail.com> wrote:
I post the last version of my code. The idee was to only redraw the
doublebuffer, when the picture has changed. Thats the case on
new data and when zoomed. The rest of the time the buffer is translatet and
then blitted to the panel.
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
On my developing system Kubuntu 12.10, python2.7, wxPython 2.8.12.1 (gtk2-unicode)
everything works fine.
On my work place Windows XP, python2.7, wxPython2.8.?? the code is broken to.
A quick research shows that the platforms handle the Blit function a bit differently. Iam
set the axis orientation of the destination DC to natural orientation. The source DC is
left alone. On Kubuntu the source 0,0 coordinate is the top left corner, as it should be. On
Windows the source 0,0 coordinate is the bottom left corner. So is the drawing translatet
almost all out of the drawing area. A little bit of the drawing is visible at the top of the panel.
The next problem is, that on Windows the Panel doesnt receive the MouseWheel Events.
Maybe OS-X handles the Blit function like windows.
I make a workaround for the error.
Am Donnerstag, 14. März 2013 04:52:22 UTC+1 schrieb Chris Barker - NOAA Federal:
Interesting, on my systemL OS-X, python2.7, wxPython 2.8.12.1, all I
get is black.
A quick research shows that the platforms handle the Blit function a bit
differently.
you might try using DrawBitmap instead -- I don't think you need to
use blit here. Though under the hood they do about the same thing, so
maybe the same bug.
set the axis orientation of the destination DC to natural orientation. The
source DC is
left alone.
In FloatCanvas, I gave up on setting axis orientation or UserScale,
and did all the scaling, etc by hand (using numpy, so it's pretty
fast). That was because of these issues, and also even with UserScale,
it still expects coordinates as integers, to if the user's "natural"
coordinates were, for example, all from 0 to 1.0, it'
s pretty worthless. (NOTE: I think GraphicsContext is better in this regard)
The next problem is, that on Windows the Panel doesnt receive the MouseWheel
Events.
odd.
Maybe OS-X handles the Blit function like windows.
sounds like it.
By the way, I mentioned GraphicsContext above -- you may want to look
at that, and use it instead of DCS -- a bit klunkier to use for some
things, but more powerful and flexible (and maybe handle your multiple
transparent buffers better).
-Chris
On Thu, Mar 14, 2013 at 12:13 PM, Ralf Werner <ralfwerner71@gmail.com> wrote:
I make a workaround for the error.
--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
OK,
I couldn't help myself -- enclosed is a version of your pan_test.py,
implimented with FloatCanvas.
It looks like you were keeping the data model in GerberCanvas separate
from the wxPanel and drawing, so I did the same thing, but I'd
probably just make GerberCanvas a Panel, probably a sub-class of
FloatCanvas.
Also, you've got three sets of 1833 objects each in this example -- if
you are drawing tha many things, you aren't going to see them all when
zoomed out, so one way to speed things up is to have zoom-dependent
rendering with FC, some of the objects have a MinSize and
DisappearWhenSmall attribute, so you dont' draw the really small
stuff. You could also do some smart culling of data when zoomed out.
That being said, on my machine, it's actually plenty fast with this example.
-Chris
fc_pan_test.py (3.61 KB)
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Hello,
The next problem is, that on Windows the Panel doesnt receive the MouseWheel
Events.
This is the case after click on the MakeNewDataButton. The Button has the focus.
In the onClick Routine the Focus must be set back to the panel.
Yesterday on Windows7 i am hit another error. My oneshot RedrawTimer doesent expire and
i have no idee why.
I couldn’t help myself – enclosed is a version of your pan_test.py,
implimented with FloatCanvas.
Ok. I will have a deeper look at floatcanvas and will try to implement something.
At first maybe another zoom operation. When iam succeed i post the
code on the floatcanvas mailing list.