Changeset 24
- Timestamp:
- 02/16/07 09:51:02 (2 years ago)
- Files:
-
- worldkit/com/brainoff/worldkitAnnotation.as (modified) (2 diffs)
- worldkit/com/brainoff/worldkitConfig.as (modified) (4 diffs)
- worldkit/com/brainoff/worldkitImages.as (modified) (8 diffs)
- worldkit/com/brainoff/worldkitInteraction.as (modified) (8 diffs)
- worldkit/com/brainoff/worldkitMain.as (modified) (1 diff)
- worldkit/com/brainoff/worldkitRSS.as (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
worldkit/com/brainoff/worldkitAnnotation.as
r14 r24 210 210 mc[ textname ]._x = textx; if (textx != x) { mc[textname].leftpos = true; } 211 211 mc[ textname ]._y = texty; if (texty != y) { mc[textname].bottompos = true; } 212 212 213 213 214 mc[textname]._xscale = scale; 214 215 mc[textname]._yscale = scale; … … 542 543 rss.setActive(this); 543 544 } 545 546 var ratio = conf.w / conf.h; 547 var stagew, stageh, textx, texty; 548 if (ratio > 1) { stagew = 100 * ratio; stageh = 100; } 549 else { stageh = 100 / ratio; stagew = 100; } 550 551 var mousex = conf.w * (_root._xmouse / stagew); 552 var mousey = conf.h * (_root._ymouse / stageh); 553 554 if (mc.origwidth - mousex < conf.textboxsize) { textx = mousex - (conf.textboxsize / interact.scale); } 555 if (mc.origheight - y < 100) { texty = mousey - (50 / interact.scale); } 556 557 mc[ textname ]._x = textx; if (textx != x) { mc[textname].leftpos = true; } 558 mc[ textname ]._y = texty; if (texty != y) { mc[textname].bottompos = true; } 559 544 560 mc[ textname ]._visible = 1; 545 561 } else { worldkit/com/brainoff/worldkitConfig.as
r19 r24 404 404 } 405 405 if (attr.minscale != undefined) { 406 this.swflayer[attr.id].min scale= attr.minscale;406 this.swflayer[attr.id].minview = attr.minscale; 407 407 } 408 408 if (attr.maxscale != undefined) { 409 this.swflayer[attr.id].max scale= attr.maxscale;409 this.swflayer[attr.id].maxview = attr.maxscale; 410 410 } 411 411 if (attr.preload != undefined) { … … 457 457 this.wms[ attr.id ] = new Object(); 458 458 this.wms[ attr.id ].url = value; 459 if (attr.path) { 460 this.wms[ attr.id ].url = this.wms[ attr.id ].url + attr.path; 461 } else { 462 this.wms[ attr.id ].url = this.wms[ attr.id ].url + "ZOOM/XTILE/YTILE.jpg"; 463 } 464 if (attr.origin) { 465 this.wms[ attr.id ].origin = attr.origin; 466 } else { 467 this.wms[ attr.id ].origin = "sw"; 468 } 459 469 this.wms[ attr.id ].width = 256; 460 470 this.wms[ attr.id ].height = 256; … … 590 600 if (wms[ s ].tilemap) { 591 601 swftemplate[ id ].url = wms[ s ].url; 602 swftemplate[ id ].origin = wms[ s ].origin; 592 603 swftemplate[ id ].tilemap = true; 593 604 } else { … … 626 637 loader.onLoad = function(success) { config.onZoomifyConfig(this,success); }; 627 638 loader.load( zoomifydir + "ImageProperties.xml" ); 639 640 if (toolbar == undefined) { 641 toolbar = true; 642 } 628 643 return true; 629 644 } else { worldkit/com/brainoff/worldkitImages.as
r21 r24 1 1 2 import com.brainoff.worldkitMain; 2 3 import com.brainoff.worldkitConfig; … … 90 91 for (var s in conf.swftemplate) { 91 92 imagemc.createEmptyMovieClip(s, layer + conf.swftemplate[s].layer); 92 if (conf.swftemplate[s].layer > l) {93 l = conf.swftemplate[s].layer; //REVIST tangled interplay of config iterator, layer, etc94 }95 93 } 96 layer += l;94 layer += conf.swftemplatelayer; 97 95 98 96 // checkSwfTemplate(); … … 103 101 */ 104 102 for (var swf in conf.swflayer) { 105 if (conf.swflayer[swf].preload != false && ! conf.swflayer[swf].fromtemplate) { //need to save layer level if not preload103 if (conf.swflayer[swf].preload != false && conf.swflayer[swf].fromtemplate != true) { //need to save layer level if not preload 106 104 loadImage(imagemc, "swflayer" + swf, conf.swflayer[swf].url, layer, "AdjustSwf", 0,1, conf.swflayer[swf].w, conf.swflayer[swf].h, conf.swflayer[swf].extent, true); 107 conf.swflayer[swf].parent = imagemc;108 105 layer++; 109 } 106 } 107 conf.swflayer[swf].parent = imagemc; 110 108 } 111 109 … … 220 218 target_mc.origwidth = target_mc._width; 221 219 } 220 target_mc.actualwidth = target_mc._width; 222 221 223 222 if (imglist[key].height != undefined) { … … 226 225 target_mc.origheight = target_mc._height; 227 226 } 227 target_mc.actualheight = target_mc._height; 228 228 } 229 229 … … 318 318 clip.setMask( clip[ "masker"] ); 319 319 } 320 interact.scaleAndPosition(mc, id, conf.swflayer[confid].extent );320 interact.scaleAndPosition(mc, id, conf.swflayer[confid].extent, true); 321 321 mc[ id ]._alpha = 100; 322 322 … … 335 335 if (mc[id] == undefined) { 336 336 loadImage(mc, id, conf.swflayer[confid].url, layer, "AdjustSwf", 0, 1, conf.swflayer[confid].w, conf.swflayer[confid].h, conf.swflayer[confid].extent); 337 layer++; 337 338 } else if (mc[id].loaded == true) { 338 interact.scaleAndPosition(mc, id, conf.swflayer[confid].extent); 339 interact.scaleAndPosition(mc, id, conf.swflayer[confid].extent, true); 340 var wsen = conf.swflayer[confid].extent.split(','); 341 //interact.onJRSSComm("<rss><channel><item><description>" + conf.swflayer[confid].extent + "</description><georss:box>" + wsen[1] + " " + wsen[0] + " " + wsen[3] + " " + wsen[2] + "</georss:box></item></channel></rss>"); 339 342 mc[ id ]._visible = true; 340 343 //setTimeNavAlpha(mc,id); … … 425 428 426 429 if (conf.swftemplate[id].tilemap) { 427 tileurl = tileurl + Math.log(conf.swftemplate[id].minscale)/Math.log(2) + "/" + i + "/" + (conf.swftemplate[id].spany - j - 1) + ".jpg"; 430 tileurl = worldkitUtil.myreplace(tileurl,"ZOOM", (Math.log(conf.swftemplate[id].minscale)/Math.log(2)).toString()); 431 tileurl = worldkitUtil.myreplace(tileurl,"XTILE", i); 432 if (conf.swftemplate[ id ].origin == "nw") { 433 tileurl = worldkitUtil.myreplace(tileurl,"YTILE", j); 434 } else { 435 tileurl = worldkitUtil.myreplace(tileurl,"YTILE", (conf.swftemplate[id].spany -j - 1).toString()); 436 } 437 438 439 //tileurl = tileurl + Math.log(conf.swftemplate[id].minscale)/Math.log(2) + "/" + i + "/" + (conf.swftemplate[id].spany - j - 1) + ".jpg"; 428 440 } else if (conf.swftemplate[id].zoomify != undefined) { 429 441 var group = Math.floor((conf.swftemplate[id].tilecount + i + (j * conf.swftemplate[id].spanx)) / 256); worldkit/com/brainoff/worldkitInteraction.as
r19 r24 223 223 } else { 224 224 mc.toolbar["DragOn"]._visible = 0; 225 conf.grabber = true; 225 226 } 226 227 } else { … … 490 491 491 492 Zoom(); 493 494 if (conf.onzoompan) { 495 var args = "extent=" + cwest + "," + csouth + "," + ceast + "," + cnorth; 496 //getURL( conf.onzoompan + "(\"" + args + "\");" ); 497 ExternalInterface.call( conf.onzoompan.substr(11), args); 498 } 492 499 } 493 500 … … 803 810 } 804 811 805 public function geo2xy(lat:Number,lon:Number,point:Boolean ):Array {812 public function geo2xy(lat:Number,lon:Number,point:Boolean,over:Boolean):Array { 806 813 807 814 var w = conf.w; … … 831 838 y = lon; 832 839 } else if (conf.west >= conf.east) { 833 if (lon <= ea ) {840 if (lon <= ea || over) { 834 841 x = ((lon - we + 360)/(ea + 360 - we)) * w; 835 842 } else { … … 873 880 The black magic of worldKit. Fit images to a map with dynamically determing width/heigh 874 881 */ 875 public function scaleAndPosition(parent:MovieClip, id:String, extent:String ):Void {882 public function scaleAndPosition(parent:MovieClip, id:String, extent:String, tiled:Boolean):Void { 876 883 877 884 var w, h; … … 890 897 var xanother = 0; 891 898 var yanother = 0; 899 var xy; 900 892 901 if (extent == 1) { 893 902 hanother = 180/(conf.north - conf.south); 894 903 wanother = 360/(conf.east - conf.west); 895 904 896 varxy = geo2xy(90,-180);905 xy = geo2xy(90,-180); 897 906 xanother = xy[0] * w / conf.w; 898 907 yanother = xy[1] * h / conf.h; 908 899 909 } else if (extent != undefined) { 900 910 var no,so,ea,we; … … 904 914 wanother = (ea - we)/(conf.east - conf.west); 905 915 906 varxy = geo2xy( no, we);916 xy = geo2xy( no, we); 907 917 xanother = xy[0] * scale * w / conf.w; 908 918 yanother = xy[1] * scale * h / conf.h; 919 909 920 } 910 921 … … 915 926 clip = parent[id]; 916 927 } 917 clip._xscale = scale * 100 * ( w / clip.origwidth) * wanother; 918 clip._yscale = scale * 100 * ( h / clip.origheight) * hanother; 928 929 930 var xscale = scale * 100 * ( w / clip.origwidth) * wanother; 931 var yscale = scale * 100 * ( h / clip.origheight) * hanother; 919 932 920 933 var xoffset = scale * ((conf.w / 2) - centerx) * (w / conf.w); 921 934 var yoffset = scale * ((conf.h / 2) - centery) * (h / conf.h); 922 935 923 clip._x = - ((w - wfactor) / 2 + ((scale - 1) * w / 2)) + xoffset + xanother; 924 clip._y = - ((h - hfactor) / 2 + ((scale - 1) * h / 2)) + yoffset + yanother; 936 var xp = - ((w - wfactor) / 2 + ((scale - 1) * w / 2)) + xoffset + xanother; 937 var yp = - ((h - hfactor) / 2 + ((scale - 1) * h / 2)) + yoffset + yanother; 938 939 if (tiled) { 940 var width = clip.actualwidth * xscale / 100; 941 var height = clip.actualheight * yscale / 100; 942 943 var x2 = Math.floor(xp * 20) / 20; 944 var y2 = Math.floor(yp * 20) / 20; 945 946 width = width + (xp - x2); 947 height = height + (yp - y2); 948 949 width = Math.ceil(width * 20) / 20; 950 height = Math.ceil(height * 20) / 20; 951 952 if (clip.actualwidth < clip.origwidth) { 953 width = Math.ceil(width); 954 } 955 if (clip.actualheight < clip.origheight) { 956 height = Math.ceil(height); 957 } 958 959 clip._width = width; 960 clip._height = height; 961 962 963 clip._x = x2; 964 clip._y = y2; 965 } else { 966 clip._xscale = xscale; 967 clip._yscale = yscale; 968 clip._x = xp; 969 clip._y = yp; 970 } 971 972 if (tiled && false) { 973 var wsen = extent.split(","); 974 xy = geo2xy(wsen[1], wsen[2], undefined, true); 975 xanother = xy[0] * scale * w / conf.w; 976 yanother = xy[1] * scale * h / conf.h; 977 978 var x2 = - ((w - wfactor) / 2 + ((scale - 1) * w / 2)) + xoffset + xanother; 979 var y2 = - ((h - hfactor) / 2 + ((scale - 1) * h / 2)) + yoffset + yanother; 980 x2 = Math.round(x2 * 20) / 20; 981 y2 = Math.round(y2 * 20) / 20; 982 trace( id + " " + clip._x + " " + clip._y); 983 trace( id + " " + x2 + "," + y2 + " " + (clip._x + clip._width) + "," + (clip._y + clip._height) ); 984 985 //clip._width += (x2 - (clip._x + clip._width)); 986 //clip._height += (y2 - (clip._y + clip._height)); 987 var xdiff = x2 - (clip._x + clip._width); 988 var ydiff = y2 - (clip._y + clip._height); 989 if (xdiff > 0.0001 && xdiff < 1) { 990 clip._width += xdiff; 991 } 992 if (ydiff > 0.0001 && ydiff < 1) { 993 clip._height += ydiff; 994 //trace( id + " " + x2 + "," + y2 + " " + (clip._x + clip._width) + "," + (clip._y + clip._height) ); 995 } 996 trace( id + " " + x2 + "," + y2 + " " + (clip._x + clip._width) + "," + (clip._y + clip._height) ); 997 } 925 998 } 926 999 worldkit/com/brainoff/worldkitMain.as
r23 r24 7 7 8 8 class com.brainoff.worldkitMain { 9 static var version:String = "3.1-20070 125";9 static var version:String = "3.1-20070201"; 10 10 11 11 var conf:worldkitConfig; worldkit/com/brainoff/worldkitRSS.as
r17 r24 351 351 break; 352 352 case("pubdate"): //RSS 2.0 353 case("issued"): //Atom 353 case("issued"): //Atom 0.3 354 case("updated"): //Atom 1.0 354 355 case("dc:date"): //RSS 1.0 355 356 case("ev:startdate"): //for consistency
