I dont know how zoom a point in fusion

4 messages Options
Embed this post
Permalink
miguel vasquez

I dont know how zoom a point in fusion

Reply Threaded More More options
Print post
Permalink
Hi all, i new in the list i try to do a zooming of a point in Mapguide
Open source but i cant do that i type a script in my app but it
zooming but dont int the point of i type. The script its the next.

function ZoomToPoint()
{
     var Fusion = window.top.Fusion;
     var oMap = Fusion.getMapByIndice(0);
     oMap.zoom(2.5637,78.2993, 10);
}

the error its when i click in the button that fire this function the
scale change but dont move to the point. The x and y valor its from
status bar display this valor.

my web app.

http://200.48.28.8:8008/mapguide/msssig/SIGFrmPrincipal.jsp its my
first application. In opcion in task panel "Nombre de vía" type
benavides and the result has a button in the final page when click
show the problem.

PD. sorry for my english i am latinamerican.

Atte
Miguel Vasquez
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Tómas Guðmundsson

FW: I dont know how zoom a point in fusion

Reply Threaded More More options
Print post
Permalink
Forgot to include the list.

-----Original Message-----
From: Tómas Guðmundsson
Sent: 10. júlí 2008 08:26
To: 'Miguel Vasquez'
Subject: RE: [fusion-users] I dont know how zoom a point in fusion

Hi Miguel.

I understand your problem. What I did to zoom in and move to the point
Is that I created a box (extents) around the point I want to zoom in to.
This is shown in CenterSelection.js I think and here is how I did it.

var lowerLeftX = x - 100;
var lowerLeftY = y - 100;
var upperRightX = x - (-100); // This is a hack for when the result of x + 100 equals in a string
var upperRightY = y - (-100); // due to wrong type coersion by javascript.
this.getMap().setExtents(new OpenLayers.Bounds(lowerLeftX, lowerLeftY, upperRightX, upperRightY));

You could just replace "this.getMap()" with your oMap variable. Somehow,
and I don't know why, but Bounds function could not accept upperRightX and
Y when I did "x + 100" because then it turned out to be a string, according
to Firebug, which is very weird but this little hack does the trick. Hope
this helps.

Regards,
Tómas.

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Miguel Vasquez
Sent: 9. júlí 2008 19:18
To: [hidden email]
Subject: [fusion-users] I dont know how zoom a point in fusion

Hi all, i new in the list i try to do a zooming of a point in Mapguide
Open source but i cant do that i type a script in my app but it
zooming but dont int the point of i type. The script its the next.

function ZoomToPoint()
{
     var Fusion = window.top.Fusion;
     var oMap = Fusion.getMapByIndice(0);
     oMap.zoom(2.5637,78.2993, 10);
}

the error its when i click in the button that fire this function the
scale change but dont move to the point. The x and y valor its from
status bar display this valor.

my web app.

http://200.48.28.8:8008/mapguide/msssig/SIGFrmPrincipal.jsp its my
first application. In opcion in task panel "Nombre de vía" type
benavides and the result has a button in the final page when click
show the problem.

PD. sorry for my english i am latinamerican.

Atte
Miguel Vasquez
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Paul Deschamps

Re: FW: I dont know how zoom a point in fusion

Reply Threaded More More options
Print post
Permalink
forgot to include the list :)

You can use parseFloat() js function as well. ;)

function zoomToExtents(minx,miny,maxx,
maxy) {
    var a = [];
    a[0] = parseFloat(minx);
    a[1] = parseFloat(miny);
    a[2] = parseFloat(maxx);
    a[3] = parseFloat(maxy);
 
    var mapWidget = Fusion.getMapById('mapArea');
    var maps = mapWidget.getAllMaps();
    var map = maps[0];
 
    map.mapWidget.setExtents(new OpenLayers.Bounds(a[0], a[1], a[2],  a[3]));
}

Cheers

Paul D.


On Fri, Jul 11, 2008 at 9:04 AM, Tómas Guðmundsson <[hidden email]> wrote:
Forgot to include the list.

-----Original Message-----
From: Tómas Guðmundsson
Sent: 10. júlí 2008 08:26
To: 'Miguel Vasquez'
Subject: RE: [fusion-users] I dont know how zoom a point in fusion

Hi Miguel.

I understand your problem. What I did to zoom in and move to the point
Is that I created a box (extents) around the point I want to zoom in to.
This is shown in CenterSelection.js I think and here is how I did it.

var lowerLeftX = x - 100;
var lowerLeftY = y - 100;
var upperRightX = x - (-100); // This is a hack for when the result of x + 100 equals in a string
var upperRightY = y - (-100); // due to wrong type coersion by javascript.
this.getMap().setExtents(new OpenLayers.Bounds(lowerLeftX, lowerLeftY, upperRightX, upperRightY));

You could just replace "this.getMap()" with your oMap variable. Somehow,
and I don't know why, but Bounds function could not accept upperRightX and
Y when I did "x + 100" because then it turned out to be a string, according
to Firebug, which is very weird but this little hack does the trick. Hope
this helps.

Regards,
Tómas.

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Miguel Vasquez
Sent: 9. júlí 2008 19:18
To: [hidden email]
Subject: [fusion-users] I dont know how zoom a point in fusion

Hi all, i new in the list i try to do a zooming of a point in Mapguide
Open source but i cant do that i type a script in my app but it
zooming but dont int the point of i type. The script its the next.

function ZoomToPoint()
{
    var Fusion = window.top.Fusion;
    var oMap = Fusion.getMapByIndice(0);
    oMap.zoom(2.5637,78.2993, 10);
}

the error its when i click in the button that fire this function the
scale change but dont move to the point. The x and y valor its from
status bar display this valor.

my web app.

http://200.48.28.8:8008/mapguide/msssig/SIGFrmPrincipal.jsp its my
first application. In opcion in task panel "Nombre de vía" type
benavides and the result has a button in the final page when click
show the problem.

PD. sorry for my english i am latinamerican.

Atte
Miguel Vasquez
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users


_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
gingerbbm

Re: FW: I dont know how zoom a point in fusion

Reply Threaded More More options
Print post
Permalink
This thread saved my sanity!

I wanted the map to recentre at the point being plotted but was having all sorts of grief. The parseFloat() function was required, i.e.

var extent = this.mapWidget.getExtentFromPoint(parseFloat(x), parseFloat(y), scale);
this.mapWidget.setExtents(extent);