Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT! - Presentation Transcript

    1. Yet Another Mapping API - Not ! Mansour Raad mraad@esri.com
    2. www.esri.com/flex
    3. www.esri.com/flex
    4. ArcGIS Services • Map Tiles ESRI / Virtual Earth (token) • Geocoding / Reverse • Query / Identify • Routing with Barriers and Time Windows • Buffer / Projection • GeoProcessing
    5. You & ArcGIS Blaze PHP Local AGS .Net
    6. Map “Hello World”
    7. Map “Hello World” 1.<?xml version=\"1.0\" encoding=\"utf-8\"?> 2.<mx:Application 3. xmlns:mx=\"http://www.adobe.com/2006/mxml\" 4. xmlns:esri=\"http://www.esri.com/2008/ags\" 5. layout=\"absolute\" 6. > 7. <esri:Map id=\"map\"> 8. <esri:ArcGISTiledMapServiceLayer url=”http://host/rest/map”/> 9. </esri:Map> 10.</mx:Application>
    8. Map “Hello World” 1.<?xml version=\"1.0\" encoding=\"utf-8\"?> 2.<mx:Application 3. xmlns:mx=\"http://www.adobe.com/2006/mxml\" 4. xmlns:esri=\"http://www.esri.com/2008/ags\" 5. layout=\"absolute\" 6. > 7. <esri:Map id=\"map\"> 8. <esri:ArcGISTiledMapServiceLayer url=”http://host/rest/map”/> 9. </esri:Map> 10.</mx:Application>
    9. 1.<?xml version=\"1.0\" encoding=\"utf-8\"?> 2.<mx:Application 3. xmlns:mx=\"http://www.adobe.com/2006/mxml\" 4. xmlns:esri=\"http://www.esri.com/2008/ags\" 5. layout=\"absolute\" 6. > 7. <esri:Map id=\"map\" openHandCursorVisible=\"false\" zoomSliderVisible=\"false\"> 8. <esri:ArcGISTiledMapServiceLayer id=\"layer\" url=\"{cb.selectedItem.url}\"/> 9. </esri:Map> 10. <mx:ComboBox id=\"cb\" dataProvider=\"{[ 11. {label:'Imagery',url:'http://host/rest/Image'}, 12. {label:'Physical',url:'http://host/rest/Physical'} 13. ]}\"/> 14.</mx:Application>
    10. 1.<?xml version=\"1.0\" encoding=\"utf-8\"?> 2.<mx:Application 3. xmlns:mx=\"http://www.adobe.com/2006/mxml\" 4. xmlns:esri=\"http://www.esri.com/2008/ags\" 5. layout=\"absolute\" 6. > 7. <esri:Map id=\"map\" openHandCursorVisible=\"false\" zoomSliderVisible=\"false\"> 8. <esri:ArcGISTiledMapServiceLayer id=\"layer\" url=\"{cb.selectedItem.url}\"/> 9. </esri:Map> 10. <mx:ComboBox id=\"cb\" dataProvider=\"{[ 11. {label:'Imagery',url:'http://host/rest/Image'}, 12. {label:'Physical',url:'http://host/rest/Physical'} 13. ]}\"/> 14.</mx:Application>
    11. 1.<?xml version=\"1.0\" encoding=\"utf-8\"?> 2.<mx:Application 3. xmlns:mx=\"http://www.adobe.com/2006/mxml\" 4. xmlns:esri=\"http://www.esri.com/2008/ags\" 5. layout=\"absolute\" 6. > 7. <esri:Map id=\"map\" openHandCursorVisible=\"false\" zoomSliderVisible=\"false\"> 8. <esri:ArcGISTiledMapServiceLayer id=\"layer\" url=\"{cb.selectedItem.url}\"/> 9. </esri:Map> 10. <mx:ComboBox id=\"cb\" dataProvider=\"{[ 11. {label:'Imagery',url:'http://host/rest/Image'}, 12. {label:'Physical',url:'http://host/rest/Physical'} 13. ]}\"/> 14.</mx:Application>
    12. GeoProcessing DriveTimes
    13. 1. <esri:Geoprocessor id=\"gp\" url=\"<GeoProcessesorURL>\" showBusyCursor=\"true\"/> 2. <esri:Map id=\"map\" openHandCursorVisible=\"false\" mapClick=\"mapClickHandler(event)\"> 3. <esri:extent> 4. <esri:Extent xmin=\"-95.41\" ymin=\"38.86\" xmax=\"-95.1\" ymax=\"39.06\"> 5. <esri:SpatialReference wkid=\"4326\"/> 6. </esri:Extent> 7. </esri:extent> 8. <esri:ArcGISTiledMapServiceLayer url=\"<MapServiceURL>\"/> 9. <esri:GraphicsLayer id=\"polygonLayer\" graphicProvider=\"{gp.executeFirstFeatureSet.features}\"> 10. <esri:renderer> 11. <esri:UniqueValueRenderer attribute=\"ToBreak\"> 12. <esri:UniqueValueInfo value=\"1\"> 13. <esri:symbol> 14. <esri:SimpleFillSymbol alpha=\"0.5\" color=\"0xFF0000\"/> 15. </esri:symbol> 16. </esri:UniqueValueInfo> 17. <esri:UniqueValueInfo value=\"2\"> 18. <esri:symbol> 19. <esri:SimpleFillSymbol alpha=\"0.5\" color=\"0x00FF00\"/> 20. </esri:symbol> 21. </esri:UniqueValueInfo> 22. <esri:UniqueValueInfo value=\"3\"> 23. <esri:symbol> 24. <esri:SimpleFillSymbol alpha=\"0.5\" color=\"0x0000FF\"/> 25. </esri:symbol> 26. </esri:UniqueValueInfo> 27. </esri:UniqueValueRenderer> 28. </esri:renderer> 29. </esri:GraphicsLayer> 30. <esri:GraphicsLayer id=\"pointLayer\"/> 31. </esri:Map>
    14. 1. <esri:Geoprocessor id=\"gp\" url=\"<GeoProcessesorURL>\" showBusyCursor=\"true\"/> 2. <esri:Map id=\"map\" openHandCursorVisible=\"false\" mapClick=\"mapClickHandler(event)\"> 3. <esri:extent> 4. <esri:Extent xmin=\"-95.41\" ymin=\"38.86\" xmax=\"-95.1\" ymax=\"39.06\"> 5. <esri:SpatialReference wkid=\"4326\"/> 6. </esri:Extent> 7. </esri:extent> 8. <esri:ArcGISTiledMapServiceLayer url=\"<MapServiceURL>\"/> 9. <esri:GraphicsLayer id=\"polygonLayer\" graphicProvider=\"{gp.executeFirstFeatureSet.features}\"> 10. <esri:renderer> 11. <esri:UniqueValueRenderer attribute=\"ToBreak\"> 12. <esri:UniqueValueInfo value=\"1\"> 13. <esri:symbol> 14. <esri:SimpleFillSymbol alpha=\"0.5\" color=\"0xFF0000\"/> 15. </esri:symbol> 16. </esri:UniqueValueInfo> 17. <esri:UniqueValueInfo value=\"2\"> 18. <esri:symbol> 19. <esri:SimpleFillSymbol alpha=\"0.5\" color=\"0x00FF00\"/> 20. </esri:symbol> 21. </esri:UniqueValueInfo> 22. <esri:UniqueValueInfo value=\"3\"> 23. <esri:symbol> 24. <esri:SimpleFillSymbol alpha=\"0.5\" color=\"0x0000FF\"/> 25. </esri:symbol> 26. </esri:UniqueValueInfo> 27. </esri:UniqueValueRenderer> 28. </esri:renderer> 29. </esri:GraphicsLayer> 30. <esri:GraphicsLayer id=\"pointLayer\"/> 31. </esri:Map>
    15. 1. <esri:Geoprocessor id=\"gp\" url=\"<GeoProcessesorURL>\" showBusyCursor=\"true\"/> 2. <esri:Map id=\"map\" openHandCursorVisible=\"false\" mapClick=\"mapClickHandler(event)\"> 3. <esri:extent> 4. <esri:Extent xmin=\"-95.41\" ymin=\"38.86\" xmax=\"-95.1\" ymax=\"39.06\"> 5. <esri:SpatialReference wkid=\"4326\"/> 6. </esri:Extent> 7. </esri:extent> 8. <esri:ArcGISTiledMapServiceLayer url=\"<MapServiceURL>\"/> 9. <esri:GraphicsLayer id=\"polygonLayer\" graphicProvider=\"{gp.executeFirstFeatureSet.features}\"> 10. <esri:renderer> 11. <esri:UniqueValueRenderer attribute=\"ToBreak\"> 12. <esri:UniqueValueInfo value=\"1\"> 13. <esri:symbol> 14. <esri:SimpleFillSymbol alpha=\"0.5\" color=\"0xFF0000\"/> 15. </esri:symbol> 16. </esri:UniqueValueInfo> 17. <esri:UniqueValueInfo value=\"2\"> 18. <esri:symbol> 19. <esri:SimpleFillSymbol alpha=\"0.5\" color=\"0x00FF00\"/> 20. </esri:symbol> 21. </esri:UniqueValueInfo> 22. <esri:UniqueValueInfo value=\"3\"> 23. <esri:symbol> 24. <esri:SimpleFillSymbol alpha=\"0.5\" color=\"0x0000FF\"/> 25. </esri:symbol> 26. </esri:UniqueValueInfo> 27. </esri:UniqueValueRenderer> 28. </esri:renderer> 29. </esri:GraphicsLayer> 30. <esri:GraphicsLayer id=\"pointLayer\"/> 31. </esri:Map>
    16. 1. <esri:Geoprocessor id=\"gp\" url=\"<GeoProcessesorURL>\" showBusyCursor=\"true\"/> 2. <esri:Map id=\"map\" openHandCursorVisible=\"false\" mapClick=\"mapClickHandler(event)\"> 3. <esri:extent> 4. <esri:Extent xmin=\"-95.41\" ymin=\"38.86\" xmax=\"-95.1\" ymax=\"39.06\"> 5. <esri:SpatialReference wkid=\"4326\"/> 6. </esri:Extent> 7. </esri:extent> 8. <esri:ArcGISTiledMapServiceLayer url=\"<MapServiceURL>\"/> 9. <esri:GraphicsLayer id=\"polygonLayer\" graphicProvider=\"{gp.executeFirstFeatureSet.features}\"> 10. <esri:renderer> 11. <esri:UniqueValueRenderer attribute=\"ToBreak\"> 12. <esri:UniqueValueInfo value=\"1\"> 13. <esri:symbol> 14. <esri:SimpleFillSymbol alpha=\"0.5\" color=\"0xFF0000\"/> 15. </esri:symbol> 16. </esri:UniqueValueInfo> 17. <esri:UniqueValueInfo value=\"2\"> 18. <esri:symbol> 19. <esri:SimpleFillSymbol alpha=\"0.5\" color=\"0x00FF00\"/> 20. </esri:symbol> 21. </esri:UniqueValueInfo> 22. <esri:UniqueValueInfo value=\"3\"> 23. <esri:symbol> 24. <esri:SimpleFillSymbol alpha=\"0.5\" color=\"0x0000FF\"/> 25. </esri:symbol> 26. </esri:UniqueValueInfo> 27. </esri:UniqueValueRenderer> 28. </esri:renderer> 29. </esri:GraphicsLayer> 30. <esri:GraphicsLayer id=\"pointLayer\"/> 31. </esri:Map>
    17. 1.<mx:Script> 2. <![CDATA[ 3. import com.esri.ags.tasks.FeatureSet; 4. import com.esri.ags.Graphic; 5. import com.esri.ags.events.MapMouseEvent; 7. private function mapClickHandler(event:MapMouseEvent):void 8. { 9. const graphic:Graphic = new Graphic(event.mapPoint); 10. pointLayer.clear(); 11. pointLayer.add(graphic); 12. const featureSet:FeatureSet = new FeatureSet([graphic]); 13. gp.execute({\"Input_Location\": featureSet, \"Drive_Times\": \"1 2 3\"}); 14. } 15. ]]> 16.</mx:Script>
    18. 1.<mx:Script> 2. <![CDATA[ 3. import com.esri.ags.tasks.FeatureSet; 4. import com.esri.ags.Graphic; 5. import com.esri.ags.events.MapMouseEvent; 7. private function mapClickHandler(event:MapMouseEvent):void 8. { 9. const graphic:Graphic = new Graphic(event.mapPoint); 10. pointLayer.clear(); 11. pointLayer.add(graphic); 12. const featureSet:FeatureSet = new FeatureSet([graphic]); 13. gp.execute({\"Input_Location\": featureSet, \"Drive_Times\": \"1 2 3\"}); 14. } 15. ]]> 16.</mx:Script>
    19. Demo Sample 1-2 DriveTimes
    20. Many Children Layers
    21. Many Graphic Layers
    22. GraphicLayer
    23. GraphicLayer • graphicProvider • ArrayCollection • renderer • graphic with no symbol
    24. Graphic
    25. Graphic • UIComponent • Flex life cycle management • geometry • symbol • attributes
    26. Graphic/Geometry
    27. Graphic/Geometry • Geometry - base class • MapPoint • Polyline • Polygon
    28. Polyline/Polygon
    29. Polyline/Polygon • Multi Part Geometry • Islands of Hawaii
    30. Graphic/Symbol
    31. Graphic/Symbol • Symbol - base class • Draws geometry of Graphic • Uses Flash Drawing API
    32. Graphic/Attributes
    33. Graphic/Attributes • Any Object ! • Attach any dynamic property to Graphic
    34. Geometry/Symbol
    35. Geometry/Symbol • [Bindable] Properties • Dispatch CHANGE event
    36. Demo Sample 3-7
    37. LCDS
    38. LCDS • Remote Objects • Messaging • Data Services
    39. Feature
    40. Feature • Serializable server side object • Properties • featureID:int; • geometry:IGeometry; • attributes:ASObject;
    41. public class Feature implements Serializable { private int m_featureId; private IGeometry m_geometry; private ASObject m_attributes; public Feature() { } public int getFeatureId() { return m_featureId; } public void setFeatureId(final int featureId) { m_featureId = featureId; } ...
    42. public class MapPoint implements IGeometry { private double m_x; private double m_y; private SpatialReference m_spatialReference; public MapPoint(){ } public MapPoint(final double x, final double y){ m_x = x; m_y = y; } public double getX(){ return m_x; } public void setX(final double x){ m_x = x; } ...
    43. DS Assembler • fill • createItem • getItem • updateItem • deleteItem
    44. private int m_featureId = 1; private Map<Integer, Feature> m_map = new ConcurrentHashMap<Integer, Feature>(17); public Collection fill(final List fillParameters) { return m_map.values(); } public Object getItem(final Map map) { return m_map.get(map.get(\"featureId\")); } public void createItem(final Object newVersion) { final Feature Feature = (Feature) newVersion; Feature.setFeatureId(m_featureId++); m_map.put(Feature.getFeatureId(), Feature); } public void updateItem(final Object newVersion, final Object prevVersion, final List changes) { final Feature Feature = (Feature) newVersion; m_map.put(Feature.getFeatureId(), Feature); } public void deleteItem(final Object prevVersion) { final Feature Feature = (Feature) prevVersion; m_map.remove(Feature.getFeatureId()); }
    45. private int m_featureId = 1; private Map<Integer, Feature> m_map = new ConcurrentHashMap<Integer, Feature>(17); public Collection fill(final List fillParameters) { return m_map.values(); } public Object getItem(final Map map) { return m_map.get(map.get(\"featureId\")); } public void createItem(final Object newVersion) { final Feature Feature = (Feature) newVersion; Feature.setFeatureId(m_featureId++); m_map.put(Feature.getFeatureId(), Feature); } public void updateItem(final Object newVersion, final Object prevVersion, final List changes) { final Feature Feature = (Feature) newVersion; m_map.put(Feature.getFeatureId(), Feature); } public void deleteItem(final Object prevVersion) { final Feature Feature = (Feature) prevVersion; m_map.remove(Feature.getFeatureId()); }
    46. private int m_featureId = 1; private Map<Integer, Feature> m_map = new ConcurrentHashMap<Integer, Feature>(17); public Collection fill(final List fillParameters) { return m_map.values(); } public Object getItem(final Map map) { return m_map.get(map.get(\"featureId\")); } public void createItem(final Object newVersion) { final Feature Feature = (Feature) newVersion; Feature.setFeatureId(m_featureId++); m_map.put(Feature.getFeatureId(), Feature); } public void updateItem(final Object newVersion, final Object prevVersion, final List changes) { final Feature Feature = (Feature) newVersion; m_map.put(Feature.getFeatureId(), Feature); } public void deleteItem(final Object prevVersion) { final Feature Feature = (Feature) prevVersion; m_map.remove(Feature.getFeatureId()); }
    47. private int m_featureId = 1; private Map<Integer, Feature> m_map = new ConcurrentHashMap<Integer, Feature>(17); public Collection fill(final List fillParameters) { return m_map.values(); } public Object getItem(final Map map) { return m_map.get(map.get(\"featureId\")); } public void createItem(final Object newVersion) { final Feature Feature = (Feature) newVersion; Feature.setFeatureId(m_featureId++); m_map.put(Feature.getFeatureId(), Feature); } public void updateItem(final Object newVersion, final Object prevVersion, final List changes) { final Feature Feature = (Feature) newVersion; m_map.put(Feature.getFeatureId(), Feature); } public void deleteItem(final Object prevVersion) { final Feature Feature = (Feature) prevVersion; m_map.remove(Feature.getFeatureId()); }
    48. private int m_featureId = 1; private Map<Integer, Feature> m_map = new ConcurrentHashMap<Integer, Feature>(17); public Collection fill(final List fillParameters) { return m_map.values(); } public Object getItem(final Map map) { return m_map.get(map.get(\"featureId\")); } public void createItem(final Object newVersion) { final Feature Feature = (Feature) newVersion; Feature.setFeatureId(m_featureId++); m_map.put(Feature.getFeatureId(), Feature); } public void updateItem(final Object newVersion, final Object prevVersion, final List changes) { final Feature Feature = (Feature) newVersion; m_map.put(Feature.getFeatureId(), Feature); } public void deleteItem(final Object prevVersion) { final Feature Feature = (Feature) prevVersion; m_map.remove(Feature.getFeatureId()); }
    49. private int m_featureId = 1; private Map<Integer, Feature> m_map = new ConcurrentHashMap<Integer, Feature>(17); public Collection fill(final List fillParameters) { return m_map.values(); } public Object getItem(final Map map) { return m_map.get(map.get(\"featureId\")); } public void createItem(final Object newVersion) { final Feature Feature = (Feature) newVersion; Feature.setFeatureId(m_featureId++); m_map.put(Feature.getFeatureId(), Feature); } public void updateItem(final Object newVersion, final Object prevVersion, final List changes) { final Feature Feature = (Feature) newVersion; m_map.put(Feature.getFeatureId(), Feature); } public void deleteItem(final Object prevVersion) { final Feature Feature = (Feature) prevVersion; m_map.remove(Feature.getFeatureId()); }
    50. data-management-config.xml
    51. data-management-config.xml <destination id=\"feature\"> <properties> <factory>spring</factory> <source>featureAssembler</source> <scope>application</scope> <use-transactions>false</use-transactions> <metadata> <identity property=\"featureId\"/> </metadata> <network> <paging enabled=\"false\" pageSize=\"10\"/> </network> </properties> </destination>
    52. Back To The Client :-)
    53. package com.esri.cats { import com.esri.ags.SpatialReference; import com.esri.ags.geometry.MapPoint; import flash.net.registerClassAlias; import mx.core.IMXMLObject; public class ClassAliasRegistry implements IMXMLObject { public function initialized(document:Object, id:String):void { registerClassAlias(\"com.esri.cats.MapPoint\", MapPoint); registerClassAlias(\"com.esri.cats.SpatialReference\", SpatialReference); } } }
    54. package com.esri.cats { import com.esri.ags.SpatialReference; import com.esri.ags.geometry.MapPoint; import flash.net.registerClassAlias; import mx.core.IMXMLObject; public class ClassAliasRegistry implements IMXMLObject { public function initialized(document:Object, id:String):void { registerClassAlias(\"com.esri.cats.MapPoint\", MapPoint); registerClassAlias(\"com.esri.cats.SpatialReference\", SpatialReference); } } }
    55. 1.package com.esri.cats 2.{ 3. import com.esri.ags.geometry.Geometry; 5. [Managed] 6. [RemoteClass(alias=\"com.esri.cats.Feature\")] 7. public class Feature 8. { 9. public var featureId:int; 10. public var geometry:Geometry; 11. public var attributes:Object; 12. 13. public function Feature() 14. { 15. } 16. 17. } 18.}
    56. 1.package com.esri.cats 2.{ 3. import com.esri.ags.geometry.Geometry; 5. [Managed] 6. [RemoteClass(alias=\"com.esri.cats.Feature\")] 7. public class Feature 8. { 9. public var featureId:int; 10. public var geometry:Geometry; 11. public var attributes:Object; 12. 13. public function Feature() 14. { 15. } 16. 17. } 18.}
    57. 1.<cats:ClassAliasRegistry/> 2.<mx:ArrayCollection id=\"features\" 3. collectionChange=\"collectionChangeHandler(event)\"/> 4.<mx:DataService id=\"ds\" destination=\"feature\"/> 5.<esri:Map id=\"map\" load=\"ds.fill(features)\"> 6. <esri:GraphicsLayer id=\"graphicsLayer\"/> 7. <esri:GraphicsLayer id=\"pointLayer\"> 8. <esri:symbol> 9. <esri:SimpleMarkerSymbol color=\"0xFFFF00\"/> 10. </esri:symbol> 11. </esri:GraphicsLayer> 12.</esri:Map>
    58. 1.<cats:ClassAliasRegistry/> 2.<mx:ArrayCollection id=\"features\" 3. collectionChange=\"collectionChangeHandler(event)\"/> 4.<mx:DataService id=\"ds\" destination=\"feature\"/> 5.<esri:Map id=\"map\" load=\"ds.fill(features)\"> 6. <esri:GraphicsLayer id=\"graphicsLayer\"/> 7. <esri:GraphicsLayer id=\"pointLayer\"> 8. <esri:symbol> 9. <esri:SimpleMarkerSymbol color=\"0xFFFF00\"/> 10. </esri:symbol> 11. </esri:GraphicsLayer> 12.</esri:Map>
    59. 1.<cats:ClassAliasRegistry/> 2.<mx:ArrayCollection id=\"features\" 3. collectionChange=\"collectionChangeHandler(event)\"/> 4.<mx:DataService id=\"ds\" destination=\"feature\"/> 5.<esri:Map id=\"map\" load=\"ds.fill(features)\"> 6. <esri:GraphicsLayer id=\"graphicsLayer\"/> 7. <esri:GraphicsLayer id=\"pointLayer\"> 8. <esri:symbol> 9. <esri:SimpleMarkerSymbol color=\"0xFFFF00\"/> 10. </esri:symbol> 11. </esri:GraphicsLayer> 12.</esri:Map>
    60. 1.<cats:ClassAliasRegistry/> 2.<mx:ArrayCollection id=\"features\" 3. collectionChange=\"collectionChangeHandler(event)\"/> 4.<mx:DataService id=\"ds\" destination=\"feature\"/> 5.<esri:Map id=\"map\" load=\"ds.fill(features)\"> 6. <esri:GraphicsLayer id=\"graphicsLayer\"/> 7. <esri:GraphicsLayer id=\"pointLayer\"> 8. <esri:symbol> 9. <esri:SimpleMarkerSymbol color=\"0xFFFF00\"/> 10. </esri:symbol> 11. </esri:GraphicsLayer> 12.</esri:Map>
    61. 1.<cats:ClassAliasRegistry/> 2.<mx:ArrayCollection id=\"features\" 3. collectionChange=\"collectionChangeHandler(event)\"/> 4.<mx:DataService id=\"ds\" destination=\"feature\"/> 5.<esri:Map id=\"map\" load=\"ds.fill(features)\"> 6. <esri:GraphicsLayer id=\"graphicsLayer\"/> 7. <esri:GraphicsLayer id=\"pointLayer\"> 8. <esri:symbol> 9. <esri:SimpleMarkerSymbol color=\"0xFFFF00\"/> 10. </esri:symbol> 11. </esri:GraphicsLayer> 12.</esri:Map>
    62. private function collectionChangeHandler(event:CollectionEvent):void { switch (event.kind) { case CollectionEventKind.RESET: doReset(event); break; case CollectionEventKind.UPDATE: doUpdate(event); break; } }
    63. private function doReset(event:CollectionEvent):void { graphicsLayer.clear(); m_graphicsDict = new Dictionary(); for each (var feature:Feature in features) { var graphic:Graphic = new Graphic(feature.geometry, null, feature); graphic.buttonMode = true; graphic.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); graphic.toolTip = String(feature.attributes.coords).replace(\" \", \"\\n\"); graphicsLayer.add(graphic); m_graphicsDict[feature.featureId] = graphic; } }
    64. private function doReset(event:CollectionEvent):void { graphicsLayer.clear(); m_graphicsDict = new Dictionary(); for each (var feature:Feature in features) { var graphic:Graphic = new Graphic(feature.geometry, null, feature); graphic.buttonMode = true; graphic.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); graphic.toolTip = String(feature.attributes.coords).replace(\" \", \"\\n\"); graphicsLayer.add(graphic); m_graphicsDict[feature.featureId] = graphic; } }
    65. private function doReset(event:CollectionEvent):void { graphicsLayer.clear(); m_graphicsDict = new Dictionary(); for each (var feature:Feature in features) { var graphic:Graphic = new Graphic(feature.geometry, null, feature); graphic.buttonMode = true; graphic.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); graphic.toolTip = String(feature.attributes.coords).replace(\" \", \"\\n\"); graphicsLayer.add(graphic); m_graphicsDict[feature.featureId] = graphic; } }
    66. private function doUpdate(event:CollectionEvent):void { for each (var propertyChangeEvent:PropertyChangeEvent in event.items) { var feature:Feature = propertyChangeEvent.target as Feature; if (propertyChangeEvent.property === \"geometry\") { var graphic:Graphic = m_graphicsDict[feature.featureId]; if (graphic) { graphic.geometry = feature.geometry; } } } }
    67. private function doUpdate(event:CollectionEvent):void { for each (var propertyChangeEvent:PropertyChangeEvent in event.items) { var feature:Feature = propertyChangeEvent.target as Feature; if (propertyChangeEvent.property === \"geometry\") { var graphic:Graphic = m_graphicsDict[feature.featureId]; if (graphic) { graphic.geometry = feature.geometry; } } } }
    68. private function doUpdate(event:CollectionEvent):void { for each (var propertyChangeEvent:PropertyChangeEvent in event.items) { var feature:Feature = propertyChangeEvent.target as Feature; if (propertyChangeEvent.property === \"geometry\") { var graphic:Graphic = m_graphicsDict[feature.featureId]; if (graphic) { graphic.geometry = feature.geometry; } } } }
    69. 1.private function mouseDownHandler(event:MouseEvent):void 2.{ 3. const graphic:Graphic = event.target as Graphic; 4. if (graphic) 5. { 6. m_feature = graphic.attributes as Feature; 7. m_graphic.geometry = map.toMapFromStage(event.stageX, event.stageY); 8. pointLayer.add(m_graphic); 9. map.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); 10. map.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); 11. } 12.} 14.private function mouseMoveHandler(event:MouseEvent):void 15.{ 16. m_graphic.geometry = map.toMapFromStage(event.stageX, event.stageY); 17. event.updateAfterEvent(); 18.} 20.private function mouseUpHandler(event:MouseEvent):void 21.{ 22. m_feature.geometry = m_graphic.geometry; // ALL DS FM is Here :-) 23. m_feature = null; 24. pointLayer.clear(); 25. map.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); 26. map.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); 27.}
    70. 1.private function mouseDownHandler(event:MouseEvent):void 2.{ 3. const graphic:Graphic = event.target as Graphic; 4. if (graphic) 5. { 6. m_feature = graphic.attributes as Feature; 7. m_graphic.geometry = map.toMapFromStage(event.stageX, event.stageY); 8. pointLayer.add(m_graphic); 9. map.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); 10. map.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); 11. } 12.} 14.private function mouseMoveHandler(event:MouseEvent):void 15.{ 16. m_graphic.geometry = map.toMapFromStage(event.stageX, event.stageY); 17. event.updateAfterEvent(); 18.} 20.private function mouseUpHandler(event:MouseEvent):void 21.{ 22. m_feature.geometry = m_graphic.geometry; // ALL DS FM is Here :-) 23. m_feature = null; 24. pointLayer.clear(); 25. map.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); 26. map.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); 27.}
    71. 1.private function mouseDownHandler(event:MouseEvent):void 2.{ 3. const graphic:Graphic = event.target as Graphic; 4. if (graphic) 5. { 6. m_feature = graphic.attributes as Feature; 7. m_graphic.geometry = map.toMapFromStage(event.stageX, event.stageY); 8. pointLayer.add(m_graphic); 9. map.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); 10. map.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); 11. } 12.} 14.private function mouseMoveHandler(event:MouseEvent):void 15.{ 16. m_graphic.geometry = map.toMapFromStage(event.stageX, event.stageY); 17. event.updateAfterEvent(); 18.} 20.private function mouseUpHandler(event:MouseEvent):void 21.{ 22. m_feature.geometry = m_graphic.geometry; // ALL DS FM is Here :-) 23. m_feature = null; 24. pointLayer.clear(); 25. map.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); 26. map.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); 27.}
    72. Demo CATS
    73. “Lots” Features
    74. Spatial Index
    75. Spatial Index • RTree • QuadTree • Grid / Trellis • Simple • Efficient (points) • Good enough !
    76. 0,0 width,height
    77. Xmax,Ymax 0,0 width,height Xmin,Ymin
    78. Xmax,Ymax 0,0 width,height Xmin,Ymin
    79. Xmax,Ymax 0,0 width,height Xmin,Ymin
    80. Cy 3 2 1 0 Cx 0 1 2 3
    81. Cy (1,3) 3 (3,2) 2 (3,2) 1 (0,0) 0 Cx 0 1 2 3
    82. Cx & Cy > 0 int
    83. Cx & Cy < 216
    84. Dict[(cx<<16)|cy]
    85. Cluster : Geometry
    86. Cluster : Geometry • Original X • Original Y • Cluster X • Cluster Y • count
    87. ClusterSymbol : Symbol
    88. ClusterSymbol : Symbol • Draws a Cluster geometry instance • Flash drawing API • beginFill - based on cluster count • drawRoundedRect - based on Cx,Cy
    89. Demo DrawSymbol Code
    90. Adaptive Clustering
    91. Adaptive Clustering • JIT • “Smart” algorithm - all client side. • React to map extent change
    92. Given set of map points
    93. Given set of map points Assign map point to cluster set
    94. Given set of map points Assign map point to cluster set do
    95. Given set of map points Assign map point to cluster set do spatial index clusters
    96. Given set of map points Assign map point to cluster set do spatial index clusters for each cluster Ci
    97. Given set of map points Assign map point to cluster set do spatial index clusters for each cluster Ci find adjacent clusters Cj
    98. Given set of map points Assign map point to cluster set do spatial index clusters for each cluster Ci find adjacent clusters Cj if Cj is close enough to Ci
    99. Given set of map points Assign map point to cluster set do spatial index clusters for each cluster Ci find adjacent clusters Cj if Cj is close enough to Ci assign Cj map points to Ci
    100. Given set of map points Assign map point to cluster set do spatial index clusters for each cluster Ci find adjacent clusters Cj if Cj is close enough to Ci assign Cj map points to Ci remove Cj from cluster set
    101. Given set of map points Assign map point to cluster set do spatial index clusters for each cluster Ci find adjacent clusters Cj if Cj is close enough to Ci assign Cj map points to Ci remove Cj from cluster set adjust Ci location
    102. Given set of map points Assign map point to cluster set do spatial index clusters for each cluster Ci find adjacent clusters Cj if Cj is close enough to Ci assign Cj map points to Ci remove Cj from cluster set adjust Ci location repeat while overlapping clusters exist
    103. Adjusting Ci location
    104. Adjusting Ci location Ci Wi
    105. Adjusting Ci location Ci Cj Wj Wi
    106. Adjusting Ci location Ci Cj Wj Wi
    107. Adjusting Ci location Ci=(Ci Wi+CjWj)/WiWj Wi+Wj
    108. Demo ClusterApp
    109. HeatMaps are Bitmaps !
    110. 1.<?xml version=\"1.0\" encoding=\"utf-8\"?> 2.<view:PrepApplication 3. xmlns:mx=\"http://www.adobe.com/2006/mxml\" 4. xmlns:esri=\"http://www.esri.com/2008/ags\" 5. xmlns:controller=\"com.esri.controller.*\" 6. xmlns:view=\"com.esri.view.*\" 7. layout=\"vertical\" 8. paddingLeft=\"0\" 9. paddingRight=\"0\" 10. paddingTop=\"0\" 11. paddingBottom=\"0\" 12. > 13. <controller:LoadCommand/> 14. <view:PrepSlider/> 15. <view:PrepMap> 16. <view:extent> 17. <esri:Extent xmin=\"-143.141073\" ymin=\"14.930875\" xmax=\"-48.0570833\" ymax=\"57.649769\"/> 18. </view:extent> 19. <esri:ArcGISTiledMapServiceLayer 20. url=\"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer\"/> 21. <view:PrepLayer/> 22. </view:PrepMap> 23.</view:PrepApplication>
    111. 1.<?xml version=\"1.0\" encoding=\"utf-8\"?> 2.<view:PrepApplication 3. xmlns:mx=\"http://www.adobe.com/2006/mxml\" 4. xmlns:esri=\"http://www.esri.com/2008/ags\" 5. xmlns:controller=\"com.esri.controller.*\" 6. xmlns:view=\"com.esri.view.*\" 7. layout=\"vertical\" 8. paddingLeft=\"0\" 9. paddingRight=\"0\" 10. paddingTop=\"0\" 11. paddingBottom=\"0\" 12. > 13. <controller:LoadCommand/> 14. <view:PrepSlider/> 15. <view:PrepMap> 16. <view:extent> 17. <esri:Extent xmin=\"-143.141073\" ymin=\"14.930875\" xmax=\"-48.0570833\" ymax=\"57.649769\"/> 18. </view:extent> 19. <esri:ArcGISTiledMapServiceLayer 20. url=\"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer\"/> 21. <view:PrepLayer/> 22. </view:PrepMap> 23.</view:PrepApplication>
    112. PrepLayer : Layer
    113. PrepLayer : Layer • Subclass Layer • Override updateLayer • Invoked by updateDisplayList • create bitmap - lock/unlock • bitmap.fillRect each heat map point • graphic.bitmapFill / drawRect
    114. PrepLayer
    115. PrepLayer • Kept data in 2 arrays • x = [] • y = [] • Easy to AMF • toScreenX/Y built-in functions
    116. Demo PrecipitationApp
    117. Street Tracing
    118. Street Tracing • A* • Create nodes and edges • Define barriers • Reverse geocoding • Custom layer - faster rendering
    119. A* / Path Finding
    120. Streets
    121. Streets
    122. “Street” Graph
    123. “Street” Graph • Intersection - nodes • Street Segment - edge • Travel distance or time - cost
    124. Nodes/Edges/Barriers
    125. Nodes/Edges/Barriers C A E B D
    126. Nodes/Edges/Barriers C A E B D
    127. Nodes/Edges/Barriers C A E B D
    128. Street Info n St M ai
    129. Street Info 200 n St M ai 100
    130. Street Info 200 199 n St M ai 100 101
    131. ReverseGeocoding
    132. ReverseGeocoding Main St Left 100-200 Right 101-199
    133. ReverseGeocoding Main St Left 100-200 Right 101-199 t
    134. ReverseGeocoding Main St Left 100-200 Right 101-199 t
    135. ReverseGeocoding Main St Left 100-200 Right 101-199 t d
    136. ReverseGeocoding Main St Left 100-200 Right 101-199 t d 153 Main St
    137. Distance Calculations
    138. Distance Calculations C B A
    139. Distance Calculations C B P A
    140. Distance Calculations AC • AB r= ∣AB∣2 C B r P A
    141. Distance Calculations AC • AB r≺0 beyond A ↤ r= ∣AB∣2 C B r P A
    142. Distance Calculations AC • AB r≺0 beyond A ↤ r= ∣AB∣2 r≻0 beyond B ↦ C B r P A
    143. Distance Calculations AC • AB r≺0 beyond A ↤ r= ∣AB∣2 r≻0 beyond B ↦ C 1 Ax Bx Cx A= 2 Ay By Cy B r P A
    144. Distance Calculations AC • AB r≺0 beyond A ↤ r= ∣AB∣2 r≻0 beyond B ↦ C 1 Ax Bx Cx A= 2 Ay By Cy height B r P A
    145. Distance Calculations AC • AB r≺0 beyond A ↤ r= ∣AB∣2 r≻0 beyond B ↦ C 1 Ax Bx Cx A= 2 Ay By Cy height B r P base A
    146. Distance Calculations AC • AB r≺0 beyond A ↤ r= ∣AB∣2 r≻0 beyond B ↦ C 1 Ax Bx Cx A= 2 Ay By Cy height B P base×height r A= base 2 A
    147. Distance Calculations AC • AB r≺0 beyond A ↤ r= ∣AB∣2 r≻0 beyond B ↦ C 1 Ax Bx Cx A= 2 Ay By Cy height B P base×height r A= base 2 A AP=rAB
    148. 1.override protected function updateLayer():void{ 2. const model:Model = Model.instance; 3. graphics.clear(); 4. graphics.lineStyle(1, 0); 5. model.streetGrid.search(map.extent, streetHandler); 6.} 8.private function streetHandler(street:Street, data:Object = null):void{ 9. for each(var path:Array in street.shpPolyline.paths){ 10. var index:int = 0; 11. var lastX:Number = toScreenX(path[index++]); 12. var lastY:Number = toScreenY(path[index++]); 13. graphics.moveTo(lastX, lastY); 14. while(index < path.length){ 15. var currX:Number = toScreenX(path[index++]); 16. var currY:Number = toScreenY(path[index++]); 17. if( currX !== lastX || currY !== lastY){ 18. graphics.lineTo(currX, currY); 19. lastX = currX; 20. lastY = currY; 21. } 22. } 23. } 24.}
    149. 1.override protected function updateLayer():void{ 2. const model:Model = Model.instance; 3. graphics.clear(); 4. graphics.lineStyle(1, 0); 5. model.streetGrid.search(map.extent, streetHandler); 6.} 8.private function streetHandler(street:Street, data:Object = null):void{ 9. for each(var path:Array in street.shpPolyline.paths){ 10. var index:int = 0; 11. var lastX:Number = toScreenX(path[index++]); 12. var lastY:Number = toScreenY(path[index++]); 13. graphics.moveTo(lastX, lastY); 14. while(index < path.length){ 15. var currX:Number = toScreenX(path[index++]); 16. var currY:Number = toScreenY(path[index++]); 17. if( currX !== lastX || currY !== lastY){ 18. graphics.lineTo(currX, currY); 19. lastX = currX; 20. lastY = currY; 21. } 22. } 23. } 24.}
    150. 1.override protected function updateLayer():void{ 2. const model:Model = Model.instance; 3. graphics.clear(); 4. graphics.lineStyle(1, 0); 5. model.streetGrid.search(map.extent, streetHandler); 6.} 8.private function streetHandler(street:Street, data:Object = null):void{ 9. for each(var path:Array in street.shpPolyline.paths){ 10. var index:int = 0; 11. var lastX:Number = toScreenX(path[index++]); 12. var lastY:Number = toScreenY(path[index++]); 13. graphics.moveTo(lastX, lastY); 14. while(index < path.length){ 15. var currX:Number = toScreenX(path[index++]); 16. var currY:Number = toScreenY(path[index++]); 17. if( currX !== lastX || currY !== lastY){ 18. graphics.lineTo(currX, currY); 19. lastX = currX; 20. lastY = currY; 21. } 22. } 23. } 24.}
    151. 1.override protected function updateLayer():void{ 2. const model:Model = Model.instance; 3. graphics.clear(); 4. graphics.lineStyle(1, 0); 5. model.streetGrid.search(map.extent, streetHandler); 6.} 8.private function streetHandler(street:Street, data:Object = null):void{ 9. for each(var path:Array in street.shpPolyline.paths){ 10. var index:int = 0; 11. var lastX:Number = toScreenX(path[index++]); 12. var lastY:Number = toScreenY(path[index++]); 13. graphics.moveTo(lastX, lastY); 14. while(index < path.length){ 15. var currX:Number = toScreenX(path[index++]); 16. var currY:Number = toScreenY(path[index++]); 17. if( currX !== lastX || currY !== lastY){ 18. graphics.lineTo(currX, currY); 19. lastX = currX; 20. lastY = currY; 21. } 22. } 23. } 24.}
    152. 1.override protected function updateLayer():void{ 2. const model:Model = Model.instance; 3. graphics.clear(); 4. graphics.lineStyle(1, 0); 5. model.streetGrid.search(map.extent, streetHandler); 6.} 8.private function streetHandler(street:Street, data:Object = null):void{ 9. for each(var path:Array in street.shpPolyline.paths){ 10. var index:int = 0; 11. var lastX:Number = toScreenX(path[index++]); 12. var lastY:Number = toScreenY(path[index++]); 13. graphics.moveTo(lastX, lastY); 14. while(index < path.length){ 15. var currX:Number = toScreenX(path[index++]); 16. var currY:Number = toScreenY(path[index++]); 17. if( currX !== lastX || currY !== lastY){ 18. graphics.lineTo(currX, currY); 19. lastX = currX; 20. lastY = currY; 21. } 22. } 23. } 24.}
    153. 1.override protected function updateLayer():void{ 2. const model:Model = Model.instance; 3. graphics.clear(); 4. graphics.lineStyle(1, 0); 5. model.streetGrid.search(map.extent, streetHandler); 6.} 8.private function streetHandler(street:Street, data:Object = null):void{ 9. for each(var path:Array in street.shpPolyline.paths){ 10. var index:int = 0; 11. var lastX:Number = toScreenX(path[index++]); 12. var lastY:Number = toScreenY(path[index++]); 13. graphics.moveTo(lastX, lastY); 14. while(index < path.length){ 15. var currX:Number = toScreenX(path[index++]); 16. var currY:Number = toScreenY(path[index++]); 17. if( currX !== lastX || currY !== lastY){ 18. graphics.lineTo(currX, currY); 19. lastX = currX; 20. lastY = currY; 21. } 22. } 23. } 24.}
    154. Demo StreetTrace
    155. When Will I Use This ?
    156. Q&A http://thunderheadxpler.blogspot.com mraad@esri.com

    + 360|Conferences360|Conferences, 6 months ago

    custom

    332 views, 0 favs, 0 embeds more stats

    In this session we will demonstrate the Flex Mappin more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 332
      • 332 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 10
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories