Changeset 14

Show
Ignore:
Timestamp:
12/28/06 06:40:44 (2 years ago)
Author:
mikel
Message:

changes from metacarta, and recent hacks. on overdue checkin

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • worldkit/com/brainoff/worldkitAnnotation.as

    r10 r14  
    1414 
    1515    private var mc:MovieClip; 
    16  
    1716    private var depth:Number; 
    1817    private var title:String; 
     
    2827    private var vector:String; 
    2928    private var vtype:String; 
     29    private var datestring:String; 
    3030    private var date:Date; 
    3131    private var precompile:Boolean; 
     
    4444    private var jsargs:String; 
    4545    private var color:Number; 
     46    private var createdate:Date; 
    4647 
    4748    private var initialplotcolor:Number; 
     
    5758    private var fillalpha:Number; 
    5859    private var window:String; 
     60    private var rssicon:String; 
     61    private var curralpha:Number; 
    5962 
    6063    private var colorobj:Color; 
    6164 
    62     public function worldkitAnnotation(main:worldkitMain, mc:MovieClip, depth:Number, title:String, url:String, lat:Number, lon:Number, summary:String, cats:Array, id:String, photo:String, prevlat:Number, prevlon:Number, vector:String, vtype:String, datestring:String, precompile:Boolean, enddate:String) { 
     65    public function worldkitAnnotation(main:worldkitMain, mc:MovieClip, depth:Number, title:String, url:String, lat:Number, lon:Number, summary:String, cats:Array, id:String, photo:String, prevlat:Number, prevlon:Number, vector:String, vtype:String, datestring:String, precompile:Boolean, enddate:String, rssicon:String) { 
    6366 
    6467        this.main = main; 
     
    8386        this.vector = vector; 
    8487        this.vtype = vtype; 
     88        this.datestring = datestring; 
    8589        this.date = new Date(worldkitUtil.parseDate(datestring)); 
    8690        this.precompile = precompile; 
     
    8892            this.enddate = new Date(worldkitUtil.parseDate(enddate)); 
    8993        }  
     94        this.rssicon = rssicon; 
    9095 
    9196        present = true; 
     
    107112        } 
    108113 
     114        createdate = new Date(); 
     115        curralpha = 100; 
    109116        mc[this.clipname].annotation = this; 
    110117    } 
     
    175182            interact.scaleAndPosition(mc,undefined); 
    176183        } 
     184 
     185 
     186        if (conf.newitemcallback) { 
     187            var msg = "title=" + escape(title) + "&url=" + escape(url) +  "&summary=" + escape( summary.split("\"").join("\\\"") ) +  "&lat=" + escape(String(lat)) + "&lon=" + escape(String(lon)) + "&id=" + escape(id);       
     188            interact.processClick("", "_" + conf.newitemcallback, msg); 
     189        } 
    177190    } 
    178191 
     
    242255        } else if (vtype == "box") { 
    243256            drawbox(); 
     257        } else if (rssicon != undefined && rssicon != "") { 
     258            if (time == 1) { 
     259                loadrssicon(); 
     260            } else { 
     261                activateicon(time); 
     262            } 
    244263        } else if (icon != undefined && icon != "") { 
    245264            if (time == 1) { 
    246265                loadicon(); 
    247             } 
     266            }  
    248267        } else if (plotshape == "square") { 
    249268            square(); 
     
    280299        var boxarray = vector.split(" "); 
    281300        if (boxarray.length == 4) { 
    282             vector = boxarray[0] + " " + boxarray[1] + " " + boxarray[0] + " " + boxarray[3] + " " + boxarray[2] + " " + boxarray[3] + " " + boxarray[1] + " " + boxarray[0] + " " + boxarray[1]; 
     301            vector = boxarray[0] + " " + boxarray[1] + " " + boxarray[0] + " " + boxarray[3] + " " + boxarray[2] + " " + boxarray[3] + " " + boxarray[2] + " " + boxarray[1] + " " + boxarray[0] + " " + boxarray[1]; 
    283302            vtype = "poly"; 
    284303            drawpoly(); 
     
    354373    } 
    355374 
     375    private function loadrssicon():Void { 
     376        if (mc[clipname]["icon"] == undefined) { 
     377                mc[clipname].createEmptyMovieClip("icon",1); 
     378        } 
     379        if (! img.loadrssicon(mc[clipname]["icon"], rssicon)) { 
     380                worldkitUtil.setTimeout(this, "loadrssicon", 1000); 
     381        } 
     382    } 
     383    public function activateicon(time:Number) { 
     384        if (mc[clipname]["icon"] == undefined) { 
     385                return; 
     386        } 
     387        var iconwidth; 
     388        var alpha = 100; 
     389        if (time == 2) { 
     390                iconwidth = conf.rssiconwidth; 
     391                alpha = curralpha; 
     392        } else if (time == 3) { 
     393                iconwidth = conf.rssiconwidth * 1.5; 
     394        } 
     395        img.activateicon(mc[clipname]["icon"], rssicon, iconwidth); 
     396        mc[clipname]["icon"]._alpha = alpha; 
     397   } 
     398 
    356399    //REVISIT  
    357400    private function tracks():Void { 
     
    449492        } 
    450493    } 
     494    public function forceActivate():Void { 
     495        if (activate == true) { 
     496                activate = false; 
     497                shape(2); 
     498        } else { 
     499                activate = true; 
     500                shape(3); 
     501        } 
     502    } 
     503 
     504    public function setAlphaFade(now:Date):Void { 
     505        if (curralpha == -1) { return; } 
     506        var s = (now - createdate) / 1000; 
     507        var clip; 
     508        if (mc[clipname]["icon"]) { 
     509                clip = mc[clipname]["icon"]; 
     510        } else { 
     511                clip = mc[clipname]; 
     512        } 
     513        clip._alpha = 100 - 100 * (s / conf.fade); 
     514        curralpha = clip._alpha; 
     515 
     516        if (curralpha <= 0) { 
     517                if (mc[clipname]["icon"]) { 
     518                        mc[clipname]["icon"].removeMovieClip(); 
     519                        mc[clipname]["icon"] = 1; 
     520                } else { 
     521                        mc[clipname].clear(); 
     522                } 
     523                if (conf.fadeditemcallback) { 
     524                        var msg = "&id=" + escape(id);   
     525                        interact.processClick("", "_" + conf.fadeditemcallback, msg); 
     526                }        
     527                curralpha = -1; 
     528        }        
     529    } 
    451530 
    452531    public function hidetext():Void { 
     
    506585        if (vector != this.vector) { this.vector = vector; changed = true; } 
    507586        if (vtype != this.vtype) { this.vtype = vtype; changed = true; } 
    508         var d:Date = new Date(worldkitUtil.parseDate(datestring)); 
    509         if (d != this.date) {this.date = d; changed = true; } //REVISIT work?? 
     587        if (datestring != this.datestring) {this.date = new Date(worldkitUtil.parseDate(datestring)); changed = true; } //REVISIT work?? 
    510588         
    511589        return changed; 
  • worldkit/com/brainoff/worldkitConfig.as

    r10 r14  
    3636    var enddate:Date; 
    3737    var enddatefield:String; 
     38    var fade:Number; 
     39    var fadeditemcallback:String; 
    3840    var fillalpha:worldkitConfigCat; 
    3941    var fscommand:Boolean; 
     
    5961    var maxzoom:Boolean; 
    6062    var neartime:Number; 
     63    var newitemcallback:String; 
    6164    var nightimg:String; 
    6265    var north:Number; 
     66    var onzoompan:String; 
    6367    var panc:Number; 
    6468    var plotinterval:Number; 
     
    6872    var precompile:Object; //beta 
    6973    var projection:String; 
     74    var resultssince:Boolean; 
    7075    var restingplotcolor:worldkitConfigCat; 
     76    var rssiconwidth:Number; 
     77    var rssbbox:Boolean; 
    7178    var showload:Boolean; 
    7279    var showonlynew:Boolean; 
     
    8188    var textinterval:Number; 
    8289    var textsize:Number; 
     90    var tilemap:Object; 
    8391    var timenav:Boolean; 
    8492    var timenavpos:Number; 
     
    118126        enddate = new Date(); 
    119127        enddatefield = "any"; 
     128        fade = -1; 
    120129        fscommand = false; 
    121130        grabber = false; 
     
    136145        polarimg = "polar.jpg"; 
    137146        projection = "none"; 
     147        resultssince = false; 
     148        rssbbox = false; 
     149        rssiconwidth = 20; 
    138150        showload = false; 
    139151        showonlynew = false; 
     
    171183        swflayer = new Object(); 
    172184        swftemplate = new Object(); 
     185        tilemap = new Object(); 
    173186        wms = new Object(); 
    174187 
     
    281294        case "timenavpos": 
    282295        case "neartime": 
     296        case "rssiconwidth": 
     297        case "fade": 
    283298            this[name] = Number(value); 
    284299            break; 
     
    301316        case "startdatefield": 
    302317        case "enddatefield": 
     318        case "newitemcallback": 
     319        case "onzoompan": 
     320        case "fadeditemcallback": 
    303321 
    304322            this[name] = value; 
     
    323341        case "fscommand": 
    324342        case "timenav": 
     343        case "resultssince": 
     344        case "rssbbox": 
    325345 
    326346            if (value == "true") { 
     
    432452            if (attr.maxtiledeg != undefined) { this.wms[ attr.id ].maxtiledeg = attr.maxtiledeg; } 
    433453            if (attr.time != undefined) { this.wms[ attr.id ].time =  new Date(worldkitUtil.parseDate(attr.time)); } 
    434             break; 
    435              
     454            if (attr.minview != undefined) { this.wms[ attr.id ].minview = attr.minview; } 
     455            if (attr.maxview != undefined) { this.wms[ attr.id ].maxview = attr.maxview; } 
     456            break; 
     457 
     458        case "tilemap": 
     459            if (attr.global_profile && attr.global_profile == 1) { //only support global profile for now 
     460                    this.wms[ attr.id ] = new Object(); 
     461                    this.wms[ attr.id ].url = value; 
     462                    this.wms[ attr.id ].width = 256; 
     463                    this.wms[ attr.id ].height = 256; 
     464                    this.wms[ attr.id ].maxtiledeg = 180; 
     465                    this.wms[ attr.id ].tilemap = true; 
     466            }    
     467            break;               
     468                     
    436469        case "precompile": 
    437470            if (attr.id != undefined) { 
     
    527560    private function processWMSConfig():Void { 
    528561        for (var s in wms) { 
    529             var l = Math.log( maxscale ) / Math.log( 2 ); //calcs number of levels in pyramid 
     562 
     563            var start; var end; 
     564            if (wms[ s ].minview != undefined) { 
     565                start = Math.log( wms[ s ].minview ) / Math.log(2); 
     566            } else { 
     567                start = 1; 
     568            } 
     569            if (wms[ s ].maxview == undefined) { 
     570                wms[ s ].maxview = maxscale; 
     571            } 
     572            end = Math.log( wms[ s ].maxview ) / Math.log(2); 
     573 
     574            //var l = Math.log( maxscale ) / Math.log( 2 ); //calcs number of levels in pyramid 
    530575         
    531             for (var i = 1; i <= l; i++) { 
     576            for (var i = start; i <= end; i++) { 
    532577                var id = s + i.toString(); 
    533578                swftemplate[ id ] = new Object(); 
     
    542587                    swftemplate[id].tileheight = h; 
    543588                } 
    544                 swftemplate[ id ].url = wms[ s ].url + "&width=" + swftemplate[id].tilewidth + "&height=" + swftemplate[id].tileheight + "&bbox=WEST,SOUTH,EAST,NORTH"; 
     589                if (wms[ s ].tilemap) { 
     590                        swftemplate[ id ].url = wms[ s ].url; 
     591                        swftemplate[ id ].tilemap = true; 
     592                } else { 
     593                        swftemplate[ id ].url = wms[ s ].url + "&width=" + swftemplate[id].tilewidth + "&height=" + swftemplate[id].tileheight + "&bbox=WEST,SOUTH,EAST,NORTH"; 
     594                } 
    545595                swftemplate[ id ].minscale = Math.pow(2, (i-1)); 
    546                 swftemplate[ id ].maxscale = maxscale
    547                 swftemplate[ id ].minview = i / 2; 
    548                 swftemplate[ id ].maxview = maxscale
     596                swftemplate[ id ].maxscale = wms[ s ].maxview
     597                swftemplate[ id ].minview = i / 2; //BUG?? 
     598                swftemplate[ id ].maxview = wms[ s ].maxview
    549599             
    550600                if (wms[ s ].maxtiledeg) { //can actually assume maxtiledeg for default and calc REVISIT 
     
    565615    } 
    566616 
    567  
    568617    public function getConfBySubject(option:String,cats:Array) { 
    569618        for (var i=0; i<cats.length; i++) { 
  • worldkit/com/brainoff/worldkitImages.as

    r10 r14  
    105105        for (var s in conf.swftemplate) { 
    106106            imagemc.createEmptyMovieClip(s, layer + conf.swftemplate[s].layer); 
    107             l = conf.swftemplate[s].layer; //REVIST tangled interplay of config iterator, layer, etc 
     107            if (conf.swftemplate[s].layer > l) { 
     108                    l = conf.swftemplate[s].layer; //REVIST tangled interplay of config iterator, layer, etc 
     109            } 
    108110        }  
    109111        layer += l; 
     
    454456                } 
    455457                var tileurl = conf.swftemplate[id].url; 
    456                 tileurl = worldkitUtil.myreplace(tileurl,"NORTH",tilenorth); 
    457                 tileurl = worldkitUtil.myreplace(tileurl,"SOUTH",tilesouth); 
    458                 tileurl = worldkitUtil.myreplace(tileurl,"EAST",tileeast); 
    459                 tileurl = worldkitUtil.myreplace(tileurl,"WEST",tilewest); 
    460                 tileurl = worldkitUtil.myreplace(tileurl,"LAT",tilelat); 
    461                 tileurl = worldkitUtil.myreplace(tileurl,"LON",tilelon); 
     458 
     459                if (conf.swftemplate[id].tilemap) { 
     460                        tileurl = tileurl + Math.log(conf.swftemplate[id].minscale)/Math.log(2) + "/" +  i + "/" + (conf.swftemplate[id].spany - j - 1) + ".jpg"; 
     461                } else { 
     462                        tileurl = worldkitUtil.myreplace(tileurl,"NORTH",tilenorth); 
     463                        tileurl = worldkitUtil.myreplace(tileurl,"SOUTH",tilesouth); 
     464                        tileurl = worldkitUtil.myreplace(tileurl,"EAST",tileeast); 
     465                        tileurl = worldkitUtil.myreplace(tileurl,"WEST",tilewest); 
     466                        tileurl = worldkitUtil.myreplace(tileurl,"LAT",tilelat); 
     467                        tileurl = worldkitUtil.myreplace(tileurl,"LON",tilelon); 
     468                } 
    462469 
    463470                conf.swflayer[tileid].url = tileurl; 
     
    621628        } 
    622629    } 
     630 
     631    public function loadrssicon(mc:MovieClip, url:String):Boolean { 
     632        var key:String = imagemc._name + ":" + escape(url);      
     633        if (imagemc[ escape(url) ].loaded) { 
     634                mc.loadMovie(url); 
     635                var w = imglist[key]["mc"][escape(url)]._width; 
     636                var h = imglist[key]["mc"][escape(url)]._height; 
     637                mc._xscale = 100 *  conf.rssiconwidth / w; 
     638                mc._yscale = 100 * conf.rssiconwidth / w; 
     639                mc._x = - .5 * (conf.rssiconwidth); 
     640                mc._y = - .5 * (conf.rssiconwidth * h / w); 
     641                return true; 
     642        } else if (imglist[ key ] == undefined) { 
     643                loadImage(imagemc, escape(url), url, layer, "MakeInvisible", 0, 1, undefined, undefined, undefined, false); 
     644                layer++; 
     645        } 
     646        return false; 
     647    } 
     648    public function activateicon(mc:MovieClip, url:String, iconwidth:Number) { 
     649        var key:String = imagemc._name + ":" + escape(url); 
     650        var w = imglist[key]["mc"][escape(url)]._width; 
     651        var h = imglist[key]["mc"][escape(url)]._height;         
     652        mc._xscale = 100 *  iconwidth / w; 
     653        mc._yscale = 100 * iconwidth / w; 
     654        mc._x = - .5 * (iconwidth); 
     655        mc._y = - .5 * (iconwidth * h / w); 
     656    } 
     657 
    623658} 
  • worldkit/com/brainoff/worldkitInteraction.as

    r12 r14  
    1212import com.brainoff.worldkitRSS; 
    1313import com.brainoff.worldkitUtil; 
     14//import com.macromedia.javascript.JavaScriptProxy; 
     15import flash.external.*; 
    1416 
    1517class com.brainoff.worldkitInteraction { 
     
    2426    private var keylistener:Object; 
    2527    private var timenavplay:Boolean; 
    26  
     28    //private var proxy:JavaScriptProxy;         
    2729 
    2830    var centery:Number; 
     
    5153    static private var timenavdepth = 10001; 
    5254    static private var dialogdepth = 10003; 
     55    static private var crosshairdepth = 10004; 
    5356 
    5457    function worldkitInteraction(main:worldkitMain) { 
     
    98101            acceptInput = true; 
    99102        } 
     103 
     104        mc.attachMovie("worldkitCrosshair", "crosshair", crosshairdepth); 
     105        mc.crosshair.parent = this; 
     106        mc.crosshair._xscale =  100 * 100 * 2/conf.w; 
     107        mc.crosshair._yscale = 100 * 100 * 2/conf.w; 
     108        if (! conf.inputonly) { 
     109                mc.crosshair._alpha = 0; 
     110        } 
     111 
     112        //proxy = new JavaScriptProxy(); 
    100113    } 
    101114 
     
    195208                mc.toolbar[ b[i] ].onReleaseOutside = function() { this.parent.zoompan = ""; this._alpha = this.parent.conf.controlalpha; } 
    196209                mc.toolbar[ b[i] ]._alpha = conf.controlalpha; 
     210            } 
     211            mc.toolbar["DragOn"].parent = this; 
     212            mc.toolbar["DragOff"].parent = this; 
     213            mc.toolbar["PanOn"].parent = this; 
     214            mc.toolbar["PanOff"].parent = this; 
     215            mc.toolbar["DragOff"].onPress = function() { 
     216                this.parent.conf.zoomselect = true; 
     217                this.parent.conf.grabber = false; 
     218                this.parent.mc.toolbar["PanOn"]._visible = 0; 
     219                this.parent.mc.toolbar["DragOn"]._visible = 1; 
     220            } 
     221            mc.toolbar["PanOff"].onPress = function() { 
     222                this.parent.conf.zoomselect = false; 
     223                this.parent.conf.grabber = true; 
     224                this.parent.mc.toolbar["PanOn"]._visible = 1; 
     225                this.parent.mc.toolbar["DragOn"]._visible = 0; 
     226            } 
     227            if (conf.zoomselect) { 
     228                mc.toolbar["PanOn"]._visible = 0; 
     229            } else { 
     230                mc.toolbar["DragOn"]._visible = 0; 
    197231            } 
    198232        } else { 
     
    232266                    acceptInput = false; 
    233267                    rss.inputToggle(acceptInput); 
     268                    Mouse.show(); 
     269                    mc.crosshair._alpha = 0; 
    234270                } else { 
    235271                    acceptInput = true; 
    236272                    rss.inputToggle(acceptInput);  
     273                    Mouse.hide(); 
     274                    mc.crosshair._alpha = 100; 
    237275                } 
    238276            } 
     
    243281        } 
    244282        zoompan = ""; 
     283        if (conf.onzoompan) { 
     284                var args = "extent=" + cwest + "," + csouth + "," + ceast + "," + cnorth; 
     285                //getURL( conf.onzoompan + "(\"" + args + "\");" ); 
     286                ExternalInterface.call( conf.onzoompan.substr(11), args); 
     287        } 
    245288    } 
    246289 
     
    250293        if (acceptInput == true) { 
    251294 
    252             if (conf.inputonly != true) { acceptInput = false; } 
     295            if (conf.inputonly != true) {  
     296                acceptInput = false; 
     297                mc.crosshair._alpha = 0; 
     298                Mouse.show(); 
     299            } 
    253300            rss.inputToggle(false); 
    254301            annotate(_root._xmouse, _root._ymouse); 
     
    280327 
    281328    public function onMouseMove():Void { 
     329        mc.crosshair._x = _root._xmouse; 
     330        mc.crosshair._y = _root._ymouse; 
     331 
    282332        if (mc.zoombox != undefined) { 
    283333            mc.zoombox.clear(); 
     
    337387            mc.grabber.removeMovieClip(); 
    338388        } 
    339     } 
    340  
     389 
     390        if (conf.onzoompan) { 
     391                var args = "extent=" + cwest + "," + csouth + "," + ceast + "," + cnorth; 
     392                //getURL( conf.onzoompan + "(\"" + args + "\");" ); 
     393                ExternalInterface.call( conf.onzoompan.substr(11), args); 
     394 
     395        } 
     396    } 
     397 
     398    public function onMouseWheel(delta:Number):Void { 
     399//      centery -= delta/(scale); 
     400//      Pan(); 
     401        if (delta > 0) { delta = 1; } else { delta = -1; } 
     402        scale = scale * (Math.pow(conf.zoomc, delta)); 
     403        if (scale > conf.maxscale) { 
     404                scale = conf.maxscale; 
     405        } else if (scale < 1) { 
     406                scale = 1; 
     407        } 
     408        Zoom(); 
     409    } 
    341410 
    342411    public function onEnterFrame():Void { 
     
    384453                Zoom(); 
    385454                zoompan = ""; 
     455                if (conf.onzoompan) { 
     456                        var args = "extent=" + cwest + "," + csouth + "," + ceast + "," + cnorth; 
     457                        ExternalInterface.call( conf.onzoompan.substr(11), args); 
     458                        //getURL(conf.onzoompan + "(\"" + args + "\");" ); 
     459                }        
    386460                break; 
    387461 
     
    512586                fscommand(tmp[1], jsargs); 
    513587            } else { 
    514                 getURL( window.substr(1) + "(\"" + jsargs + "\");" ); 
     588                //proxy.call( window.substr(12), jsargs); 
     589                //getURL( window.substr(1) + "(\"" + jsargs + "\");" ); 
     590                ExternalInterface.call(window.substr(12), jsargs); 
    515591            } 
    516592        } else { 
     
    549625                fscommand(tmp[1], args); 
    550626            } else { 
    551                 getURL( conf.annotateurl + "(\"" + args + "\")" ); 
     627                //proxy.call( conf.annotateurl.substr(11), args); 
     628                //getURL( conf.annotateurl + "(\"" + args + "\")" ); 
     629                ExternalInterface.call( conf.onzoompan.substr(11), args); 
     630 
    552631            } 
    553632        } else { 
     
    565644        _root.JZoomComm = ""; 
    566645        _root.JActComm = ""; 
     646        _root.JItemActComm = ""; 
    567647        _root.JAnnoComm = ""; 
    568648        _root.JHackComm = ""; 
    569649        _root.JInputComm = ""; 
    570650        _root.JGetItemComm = ""; 
     651        _root.JNavmodecomm = ""; 
     652        _root.JGetExtentComm = ""; 
    571653        _root.watch("JComm",worldkitInteraction.onJavascript,this); 
    572654        _root.watch("JSubComm", worldkitInteraction.onJavascript,this); 
     
    576658        _root.watch("JZoomComm", worldkitInteraction.onJavascript,this); 
    577659        _root.watch("JActComm", worldkitInteraction.onJavascript,this); 
     660        _root.watch("JItemActComm", worldkitInteraction.onJavascript,this); 
    578661        _root.watch("JAnnoComm", worldkitInteraction.onJavascript,this); 
    579662        _root.watch("JHackComm", worldkitInteraction.onJavascript,this); 
    580663        _root.watch("JInputComm", worldkitInteraction.onJavascript,this); 
    581664        _root.watch("JGetItemComm", worldkitInteraction.onJavascript,this); 
     665        _root.watch("JNavmodeComm", worldkitInteraction.onJavascript,this); 
     666        _root.watch("JGetExtentComm", worldkitInteraction.onJavascript,this); 
    582667    } 
    583668 
     
    628713        rss.onJActComm(newVal); 
    629714    } 
     715    public function onJItemActComm(newVal) { 
     716        rss.onJItemActComm(newVal); 
     717    } 
    630718    public function onJLoadComm(newVal) { 
    631719        rss.onJLoadComm(newVal); 
     
    652740    public function onJGetItemComm(newVal) { 
    653741        rss.onJGetItemComm(newVal); 
     742    } 
     743    public function onJNavmodeComm(newVal) { 
     744        if (newVal == "zoomselect") { 
     745                conf.zoomselect = true; 
     746                conf.grabber = false; 
     747        } else if (newVal == "grabber") { 
     748                conf.grabber = true; 
     749                conf.zoomselect = false; 
     750        } 
     751    } 
     752    public function onJGetExtentComm(newVal) { 
     753        var args = "extent=" + cwest + "," + csouth + "," + ceast + "," + cnorth + "&" + "zoom=" + scale; 
     754        ExternalInterface.call( newVal, args); 
     755        _root.JGetExtentComm = ""; 
    654756    } 
    655757    public function SetupTimenav():Void { 
  • worldkit/com/brainoff/worldkitMain.as

    r13 r14  
    77 
    88class com.brainoff.worldkitMain { 
    9     static var version:String = "3.0-08052006"; 
     9    static var version:String = "3.0-28122006"; 
    1010 
    1111    var conf:worldkitConfig; 
  • worldkit/com/brainoff/worldkitRSS.as

    r10 r14  
    2323    private var prevlat:Object; 
    2424    private var prevlon:Object; 
     25    private var lastRequest:Boolean; 
     26    private var intervalId:Number; 
    2527 
    2628    function worldkitRSS(main:worldkitMain) { 
     
    7173            } 
    7274            if (conf.update > 0) { 
    73                setInterval( this, "loadData", conf.update * 1000, conf.updateurl);  
     75               intervalId = setInterval( this, "loadData", conf.update * 1000, conf.updateurl);  
    7476            } 
    7577            interact.LoadingDialog(conf.loadrssmsg); 
     78        }        
     79        if (conf.fade != -1) { 
     80                setInterval( this, "setAlphaFade", 60000); 
    7681        } 
    7782    } 
    7883         
    7984    public function loadData(url:String):Void { 
     85        if (conf.resultssince == true && lastRequest == true) { 
     86                if (url.indexOf("?") == -1) { url = url + "?"; } 
     87                //url = url + "&" + lastRequest; 
     88                var age = Math.ceil(conf.update / 60000); 
     89                url = url + "&age=" + age.toString(); //age is mc specific.... 
     90        } 
     91        if (conf.rssbbox == true) { 
     92                if (url.indexOf("?") == -1) { url = url + "?"; } 
     93                var bbox = interact.cwest + "," + interact.csouth + "," + interact.ceast + "," + interact.cnorth; 
     94                url = url + "&bbox=" + bbox; 
     95 
     96        }        
    8097        if (conf.uniqueurls == true) { 
    8198            var d = new Date(); 
     
    89106            rss.onLoad(this,success); 
    90107        } 
     108        lastRequest = true; //new Date(); //set to now 
    91109        loader.load(url); 
     110 
    92111    } 
    93112 
     
    175194 
    176195    private function parseItem(node:XMLNode):Void { 
    177         var e="", n="", u="", g="", lat="", lon="", v="", photo="", id="", nv="", nn=n, attr="", dt=undefined, edt=undefined, list:String=undefined, type=""
     196        var e="", n="", u="", g="", lat="", lon="", v="", photo="", id="", nv="", nn=n, attr="", dt=undefined, edt=undefined, list:String=undefined, type="", icon=undefined
    178197        var sub=new Array(); 
    179198 
     
    264283            case("georss:polygon"): 
    265284                list = nv; 
    266                 type = "polygon"; 
     285                type = "poly"; 
    267286                break; 
    268287            case("georss:box"): 
     
    283302                } else if (node.childNodes[l].firstChild.nodeName == "gml:Polygon") { 
    284303                    list = node.childNodes[l].firstChild.firstChild.firstChild.firstChild.firstChild.nodeValue; 
    285                     type = "polygon"; 
     304                    type = "poly"; 
    286305                } else if (node.childNodes[l].firstChild.nodeName == "gml:Envelope") { 
    287306                    list = node.childNodes[l].firstChild.childNodes[0].firstChild.nodeValue + " " + node.childNodes[l].firstChild.childNodes[1].firstChild.nodeValue; 
     
    317336                photo = nv; 
    318337                break; 
     338            case("media:icon"): 
     339                icon = nv; 
     340                break; 
    319341            case("pubdate"): //RSS 2.0 
    320342            case("issued"): //Atom 
     
    331353                } 
    332354                break; 
     355            case("metacarta:geoextract"): 
     356                v = v + "<br/><font color='#ff0000'>" + nv + "</font>"; 
     357                break; 
    333358            default: 
    334359            } 
     
    342367        if (lat != "" && lon != "") { 
    343368            g = lat + "," + lon; 
    344         } else if (type == "poly" || type == "line") { 
     369        } else if (list != "") { 
    345370            var listtmp = list.split(" "); 
    346371            lat = listtmp[0]; lon = listtmp[1]; 
     
    364389        sub.push("_default_"); 
    365390 
    366         if ((g != "" && interact.pointOnMap(lat,lon)) || (Points[id] != undefined)) { 
     391        if ((g != "" && interact.pointOnMap(lat,lon)) || (Points[id] != undefined) || (type != "")) { 
    367392            if (Points[id] == undefined) { 
    368393                var plat,plon; 
     
    375400                } 
    376401 
    377                 Points[id] = new worldkitAnnotation(main,mc.rss,depth,n,u,lat,lon,v,sub,id,photo,plat,plon,list,type,dt,undefined,edt); 
     402                Points[id] = new worldkitAnnotation(main,mc.rss,depth,n,u,lat,lon,v,sub,id,photo,plat,plon,list,type,dt,undefined,edt,icon); 
    378403             
    379404                if (conf.plotinterval == 0) { 
     
    387412             
    388413                if (conf.maxzoom) { 
    389                     interact.recordExtremes(lat,lon); 
     414                    if (type == "poly" || type == "line") { 
     415                        var varray = list.split(" "); 
     416                        for (var i=0; i<varray.length-1; i+=2) { 
     417                            interact.recordExtremes(varray[i],varray[i+1]); 
     418                        } 
     419                    } else { 
     420                            interact.recordExtremes(lat,lon); 
     421                    } 
    390422                } 
    391423                //record time extremes? 
     
    484516    } 
    485517 
     518    public function setAlphaFade():Void { 
     519        var now:Date = new Date(); 
     520        for (var p in Points) { 
     521                Points[p].setAlphaFade(now); 
     522        } 
     523    } 
     524 
    486525    public function setActive(nowActive:worldkitAnnotation):Void { 
    487526        var a = activeAnnotation; 
     
    519558        } 
    520559    } 
     560    public function onJItemActComm(id:String):Void { 
     561        Points[id].forceActivate(); 
     562    } 
    521563    public function onJLoadComm(action:String):Void { 
    522564        if (action == "updateurl") { 
     
    529571            clear(); 
    530572        } else if (action != "") { 
    531             loadData(action); 
     573            conf.updateurl = action; 
     574            lastRequest = false; 
     575            if (conf.update > 0) { 
     576                if (intervalId) { 
     577                        clearInterval(intervalId); 
     578                }        
     579                intervalId = setInterval( this, "loadData", conf.update * 1000, conf.updateurl); 
     580            } 
     581            loadData(conf.updateurl); 
    532582            interact.LoadingDialog(conf.loadrssmsg); 
    533583        }