Merge branch 'master' into mapquest
authorAntony Pegg <antthelimey@gmail.com>
Tue, 12 Apr 2011 12:47:42 +0000 (08:47 -0400)
committerAntony Pegg <antthelimey@gmail.com>
Tue, 12 Apr 2011 12:47:42 +0000 (08:47 -0400)
Conflicts:
net/systemeD/potlatch2/Toolbox.mxml
version.as.template

1  2 
net/systemeD/potlatch2/TagViewer.mxml
net/systemeD/potlatch2/Toolbox.mxml
potlatch2.mxml
resources/imagery.xml
version.as.template

index 359eed29e897d887d94e143c0fdaa0ac83cffb7e,b107fe0da2988a5bc608f1cca9a4a3c257da73f7..26acee82d1ac1ac6c73281c29d6ab234e0d1cb33
@@@ -21,7 -21,7 +21,7 @@@
                </mx:HBox>
  
                <mx:TileList dataProvider="{dndRep.currentItem.getFeaturesForType('point', true)}" width="100%" height="1"
 -                                   rowHeight="32" columnWidth="32" updateComplete="resizePOIGrid(event)" styleName="dndPanelTileList">
 +                                   updateComplete="resizePOIGrid(event)" styleName="dndPanelTileList">
                        <mx:itemRenderer>
                                <mx:Component>
                                        <mx:VBox toolTip="{data.name}">
@@@ -44,7 -44,7 +44,7 @@@
                                                                DragManager.doDrag(dragInitiator, dragSource, event, dragProxy);
                                                        }
                                                ]]></mx:Script>
 -                                              <mx:Image id="foo" source="{data.dndimage}" height="24" width="24" mouseMove="dragPOI(event, data.tags)" toolTip="{data.name}" />
 +                                              <mx:Image id="foo" source="{data.dndimage}" height="20" width="20" mouseMove="dragPOI(event, data.tags)" toolTip="{data.name}" />
                                        </mx:VBox>
                                </mx:Component>
                        </mx:itemRenderer>
        import mx.core.DragSource;
        import flexlib.containers.SuperTabNavigator;
  
