Permalink
Browse files

reverting back to URLRequestBuffer because of performance

  • Loading branch information...
1 parent f676200 commit eb12fc0f1120615fce908bcfd9731cbfaaeebe08 @jozefchutka committed Sep 3, 2013
Showing with 534 additions and 101 deletions.
  1. +6 −11 ApplicationDemo/src/main/actionscript/sk/yoz/ycanvas/demo/simple/Partition.as
  2. +5 −12 ApplicationExplorer/src/main/actionscript/sk/yoz/ycanvas/demo/explorer/modes/Partition.as
  3. +10 −3 ApplicationMap/src/main/actionscript/sk/yoz/ycanvas/map/demo/Main.as
  4. +4 −2 ApplicationMap/src/main/actionscript/sk/yoz/ycanvas/map/demo/MapHelperMain.as
  5. +7 −2 ApplicationMap/src/main/actionscript/sk/yoz/ycanvas/map/demo/MapHelperOverlay.as
  6. +4 −2 ApplicationMap/src/main/actionscript/sk/yoz/ycanvas/map/demo/MapHelperSmall.as
  7. +4 −2 ApplicationMap/src/main/actionscript/sk/yoz/ycanvas/map/demo/partition/CustomPartition.as
  8. +4 −3 ApplicationMap/src/main/actionscript/sk/yoz/ycanvas/map/demo/partition/CustomPartitionFactory.as
  9. +3 −3 ApplicationMapMobile/.actionScriptProperties
  10. +5 −12 ApplicationMarkers/src/main/actionscript/sk/yoz/ycanvas/demo/markers/ycanvas/Partition.as
  11. +5 −11 ApplicationRemotair/src/main/actionscript/sk/yoz/ycanvas/demo/remotair/Partition.as
  12. +3 −3 YCanvasMapLibrary/.actionScriptProperties
  13. +40 −0 YCanvasMapLibrary/libs/yoz/sk/yoz/events/URLRequestBufferEvent.as
  14. +229 −0 YCanvasMapLibrary/libs/yoz/sk/yoz/net/URLRequestBuffer.as
  15. +105 −0 YCanvasMapLibrary/libs/yoz/sk/yoz/net/URLRequestBufferItem.as
  16. +11 −1 YCanvasMapLibrary/src/main/actionscript/sk/yoz/ycanvas/map/YCanvasMap.as
  17. +64 −0 YCanvasMapLibrary/src/main/actionscript/sk/yoz/ycanvas/map/managers/LoaderOptimizer.as
  18. +20 −32 YCanvasMapLibrary/src/main/actionscript/sk/yoz/ycanvas/map/partitions/Partition.as
  19. +5 −2 YCanvasMapLibrary/src/main/actionscript/sk/yoz/ycanvas/map/partitions/PartitionFactory.as
