Am 12.06.2009, 08:25 Uhr, schrieb Matti Picus <[email protected]>:

>  From their website "/SharpMap/ is an easy-to-use map rendering and
> display engine, including AJAX-
>
> powered ASP.Net UserControl and a WinForm 2.0 control."
>
> On the other hand, floatcanvas just works :),
>
> I have an wxPython application with live video in one Panel and a map in
> a FloatCanvas and the frame rate is acceptable. Now the project wants to
> move to csharp for the framework, but the under the SharpMap
> implementation the frame rate is way too low.
>
> How hard would it be to integrate a floatcanvas panel into a csharp
> application? What would be the best way to go about it? I have seen
> wx.Net and IronPython - neither seem to be able to actually call
> wxPython directly.

I'm assuming this is a desktop application and you don't need  
functionality like the ASP.Net UserControl.

There are different ways to do what you want I think. It depends a bit how  
interactive your map is. If it's something like your video shows a car  
driving and the map next to it shows a red dot representing the curent  
position of the car then you could do it like this:

Method 1:

1) Just make your fc application work as it is.
2) Add a method which retrieves the contents of yourCanvas._Buffer
3) Add a way of IPC between your C# and your python application (e.g.  
sockets)
4) Transfer the bitmap retrieved in 2) over IPC to your C# app for display
5) Add more methods so you C# app can tell the fc app to load a different  
map for instance

I don't know what the actual speed of this will be, it probably depends on  
the size of your map window. Very old machines probably can't do this too  
fast. As a bonus if you use sockets for IPC you can have a server  
streaming the data and multiple clients listening. Shared-memory IPC might  
save you some copies.

Method 2:

1) Add some kind of empty placeholder control where the map is supposed to  
be in your C# app
2) Make sure the float canvas panel always displays at the position and  
size of this placeholder control
3) Add some way of IPC to exchange information between both apps

This method has the advantage that you don't have to get and transfer the  
contents of the bitmap around which might slow things down a lot.

Method 3:

Maybe there is a way to make this work by directly integrating the fc app  
and .net into a single process. From what I read IronPython probably will  
refuse to load the wxPython dlls since they are not .net assemblies.
I don't know if you can embed python into .net or vice-versa in a  
different way. If this could be done, you could call the wx main loop  
step-by-step manually, just as the .net one.

-Matthias
_______________________________________________
FloatCanvas mailing list
[email protected]
http://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to