Local file vector import (not .shp yet)
[potlatch2.git] / net / systemeD / potlatch2 / dialogs / VectorSourceDialog.mxml
index 6ba72e084896e2a5307f2ad06c3e27d87160987c..d8a275a4aebee827edb4d67ddb03a11ee2517b68 100644 (file)
        import mx.controls.Alert;
 
        private var map:Map;
        import mx.controls.Alert;
 
        private var map:Map;
+       private var localFileReference:FileReference;
 
        public function styleEdited(name:String,stylesheet:String):void {
                map.findLayer(name).setStyle(stylesheet);
 
        public function styleEdited(name:String,stylesheet:String):void {
                map.findLayer(name).setStyle(stylesheet);
        
        /** Present an 'Open File' dialogue. */
        private function loadFileLocal():void {
        
        /** Present an 'Open File' dialogue. */
        private function loadFileLocal():void {
-               var file:FileReference=new FileReference(); 
+               // note scoping issues - http://blog.wrench.com.au/2010/06/16/filereferenceload-keep-it-in-scope/
+               localFileReference=new FileReference(); 
                var fileTypes:FileFilter=new FileFilter("*."+selectedType, "*."+selectedType); 
                var fileTypes:FileFilter=new FileFilter("*."+selectedType, "*."+selectedType); 
-               file.browse([fileTypes]); 
-               file.addEventListener(Event.SELECT, selectFileLocal);
+               localFileReference.browse([fileTypes]); 
+               localFileReference.addEventListener(Event.SELECT, selectFileLocal);
        }
        
        /** The user has chosen a file in the local 'Open File' dialogue. */
        private function selectFileLocal(event:Event):void {
        }
        
        /** The user has chosen a file in the local 'Open File' dialogue. */
        private function selectFileLocal(event:Event):void {
-               var connection:Connection = new Connection(name, url, null, null, CSSTransform.getInstance());
+               var connection:Connection = new Connection(localFileReference.name, '', null, null, CSSTransform.getInstance());
                var importer:Importer = findImporter(connection);
                var importer:Importer = findImporter(connection);
-               importer.importFromLocalFile();
+               importer.importFromLocalFile(localFileReference);
        }
        
        /** Create an Importer object of the type selected by the user. */
        }
        
        /** Create an Importer object of the type selected by the user. */