[mapguide-users] fusion and javascript

Mark Pendergraft markp at Meadgilman.com
Wed Aug 20 12:27:40 EDT 2008


I have answered some of my own questions here.

Lines 253 and 321 in MapGuideViewerApi.js were continually breaking my code.  They were curly braces followed by a comma as part of the LineHandlers and RectangleHandlers classes  "},".  Both of those lines are the closing braces for the last functions in the class, and once I removed the commas following the two curly braces mentioned, everything compiled.
Also, I had to add a reference to fusion "var Fusion = window.top.Fusion" to the file.

I also have to reference a bunch of stuff to use the functions.  In order to use the DigitizePoint() function I had to reference:
Fusion.js
Map.js
Prototype.js
CanvasTool.js

And of course MapGuideViewerApi.js


Is anyone else having these problems calling MapGuideViewerApi functions in their application, or am I just doing something wrong?

-Mark P.

-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Mark Pendergraft
Sent: Monday, August 18, 2008 3:59 PM
To: mapguide-users at lists.osgeo.org
Subject: [mapguide-users] fusion and javascript

Hello All,
I’m having a lot of trouble with Fusion and javascript.  I am somewhat of a newb to fusion, so please bare with me.
I have a aspx page in the task pane which I have been adding some buttons with some javascript too, in order to test things out.
At this point, it appears that any call to a function defined in MapGuide.js (../fusion/mapguide/mapguide.js) won’t break my code.  For example “parent.document.getElementById('Map').widget.aMaps[0].drawMap();” would refresh the map.
However, any calls to MapGuideViewerApi.js will not work.
I have tried including it into my page, and I have also tried calling it in different fashion.
For example:
var Fusion = window.top.Fusion;
var map = Fusion.getWidgetById('Map');
map.Refresh();

Why won’t the MapGuideViewerApi.js functions work?  If they can’t be used, how do i zoom and digitize points?
Also, I mentioned that the mapguide.js functions work, yet setSelection does not.
I get the following error

Fusion Error:
WARNING: Exception occurred in AJAX callback.
[object Error]
Location: {1} ({2})
xx)

At this point, the functions I need to work in order for my code to function are:
setSelection
digitizePoint
digitizeRectangle

None of which work  
Any help or a push in the right direction would be greatly appreciated.

Setup:
MGOS 2.0.1
Fusion 1.0.6
Autodesk MapGuide Studio 2009
Using IIS, VB, and VS 2005 Pro


More information about the mapguide-users mailing list