-       private static const dndPrompt:String="Add new points by dragging them onto the map";
+       [Bindable]
+       public var dndPrompt:String="Add new points by dragging them onto the map";
  
        private var editorStackTabNavigator:SuperTabNavigator;
        private var editorStackAccordion:Accordion;
                        for each (var entity:Entity in EntityCollection(selectedEntity).entities) {
                                var indexes:Array=relation.findEntityMemberIndexes(entity);
                                for each (var index:int in indexes) {
-                                       relation.setMember(index, new RelationMember(entity,newRole));
+                                       relation.setMember(index, new RelationMember(entity,newRole), MainUndoStack.getGlobalStack().addAction);
                                }
                        }
                } else {
-                       relation.setMember(props['index'], new RelationMember(selectedEntity,newRole));
+                       relation.setMember(props['index'], new RelationMember(selectedEntity,newRole), MainUndoStack.getGlobalStack().addAction);
                }
        }
  
        }
  
        private function tagChanged(event:TagEvent):void {
-             if(selectedEntity != null && selectedEntity is EntityCollection) {
-                       setupMultiAdvanced(selectedEntity);
-                   return;
-                 }
            refreshFeatureIcon();
-           // ** FIXME - changing tags on Advanced tab should update simple view
-           // (but putting initialiseEditors here breaks other stuff, because it causes
-           // the Basic pane to be selected)
-           // if the advancedTagGrid has already been set up, it needs to be refreshed.
-           // FIXME make this better, maybe advancedTagGrid should be event listening.
-           if(advancedContainer.initialized) {
-             checkAdvanced();
-           }
        }
  
        public function loadFeatures():void {
index 7637c8f10b18682b5b433001f86ca5cc82c77fce,a553ab6a26ee6b7be38e1db1e0e386dbac23adcf..241d5f42adc75a754a3db32ee79ccdab9ac9de1a
@@@ -2,13 -2,18 +2,13 @@@
  <mx:Panel
        xmlns:mx="http://www.adobe.com/2006/mxml"
        xmlns:potlatch2="net.systemeD.potlatch2.*"
 -      height="76" width="129" layout="absolute"
 -      styleName="theToolBox">
 +      borderThicknessRight="1" borderThicknessLeft="1" borderThicknessBottom="3"
 +      title="Edit Pathways and Areas" layout="horizontal" styleName="theToolBox">
  
          <!-- the animation effect that controls the rotation of the reverse arrow.
                We could get more fancy by using previous angle in angleFrom, and a longer duration, to give a nice animated effect -->
          <mx:Rotate id="rotate" angleFrom="{angle-1}" angleTo="{angle}" target="{arrowBox}" originX="{arrowBox.width/2}" originY="{arrowBox.height/2}" duration="4"/>
  
 -
 -              <mx:Image data="@Embed('../../../embedded/close_small.png')"
 -                      includeInLayout="false" id="toolboxClose" click="toggle();" 
 -                      y="-6" x="115" />
 -
                <!-- Top row -->
  
                <mx:Button icon="@Embed('../../../embedded/delete.svg')"
                        enabled="{canDo('delete')}" 
                        alpha="{getAlpha('delete')}" 
                        toolTip="{deleteToolTipText()}" 
 -                      width="28" height="28" textAlign="left" y="4" x="6" paddingLeft="6" paddingRight="0" />
 +                      width="24" height="24" />
  
-         <mx:HBox width="24" height="24" y="4" x="36" borderStyle="solid" cornerRadius="12" click="reverseClicked();" horizontalAlign="center" verticalAlign="middle">
-             <mx:ViewStack id="rotateButtonStack">
 -        <mx:HBox id="reverseButton" width="28" height="28" y="4" x="36" borderStyle="solid" cornerRadius="4"
 -                  click="reverseClicked();" horizontalAlign="center" verticalAlign="middle" toolTip="Reverse direction (V)">
++        <mx:HBox id="reverseButton" width="24" height="24" y="4" x="36" borderStyle="solid" cornerRadius="12" 
++                        click="reverseClicked();" horizontalAlign="center" verticalAlign="middle" toolTip="Reverse direction (V)">
+             <mx:ViewStack id="rotateButtonStack" creationPolicy="all">
                  <mx:HBox id="arrowBoxWrapper"><!-- changing the viewstack back onto a rotated hbox causes positioning glitches, hence this wrapper -->
                      <!-- I can totally recommend adding borderStyle="solid" to arrowBox when debugging -->
                      <mx:HBox id="arrowBox" horizontalAlign="center" verticalAlign="middle" width="24" height="24">
                          <mx:Image id="arrow" source="@Embed('../../../embedded/arrow.svg')"
                              alpha="{getAlpha('reverseDirection')}"
-                             toolTip="Reverse direction (V)"
                              width="22" height="22"/>
                      </mx:HBox>
                  </mx:HBox>
                  <mx:HBox id="clockwiseBox" horizontalAlign="center" verticalAlign="middle">
                      <mx:Image id="clockwise" source="@Embed('../../../embedded/clockwise.svg')"
                          alpha="{getAlpha('reverseDirection')}"
-                         toolTip="Reverse direction (V)"
                          width="22" height="22" x="2" y="2"/>
                  </mx:HBox>
                  <mx:HBox id="antiClockwiseBox" horizontalAlign="center" verticalAlign="middle">
                          click='doReverseDirection();'
                          enabled="{canDo('reverseDirection')}"
                          alpha="{getAlpha('reverseDirection')}"
-                         toolTip="Reverse direction (V)"
                          width="22" height="22" x="2" y="2"/>
                  </mx:HBox>
              </mx:ViewStack>
          </mx:HBox>
                <mx:Button icon="@Embed('../../../embedded/cut.svg')" 
+                       id="splitButton"
                        click='doSplit();'
                        enabled="{canDo('split')}" 
                        alpha="{getAlpha('split')}" 
                        toolTip="Split way (X)" 
 -                      width="28" height="28" textAlign="left" y="4" x="66" paddingLeft="8" paddingRight="0" />
 +                      width="24" height="24" />
                <mx:Button icon="@Embed('../../../embedded/merge.svg')" 
+                       id="mergeButton"
                        click='doMerge();'
                        enabled="{canDo('merge')}" 
                        alpha="{getAlpha('merge')}" 
                        toolTip="Merge ways" 
 -                      width="28" height="28" textAlign="left" y="4" x="96" paddingLeft="3" paddingRight="0" />
 +                      width="24" height="24" />
  
                <!-- Second row -->
  
                <mx:Button icon="@Embed('../../../embedded/straighten.svg')" 
+                       id="straightenButton"
                        click='doStraighten();' 
                        enabled="{canDo('straighten')}" 
                        alpha="{getAlpha('straighten')}" 
                        toolTip="Straighten way" 
 -                      width="28" height="28" textAlign="left" y="34" x="6" paddingLeft="5" paddingRight="0" />
 +                      width="24" height="24" />
                <mx:Button icon="@Embed('../../../embedded/circle.svg')" 
+                       id="circulariseButton"
                        click='doCircularise();' 
                        enabled="{canDo('circularise')}" 
                        alpha="{getAlpha('circularise')}" 
                        toolTip="Make circular" 
 -                      width="28" height="28" textAlign="left" y="34" x="36" paddingLeft="4" paddingRight="0" />
 +                      width="24" height="24" />
                <mx:Button icon="@Embed('../../../embedded/quadrilateralise.svg')" 
+                       id="quadrilateraliseButton"
                        click='doQuadrilateralise();' 
                        enabled="{canDo('quadrilateralise')}" 
                        alpha="{getAlpha('quadrilateralise')}" 
 -                      toolTip="Make right-angled (Q)"
 -                      width="28" height="28" textAlign="left" y="34" x="66" paddingLeft="6" paddingRight="0" />
 +                      toolTip="Make right-angled (Q)" 
 +                      width="24" height="24" />
                <mx:Button icon="@Embed('../../../embedded/parallel.svg')" 
+                       id="parralleliseButton"
                        click='doParallelise();' 
                        enabled="{canDo('parallelise')}" 
                        alpha="{getAlpha('parallelise')}" 
                        toolTip="Create parallel way (P)" 
 -                      width="28" height="28" textAlign="left" y="34" x="96" paddingLeft="8" paddingRight="0" />
 +                      width="24" height="24" />
  
        <mx:Script><![CDATA[
  
          [Bindable]
          public var angle:int=0;
  
+         public var deleteNode:String = "Delete Node (Delete)";
+         public var deleteArea:String = "Delete Area (Shift+Delete)";
+         public var deleteWay:String = "Delete Way (Shift+Delete)";
+         public var deleteItem:String = "Delete Item"; // When nothing is selected
                public function init(controller:EditController):void {
                        this.controller=controller;
                        /* check if the toolbox was explictly turned off in a previous session */
                [Bindable(event="updateSkin")]
                private function deleteToolTipText():String {
                        var entity:Entity=controller.state.firstSelected;
-                       if (entity is Node) { return "Delete Node (Delete)"; }
-                       if (entity is Way && Way(entity).isArea()) { return "Delete Area (Shift+Delete)"; }
-                       if (entity is Way) { return "Delete Way (Shift+Delete)"; }
-                       return "Delete Item"; // When nothing is selected
+                       if (entity is Node) { return deleteNode; }
+                       if (entity is Way && Way(entity).isArea()) { return deleteArea; }
+                       if (entity is Way) { return deleteWay; }
+                       return deleteItem; // When nothing is selected
                }
  
          private function updateDirectionArrow():void {
diff --combined potlatch2.mxml
index 64124dca1769970e9892729c6b15c35a6cd1ca7b,fbf700e56f28d06f559188ed520809e240d8f6ba..72153cc000fba3eb44a324b3279f3229cabd6e4f
@@@ -9,19 -9,21 +9,21 @@@
        horizontalAlign="center" 
        addedToStage="initApp()"
        preloader="net.systemeD.potlatch2.Preloader">
-       
+     <map:LocalizationMap xmlns:map="l10n.map.*" />
        <mx:Style source="styles/Application.css"/>
  
      <mx:Glow id="glowImage" duration="100" 
 -        alphaFrom="0.3" alphaTo="1.0" 
 +        alphaFrom="0" alphaTo="0.8"
          blurXFrom="0.0" blurXTo="5.0" 
          blurYFrom="0.0" blurYTo="5.0" 
 -        color="0xFF8000"/>
 +        color="0x009ADE"/>
      <mx:Glow id="unglowImage" duration="100" 
 -        alphaFrom="1.0" alphaTo="0.3" 
 +        alphaFrom="0.8" alphaTo="0"
          blurXFrom="5.0" blurXTo="0.0" 
          blurYFrom="5.0" blurYTo="0.0" 
 -        color="0xFF8000"/>
 +        color="0x009ADE"/>
      <mx:WipeLeft id="wipeOut" duration="250"/>
      <mx:WipeRight id="wipeIn" duration="250"/>
  
@@@ -38,9 -40,9 +40,9 @@@
                                                     theMap.removeVectorLayer(theMap.findVectorLayer('GPS tracks')); }">
                        <mx:dataProvider>
                                <mx:Array>
-                                       <mx:Object label="GPS data" />
-                                       <mx:Object label="My tracks" />
-                                       <mx:Object label="Clear" />
+                                       <mx:Object label="GPS data" id="gpsData" />
+                                       <mx:Object label="My tracks" id="myTracks" />
+                                       <mx:Object label="Clear" id="clearGps" />
                                </mx:Array>
                        </mx:dataProvider>
                </mx:PopUpMenuButton>
          <mx:Button id="redo" label="Redo" click="MainUndoStack.getGlobalStack().redo();" styleName="appBarButton"
              enabled="{MainUndoStack.getGlobalStack().canRedo()}"/>
          <mx:Spacer width="100%"/>
-         <mx:Button label="Help" click="new HelpDialog().init();" styleName="appBarButton" />
-         <mx:Button label="Options" click="new OptionsDialog().init();" styleName="appBarButton" /> 
+         <mx:Button id="helpButton" label="Help" click="new HelpDialog().init();" styleName="appBarButton" />
+         <mx:Button id="optionsButton" label="Options" click="new OptionsDialog().init();" styleName="appBarButton" />
          <mx:Button label="Save" icon="@Embed('embedded/upload.svg')" disabledIcon="@Embed('embedded/upload_disabled.svg')" styleName="appBarButton"
                        click="SaveManager.saveChanges();" id="saveButton" enabled="false"/>
      </mx:ApplicationControlBar>
-     <map:LocalizationMap xmlns:map="l10n.map.*" />
      
      <mx:HDividedBox width="100%" height="100%">
  
          <mx:Canvas id="map_area" resize="onResizeMap()"
              top="0" left="0" width="100%" height="100%" dragEnter="dragEnterHandler(event);" dragDrop="dragDropHandler(event);">
          </mx:Canvas>
 -        <mx:Image source="@Embed('embedded/zoomIn.svg')" right="3" top="3" click="theMap.zoomIn();"
 +        <mx:Image source="@Embed('embedded/zoom_in.png')" right="7" top="3" click="theMap.zoomIn();"
              rollOverEffect="glowImage" rollOutEffect="unglowImage" toolTip="{'Zoom in - currently z'+getScale()}" />
 -        <mx:Image source="@Embed('embedded/zoomOut.svg')" right="3" top="20" click="theMap.zoomOut();"
 +        <mx:Image source="@Embed('embedded/zoom_out.png')" right="7" top="30" click="theMap.zoomOut();"
              rollOverEffect="glowImage" rollOutEffect="unglowImage" toolTip="{'Zoom out - currently z'+getScale()}" />
 -        <mx:TextArea id="dataWorking" text="" right="20" top="3" disabledColor="black" backgroundDisabledColor="0xFFFFEA" height="18"
 +        <mx:TextArea id="dataWorking" text="" right="35" top="3" disabledColor="black" backgroundDisabledColor="0xFFFFEA" height="18"
              enabled="false" borderThickness="0"
              showEffect="{wipeIn}" hideEffect="{wipeOut}"/>
          <mx:TextArea id="coordsbox" left="0" top="0" disabledColor="black" backgroundDisabledColor="0xFFFFEA" height="33"
  
                private function initApp():void {
  
-             /* For reasons that I don't yet understand, the en_US locale is the default and doesn't work at all. Use en_GB instead. */
-             /* Change this to another locale (e.g. fr_FR) to see the differences. This will obviously become done differently at some point. */
-             dispatchEvent(new LocaleEvent(LocaleEvent.LOAD_LOCALE,'en_GB'));
+             /* For reasons that I don't yet understand, the en_US locale is the default and doesn't work at all. */
+             /* Change this to another locale (e.g. fr_FR) to see the differences. */
+             if (loaderInfo.parameters['locale']) {
+               dispatchEvent(new LocaleEvent(LocaleEvent.LOAD_LOCALE,loaderInfo.parameters['locale']));
+             }
  
                        Globals.vars.map_area = map_area;
                        Globals.vars.root = map_area.rawChildren;                       // set up global reference to root level
  
                        // Get the tags
              var tags:Array = event.dragSource.dataForFormat('tags') as Array;
-             var mapLoc:Point = Globals.vars.root.globalToLocal(new Point(event.stageX, event.stageY));
+             // If you dnd quick enough, this exposes a flex bug and event.stageX/Y become negative.
+             // Take the mouse positions from a displayObject's stage for consistent results.
+             var mapLoc:Point = Globals.vars.root.globalToLocal(new Point(event.target.stage.mouseX, event.target.stage.mouseY));
              var lat:Number = Globals.vars.root.coord2lat(mapLoc.y);
              var lon:Number = Globals.vars.root.coord2lon(mapLoc.x);
              
diff --combined resources/imagery.xml
index 303c3a98b3aab473f3bea7b8ccc8650f42d4dcd5,0a0de6771159e6f75da8e553b981bf39244693dc..5b470cd4d8e000efa18f4076572f2c7f7735b3e5
                <terms_url>http://opengeodata.org/microsoft-imagery-details</terms_url>
                <default>yes</default>
        </set>
 +    <set>
 +        <name>MapQuest Open Aerial</name>
 +        <url>http://oatile1.mqcdn.com/naip/$z/$x/$y.png</url>
 +    </set>
        <set>
                <name>OSM - Mapnik</name>
                <url>http://tile.openstreetmap.org/$z/$x/$y.png</url>
      <set>
          <name>OSM - MapQuest</name>
          <url>http://otile1.mqcdn.com/tiles/1.0.0/osm/$z/$x/$y.png</url>
 +    </set>
 +    <set minlat="17" minlon="175" maxlat="72" maxlon="-46">
 +      <name>OSM - Tiger Edited Map</name>
 +      <type>900913</type>
 +      <url>http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/$z/$x/$y.png</url>
      </set>
        <set minlat="49.8" minlon="-9" maxlat="61.1" maxlon="1.9">
                <name>OS OpenData Streetview</name>
@@@ -55,7 -46,7 +55,7 @@@
        </set>
        <set minlat="49.8" minlon="-9" maxlat="61.1" maxlon="1.9">
                <name>OS 7th Series historic</name>
-               <url>http://ooc.openstreetmap.org/os7/$z/$x/$y.png</url>
+               <url>http://ooc.openstreetmap.org/os7/$z/$x/$y.jpg</url>
                <sourcetag>OS7</sourcetag>
        </set>
        <set minlat="49.8" minlon="-5.8" maxlat="55.8" maxlon="1.9">
diff --combined version.as.template
index d04f0a9279e4a86c894a185d17059f9c4c3bfd69,8e51cc0602d80492eee433fc208b69ecaf896e47..9288362868aea30333261613baa71a05c74d5ab7
@@@ -3,4 -3,4 +3,5 @@@
  // at some point in the future.
  
  public var build_number:String="@@@buildnumber@@@";
- public var version:String="0.5-MQ";
 -public var version:String="2.0";
++public var version:String="2.0-MQ";
++