[Chameleon] Locate widget and JSAPI - samples don't work
Deschamps,Paul [NCR]
Paul.Deschamps at ec.gc.ca
Wed Nov 9 12:40:22 EST 2005
Thank you Bart those are some useful functions.
To resolve this issue we were having I mainly added one line of code in the locateCB function to post the form after it
populates the form variables. Seems to work well for our purposes right now.
Doing it with the examples you have show would be a more "keeping with the whole jsapi" way of doing things and a better way to accomplish it, without posting the form.
However we are moving forward squishing bugs, time is of the essence. So if we have time I would like to implement "this true JSAPI way" at a later date.
I will definitely keep these functions handy, very nice.
Thanks a lot.
Paul D.
Paul Deschamps, UI Design / Graphic Artist
Integrated Environmental Applications Branch / Direction des Applications Environnementales Intégrés
Knowledge Integration Directorate / Direction générale de l'integration du savoir
Environment Canada / Environnement Canada
70 Crémazie, 7th Floor / 7e étage
Gatineau, Québec K1A 0H3
Tel / Tél: (819) 934-2986
E-mail / Courriel: Paul.Deschamps at ec.gc.ca
-----Original Message-----
From: Bart van den Eijnden [mailto:BEN at Syncera-ITSolutions.NL]
Sent: Wednesday, November 09, 2005 2:56 AM
To: pspencer at dmsolutions.ca; Pagurek,Debbie [NCR]; Bart van den Eijnden
Cc: Deschamps,Paul [NCR]; chameleon at lists.maptools.org
Subject: Re: [Chameleon] Locate widget and JSAPI - samples don't work
I forgot to copy and paste a helper function (note it has assumptions for my situation):
function CWCCalculateExtent(CenterX, CenterY, MapWidth, MapHeight, Scale) {
// assumes map units are METERS and resolution is 72 in mapserver C code
var WidthX = (Scale*MapWidth)/(72*39.3701);
var WidthY = (Scale*MapHeight)/(72*39.3701);
MinX = CenterX-(WidthX/2);
MaxX = CenterX+(WidthX/2);
MinY = CenterY-(WidthY/2);
MaxY = CenterY+(WidthY/2);
return MinX + "," + MinY + "," + MaxX + "," + MaxY;
}
Best regards,
Bart
Bart van den Eijnden
Syncera IT Solutions
Postbus 270
2600 AG DELFT
tel.nr.: 015-7512436
email: BEN at Syncera-ITSolutions.nl
>>> "Bart van den Eijnden" <BEN at syncera-itsolutions.nl> 11/09/05 8:36 AM
>>> >>>
Paul, Debbie,
I have a got a similar widget as the Locate working in JSAPI mode. I use the following javascript:
function CWCZoomToBox(coordinates, zoomscale)
{
CWCDHTML_ShowLayer("ActivityLayer");
var xmin, ymin, xmax, ymax;
var arCoordinates = coordinates.split(" ");
var arLowerLeft = arCoordinates[0].split(",");
var arUpperRight = arCoordinates[1].split(",");
var center_x = (parseInt(arUpperRight[0])+parseInt(arLowerLeft[0]))/2;
var center_y = (parseInt(arUpperRight[1])+parseInt(arLowerLeft[1]))/2;
var map_width = goCWCJSAPI.oMap.width;
var map_height = goCWCJSAPI.oMap.height;
aHiddenVars = new Array(3);
aHiddenVars[0] = new Array(2);
aHiddenVars[0][0] = "NAV_CMD";
aHiddenVars[0][1] = "ZOOM_BBOX";
aHiddenVars[1] = new Array(2);
aHiddenVars[1][0] = "NAV_INPUT_TYPE";
aHiddenVars[1][1] = "RECTANGLE";
aHiddenVars[2] = new Array(2);
aHiddenVars[2][0] = "NAV_INPUT_COORDINATES";
aHiddenVars[2][1] = CWCCalculateExtent(center_x, center_y, map_width, map_height, zoomscale);
goCWCJSAPI.CallServer("goCWCJSAPI.MapExtentsUpdated()", aHiddenVars);
return true;
}
Hope this helps.
Best regards,
Bart
Bart van den Eijnden
Syncera IT Solutions
Postbus 270
2600 AG DELFT
tel.nr.: 015-7512436
email: BEN at Syncera-ITSolutions.nl
>>> Paul Spencer <pspencer at dmsolutions.ca> 11/09/05 3:47 AM >>>
Debbie,
it seems likely that the locate widget was never designed to work in
JSAPI mode from what you are describing ... Your choices at this
point are limited, if you can implement the necessary changes to make
it work in JSAPI mode then I will see that they make it into CVS ...
Cheers
Paul
On 8-Nov-05, at 4:11 PM, Pagurek,Debbie [NCR] wrote:
> We've narrowed down this problem to the LocateCB function... It
> appears that there is no JSAPI call to refresh the map image
> once the
> opener gets the geographic coordinates from the Locate Pop up.
>
> So how do we get the map image to refresh zoomed in to the selected
> Location?
>
> Thanks in advance,
> D. Pagurek
>
> -----Original Message-----
> From: chameleon-bounces at lists.maptools.org
> [mailto:chameleon-bounces at lists.maptools.org] On Behalf Of
> Pagurek,Debbie [NCR]
> Sent: Tuesday, November 08, 2005 11:46 AM
> To: chameleon at lists.maptools.org
> Subject: [Chameleon] Locate widget and JSAPI - samples don't work
>
>
>
> Is there anything special that has to be done with the locate
> widget for
> it to work when the JSAPI is enabled? I checked the chameleon
> Samples -
> Enhanced Sample using the JSAPI mode and it doesn't appear to be
> working
> there either. The actual query to the locate services works fine.
> By not
> working I mean that the map doesn't get updated or get zoomed in when
> the Apply button is clicked.
>
> Does anyone have a working example of LOCATE widget with JSAPI?
>
> D. Pagurek
>
> -----Original Message-----
> From: chameleon-bounces at lists.maptools.org
> [mailto:chameleon-bounces at lists.maptools.org] On Behalf Of Bart van
> den
> Eijnden
> Sent: Tuesday, November 08, 2005 2:02 AM
> To: Pagurek,Debbie [NCR]; chameleon at lists.maptools.org
> Subject: Re: [Chameleon] Locate widget on netscape problem
>
>
> Hi Debbie,
>
> errors which are written in HTML directly are somehow handled
> differently by Firefox or IE. I always notice it when I do some
> debugging with echo's in php, in IE I won't see them most of the time
> until I view the HTML source, probably since they could be before or
> after the <html> begin and end tags.
>
> The widget code needs to be changed for this. In the InitDefaults
> of the
> Locate widget, parent::InitDefaults should be called as the first
> line.
> I would suggest filing a bug as well, after first checking in the
> current CVS file has the same problem.
>
> function InitDefaults()
> {
> parent::InitDefaults();
>
> Hope this helps.
>
> Best regards,
> Bart
>
> Bart van den Eijnden
> Syncera IT Solutions
> Postbus 270
> 2600 AG DELFT
>
> tel.nr.: 015-7512436
> email: BEN at Syncera-ITSolutions.nl
>>>> "Pagurek,Debbie [NCR]" <Debbie.Pagurek at ec.gc.ca> 11/07/05 9:22 PM
>>>>>>>
> Hi all,
> We've been testing our app in different browsers and we're seeing a
> problem in Netscape (7.0 is what I'm testing right now) in the locate
> widget. The postal code or placename seems to be found ok because a
> list
> of places is provided, but the following error appears next to the
> list:
>
> ERROR 1: ERROR: InitDefaults didn't call base class InitDefaults in
> widget locate
>
> And then of course when you click on Apply or OK, the map appears
> to be
> trying to do something (the "please wait" notice appears) but the map
> doesn't get updated with a point and it doesn't zoom in.
>
> Can anyway suggest what the problem might be?
>
> The locate widget is working just fine in IE and Mozilla.
>
> Thanks in advance,
> D. Pagurek
>
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
>
>
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
>
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
>
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
+-----------------------------------------------------------------+
|Paul Spencer pspencer at dmsolutions.ca |
+-----------------------------------------------------------------+
|Applications & Software Development |
|DM Solutions Group Inc http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+
_______________________________________________
Chameleon mailing list
Chameleon at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/chameleon
_______________________________________________
Chameleon mailing list
Chameleon at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/chameleon
More information about the Chameleon
mailing list