[mapguide-users] parent.parent.parent.mapFrame - AJAX vs FUSION

Fraser Burgess fburgess at lakelandenergy.com
Tue Sep 15 15:39:57 EDT 2009


Hi List,

 

I'm making steady progress with my project and learning many things
about MapGuide along the way thanks largely to the help from those on
this list - many thanks to those who have helped so far

 

>From what I can tell parent.parent.parent.mapFrame is how the map frame
is referenced from the task pane in the AJAX viewer.  I have been
reading posts about how this is referenced in Fusion and it seems the
MapGuideViewerAPI.js file has a bit of info.  Unfortunately I'm having a
bit if trouble putting the pieces together and was hoping that someone
here may steer me in the right direction.

 

In both AJAX and FUSION I'm working from the taskpane and using the
markup scripts that are part of the AJAX demo's and tutorials.

 

I assume I need to substitute either 'Fusion' or 'window.top.Fusion'
somehow for
'parent.parent.parent.mapFrame.DigitizePoint(OnPointDigitized);'. in my
script however I have yet to do this in such a way that it works.  I
keep getting 'Object doesn't support this property or method'.

 

So for example in my editmarkup.aspx code for example, I have the
following function which should be activated when I click the digitize
point button

 

            function AddPoint()

            {

                  SetDigitizeInfo(EDIT_POINT_HELP);

 
parent.parent.parent.mapFrame.DigitizePoint(OnPointDigitized);

            }

 

In Fusion this code gives an error 'parent.parent,parent.mapFrame' is
null or not an object

 

I see that in MapGuideViewerAPI.js

 

function DigitizePoint(handler) {

    if (handler) {

      var Fusion = window.top.Fusion;

      var mapWidget = Fusion.getWidgetById(mapWidgetId);

      var digitizer = new Fusion.Tool.Canvas.Point(mapWidget);

      digitizer.mouseUp = PointHandlers.prototype.mouseUp;

      Object.inheritFrom(digitizer, Fusion.Tool.Canvas.prototype, []);

      digitizer.initializeCanvas();

      var activeWidget = mapWidget.buttonSet.activeButton;

      mapWidget.buttonSet.setActiveButton(null);

      digitizer.handler = function() {

          handler.apply(null, arguments);

          activeWidget.setActive(true);

      }

      digitizer.activateCanvas();

      

      //add a listener to update the position of the features

      var mapWidget = Fusion.getWidgetById(mapWidgetId);

      mapWidget.registerForEvent(Fusion.Event.MAP_EXTENTS_CHANGED, 

        function(){

          digitizer.updatePx();

          digitizer.clearContext();

          digitizer.draw(digitizer.context);

        }

      );

    }

}

 

Thanks

Fraser

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20090915/bd58408b/attachment.html


More information about the mapguide-users mailing list