-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd8997c
commit 6c231fb
Showing
15 changed files
with
296 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
ApplicationMap/src/main/actionscript/FlexUnitApplication.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package | ||
{ | ||
import Array; | ||
|
||
import flash.display.Sprite; | ||
|
||
import flexunit.flexui.FlexUnitTestRunnerUIAS; | ||
|
||
import sk.yoz.utils.PathSimplifyTest; | ||
import sk.yoz.ycanvas.map.demo.utils.BingMapsUtilsTest; | ||
import sk.yoz.ycanvas.map.utils.PartialBoundsUtilsTest; | ||
import sk.yoz.ycanvas.map.utils.PolygonUtilsTest; | ||
import sk.yoz.ycanvas.map.utils.StrokeUtilsTest; | ||
import sk.yoz.ycanvas.map.utils.VertexDataUtilsTest; | ||
|
||
public class FlexUnitApplication extends Sprite | ||
{ | ||
public function FlexUnitApplication() | ||
{ | ||
onCreationComplete(); | ||
} | ||
|
||
private function onCreationComplete():void | ||
{ | ||
var testRunner:FlexUnitTestRunnerUIAS=new FlexUnitTestRunnerUIAS(); | ||
testRunner.portNumber=8765; | ||
this.addChild(testRunner); | ||
testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "ApplicationMap"); | ||
} | ||
|
||
public function currentRunTestSuite():Array | ||
{ | ||
var testsToRun:Array = new Array(); | ||
testsToRun.push(sk.yoz.utils.PathSimplifyTest); | ||
testsToRun.push(sk.yoz.ycanvas.map.utils.PolygonUtilsTest); | ||
testsToRun.push(sk.yoz.ycanvas.map.demo.utils.BingMapsUtilsTest); | ||
testsToRun.push(sk.yoz.ycanvas.map.utils.PartialBoundsUtilsTest); | ||
testsToRun.push(sk.yoz.ycanvas.map.utils.VertexDataUtilsTest); | ||
testsToRun.push(sk.yoz.ycanvas.map.utils.StrokeUtilsTest); | ||
return testsToRun; | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
ApplicationMap/src/main/actionscript/FlexUnitCompilerApplication.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
*This file is automatically generated by Flash Builder to compile FlexUnit classes and is not intended for modification. | ||
*Please click on the "Refresh" icon in "FlexUnit Results" view to regenerate this file. | ||
*/ | ||
|
||
package | ||
{ | ||
import flash.display.Sprite; | ||
|
||
import sk.yoz.ycanvas.map.demo.utils.BingMapsUtilsTest; | ||
|
||
public class FlexUnitCompilerApplication extends Sprite | ||
{ | ||
|
||
private var sk_yoz_ycanvas_map_demo_utils_BingMapsUtilsTest_obj:sk.yoz.ycanvas.map.demo.utils.BingMapsUtilsTest; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
ApplicationMap/src/main/actionscript/sk/yoz/ycanvas/map/demo/partition/CustomPartition.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package sk.yoz.ycanvas.map.demo.partition | ||
{ | ||
import flash.events.IEventDispatcher; | ||
|
||
import sk.yoz.net.URLRequestBuffer; | ||
import sk.yoz.ycanvas.interfaces.ILayer; | ||
import sk.yoz.ycanvas.map.demo.utils.BingMapsUtils; | ||
import sk.yoz.ycanvas.map.partitions.Partition; | ||
import sk.yoz.ycanvas.map.valueObjects.MapConfig; | ||
|
||
public class CustomPartition extends Partition | ||
{ | ||
public function CustomPartition(x:int, y:int, layer:ILayer, | ||
config:MapConfig, dispatcher:IEventDispatcher, | ||
buffer:URLRequestBuffer) | ||
{ | ||
super(x, y, layer, config, dispatcher, buffer); | ||
} | ||
|
||
override protected function get url():String | ||
{ | ||
var url:String = super.url; | ||
if(url.indexOf("${bingMapsQuadKey}") > 0) | ||
{ | ||
var quadKey:String = BingMapsUtils.tileXYToQuadKey( | ||
x / expectedWidth / layer.level, | ||
y / expectedHeight / layer.level, | ||
18 - getLevel(layer.level)); | ||
url = url.replace("${bingMapsQuadKey}", quadKey); | ||
} | ||
|
||
return url; | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...tionMap/src/main/actionscript/sk/yoz/ycanvas/map/demo/partition/CustomPartitionFactory.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package sk.yoz.ycanvas.map.demo.partition | ||
{ | ||
import flash.events.IEventDispatcher; | ||
|
||
import sk.yoz.net.URLRequestBuffer; | ||
import sk.yoz.ycanvas.interfaces.ILayer; | ||
import sk.yoz.ycanvas.interfaces.IPartition; | ||
import sk.yoz.ycanvas.map.partitions.PartitionFactory; | ||
import sk.yoz.ycanvas.map.valueObjects.MapConfig; | ||
|
||
public class CustomPartitionFactory extends PartitionFactory | ||
{ | ||
public function CustomPartitionFactory(config:MapConfig, | ||
dispatcher:IEventDispatcher, buffer:URLRequestBuffer) | ||
{ | ||
super(config, dispatcher, buffer); | ||
} | ||
|
||
override public function create(x:int, y:int, layer:ILayer):IPartition | ||
{ | ||
return new CustomPartition(x, y, layer, config, dispatcher, buffer); | ||
} | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
ApplicationMap/src/main/actionscript/sk/yoz/ycanvas/map/demo/utils/BingMapsUtils.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* Inspired by: | ||
http://msdn.microsoft.com/en-us/library/bb259689.aspx | ||
*/ | ||
package sk.yoz.ycanvas.map.demo.utils | ||
{ | ||
import sk.yoz.ycanvas.map.demo.valueObjects.BingMapsTileInfo; | ||
|
||
public class BingMapsUtils | ||
{ | ||
public static function tileXYToQuadKey(tileX:uint, tileY:uint, levelOfDetail:uint):String | ||
{ | ||
var quadKey:String = ""; | ||
for(var i:uint = levelOfDetail; i > 0; i--) | ||
{ | ||
var digit:uint = 0; | ||
var mask:uint = 1 << (i - 1); | ||
if((tileX & mask) != 0) | ||
{ | ||
digit++; | ||
} | ||
if((tileY & mask) != 0) | ||
{ | ||
digit++; | ||
digit++; | ||
} | ||
quadKey += digit; | ||
} | ||
return quadKey; | ||
} | ||
|
||
public static function quadKeyToTileXY(quadKey:String):BingMapsTileInfo | ||
{ | ||
var result:BingMapsTileInfo = new BingMapsTileInfo; | ||
result.tileX = 0; | ||
result.tileY = 0; | ||
result.levelOfDetail = quadKey.length; | ||
for(var i:uint = result.levelOfDetail; i > 0; i--) | ||
{ | ||
var mask:uint = 1 << (i - 1); | ||
switch(quadKey.charAt(result.levelOfDetail - i)) | ||
{ | ||
case '0': | ||
break; | ||
|
||
case '1': | ||
result.tileX |= mask; | ||
break; | ||
|
||
case '2': | ||
result.tileY |= mask; | ||
break; | ||
|
||
case '3': | ||
result.tileX |= mask; | ||
result.tileY |= mask; | ||
break; | ||
|
||
default: | ||
throw new Error("Invalid QuadKey digit sequence."); | ||
} | ||
} | ||
return result; | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...icationMap/src/main/actionscript/sk/yoz/ycanvas/map/demo/valueObjects/BingMapsTileInfo.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package sk.yoz.ycanvas.map.demo.valueObjects | ||
{ | ||
public class BingMapsTileInfo | ||
{ | ||
public var tileX:uint | ||
public var tileY:uint; | ||
public var levelOfDetail:uint; | ||
} | ||
} |
Oops, something went wrong.