[Chameleon-dev] [Bug 1073] Scale widget does not have a JSAPI mode
of operation
bugzilla-daemon at bugzilla.maptools.org
bugzilla-daemon at bugzilla.maptools.org
Sat Jun 4 14:08:47 EDT 2005
http://bugzilla.maptools.org/show_bug.cgi?id=1073
bartvde at xs4all.nl changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |BEN at syncera-itsolutions.nl
------- Additional Comments From bartvde at xs4all.nl 2005-06-04 14:08 -------
Okay, I finally managed to tackle this and get it to work.
But since I am not 100% sure this is the best solution, I would like some
feedback from Paul/Julien before committing this.
I changed:
1) Scale.widget.php:
KeyPressed function:
if ($bCWCJSAPI)
{
CWCZoomToScale({$this->mszHTMLForm}.SCALE.value);
}
else
{
// clear the navigation form
{$this->mszHTMLForm}.NAV_CMD.value = '';
{$this->mszHTMLForm}.UPDATE_MAP.value = "1";
{$this->mszHTMLForm}.submit();
}
2)
cwcjsapi.js
Added function CWCZoomToScale:
function CWCZoomToScale(scale)
{
aHiddenVars = new Array(2);
aHiddenVars[0] = new Array(2);
aHiddenVars[0][0] = "ZOOM_TO_SCALE";
aHiddenVars[0][1] = "1";
aHiddenVars[1] = new Array(2);
aHiddenVars[1][0] = "ZOOM_SCALE";
aHiddenVars[1][1] = scale;
goCWCJSAPI.oMap.oApplication.CallServer("goCWCJSAPI.MapExtentsUpdated()",aHiddenVars);
return true;
}
3) changed UpdateMap.php, added the following:
if (isset( $HTTP_FORM_VARS["ZOOM_TO_SCALE"]) &&
$HTTP_FORM_VARS["ZOOM_TO_SCALE"] != "")
{
$oMap = $oMapSession->oMap;
if (isset($HTTP_FORM_VARS["ZOOM_SCALE"]))
$szScale = $HTTP_FORM_VARS["ZOOM_SCALE"];
{
$nCenterX = ($oMap->extent->minx+$oMap->extent->maxx)/2;
$nCenterY = ($oMap->extent->miny+$oMap->extent->maxy)/2;
$inchesPerUnit = array(1, 12, 63360.0, 39.3701, 39370.1, 4374754);
$nWidthX =
($szScale*$oMap->width)/($oMap->resolution*$inchesPerUnit[$oMap->units]);
$nWidthY =
($szScale*$oMap->height)/($oMap->resolution*$inchesPerUnit[$oMap->units]);
$nMinX = $nCenterX-($nWidthX/2);
$nMaxX = $nCenterX+($nWidthX/2);
$nMinY = $nCenterY-($nWidthY/2);
$nMaxY = $nCenterY+($nWidthY/2);
$oMap->extent->setExtent($nMinX, $nMinY, $nMaxX, $nMaxY);
$szFormContents .= BuildHTMLOutputMapExtentsChanged($oMap);
}
}
Ideas? Thoughts?
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
Please do NOT reply to this email, use the link above instead to
login to bugzilla and submit your comment. Any email reply to this
address will be lost.
More information about the Chameleon-dev
mailing list