[ka-Map-users] Re: Zoom tool

Paul Spencer pspencer at dmsolutions.ca
Thu May 18 07:48:12 EDT 2006


Lorenzo,

what do you think about incorporating this tool into the standard  
interface?  I'd rather you make the changes :)

Cheers

Paul

On 18-May-06, at 1:32 AM, Wei Yang, Ng - Wayne wrote:

> Hi Paul,
> The kaZoomOnClick tool has been written. I also noticed a slight  
> switchMode problem in startUp.js. Omitting either the query or pan  
> tool will cause the code to break. This has been fixed as well.  
> Just look for my name in startUp.js
> I have written the new zoom tool in a separate file  
> (kaZoomOnClick.js) to avoid confusion. Your sample code uses  
> this.startx and this.starty to get pixel coordinates. For some  
> unknown reason, I get null values for the two variables. (my query  
> tool isn't working right) Therefore I extracted x and y from  
> e.pageX and e.pageY which I believe is safer but lengthier.
> I am sending the files to you and I will try to find the cause of  
> the error in kaQuery.js
>
> Cheers,
> Wayne
>
> Paul Spencer wrote:
>> Wayne,
>>
>> you are correct, there is no tool to zoom at the point of click.  
>> It would be relatively straightforward to accomplish this with a  
>> subclass of the query tool. Here's a sample (untested of course ;))
>>
>> KAMAP_ZOOMIN = 0;
>> KAMAP_ZOOMOUT = 1;
>>
>> function kaZoomOnClick( oKaMap, type ) {
>> kaQuery.apply( this, [oKaMap, KAMAP_POINT_QUERY] );
>> this.name = 'kaZoomOnClick';
>> this.cursor = 'auto';
>> this.type = type;
>>
>> for (var p in kaQuery.prototype) {
>> if (!kaZoomOnClick.prototype[p])
>> kaZoomOnClick.prototype[p]= kaQuery.prototype[p];
>> }
>> };
>>
>> kaQuery.prototype.onmouseup = function(e) {
>> var gp = this.kaMap.pixToGeo( -this.startx, -this.starty );
>> var map = this.kaMap.getCurrentMap();
>> var scales = this.kaMap.getScales();
>> var newScale = map.currentScale;
>> if (this.type == KAMAP_ZOOMIN && newScale < scales.length - 1) {
>> newScale ++;
>> } else if (this.type == KAMAP_ZOOMOUT && newScale > 0) {
>> newScale --;
>> }
>> this.kaMap.zoomTo(gp[0],gp[1], scales[newScale]);
>> return false;
>> };
>>
>> Cheers
>>
>> Paul
>>
>> On 17-May-06, at 2:28 AM, Wei Yang, Ng - Wayne wrote:
>>
>>> Hi Paul,
>>> I was asked to create a zoom tool that allows me to click any  
>>> where on the map and either zoom in on the location or zoom out  
>>> of it. Is there such a tool yet? From my understanding there is  
>>> only the query and pan tool.
>>>
>>> Cheers,
>>> Wayne
>>
>> +-----------------------------------------------------------------+
>> |Paul Spencer pspencer at dmsolutions.ca |
>> +-----------------------------------------------------------------+
>> |Applications & Software Development |
>> |DM Solutions Group Inc http://www.dmsolutions.ca/|
>> +-----------------------------------------------------------------+
>>
>>
>>
>>
>
> / 
> **********************************************************************
>  *  kaZoomOnClick.js
>  *
>  *  Date: 17th May 2006
>  *
>  *  purpose: A convenient zoom tool that allows the user to zoom in
>  *           or out of the map location where it was clicked.
>  *
>  *  author: Wei Yang, Ng - Wayne
>  *
>  *  Acknowledgments: Paul Spencer for his guidance.
>  *  Note: Alot of the code was borrowed from kaTool.js
>   
> **********************************************************************
>  *  Usage:
>  *  1) Add the following to your page:
>  *     <script type="text/javascript" src="kaZoomOnClick.js"></script>
>  *
>  *  2) create 2 instances of kaZoomOnClick:
>  *     (hint: look for initialization code - eg. myOnLoad() in  
> startUp.js)
>  *     myKaZoomInOnClick = new kaZoomOnClick( myKaMap, KAMAP_ZOOMIN );
>  *     myKaZoomOutOnClick = new kaZoomOnClick( myKaMap,  
> KAMAP_ZOOMOUT );
>  *
>  *  3) Include the following img icons in your webpage:
>  *    <img id="toolZoomIn" class="clickIcon" onclick="switchMode 
> (this.id)"
>  *     src="./images/a_pixel.gif" border="0" title="Switch to Zoom  
> In Mode"
>  *     alt="Switch to Zoom In Mode" />
>  *    <img id="toolZoomOut" class="clickIcon" onclick="switchMode 
> (this.id)"
>  *     src="./images/a_pixel.gif" border="0" title="Switch to Zoom  
> Out Mode"
>  *     alt="Switch to Zoom Out Mode" />
>  *
>  *  Note: the switchMode function in startUp.js just went through  
> major changes
>  *        ensure you are using the latest startUp.js version
>  *
>   
> ********************************************************************** 
> /
> var KAMAP_ZOOMIN = 0;
> var KAMAP_ZOOMOUT = 1;
>
> /**
>  *  kaZoomOnClick constructor
>  */
> function kaZoomOnClick( oKaMap, type ) {
>     kaTool.apply( this, [oKaMap] );
>     this.name = 'kaZoomOnClick';
>     this.cursor = ["url('images/cross.png'),move"];
>     this.type = type;
>
>     for (var p in kaTool.prototype) {
>         if (!kaZoomOnClick.prototype[p])
>             kaZoomOnClick.prototype[p]= kaTool.prototype[p];
>     }
> }
>
> /**
>  *  Move to the point where the cursor was double clicked and zoom in.
>  *  This is basically a slight modification of the  
> "kaNavigator.prototype.ondblclick"
>  *  function in kaTool.js
>  */
> kaZoomOnClick.prototype.onmouseup = function(e) {
>     e = (e)?e:((event)?event:null);
>
>     var posX = 0, posY = 0;
>
>     if (e.pageX && e.pageY) {
>         posX = e.pageX;
>         posY = e.pageY;
>     } else {
>         var iebody=(document.compatMode && document.compatMode !=  
> "BackCompat")? document.documentElement : document.body;
>         var scrollX = iebody.scrollLeft?iebody.scrollLeft: 
> (window.pageXOffset?window.pageXOffset:0);
>         var scrollY = iebody.scrollTop?iebody.scrollTop: 
> (window.pageYOffset?window.pageYOffset:0);
>
>         posX = e.clientX + scrollX;
>         posY = e.clientY + scrollY;
>     }
>
>     var aPixPos = this.adjustPixPosition( posX, posY);
>
>     var vpX = this.kaMap.viewportWidth/2;
>     var vpY = this.kaMap.viewportHeight/2;
>
>     var dx = parseInt(this.kaMap.theInsideLayer.style.left) -  
> this.kaMap.xOrigin - vpX - aPixPos[0];
>     var dy = parseInt(this.kaMap.theInsideLayer.style.top) -  
> this.kaMap.yOrigin - vpY - aPixPos[1];
>
>     this.kaMap.moveBy(-dx, -dy);
>     if (this.type == KAMAP_ZOOMIN) {
>         myZoomIn();
>     } else if (this.type == KAMAP_ZOOMOUT) {
>         myZoomOut();
>     }
>     return false;
> }
>
> / 
> **********************************************************************
>  *
>  * $Id: startUp.js,v 1.28 2006/04/21 15:57:39 pspencer Exp $
>  *
>  * purpose: start up code to bootstrap initialization of kaMap within
>  *          the sample interface.  Examples of using many parts of
>  *          the kaMap core api.
>  *
>  * author: Lorenzo Becchi and Andrea Cappugi
>  *
>  * contributions by Paul Spencer (pspencer at dmsolutions.ca)
>  *
>  * TODO:
>  *
>   
> **********************************************************************
>  *
>  * Copyright (c) 2005, DM Solutions Group Inc.
>  *
>  * Permission is hereby granted, free of charge, to any person  
> obtaining a
>  * copy of this software and associated documentation files (the  
> "Software"),
>  * to deal in the Software without restriction, including without  
> limitation
>  * the rights to use, copy, modify, merge, publish, distribute,  
> sublicense,
>  * and/or sell copies of the Software, and to permit persons to  
> whom the
>  * Software is furnished to do so, subject to the following  
> conditions:
>  *
>  * The above copyright notice and this permission notice shall be  
> included
>  * in all copies or substantial portions of the Software.
>  *
>  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,  
> EXPRESS OR
>  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF  
> MERCHANTABILITY,
>  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO  
> EVENT SHALL
>  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,  
> DAMAGES OR OTHER
>  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,  
> ARISING
>  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>  * DEALINGS IN THE SOFTWARE.
>  *
>   
> ********************************************************************** 
> /
>
> / 
> ********************************************************************** 
> ********
>  *
>  * To customize startUp:
>  *
>  * 1) modify toolbar Layout
>  *  act on screen.css file and modify the funcion myMapInitialized().
>  *  If you change pan and identifyer images edit switchMode()  
> function too.
>  *
>   
> ********************************************************************** 
> *******/
>
> var myKaMap = myKaNavigator = myKaQuery = myScalebar =  
> myKaZoomInOnClick = myKaZoomOutOnClick = null;
> var queryParams = null;
>
> /**
>  * parse the query string sent to this window into a global array  
> of key = value pairs
>  * this function should only be called once
>  */
> function parseQueryString() {
>     queryParams = {};
>     var s=window.location.search;
>     if (s!='') {
>         s=s.substring( 1 );
>         var p=s.split('&');
>         for (var i=0;i<p.length;i++) {
>             var q=p[i].split('=');
>             queryParams[q[0]]=q[1];
>         }
>     }
> }
>
> /**
>  * get a query value by key.  If the query string hasn't been  
> parsed yet, parse it first.
>  * Return an empty string if not found
>  */
> function getQueryParam(p) {
>     if (!queryParams) {
>         parseQueryString();
>     }
>     if (queryParams[p]) {
>         return queryParams[p];
>     } else {
>         return '';
>     }
> }
>
> /*
> function myOnLoad() {
>     initDHTMLAPI();
>
> 	window.onresize=drawPage;
>
> 	myKaMap = new kaMap( 'viewport' );
>
> 	var szMap = getQueryParam('map');
>     var szExtents = getQueryParam('extents');
>     var szCPS = getQueryParam('cps');
>
>     var myKaLegend = new kaLegend( myKaMap, 'legend', false );
>     var myKaKeymap = new kaKeymap( myKaMap, 'keymap' );
>
>     myKaMap.registerForEvent( KAMAP_INITIALIZED, null,  
> myInitialized );
>     myKaMap.registerForEvent( KAMAP_MAP_INITIALIZED, null,  
> myMapInitialized );
>     myKaMap.registerForEvent( KAMAP_SCALE_CHANGED, null,  
> myScaleChanged );
>     myKaMap.registerForEvent( KAMAP_EXTENTS_CHANGED, null,  
> myExtentChanged );
>     myKaMap.registerForEvent( KAMAP_LAYERS_CHANGED, null,  
> myLayersChanged );
>     myKaMap.registerForEvent( KAMAP_QUERY, null, myQuery );
>     myKaMap.registerForEvent( KAMAP_MAP_CLICKED, null, myMapClicked );
>
>     myKaNavigator = new kaNavigator( myKaMap );
>     myKaNavigator.activate();
>
>     myKaQuery = new kaQuery( myKaMap, KAMAP_RECT_QUERY );
>
>     myScalebar = new ScaleBar(1);
>     myScalebar.divisions = 3;
>     myScalebar.subdivisions = 2;
>     myScalebar.minWidth = 150;
>     myScalebar.maxWidth = 250;
>     myScalebar.place('scalebar');
>
> 	drawPage();
>     myKaMap.initialize( szMap, szExtents, szCPS );
> }*/
>
> /**
>  * event handler for KAMAP_INITIALIZED.
>  *
>  * at this point, ka-Map! knows what map files are available and we  
> have
>  * access to them.
>  */
> function myInitialized() {
>     //myMapInitialized( null, myKaMap.getCurrentMap().name );
> }
>
> /**
>  * event handler for KAMAP_MAP_INITIALIZED
>  *
>  * the scales are put into a select ... this will be used for zooming
>  */
> function myMapInitialized( eventID, mapName ) {
>     //get list of maps and populate the maps select box
>     var aMaps = myKaMap.getMaps();
>     var oSelect = document.forms[0].maps;
>     var j = 0;
>     var opt = new Option( 'select a map', '', true, true );
>     oSelect[j++] = opt;
>     for(var i in aMaps) {
>         oSelect[j++] = new Option(aMaps[i].title,aMaps 
> [i].name,false,false);
>     }
>
>     //make sure the map is selected ...
>     var oSelect = document.forms[0].maps;
>     if (oSelect.options[oSelect.selectedIndex].value != mapName) {
>         for(var i = 0; i < oSelect.options.length; i++ ) {
>             if (oSelect.options[i].value == mapName) {
>                 oSelect.options[i].selected = true;
>                 break;
>             }
>         }
>     }
>     //update the scales select
>     var currentMap = myKaMap.getCurrentMap();
>     var scales = currentMap.getScales();
>     var currentScale=myKaMap.getCurrentScale();
>
>     //Insert tools into zoomer div
>
>     var iWidth = 6;//width of the zoom to scale item
>     var iMaxHeight = 10;//width of the zoom to scale item
>     var iMinHeight = 20;//width of the zoom to scale item
>     var zoomer="<span style='width:"+(scales.length*iWidth)+"'>";
>     for(var i=0; i<scales.length; i++) {
>         var zoomTo = 'mySetScale(' +scales[i]+')';
>         //var iHeight =  parseInt(i)*2.5+10;
>         var iHeight =  iMaxHeight - parseInt((iMaxHeight -  
> iMinHeight) *i/scales.length);
>
>         var zoomImg = '';
>         if (scales[i]==currentScale) {
>             zoomImg = '<img src="images/pixel-red.png" width="' +  
> iWidth + '" height="' + iHeight + 'px" border="0" onclick="'+zoomTo 
> +'"  title="Zoom to 1:'+scales[i]+'" alt="Zoom to 1:'+scales[i]+'"   
> id="img'+scales[i]+'"/>';
>         } else {
>             zoomImg = '<img src="images/pixel-blue.png" width="' +  
> iWidth + '" height="' + iHeight + 'px" border="0" onclick="'+zoomTo 
> +'"  title="Zoom to 1:'+scales[i]+'" alt="Zoom to 1:'+scales[i]+'"  
> id="img'+scales[i]+'"/>';
>         }
>         zoomer = zoomer  + zoomImg ;
>     }
>     zoomer=zoomer+"</span>";
>     getRawObject('zoomer').innerHTML = zoomer;
>     //Activate query button
>     switchMode('toolPan');
>
> 	/* handle request for layer visibility */
> 	var layers = getQueryParam('layers');
> 	if (layers != '') {
> 		var map = myKaMap.getCurrentMap();
> 		//turn off all layers
> 		var allLayers = map.getAllLayers();
> 		for (var i=0; i<allLayers.length; i++) {
> 			allLayers[i].setVisibility(false);
> 		}
> 		aLayers = layers.split(',');
> 		for (var i=0;i<aLayers.length; i++) {
> 			map.setLayerVisibility (unescape(aLayers[i]), true);
> 		}
> 	}
> }
>
> /**
>  * handle the extents changing by updating a link in the interface  
> that links
>  * to the current view
>  */
> function myExtentChanged( eventID, extents ) {
> 	updateLinkToView();
> }
>
> function myLayersChanged(eventID, map) {
> 	updateLinkToView();
> }
>
> function updateLinkToView()  {
> 	var url = window.location.protocol+'/'+'/'+window.location.host  
> +':'+window.location.port+'/'+window.location.pathname+'?';
> 	var extents = myKaMap.getGeoExtents();
> 	var cx = (extents[2] + extents[0])/2;
> 	var cy = (extents[3] + extents[1])/2;
> 	var cpsURL = 'cps='+cx+','+cy+','+myKaMap.getCurrentScale();
> 	var mapURL = 'map=' + myKaMap.currentMap;
>     var theMap = myKaMap.getCurrentMap();
> 	var aLayers = theMap.getLayers();
> 	var layersURL = 'layers=';
> 	var sep = '';
> 	for (var i=0;i<aLayers.length;i++) {
> 		layersURL += sep + aLayers[i].name;
> 		sep = ',';
> 	}
>
> 	var link = document.getElementById('linkToView');
> 	link.href = url + mapURL + '&' + cpsURL + '&' + layersURL;
> }
>
> /**
>  * called when kaMap tells us the scale has changed
>  */
> function myScaleChanged( eventID, scale ) {
>     //todo: update scale select and enable/disable zoomin/zoomout
>     var currentMap = myKaMap.getCurrentMap();
>     var scales = currentMap.getScales();
>     for(var i in scales){
>         var imgString = 'img'+scales[i];
>         var scaleString = 'img'+scale;
>         if(getRawObject(imgString)) {
>             if(imgString == scaleString) {
>                 getRawObject(scaleString).src = 'images/pixel- 
> red.png';
>             } else {
>                 getRawObject(imgString).src = 'images/pixel-blue.png';
>             }
>         }
>     }
>     myScalebar.update(scale);
>     if (scale >= 1000000) {
>         scale = scale / 1000000;
>         scale = scale + " Million";
>     }
>     var outString = 'current scale 1:'+ scale;
>     getRawObject('scale').innerHTML = outString;
> }
>
> /**
>  * called when the user changes scales.  This will cause the map to  
> zoom to
>  * the new scale and trigger a bunch of events, including:
>  * KAMAP_SCALE_CHANGED
>  * KAMAP_EXTENTS_CHANGED
>  */
> function mySetScale( scale ) {
>     myKaMap.zoomToScale( scale );
> }
>
> /**
>  * called when the map selection changes due to the user selecting  
> a new map.
>  * By calling myKaMap.selectMap, this triggers the  
> KAMAP_MAP_INITIALIZED event
>  * after the new map is initialized which, in turn, causes  
> myMapInitialized
>  * to be called
>  */
> function mySetMap( name ) {
>     myKaMap.selectMap( name );
> }
>
> function myQuery( eventID, queryType, coords ) {
>     var szLayers = '';
>     var layers = myKaMap.getCurrentMap().getQueryableLayers();
>     if(layers.length==0) {
>      alert("No queryable layers at this scale and extent");
>      return;
>     }
>     for (var i=0;i<layers.length;i++) {
>         szLayers = szLayers + "," + layers[i].name;
>     }
>
>
>     var extent = myKaMap.getGeoExtents();
>     var scale = myKaMap.getCurrentScale();
>     var cMap = myKaMap.getCurrentMap().name;
> 	var params='map='+cMap+'&q_type='+queryType+'&scale='+scale 
> +'&groups='+szLayers+'&coords='+coords+'&extent='+extent[0] 
> +'|'+extent[1]+'|'+extent[2]+'|'+extent[3];
>
> 	WOOpenWin( 'Query', 'map_query.php?'+params,  
> 'resizable=yes,scrollbars=yes,width=600,height=400' );
>
> //    alert( "Map: " + cMap + " | Scale: " + scale + " | Extent: "  
> + extent + " | QUERY: " + queryType + " " + coords + " on layers "  
> + szLayers );
> }
>
> function myMapClicked( eventID, coords ) {
>     //alert( 'myMapClicked('+coords+')');
> 	//myKaMap.zoomTo(coords[0],coords[1]);
> }
>
> function myZoomIn() {
>     myKaMap.zoomIn();
> }
>
> function myZoomOut() {
>     myKaMap.zoomOut();
> }
>
> function toggleToolbar(obj) {
>     if (obj.style.backgroundImage == '') {
>         obj.isOpen = true;
>     }
>
>     if (obj.isOpen) {
>         obj.title = 'show toolbar';
>         obj.style.backgroundImage = 'url(images/arrow_down.png)';
>         var bValue = getObjectTop(obj);;
>         var d = getObject('toolbar');
>         d.display = "none";
>         obj.isOpen = false;
>         obj.style.top = "3px";
>     } else {
>         obj.title = 'hide toolbar';
>         obj.style.backgroundImage = 'url(images/arrow_up.png)';
>         var d = getObject('toolbar');
>         d.display="block";
>         obj.isOpen = true;
>         var h = getObjectHeight('toolbar');
>         obj.style.top = (h + 3) + "px";
>     }
> }
>
> function toggleKeymap(obj) {
>     if (obj.style.backgroundImage == '') {
>         obj.isOpen = true;
>     }
>
>     if (obj.isOpen) {
>         obj.title = 'show keymap';
>         obj.style.backgroundImage = 'url(images/arrow_left.png)';
>         var bValue = getObjectTop(obj);;
>         var d = getObject('keymap');
>         d.display = "none";
>         obj.isOpen = false;
>     } else {
>         obj.title = 'hide keymap';
>         obj.style.backgroundImage = 'url(images/arrow_right.png)';
>         var d = getObject('keymap');
>         d.display="block";
>         obj.isOpen = true;
>     }
> }
>
> function toggleReference(obj) {
>     if (obj.style.backgroundImage == '') {
>         obj.isOpen = true;
>     }
>
>     if (obj.isOpen) {
>         obj.title = 'show reference';
>         obj.style.backgroundImage = 'url(images/arrow_up.png)';
>         var d = getObject('reference');
>         d.display = 'none';
>         obj.isOpen = false;
>         obj.style.bottom = '3px';
>     } else {
>         obj.title = 'hide reference';
>         obj.style.backgroundImage = 'url(images/arrow_down.png)';
>         var d = getObject('reference');
>         d.display = 'block';
>         obj.isOpen = true;
>         obj.style.bottom = (getObjectHeight('reference') + 3) + 'px';
>     }
> }
>
> function dialogToggle( href, szObj) {
>     var obj = getObject(szObj);
>     if (obj.display == 'none') {
>         obj.display = 'block';
>         href.childNodes[0].src = 'images/dialog_shut.png';
>     } else {
>         obj.display = 'none';
>         href.childNodes[0].src = 'images/dialog_open.png';
>     }
> }
>
> /**
>  * drawPage - calculate sizes of the various divs to make the app  
> full screen.
>  */
> function drawPage() {
>     var browserWidth = getInsideWindowWidth();
>     var browserHeight = getInsideWindowHeight();
>
>     var viewport = getRawObject('viewport');
>
>     //Set Viewport Width
>     if(myKaMap.isIE4) {
>         //terrible hack to avoid IE to show scrollbar
>         viewport.style.width = (browserWidth -2) + "px";
>     } else {
>         viewport.style.width = browserWidth + "px";
>     }
>
>     //Set Viewport Height
>     if(myKaMap.isIE4) {
>         //terrible hack to avoid IE to show scrollbar
>         viewport.style.height = (browserHeight -2) + "px";
>     } else {
>         viewport.style.height = browserHeight + "px";
>     }
>
>     myKaMap.resize();
> }
>
> /**
>  * getFullExtent
>  * ...
>  */
> function getFullExtent() {
>     var exStr = myKaMap.getCurrentMap().defaultExtents.toString();
>     var ex = myKaMap.getCurrentMap().defaultExtents;
>     myKaMap.zoomToExtents(ex[0],ex[1],ex[2],ex[3]);
> }
>
> /**
>  * switchMode
>  * ...
>  * Modified by Wayne.
>  * Excluding one or more tools won't cause problems.
>  */
> function switchMode(id) {
>     if (id=='toolQuery' && getRawObject('toolQuery') != null) {
>         getRawObject('toolQuery').style.backgroundImage = 'url 
> (images/tool_query_2.png)';
>         myKaQuery.activate();
>     } else {
>         if (getRawObject('toolQuery') != null)
>             getRawObject('toolQuery').style.backgroundImage = 'url 
> (images/tool_query_1.png)';
>     }
>
>     if (id=='toolPan' && getRawObject('toolPan') != null) {
>         getRawObject('toolPan').style.backgroundImage = 'url(images/ 
> tool_pan_2.png)';
>         myKaNavigator.activate();
>     } else {
>         if (getRawObject('toolPan') != null)
>             getRawObject('toolPan').style.backgroundImage = 'url 
> (images/tool_pan_1.png)';
>     }
>
>     if (id=='toolZoomIn' && getRawObject('toolZoomIn') != null) {
>         getRawObject('toolZoomIn').style.backgroundImage = 'url 
> (images/tool_zoomin_2.png)';
>         myKaZoomInOnClick.activate();
>     } else {
>         if (getRawObject('toolZoomIn') != null)
>             getRawObject('toolZoomIn').style.backgroundImage = 'url 
> (images/tool_zoomin_1.png)';
>     }
>
>     if (id=='toolZoomOut' && getRawObject('toolZoomOut') != null) {
>         getRawObject('toolZoomOut').style.backgroundImage = 'url 
> (images/tool_zoomout_2.png)';
>         myKaZoomOutOnClick.activate();
>     } else {
>         if (getRawObject('toolZoomOut') != null)
>             getRawObject('toolZoomOut').style.backgroundImage = 'url 
> (images/tool_zoomout_1.png)';
>     }
> }
>
> /*
>  *  applyPNGFilter(o)
>  *
>  *  Applies the PNG Filter Hack for IE browsers when showing 24bit  
> PNG's
>  *
>  *  var o = object (this png element in the page)
>  *
>  * The filter is applied using a nifty feature of IE that allows  
> javascript to
>  * be executed as part of a CSS style rule - this ensures that the  
> hack only
>  * gets applied on IE browsers :)
>  */
> function applyPNGFilter(o) {
>     var t="images/a_pixel.gif";
>     if( o.src != t ) {
>         var s=o.src;
>         o.src = t;
>         o.runtimeStyle.filter =  
> "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+s 
> +"',sizingMethod='scale')";
>     }
> }
>
> //functions to open popup
>
> function WOFocusWin( nn ) {
> 	eval( "if( this."+name+") this."+name+".moveTo(50,50); this."+name 
> +".focus();" );
> }
>
> function WOOpenWin( name, url, ctrl ) {
>     eval( "this."+name+"=window.open('"+url+"','"+name+"','"+ctrl 
> +"');" );
>
>     /*IE needs a delay to move forward the popup*/
>     // window.setTimeout( "WOFocusWin(nome);", 300 );
> }
>
> function WinOpener() {
>     this.openWin=WOOpenWin;
> 	this.focusWin=WOFocusWin;
> }

+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+






More information about the ka-Map-users mailing list