[mapguide-users] Fusion - one AppDef many maps best approach?

Andy Morsell amorsell at spatialgis.com
Wed May 14 18:39:12 EDT 2008


Well, that was easier than I thought it would be.  To accomplish what I
specifically need anyway, which is to pass a MGOS map resource ID via a URL
parameter to Fusion and have it open that map in a given Fusion appDef.  

While researching this, I discovered an undocumented URL parameter called
mapid that was already in the code (ApplicationDefinition.js).  But, I'm not
sure what that is intended for, so I left it alone.   To make this work, I
edited the Fusion.Lib.ApplicationDefinition.Map class with the following
lines:

var paramMgMapResourceId = Fusion.getQueryParam('mgmapresourceid');
if (paramMgMapResourceId.length>0) {
         this.resourceId = paramMgMapResourceId;
}

So, if you pass a map resource ID at the URL, Fusion will pick that up and
use it instead of the one in the appDef file.  In my case, I actually
removed the contents of my ResourceId tag in the MapSet definition.  This
can be tested by making a copy of the Sheboygan map and calling it
Sheboygan_2 (make some changes to it so you can tell the difference between
it and the regular Sheboygan map).  Then, enter the following URL address
into your browser:

http://YOURSERVER:8008/mapguide/fusion/templates/mapguide/slate/index.html?m
gmapresourceid=Library://Samples/Sheboygan/Maps/Sheboygan_2.MapDefinition

This information with more detailed instructions has been entered into the
Fusion trac: http://trac.osgeo.org/fusion/ticket/65


Andy Morsell, P.E.
Spatial Integrators, Inc.
http://www.SpatialGIS.com

-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Mike Adair
Sent: Tuesday, May 13, 2008 1:02 PM
To: MapGuide Users Mail List
Subject: Re: [mapguide-users] Fusion - one AppDef many maps best approach?

Around line 532 of lib/ApplicationDefinition.js there is an over-ride of the
mapid by a query param.  You should be able to do something similar there,
or else just above that in the Fusion.Lib.ApplicationDefinition.Map where it
extracts the resourceId from the MapGroup.

Patches like this would be welcome.  Just create a ticket first and attach
the patch to it.

Mike

Andy Morsell wrote:
> Thanks for the MapMenu widget possibility.  That may work out okay 
> pointing to a library folder, and I'll have to figure out how to hide 
> the widget itself from the end-user.
>
> Yes, having a URL parameter that points to a mapResource would be perfect.
> I will look at modifying Fusion.  Any quick clues as to which Fusion 
> files I should start looking at?
>
> Thanks again.
>
>
> Andy
>
> -----Original Message-----
> From: mapguide-users-bounces at lists.osgeo.org
> [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Mike 
> Adair
> Sent: Tuesday, May 13, 2008 11:56 AM
> To: MapGuide Users Mail List
> Subject: Re: [mapguide-users] Fusion - one AppDef many maps best approach?
>
> Andy,
>
> Fusion doesn't support that use-case right now although you might be 
> able to look at the MapMenu widget to see if that might fit your 
> needs, or you may be able to customize it to suit. The MapMenu 
> supports loading a list of Map definitions from a MapGuide folder 
> resource, i.e point it at a MapGuide Library://some/folder and it will 
> enumerate all the MapDefinition items and list them in the menu.
>
> The other approach would be to modify Fusion to accept a 'mapResource' 
> URL parameter that would override the ResourceId pointer in a 
> MapGroup, in this case the <MapGroup><Map> element in AppDef would
represent a template.
>
> Mike
>
> Andy Morsell wrote:
>   
>> Hi,
>> I'm trying to use Fusion on a new project and still wrapping my head 
>> around everything.  I have a an application with potentially hundreds 
>> of map definitions in the MGOS repository.  I would like ONE Fusion 
>> ApplicationDefinition for the entire application.
>>
>> From what I understand  the map definition must be defined in the 
>> ApplicationDefinition.xml file in the MapSet tag, MapGroup container, 
>> Map tag.  Further, the MapGroup ID is then referenced by the MapWidget.
>>
>> To avoid having a huge and difficult to maintain 
>> ApplicationDefinition file with all of my maps, what would be the 
>> best approach for my needs?  The map will be determined by the 
>> application at run-time after the user logs in, and I need to then 
>> load the Fusion layout with that map (a MGOS map resource).  I see 
>> that the loadMap() method in the Fusion command API will do what I 
>> need, but the map definition must exist in the AppDef first.
>>
>> Any suggestions are greatly appreciated.  Thank you.
>>
>> Andy Morsell, P.E.
>> Spatial Integrators, Inc.
>> _http://www.SpatialGIS.com_
>>
>> ---------------------------------------------------------------------
>> -
>> --
>>
>> _______________________________________________
>> mapguide-users mailing list
>> mapguide-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>   
>>     
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
>   
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users




More information about the mapguide-users mailing list