チェンジセット 2058
- コミット日時:
- 2008/12/16 00:28:25 (3 年前)
- ファイル:
-
- as3/StreetView/trunk/libs (追加)
- as3/StreetView/trunk/samples/Sample-app.xml (更新) (1 diff)
- as3/StreetView/trunk/samples/Sample.as (更新) (3 diffs)
- as3/StreetView/trunk/src (更新) (1 prop)
- as3/StreetView/trunk/src/uranodai/streetview/StreetView.as (更新) (6 diffs)
- as3/StreetView/trunk/src/uranodai/streetview/data (追加)
- as3/StreetView/trunk/src/uranodai/streetview/data/LocationData.as (追加)
- as3/StreetView/trunk/src/uranodai/streetview/data/Shibuya.as (追加)
- as3/StreetView/trunk/src/uranodai/streetview/event (追加)
- as3/StreetView/trunk/src/uranodai/streetview/event/StreetViewEvent.as (追加)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/StreetView/trunk/samples/Sample-app.xml
r1227 r2058 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 <application xmlns="http://ns.adobe.com/air/application/1. 0">2 <application xmlns="http://ns.adobe.com/air/application/1.5"> 3 3 4 4 <!-- Adobe AIR Application Descriptor File Template. as3/StreetView/trunk/samples/Sample.as
r1227 r2058 2 2 { 3 3 import flash.display.Sprite; 4 import flash.display.StageAlign; 5 import flash.display.StageScaleMode; 6 import flash.events.Event; 4 7 import flash.events.KeyboardEvent; 5 8 import flash.ui.Keyboard; 6 9 7 10 import uranodai.streetview.StreetView; 11 import uranodai.streetview.data.LocationData; 12 import uranodai.streetview.data.Shibuya; 8 13 9 [SWF(width=" 300",height="350",frameRate="30",backgroundColor="#FFFF00")]14 [SWF(width="500",height="550",frameRate="30",backgroundColor="#FFFF00")] 10 15 11 16 public class Sample extends Sprite … … 15 20 public function Sample() 16 21 { 17 streetView = new StreetView(300,300); 18 streetView.load("http://localhost/Workspace/StreetView/app/"); 22 stage.scaleMode = StageScaleMode.NO_SCALE; 23 stage.align = StageAlign.TOP_LEFT; 24 25 var location:LocationData = new Shibuya().minamiguchi; 26 27 streetView = new StreetView(500,500); 28 streetView.load(location.lat, location.lon); 19 29 addChild(streetView); 30 31 stage.addEventListener(Event.RESIZE, onResize); 20 32 21 33 stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); … … 25 37 { 26 38 if(e.keyCode == Keyboard.UP){ 27 //進む 39 //進む 28 40 streetView.goFront(); 29 41 } 30 42 } 31 43 44 private function onResize(e:Event):void 45 { 46 streetView.resize(stage.stageWidth, stage.stageHeight-50); 47 } 48 32 49 } 33 50 } as3/StreetView/trunk/src
- 属性の設定値: svn:ignore (登録)
Sample-app.xml
Sample.as
- 属性の設定値: svn:ignore (登録)
as3/StreetView/trunk/src/uranodai/streetview/StreetView.as
r1227 r2058 1 1 package uranodai.streetview 2 2 { 3 import flash.display.Bitmap; 4 import flash.display.BitmapData; 3 5 import flash.display.Sprite; 6 import flash.events.Event; 4 7 import flash.html.HTMLLoader; 5 8 import flash.net.URLRequest; 9 10 import uranodai.streetview.event.StreetViewEvent; 6 11 7 12 public class StreetView extends Sprite 8 13 { 14 public static const APP_URL:String = "http://uranodai.com/docs/streetview/"; 15 9 16 private var html:HTMLLoader; 17 18 private var bitmap:Bitmap; 19 private var bitmapData:BitmapData; 10 20 11 21 private var _lat:Number; 12 22 private var _lon:Number; 23 24 private var w:int; 25 private var h:int; 13 26 14 27 public function StreetView(w:int, h:int) … … 17 30 html.width = w; 18 31 html.height = h; 32 33 this.w = w; 34 this.h = h; 19 35 } 20 36 21 public function load( appUrl:String="", latitude:Number=42.345573, longitude:Number=-71.098326):void37 public function load(latitude:Number=42.345573, longitude:Number=-71.098326, appUrl:String=APP_URL):void 22 38 { 23 39 var req:URLRequest = new URLRequest(); … … 30 46 html.window.load(latitude, longitude); 31 47 } 48 html.window.onYawChanged = function(yaw:Number):void 49 { 50 //trace("yaw", yaw); 51 } 52 html.window.onPitchChanged = function(pitch:Number):void 53 { 54 //trace("pitch", pitch); 55 } 56 html.window.onZoomChanged = function(zoom:Number):void 57 { 58 //trace("zoom", zoom); 59 } 60 html.window.onInitialized = function(location:Object):void 61 { 62 _lat = String(location.latlng).split(", ")[0].toString().split("(")[1]; 63 _lon = String(location.latlng).split(", ")[1].toString().split(")")[0]; 64 //trace(_lat, _lon); 65 //trace(location.pov); 66 //trace(location.description); 67 //trace(location.panoId); 68 } 32 69 33 70 _lat = latitude; 34 71 _lon = longitude; 72 73 bitmapData = new BitmapData(w, h); 74 bitmapData.draw(html); 75 bitmap = new Bitmap(bitmapData, "auto", true); 76 addChild(bitmap); 77 78 addEventListener(Event.ENTER_FRAME, onEnterFrame); 79 } 80 81 private var _loaded:Boolean = false; 82 83 private function onEnterFrame(e:Event):void 84 { 85 if(html.window.StreetView != undefined && _loaded == false){ 86 _loaded = true; 87 dispatchEvent(new StreetViewEvent(StreetViewEvent.ON_LOAD)); 88 } 89 90 bitmapData.draw(html); 91 } 92 93 public function getLat():Number 94 { 95 return _lat; 96 } 97 98 public function getLng():Number 99 { 100 return _lon; 35 101 } 36 102 … … 42 108 { 43 109 return html.window.StreetView.currentYaw; 110 } 111 public function getZoom():Number 112 { 113 return html.window.StreetView.currentZoom; 44 114 } 45 115 … … 87 157 html.window.zoomOut(); 88 158 } 159 160 public function scaleTo(scale:Number):void 161 { 162 163 bitmap.scaleX = scale; 164 bitmap.scaleY = scale; 165 bitmap.x = (1-scale)*html.width/2; 166 bitmap.y = (1-scale)*html.height/2; 167 168 //Tweener.addTween(bitmap, {scaleX:scale, scaleY:scale, x:(1-scale)*html.width/2, y:(1-scale)*html.height/2, time:0.5, transition:"easeOutCubic" }); 169 } 170 171 public function update(lat:Number, lon:Number):void 172 { 173 _lat = lat; 174 _lon = lon; 175 html.window.load(lat, lon); 176 } 177 89 178 public function resize(w:int, h:int):void 90 179 { … … 92 181 html.height = h; 93 182 html.window.load(_lat, _lon); 183 184 185 bitmapData = new BitmapData(w, h); 186 bitmap.bitmapData = bitmapData; 94 187 } 95 188 }

