[ka-Map-users] quick question
Paul Spencer
pspencer at dmsolutions.ca
Sun Nov 6 23:07:06 EST 2005
Sebastien,
this seems eminently useful, any problem if I look at incorporating
this into cvs?
Paul
On 4-Nov-05, at 11:17 AM, Sebastian Podjasek wrote:
> Matthew Edmondson:
>
>> I searched the ka-map archives list but didn't find an answer to
>> the following question: Is it possible to have most of the data
>> stay cached on the client side but refreshing a individual point
>> data layer to give to appearance of real time updates, without the
>> need to have the background GIS data refreshing with it.
>
>
>
> Probably you will not need this, but in my project I needed to
> update one map layer at every
> tile fetch, so I've made few changes to kaMap.js and init.php to
> achieve this. Now I can declare
> FORCE_REDRAW in Layer MetaData and ka-map will redraw this layer
> every time...
> Patches included...
>
> --
> Sebastian Podjasek
> morenet.pl
> Index: init.php
> ===================================================================
> RCS file: /cvs/maptools/cvsroot/ka-map/htdocs/init.php,v
> retrieving revision 1.20
> diff -c -r1.20 init.php
> *** init.php 23 Sep 2005 12:29:48 -0000 1.20
> --- init.php 4 Nov 2005 15:57:09 -0000
> ***************
> *** 70,75 ****
> --- 70,81 ----
> $aGroups[$oLayer->group] = 0;
> $status = ($oLayer->status!=MS_OFF)?'true':'false';
> $opacity = $oLayer->getMetaData( 'opacity' );
> + $force = $oLayer->getMetaData( 'force_redraw' );
> + if( $force == '1' ) {
> + $force = "true";
> + } else {
> + $force = "false";
> + }
>
> /* dynamic imageformat */
> $imageformat = $oLayer->getMetaData
> ( 'imageformat' );
> ***************
> *** 90,96 ****
>
> if ($opacity == '')
> $opacity = 100;
> ! $szLayers .= "map.addLayer(new _layer( '".$oLayer-
> >group."', ".$status.", ".$opacity.", '".$imageformat."',".
> $szQueryable."));"; //added imageformat parameter
> }
> }
> else if (!isset($aGroups['__base__']))
> --- 96,104 ----
>
> if ($opacity == '')
> $opacity = 100;
> ! $szLayers .= "map.addLayer(new _layer( '".$oLayer-
> >group."', ".$status.", ".$opacity.", '".$imageformat."',".
> $szQueryable.",".$force."));";
> ! // added forced
> ! //added imageformat parameter
> }
> }
> else if (!isset($aGroups['__base__']))
> Index: kaMap.js
> ===================================================================
> RCS file: /cvs/maptools/cvsroot/ka-map/htdocs/kaMap.js,v
> retrieving revision 1.53
> diff -c -r1.53 kaMap.js
> *** kaMap.js 17 Oct 2005 16:03:57 -0000 1.53
> --- kaMap.js 4 Nov 2005 15:54:38 -0000
> ***************
> *** 40,45 ****
> --- 40,70 ----
> var KAMAP_SCALE_CHANGED = gnLastEventId ++;
> var KAMAP_LAYERS_CHANGED = gnLastEventId ++;
>
> + /*
> + * log( szMessage )
> + * for debugging purposes, this function creates a div element on
> the fly to
> + * contain the log.
> + */
> + function log(szMessage)
> + {
> + var d = document.getElementById( 'log' );
> + if (d == undefined)
> + {
> + d = document.createElement( 'div' );
> + d.id = 'log';
> + d.setAttribute( 'style', 'zIndex:102;font-
> family:arial;font-size:10px;position:absolute;top:0px;left:
> 400px;width:400px;height:100px;overflow:auto;visibility:visible');
> + document.body.appendChild( d );
> + }
> + var p = document.createElement( 'p' );
> + p.appendChild(document.createTextNode( ((new Date
> ( )).toLocaleString()) + ": " + szMessage ))
> + if (d.firstChild)
> + d.insertBefore( p, d.firstChild );
> + else
> + d.appendChild(p);
> + d.style.scrollTop = 0;
> + }
> +
> +
>
> /
> **********************************************************************
> ********
> * kaMap main class
> ***************
> *** 1952,1959 ****
> * being capable of being queried. The layer also
> has to have
> * it's query state turned on using setQueryable
> *
>
> **********************************************************************
> *******/
> ! function _layer( szName, bVisible, opacity, imageformat,
> bQueryable )
> {
>
> this.name = szName;
> --- 1977,1986 ----
> * being capable of being queried. The layer also
> has to have
> * it's query state turned on using setQueryable
> *
> + * bForced
> + *
>
> **********************************************************************
> *******/
> ! function _layer( szName, bVisible, opacity, imageformat,
> bQueryable, bForced )
> {
>
> this.name = szName;
> ***************
> *** 1964,1969 ****
> --- 1991,1999 ----
> this.imageformat = imageformat;
> this.queryable = bQueryable;
> this.queryState = bQueryable;
> + this.forced = bForced;
> +
> + //log( 'New Layer: ' + szName + ', force: ' + bForced );
> }
>
> _layer.prototype.isQueryable = function()
> ***************
> *** 2013,2018 ****
> --- 2043,2051 ----
> szForce = '&force=true';
> var szGroup = "&g="+img.layer.domObj.id;
> var szScale = '&s='+this._map.aScales[this._map.currentScale];
> +
> + //log('Layer: ' + img.layer.domObj.id);
> +
>
> // dynamic imageformat
> var szImageformat = '';
> ***************
> *** 2022,2027 ****
> --- 2055,2064 ----
> image_format = img.layer.imageformat;
> szImageformat = '&i='+image_format;
> }
> + if (img.layer.forced == true) {
> + szForce = '&force=true';
> + //log('layer forced');
> + }
>
> var l = safeParseInt(img.style.left) + this._map.kaMap.xOrigin;
> var t = safeParseInt(img.style.top) + this._map.kaMap.yOrigin;
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/ka-map-users
+-----------------------------------------------------------------+
|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