@@ -106,8 +106,8 @@ package sk.yoz.ycanvas.demo.simple
loader.load(new URLRequest(url), context);
var loaderInfo:LoaderInfo = loader.contentLoaderInfo;
- loaderInfo.addEventListener(Event.COMPLETE, onComplete);
- loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError);
+ loaderInfo.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
+ loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError, false, 0, true);
}
public function stopLoading():void
@@ -121,18 +121,13 @@ package sk.yoz.ycanvas.demo.simple
}
catch(error:Error){}
- try
- {
- loader.unload();
- }
- catch(error:Error){}
-
- var loaderInfo:LoaderInfo = loader.loaderInfo;
+ var loaderInfo:LoaderInfo = loader.contentLoaderInfo;
if(loaderInfo)
{
- loaderInfo.removeEventListener(Event.COMPLETE, onComplete);
- loaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onError);
+ loaderInfo.removeEventListener(Event.COMPLETE, onComplete, false);
+ loaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onError, false);
}
+
loader = null;
}
@@ -136,8 +136,8 @@ package sk.yoz.ycanvas.demo.explorer.modes
loader.load(new URLRequest(url), context);
var loaderInfo:LoaderInfo = loader.contentLoaderInfo;
- loaderInfo.addEventListener(Event.COMPLETE, onComplete);
- loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError);
+ loaderInfo.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
+ loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError, false, 0, true);
}
public function stopLoading(cancelRequest:Boolean = true):void
@@ -152,20 +152,13 @@ package sk.yoz.ycanvas.demo.explorer.modes
loader.close();
}
catch(error:Error){}
-
- try
- {
- loader.unload();
- }
- catch(error:Error){}
-
}
- var loaderInfo:LoaderInfo = loader.loaderInfo;
+ var loaderInfo:LoaderInfo = loader.contentLoaderInfo;
if(loaderInfo)
{
- loaderInfo.removeEventListener(Event.COMPLETE, onComplete);
- loaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onError);
+ loaderInfo.removeEventListener(Event.COMPLETE, onComplete, false);
+ loaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onError, false);
}
loader = null;
}
@@ -19,6 +19,7 @@ package sk.yoz.ycanvas.map.demo
import sk.yoz.ycanvas.map.demo.mock.RouteRomeParis;
import sk.yoz.ycanvas.map.display.MapStroke;
import sk.yoz.ycanvas.map.display.Polygon;
+ import sk.yoz.ycanvas.map.managers.LoaderOptimizer;
import sk.yoz.ycanvas.map.utils.OptimizedPointsUtils;
import sk.yoz.ycanvas.map.valueObjects.OptimizedPoints;
@@ -62,6 +63,7 @@ package sk.yoz.ycanvas.map.demo
private var routeNewYorkWashingtonStroke:MapStroke;
private var areaCzechRepublicPolygon:Polygon;
private var citiesMarkers:Vector.<CityMarker>;
+ private var loaderOptimizer:LoaderOptimizer;
public function Main()
{
@@ -116,12 +118,14 @@ package sk.yoz.ycanvas.map.demo
private function createMaps():void
{
- mapMain = new MapHelperMain();
+ loaderOptimizer = new LoaderOptimizer;
+
+ mapMain = new MapHelperMain(loaderOptimizer);
mapMain.map.display.addEventListener(TouchEvent.TOUCH, onMapMainTouch);
mapContainer.addChild(mapMain.map.display);
mapMain.map.display.invalidateStarlingViewPort();
- mapSmall = new MapHelperSmall(mapMain.map);
+ mapSmall = new MapHelperSmall(loaderOptimizer, mapMain.map);
mapContainer.addChild(mapSmall.map.display);
mapSmall.map.display.invalidateStarlingViewPort();
@@ -151,6 +155,9 @@ package sk.yoz.ycanvas.map.demo
mapSmall.dispose();
mapSmall = null;
}
+
+ loaderOptimizer.dispose();
+ loaderOptimizer = null;
}
private function disposeMapOverlay():void
@@ -426,7 +433,7 @@ package sk.yoz.ycanvas.map.demo
{
if(showOverlayCheck.isSelected)
{
- mapOverlay = new MapHelperOverlay(mapMain.map);
+ mapOverlay = new MapHelperOverlay(loaderOptimizer, mapMain.map);
mapContainer.addChildAt(mapOverlay.map.display, mapContainer.getChildIndex(mapMain.map.display) + 1);
mapMain.map.display.invalidateStarlingViewPort();
resize();
@@ -15,6 +15,7 @@ package sk.yoz.ycanvas.map.demo
import sk.yoz.ycanvas.map.events.CanvasEvent;
import sk.yoz.ycanvas.map.layers.LayerFactory;
import sk.yoz.ycanvas.map.managers.AbstractTransformationManager;
+ import sk.yoz.ycanvas.map.managers.LoaderOptimizer;
import sk.yoz.ycanvas.map.managers.MouseTransformationManager;
import sk.yoz.ycanvas.map.managers.TouchTransformationManager;
import sk.yoz.ycanvas.map.valueObjects.Limit;
@@ -37,7 +38,7 @@ package sk.yoz.ycanvas.map.demo
public var markerLayer:MarkerLayer;
public var transformationManager:AbstractTransformationManager;
- public function MapHelperMain()
+ public function MapHelperMain(loaderOptimizer:LoaderOptimizer)
{
var transformation:Transformation = new Transformation;
transformation.centerX = GeoUtils.lon2x(7.75);
@@ -56,10 +57,11 @@ package sk.yoz.ycanvas.map.demo
var config:MapConfig = Maps.ARCGIS_IMAGERY;
map = new YCanvasMap(config, transformation, 256);
+ map.loaderOptimizer = loaderOptimizer;
//Lets customize partition factory so it creates CustomPartition
// capable of handling bing maps
- map.partitionFactory = new CustomPartitionFactory(config, map);
+ map.partitionFactory = new CustomPartitionFactory(config, map, map.loaderOptimizer);
map.layerFactory = new LayerFactory(config, map.partitionFactory);
map.addEventListener(CanvasEvent.TRANSFORMATION_FINISHED, onMapTransformationFinished);
@@ -3,6 +3,8 @@ package sk.yoz.ycanvas.map.demo
import sk.yoz.ycanvas.map.YCanvasMap;
import sk.yoz.ycanvas.map.demo.mock.Maps;
import sk.yoz.ycanvas.map.events.CanvasEvent;
+ import sk.yoz.ycanvas.map.managers.LoaderOptimizer;
+ import sk.yoz.ycanvas.map.valueObjects.MapConfig;
import sk.yoz.ycanvas.map.valueObjects.Transformation;
/**
@@ -15,7 +17,7 @@ package sk.yoz.ycanvas.map.demo
private var mapMain:YCanvasMap;
- public function MapHelperOverlay(mapMain:YCanvasMap)
+ public function MapHelperOverlay(loaderOptimizer:LoaderOptimizer, mapMain:YCanvasMap)
{
this.mapMain = mapMain;
@@ -25,7 +27,10 @@ package sk.yoz.ycanvas.map.demo
transformation.scale = mapMain.scale;
transformation.rotation = mapMain.rotation;
- map = new YCanvasMap(Maps.ARCGIS_REFERENCE, transformation, 0, 1);
+ var config:MapConfig = Maps.ARCGIS_REFERENCE;
+
+ map = new YCanvasMap(config, transformation, 0, 1);
+ map.loaderOptimizer = loaderOptimizer;
map.display.touchable = false;
mapMain.addEventListener(CanvasEvent.RENDERED, sync);
@@ -8,6 +8,7 @@ package sk.yoz.ycanvas.map.demo
import sk.yoz.ycanvas.map.display.MapDisplay;
import sk.yoz.ycanvas.map.events.CanvasEvent;
import sk.yoz.ycanvas.map.layers.LayerFactory;
+ import sk.yoz.ycanvas.map.managers.LoaderOptimizer;
import sk.yoz.ycanvas.map.valueObjects.MapConfig;
import sk.yoz.ycanvas.map.valueObjects.Transformation;
@@ -26,7 +27,7 @@ package sk.yoz.ycanvas.map.demo
private var background:Quad;
private var mapMain:YCanvasMap;
- public function MapHelperSmall(mapMain:YCanvasMap)
+ public function MapHelperSmall(loaderOptimizer:LoaderOptimizer, mapMain:YCanvasMap)
{
this.mapMain = mapMain;
@@ -42,10 +43,11 @@ package sk.yoz.ycanvas.map.demo
var config:MapConfig = Maps.OSM;
map = new YCanvasMap(config, transformation);
+ map.loaderOptimizer = loaderOptimizer;
//Lets customize partition factory so it creates CustomPartition
// capable of handling bing maps
- map.partitionFactory = new CustomPartitionFactory(config, map);
+ map.partitionFactory = new CustomPartitionFactory(config, map, map.loaderOptimizer);
map.layerFactory = new LayerFactory(config, map.partitionFactory);
map.display.addChildAt(background, 0);
@@ -4,15 +4,17 @@ package sk.yoz.ycanvas.map.demo.partition
import sk.yoz.ycanvas.interfaces.ILayer;
import sk.yoz.ycanvas.map.demo.utils.BingMapsUtils;
+ import sk.yoz.ycanvas.map.managers.LoaderOptimizer;
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)
+ config:MapConfig, dispatcher:IEventDispatcher,
+ loaderOptimizer:LoaderOptimizer)
{
- super(x, y, layer, config, dispatcher);
+ super(x, y, layer, config, dispatcher, loaderOptimizer);
}
override protected function get url():String
@@ -4,20 +4,21 @@ package sk.yoz.ycanvas.map.demo.partition
import sk.yoz.ycanvas.interfaces.ILayer;
import sk.yoz.ycanvas.interfaces.IPartition;
+ import sk.yoz.ycanvas.map.managers.LoaderOptimizer;
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)
+ dispatcher:IEventDispatcher, loaderOptimizer:LoaderOptimizer)
{
- super(config, dispatcher);
+ super(config, dispatcher, loaderOptimizer);
}
override public function create(x:int, y:int, layer:ILayer):IPartition
{
- return new CustomPartition(x, y, layer, config, dispatcher);
+ return new CustomPartition(x, y, layer, config, dispatcher, loaderOptimizer);
}
}
}
@@ -54,7 +54,6 @@
<flashCatalyst validateFlashCatalystCompatibility="false"/>
<buildTargets>
<buildTarget buildTargetName="device" iosSettingsVersion="2" isCurrent="true" platformId="com.adobe.flexide.multiplatform.ios.platform" provisioningFile="C:/Users/jozef.chutka/work/cert/YCanvasMap_Dev.mobileprovision" releasePackageType="">
- <multiPlatformSettings enabled="true" hideAneLibSymbols="0" includePlatformLibs="false" platformID="com.adobe.flexide.multiplatform.ios.platform" reducedSizePackaging="false" version="1"/>
<airSettings airCertificatePath="C:/Users/jozef.chutka/work/cert/ios_developer.p12" airTimestamp="true" anePathSet="true" version="1">
<airExcludes/>
<anePaths/>
@@ -63,10 +62,10 @@
<newPackagingParams/>
<modifiedPackagingParams/>
</airSettings>
+ <multiPlatformSettings enabled="true" hideAneLibSymbols="0" includePlatformLibs="false" platformID="com.adobe.flexide.multiplatform.ios.platform" reducedSizePackaging="false" version="1"/>
<actionScriptSettings version="1"/>
</buildTarget>
<buildTarget airDownloadURL="https://market.android.com/details?id=com.adobe.air" androidSettingsVersion="2" buildTargetName="device" isCurrent="true" platformId="com.adobe.flexide.multiplatform.android.platform">
- <multiPlatformSettings enabled="true" hideAneLibSymbols="0" includePlatformLibs="false" platformID="com.adobe.flexide.multiplatform.android.platform" reducedSizePackaging="false" version="1"/>
<airSettings airCertificatePath="C:/Users/jozef.chutka/work/cert/android.p12" airTimestamp="true" anePathSet="true" version="1">
<airExcludes/>
<anePaths/>
@@ -75,10 +74,10 @@
<newPackagingParams/>
<modifiedPackagingParams/>
</airSettings>
+ <multiPlatformSettings enabled="true" hideAneLibSymbols="0" includePlatformLibs="false" platformID="com.adobe.flexide.multiplatform.android.platform" reducedSizePackaging="false" version="1"/>
<actionScriptSettings version="1"/>
</buildTarget>
<buildTarget buildTargetName="default" isCurrent="true" platformId="default">
- <multiPlatformSettings enabled="false" hideAneLibSymbols="0" includePlatformLibs="false" platformID="default" reducedSizePackaging="false" version="1"/>
<airSettings airCertificatePath="" airTimestamp="true" anePathSet="false" version="1">
<airExcludes/>
<anePaths/>
@@ -87,6 +86,7 @@
<newPackagingParams/>
<modifiedPackagingParams/>
</airSettings>
+ <multiPlatformSettings enabled="false" hideAneLibSymbols="0" includePlatformLibs="false" platformID="default" reducedSizePackaging="false" version="1"/>
<actionScriptSettings version="1"/>
</buildTarget>
</buildTargets>
@@ -140,8 +140,8 @@ package sk.yoz.ycanvas.demo.markers.ycanvas
loader.load(new URLRequest(url), context);
var loaderInfo:LoaderInfo = loader.contentLoaderInfo;
- loaderInfo.addEventListener(Event.COMPLETE, onComplete);
- loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError);
+ loaderInfo.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
+ loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError, false, 0, true);
}
public function stopLoading(cancelRequest:Boolean = true):void
@@ -156,20 +156,13 @@ package sk.yoz.ycanvas.demo.markers.ycanvas
loader.close();
}
catch(error:Error){}
-
- try
- {
- loader.unload();
- }
- catch(error:Error){}
-
}
- var loaderInfo:LoaderInfo = loader.loaderInfo;
+ var loaderInfo:LoaderInfo = loader.contentLoaderInfo;
if(loaderInfo)
{
- loaderInfo.removeEventListener(Event.COMPLETE, onComplete);
- loaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onError);
+ loaderInfo.removeEventListener(Event.COMPLETE, onComplete, false);
+ loaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onError, false);
}
loader = null;
}
@@ -114,8 +114,8 @@ package sk.yoz.ycanvas.demo.remotair
loader.load(new URLRequest(url), context);
var loaderInfo:LoaderInfo = loader.contentLoaderInfo;
- loaderInfo.addEventListener(Event.COMPLETE, onComplete);
- loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError);
+ loaderInfo.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
+ loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError, false, 0, true);
}
public function stopLoading():void
@@ -129,17 +129,11 @@ package sk.yoz.ycanvas.demo.remotair
}
catch(error:Error){}
- try
- {
- loader.unload();
- }
- catch(error:Error){}
-
- var loaderInfo:LoaderInfo = loader.loaderInfo;
+ var loaderInfo:LoaderInfo = loader.contentLoaderInfo;
if(loaderInfo)
{
- loaderInfo.removeEventListener(Event.COMPLETE, onComplete);
- loaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onError);
+ loaderInfo.removeEventListener(Event.COMPLETE, onComplete, false);
+ loaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onError, false);
}
loader = null;
}
@@ -10,15 +10,15 @@
<excludedEntries>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_charts.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/advancedgrids.swc" useDefaultLinkType="false"/>
- <libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_air.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/charts.swc" useDefaultLinkType="false"/>
- <libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/netmon.swc" useDefaultLinkType="false"/>
+ <libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_air.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/locale/{locale}" useDefaultLinkType="false"/>
+ <libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/netmon.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/spark.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/sparkskins.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/rpc.swc" useDefaultLinkType="false"/>
- <libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/videoPlayer.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp_air.swc" useDefaultLinkType="false"/>
+ <libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/videoPlayer.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/flash-integration.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/authoringsupport.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp.swc" useDefaultLinkType="false"/>
Oops, something went wrong.

0 comments on commit eb12fc0

Please sign in to comment.