[fusion-users] fusion widget / invokeurl questions

Paul Spencer pspencer at dmsolutions.ca
Wed Mar 26 10:52:52 EDT 2008


Hi Larry,

any list is fine :)

I don't have a lot of answers for you on the InvokeUrl thing, its not  
really a concept that is a natural fit for Fusion but we tried to  
provide a version of it to make some existing ajax viewer things work  
more easily.  There are a few things that are broken with it though,  
in particular you can't pass the current selection in the same way  
because Fusion assumes the selection is on the server and you can  
restore it using

$sel = new MgSelection($map);
$sel->Open($resourceService, $mapName);

rather than using the XML base64 encoded version of the selection.   
Communication from javascript in the TaskPane to Fusion is somewhat  
complicated by the fact that it is an iframe (yuck) but you can  
probably look in fusion/widgets/BufferPanel for an example of how it  
works now.

For your specific example of quick view, Fusion has a tendency to be  
more javascript based so setting extent would happen client side  
rather than server side.  As a quick hack, I would do something like  
this in my HTML (where minx,miny,maxx,maxy are the actual extent  
values):

<select id="QuickView" name="QuickView" onchange="QuickViewOnChange()">
   <option value="minx,miny,maxx,maxy">Place 1</option>
   <!-- more options -->
</select>

and then in the javascript of my page, I would add:

function QuickViewOnChange() {
     var select = document.getElementById('QuickView');
     var opt = select.options[sel.selectedIndex];
     var extent = opt.value.split(',');
     for (var i=0; i<extent.length; i++) {
       extent[i] = parseFloat(extent[i]);
     }
     var map = Fusion.getWidgetById('map');
     map.setExtents(extent);
}

To encapsulate this as a widget would be relatively straight forward  
and then the widget could be added to a template and values for  
zooming could be configured in the ApplicationDefinition.

Building this widget could be a good tutorial for the Fusion wiki in  
fact - volunteers to attempt this?

Cheers

Paul

On 26-Mar-08, at 10:04 AM, larry white wrote:
> Not sure if this is the appropriate list for the following questions -
> maybe dev list?
>
> Perhaps I'm missing something obvious, but I'm having difficulty
> figuring out how to migrate custom tasks from a MapGuide ajaxviewer  
> app
> to a Fusion app - would like to create analogous widgets / InvokeUrl
> calls in Fusion.
>
> For example, a 'quick view'-type function, that contains a list of  
> links
> to places (click the link and the map will recenter and zoom to the
> point) or a geocoding function.
> MapGuide ajaxviewer uses the 'gotopoint.php' file to accomplish these
> things.
>
>
> I've gone through the code for most of the existing widgets, but can't
> find much that seems to helps me with Invoke URL calls.
> So, my initial questions:
>
> 1) Are there examples of InvokeURL usage? (I couldn't find any  
> examples
> in the widgets dir or in the documentation)
>
> 2) Is there an existing, similar file/widget that accomplishes the
> 'gotopoint.php' capability?
>
> 3) If it doesn't exist, where would one start in building such a  
> capability?
>   Should this be an 'InvokeURL' call?  a Widget?
>   How/where to build 'gotopoint' logic so that it can be used in
> multiple instances/widgets (eg., quick-view and geocoding)
>
> 4) How to communicate between task pane and map? how to pass
> javascript-y things between task pane and map using widgets and  
> InvokeURL
>    - which files to include
>    - what methods/functions/calls to use
>
>
> thanks in advance....
>
> -- larry white
>
> -- 
> -------------------------------------------
> Openflows Community Technology Lab, Inc.
> New York | Toronto | Montreal | Vienna
> http://openflows.com
> People are intelligent. Machines are tools.
> _______________________________________________
>
> _______________________________________________
> fusion-users mailing list
> fusion-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fusion-users


__________________________________________

    Paul Spencer
    Chief Technology Officer
    DM Solutions Group Inc
    http://www.dmsolutions.ca/



More information about the fusion-users mailing list