Intergrating DWF Viewer of MapGuide Enterprise 2009 into Windows Forms

10 Messages Forum Options Options
Embed this topic
Permalink
Carl Jokl
Intergrating DWF Viewer of MapGuide Enterprise 2009 into Windows Forms
Reply Threaded More
Print post
Permalink

I have a task in migration of a Windows Forms based Application which embeds
the DWF Viewer of MapGuide 6. The Migration is basically just to swap out
the MapGuide 6 DWF Viewer ActiveX Control and instead replace it with the
MapGuide Enterprise 2009 DWF Viewer ActiveX control. I am having some
difficulty in this due to working slightly blind on this without complete
documentation on how to do something like this. I am using the
EMapViewer.dll library and examining the classes within it but am not
certain that this is the correct library or whether this library has other
dependencies (though that I may be able to check with a dependency walker
utility). I manage to create an instance of the CEmapViewerClass which I am
guessing is what should be instantiated. I need to point this to a map
though and tried using the NavigateTo method to supply the URL to be used.
This action threw a COM Exception which I think may be due to no map being
loaded (though this is what I am trying to do anyway). I am able to see some
of the internal state of the viewer as I have turned on native debugging.

Item 1 which I need to get working is getting the Map Viewer to load a map
at a given URL.

My second problem is that as this application is Windows Forms based (ableit
written in C# .Net) I need to be able to cast the ActiveX control to be some
kind of component which can be added to a form as well as do things like set
the position and size and docking etc.

Item 2 be able to use DWF ActiveX control as Windows Forms Component.

I could be going about this whole process wrongly but I am somewhat working
blind at the moment without guidence. I have a document about the DWF Viewer
API which shows me the methods available and events and some coverage of
what the classes are. The guide I have is not detailed enough to cover items
1 and 2 which I am trying to figure out. I am aware that the DWF Viewer has
wider scope usage than MapGuide alone and can be intergrated in many types
of applications. I have looked a bit on Autodesks site for documentation.
There is some but it can be patchy. For example when I try and download code
examples some deny access another one was a zip download file 0 bytes in
size. I would appreciate any help anyone may be able to provide.
--
View this message in context: http://www.nabble.com/Intergrating-DWF-Viewer-of-MapGuide-Enterprise-2009-into-Windows-Forms-tp19196339p19196339.html
Sent from the MapGuide Internals mailing list archive at Nabble.com.

_______________________________________________
mapguide-internals mailing list
mapguide-internals@...
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
Kenneth Skovhede, GEOGRAF A/S
Re: Intergrating DWF Viewer of MapGuide Enterprise 2009 into Windows Forms
Reply Threaded More
Print post
Permalink
I have not tried to do this with the DWF viewer, but have done it with
the MapGuide 6.5 viewer.

If you look at the DWFViewer html files for MapGuide, you should be able
to find the GUID of the desired class (the map viewer).
With this GUID, you can search the registry to find the name of the
component.

In Visual Studio, you can pick the component, by adding a reference, and
selecting it on the "COM" tab.
If you found the right class, it will generate a wrapper assembly that
is also a .Net control.
You can then add the control as a normal control.
You should also be able to see the properties for the control.

There is also a tool to generate the assembly outside of Visual Studio,
but I can't remember its name.

Regards, Kenneth Skovhede, GEOGRAF A/S



Carl Jokl skrev:

> I have a task in migration of a Windows Forms based Application which embeds
> the DWF Viewer of MapGuide 6. The Migration is basically just to swap out
> the MapGuide 6 DWF Viewer ActiveX Control and instead replace it with the
> MapGuide Enterprise 2009 DWF Viewer ActiveX control. I am having some
> difficulty in this due to working slightly blind on this without complete
> documentation on how to do something like this. I am using the
> EMapViewer.dll library and examining the classes within it but am not
> certain that this is the correct library or whether this library has other
> dependencies (though that I may be able to check with a dependency walker
> utility). I manage to create an instance of the CEmapViewerClass which I am
> guessing is what should be instantiated. I need to point this to a map
> though and tried using the NavigateTo method to supply the URL to be used.
> This action threw a COM Exception which I think may be due to no map being
> loaded (though this is what I am trying to do anyway). I am able to see some
> of the internal state of the viewer as I have turned on native debugging.
>
> Item 1 which I need to get working is getting the Map Viewer to load a map
> at a given URL.
>
> My second problem is that as this application is Windows Forms based (ableit
> written in C# .Net) I need to be able to cast the ActiveX control to be some
> kind of component which can be added to a form as well as do things like set
> the position and size and docking etc.
>
> Item 2 be able to use DWF ActiveX control as Windows Forms Component.
>
> I could be going about this whole process wrongly but I am somewhat working
> blind at the moment without guidence. I have a document about the DWF Viewer
> API which shows me the methods available and events and some coverage of
> what the classes are. The guide I have is not detailed enough to cover items
> 1 and 2 which I am trying to figure out. I am aware that the DWF Viewer has
> wider scope usage than MapGuide alone and can be intergrated in many types
> of applications. I have looked a bit on Autodesks site for documentation.
> There is some but it can be patchy. For example when I try and download code
> examples some deny access another one was a zip download file 0 bytes in
> size. I would appreciate any help anyone may be able to provide.
>  
_______________________________________________
mapguide-internals mailing list
mapguide-internals@...
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
Carl Jokl
Re: Intergrating DWF Viewer of MapGuide Enterprise 2009 into Windows Forms
Reply Threaded More
Print post
Permalink
In reply to this post by Carl Jokl

I have got as far as having the EMapViewer component added to the Form. The
problem I am having I believe is an initialisaton error. The error I am
getting it that the component did not return a valid window reference
(HREF). My guess as to why this is happening is that the ActiveX component
is not being properly initialised and so when it is trying to be added to
the form it is not in a state where it has a valid windowing component to
return. I need to establish how the EMapViewer needs to be configured in
order to work. I have the Url of the server I want the viewer to point to.
It is not quite so straight forward determining the configuration as when
that has been working it has been managed partly by the browser. I can have
a look at the Object parameters in the page for some clues but if anyone has
experience of using the map viewer as a component in a Windows Forms
application who could tell me how the initialisation needs to be carried out
then it would help me out a great deal.

--
View this message in context: http://www.nabble.com/Intergrating-DWF-Viewer-of-MapGuide-Enterprise-2009-into-Windows-Forms-tp19196339p19198704.html
Sent from the MapGuide Internals mailing list archive at Nabble.com.

_______________________________________________
mapguide-internals mailing list
mapguide-internals@...
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
zspitzer
Re: Intergrating DWF Viewer of MapGuide Enterprise 2009 into Windows Forms
Reply Threaded More
Print post
Permalink
Carl,

what are the benefits you get from the DWF Viewer
over embedding a browser instance?

What am i missing out on in ajax land?

z

On Thu, Aug 28, 2008 at 9:33 PM, Carl Jokl <carl.jokl@...> wrote:

>
> I have got as far as having the EMapViewer component added to the Form. The
> problem I am having I believe is an initialisaton error. The error I am
> getting it that the component did not return a valid window reference
> (HREF). My guess as to why this is happening is that the ActiveX component
> is not being properly initialised and so when it is trying to be added to
> the form it is not in a state where it has a valid windowing component to
> return. I need to establish how the EMapViewer needs to be configured in
> order to work. I have the Url of the server I want the viewer to point to.
> It is not quite so straight forward determining the configuration as when
> that has been working it has been managed partly by the browser. I can have
> a look at the Object parameters in the page for some clues but if anyone
> has
> experience of using the map viewer as a component in a Windows Forms
> application who could tell me how the initialisation needs to be carried
> out
> then it would help me out a great deal.
>
> --
> View this message in context:
> http://www.nabble.com/Intergrating-DWF-Viewer-of-MapGuide-Enterprise-2009-into-Windows-Forms-tp19196339p19198704.html
> Sent from the MapGuide Internals mailing list archive at Nabble.com.
>
> _______________________________________________
> mapguide-internals mailing list
> mapguide-internals@...
> http://lists.osgeo.org/mailman/listinfo/mapguide-internals
>



--
Zac Spitzer -
http://zacster.blogspot.com (My Blog)
+61 405 847 168
_______________________________________________
mapguide-internals mailing list
mapguide-internals@...
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
Carl Jokl
Re: Intergrating DWF Viewer of MapGuide Enterprise 2009 into Windows Forms
Reply Threaded More
Print post
Permalink

We at the company I work for have considered the possibility of embedding a
browser in the future to use the AJAX viewer. At the moment the system we
are developing uses the DWF viewer due to performance. If you use the AJAX
viewer with something like the Sheboygan example which is just a few layers
and fairly simple then the performance is quite acceptable. For the system
we are using which has many layers and much larger volumes of data the AJAX
viewer becomes so slow it is practically unusable. AutoDesk are saying the
issues with the AJAX viewer are being worked on and hope to make it faster.
AutoDesk are solidly pushing the AJAX viewer. To compound this they are also
planning to stop supporting the DWF viewer. For all it's problems the DWF
Viewer is much much faster for large volumes of data than the AJAX viewer.
--
View this message in context: http://www.nabble.com/Intergrating-DWF-Viewer-of-MapGuide-Enterprise-2009-into-Windows-Forms-tp19196339p19201162.html
Sent from the MapGuide Internals mailing list archive at Nabble.com.

_______________________________________________
mapguide-internals mailing list
mapguide-internals@...
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
Maksim Sestic
RE: Intergrating DWF Viewer of MapGuideEnterprise 2009 into Windows Forms
Reply Threaded More
Print post
Permalink
Hi folks,

This is something I have to agree with. My company also runs few
large-volume apps still leaning on MapGuide 6.5  due to it's speed and
reliability. Corporate networks in general are closed, supervised
environments. It's much bigger chances that AJAX viewer won't work there
because of no-script policy, while signed ActiveX controls (i.e. DWF viewer)
pose no threat. Once again - it's all about speed (hundreds of layers,
terabytes of static maps) and reliability (MG server crashing may cost us
considerable amounts of money).

Regards,
Maksim Sestic
 

-----Original Message-----
From: mapguide-internals-bounces@...
[mailto:mapguide-internals-bounces@...] On Behalf Of Carl Jokl
Sent: Thursday, August 28, 2008 15:59
To: mapguide-internals@...
Subject: Re: [mapguide-internals] Intergrating DWF Viewer of
MapGuideEnterprise 2009 into Windows Forms


We at the company I work for have considered the possibility of embedding a
browser in the future to use the AJAX viewer. At the moment the system we
are developing uses the DWF viewer due to performance. If you use the AJAX
viewer with something like the Sheboygan example which is just a few layers
and fairly simple then the performance is quite acceptable. For the system
we are using which has many layers and much larger volumes of data the AJAX
viewer becomes so slow it is practically unusable. AutoDesk are saying the
issues with the AJAX viewer are being worked on and hope to make it faster.
AutoDesk are solidly pushing the AJAX viewer. To compound this they are also
planning to stop supporting the DWF viewer. For all it's problems the DWF
Viewer is much much faster for large volumes of data than the AJAX viewer.
--
View this message in context:
http://www.nabble.com/Intergrating-DWF-Viewer-of-MapGuide-Enterprise-2009-in
to-Windows-Forms-tp19196339p19201162.html
Sent from the MapGuide Internals mailing list archive at Nabble.com.

_______________________________________________
mapguide-internals mailing list
mapguide-internals@...
http://lists.osgeo.org/mailman/listinfo/mapguide-internals

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3395 (20080828) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

 

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3395 (20080828) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 

_______________________________________________
mapguide-internals mailing list
mapguide-internals@...
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
Walt Welton-Lair
RE: Intergrating DWF Viewer of MapGuide Enterprise 2009 into Windows Forms
Reply Threaded More
Print post
Permalink
In reply to this post by Kenneth Skovhede, GEOGRAF A/S
Carl,

With DWF Viewer you have an outer control - the ExpressViewer - and different inner controls (document handlers) - EPlotViewer, EMapViewer, etc.

You need to create an instance of the ExpressViewer, and then call its DocumentHandler property to get the inner EMapViewer control.  You'll also need to set the SourcePath before you can get the inner control.  That's because the ExpressViewer doesn't know what kind of DWF you are viewing until you set the SourcePath.  Once set it can read the first few bytes, determine the type of DWF, and instantiate the correct type of inner control.

The SourcePath in your case is a GETMAP HTTP request to the MapGuide server.  Use an HTTP sniffer to see examples of this request.  It will be something like:

<mapAgentLocation>?OPERATION=GETMAP
        &VERSION=1.0.0
        &DWFVERSION=6.01
        &EMAPVERSION=1.0
        &MAPDEFINITION=<mapDefinitionResource>
        &LOCALE=<2-letter-locale>

You can optionally include
        &SETVIEWCENTERX=<viewCenterX>
        &SETVIEWCENTERY=<viewCenterY>
        &SETVIEWSCALE=<viewScale>


Hopefully this is enough to point you in the right direction.

Walt

-----Original Message-----
From: mapguide-internals-bounces@... [mailto:mapguide-internals-bounces@...] On Behalf Of Kenneth Skovhede, GEOGRAF A/S
Sent: Thursday, August 28, 2008 5:52 AM
To: MapGuide Internals Mail List
Subject: Re: [mapguide-internals] Intergrating DWF Viewer of MapGuide Enterprise 2009 into Windows Forms

I have not tried to do this with the DWF viewer, but have done it with
the MapGuide 6.5 viewer.

If you look at the DWFViewer html files for MapGuide, you should be able
to find the GUID of the desired class (the map viewer).
With this GUID, you can search the registry to find the name of the
component.

In Visual Studio, you can pick the component, by adding a reference, and
selecting it on the "COM" tab.
If you found the right class, it will generate a wrapper assembly that
is also a .Net control.
You can then add the control as a normal control.
You should also be able to see the properties for the control.

There is also a tool to generate the assembly outside of Visual Studio,
but I can't remember its name.

Regards, Kenneth Skovhede, GEOGRAF A/S



Carl Jokl skrev:

> I have a task in migration of a Windows Forms based Application which embeds
> the DWF Viewer of MapGuide 6. The Migration is basically just to swap out
> the MapGuide 6 DWF Viewer ActiveX Control and instead replace it with the
> MapGuide Enterprise 2009 DWF Viewer ActiveX control. I am having some
> difficulty in this due to working slightly blind on this without complete
> documentation on how to do something like this. I am using the
> EMapViewer.dll library and examining the classes within it but am not
> certain that this is the correct library or whether this library has other
> dependencies (though that I may be able to check with a dependency walker
> utility). I manage to create an instance of the CEmapViewerClass which I am
> guessing is what should be instantiated. I need to point this to a map
> though and tried using the NavigateTo method to supply the URL to be used.
> This action threw a COM Exception which I think may be due to no map being
> loaded (though this is what I am trying to do anyway). I am able to see some
> of the internal state of the viewer as I have turned on native debugging.
>
> Item 1 which I need to get working is getting the Map Viewer to load a map
> at a given URL.
>
> My second problem is that as this application is Windows Forms based (ableit
> written in C# .Net) I need to be able to cast the ActiveX control to be some
> kind of component which can be added to a form as well as do things like set
> the position and size and docking etc.
>
> Item 2 be able to use DWF ActiveX control as Windows Forms Component.
>
> I could be going about this whole process wrongly but I am somewhat working
> blind at the moment without guidence. I have a document about the DWF Viewer
> API which shows me the methods available and events and some coverage of
> what the classes are. The guide I have is not detailed enough to cover items
> 1 and 2 which I am trying to figure out. I am aware that the DWF Viewer has
> wider scope usage than MapGuide alone and can be intergrated in many types
> of applications. I have looked a bit on Autodesks site for documentation.
> There is some but it can be patchy. For example when I try and download code
> examples some deny access another one was a zip download file 0 bytes in
> size. I would appreciate any help anyone may be able to provide.
>
_______________________________________________
mapguide-internals mailing list
mapguide-internals@...
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
_______________________________________________
mapguide-internals mailing list
mapguide-internals@...
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
Carl Jokl
RE: Intergrating DWF Viewer of MapGuide Enterprise 2009 into Windows Forms
Reply Threaded More
Print post
Permalink

It looks like in order to build the URL in the right format that the viewer
will expect I need to use some of the MapGuide api to establish a session
and pass the id of that session to the DWF Viewer. Would the MapGuide API
classes work when running on a client computer or do the MapGuide API
Classes only work when running on the same host as the MapGude Enterprise
server?
--
View this message in context: http://www.nabble.com/Intergrating-DWF-Viewer-of-MapGuide-Enterprise-2009-into-Windows-Forms-tp19196339p19216114.html
Sent from the MapGuide Internals mailing list archive at Nabble.com.

_______________________________________________
mapguide-internals mailing list
mapguide-internals@...
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
Carl Jokl
RE: Intergrating DWF Viewer of MapGuide Enterprise 2009 into Windows Forms
Reply Threaded More
Print post
Permalink



Carl Jokl wrote:
>
> It looks like in order to build the URL in the right format that the
> viewer will expect I need to use some of the MapGuide api to establish a
> session and pass the id of that session to the DWF Viewer. Would the
> MapGuide API classes work when running on a client computer or do the
> MapGuide API Classes only work when running on the same host as the
> MapGude Enterprise server?
>

Scratch that. I am not going to use the MapGuide classes in the client
application. I am going to add some functionality to a existing Http Handler
portal on the web server to do that for me. I can just get the client
application to communicate and authenticate via that and the portal will
return the mapguide session id as well as other details needed to form the
correct url
--
View this message in context: http://www.nabble.com/Intergrating-DWF-Viewer-of-MapGuide-Enterprise-2009-into-Windows-Forms-tp19196339p19216477.html
Sent from the MapGuide Internals mailing list archive at Nabble.com.

_______________________________________________
mapguide-internals mailing list
mapguide-internals@...
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
Kenneth Skovhede, GEOGRAF A/S
Re: Intergrating DWF Viewer of MapGuide Enterprise 2009 into Windows Forms
Reply Threaded More
Print post
Permalink
You might want to have a look at the Web API:
http://localhost/mapguide/mapagent/index.html

That page has test forms for most of the avalible Web API methods,
including CreateSession (it's under Others).

Using the .Net WebClient class, it is very easy to send a request that
mimics the form,
and reads out the sessionId.

If you want to skip some of the work, I have done so already in the
MaestroAPI (C# code):
http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI

This is the code you would use to create a session, and grab the ID:

' Create HttpServerConnection object with credentials enabling establishing a session
ServerConnectionI con = new HttpServerConnection(new Uri("http://server/mapguide/mapagent/mapagent.fcgi")
, "Administrator", "admin", "en", True);

'Grab the id
string sessionId = con.SessionID;


If the sessionId is your only worry, I think you can also pass the
querystring: "&USERNAME=Administratror&PASSWORD=admin" instead of the
session id.

Regards, Kenneth Skovhede, GEOGRAF A/S



Carl Jokl skrev:

>
> Carl Jokl wrote:
>  
>> It looks like in order to build the URL in the right format that the
>> viewer will expect I need to use some of the MapGuide api to establish a
>> session and pass the id of that session to the DWF Viewer. Would the
>> MapGuide API classes work when running on a client computer or do the
>> MapGuide API Classes only work when running on the same host as the
>> MapGude Enterprise server?
>>
>>    
>
> Scratch that. I am not going to use the MapGuide classes in the client
> application. I am going to add some functionality to a existing Http Handler
> portal on the web server to do that for me. I can just get the client
> application to communicate and authenticate via that and the portal will
> return the mapguide session id as well as other details needed to form the
> correct url
>  
_______________________________________________
mapguide-internals mailing list
mapguide-internals@...
http://lists.osgeo.org/mailman/listinfo/mapguide-internals