Infrastructure Map Server General Discussion

Infrastructure Map Server General Discussion

Reply
Member
4 Posts
0 Kudos
Registered: ‎04-11-2012
Post 1 of 2
Accepted Solution

"Flexible Web Layout Example 2: Selections" generates error

989 Views, 1 Replies
02-28-2013 02:18 AM

Hi,

 

I'm testing "Example 2: Selections" in the "Flexible Web Layout Examples":

 

http://wikihelp.autodesk.com/Infr._Map_Server/enu/2013/Help/0005-Develope0/0105-Flexible105/0112-Exa...

 

Testing the Example2.js provided, a javascript error is generated on the following line:

 

var oSelection = selection[theMap.getMapName()];

The error generated is:

 

Fusion Error:
WARNING: Exception occurred in AJAX callback.
Message: getMapName is not a function

 

The same code appears in 

 

http://wikihelp.autodesk.com/Infr._Map_Server/enu/2013/Help/0005-Develope0/0094-Flexible94/0100-Work...

 

What is the correct code for working with selections?

 

Kind regards,
Dave.

Oh dear! Someone changed the API and failed to document this!

 

Anyway, here's how you can get the map name.

 

//Gets the MapGuide map name from the map widget
//
//theMap: The Fusion.Widget.Map instance
function getMapName(theMap) {
//subMaps will be an array of Fusion.Layers instances (of which Fusion.Layers.MapGuide is a subclass of) var subMaps = theMap.getAllMaps(); for (var i = 0; i < subMaps.length; i++) { if (subMaps[i].arch == "MapGuide") { //Is a Fusion.Layers.MapGuide object return subMaps[i].getMapName(); //Map name is here } } return null; }

Unless you have some strange multi-map setup, the subMaps array will generally have at most one Fusion.Layers.MapGuide instance, so you just find that instance (using the .arch property to determine the correct sub-type) and get the map name from that instance.

 

 - Jackie

Valued Mentor
284 Posts
24 Kudos
Registered: ‎10-06-2008
Post 2 of 2

Re: "Flexible Web Layout Example 2: Selections" generates error

03-03-2013 04:41 PM in reply to: dajvid

Oh dear! Someone changed the API and failed to document this!

 

Anyway, here's how you can get the map name.

 

//Gets the MapGuide map name from the map widget
//
//theMap: The Fusion.Widget.Map instance
function getMapName(theMap) {
//subMaps will be an array of Fusion.Layers instances (of which Fusion.Layers.MapGuide is a subclass of) var subMaps = theMap.getAllMaps(); for (var i = 0; i < subMaps.length; i++) { if (subMaps[i].arch == "MapGuide") { //Is a Fusion.Layers.MapGuide object return subMaps[i].getMapName(); //Map name is here } } return null; }

Unless you have some strange multi-map setup, the subMaps array will generally have at most one Fusion.Layers.MapGuide instance, so you just find that instance (using the .arch property to determine the correct sub-type) and get the map name from that instance.

 

 - Jackie

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!