Module: nagvis Branch: master Commit: 76d0afe407eff8f664b13b0c10ea681c2b329cff URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis/commit/?id=76d0afe407eff8f664b13b0c10ea681c2b329cff
Author: Andriy Skuratov <[email protected]> Date: Tue Aug 25 16:55:22 2009 +0300 gmap:During the link creation/edit it is visualized. --- uifx/src/modules/gmap/events/LinkEvent.as | 1 + uifx/src/modules/gmap/mate/LinksEM.mxml | 5 ++ uifx/src/modules/gmap/mediator/MapMD.as | 18 +++++- uifx/src/modules/gmap/view/DialogLink.mxml | 22 +++++++- .../modules/gmap/view/controls/GMapControl.mxml | 2 + .../modules/gmap/view/controls/GMapLinkControl.as | 59 ++++++++++++++------ 6 files changed, 84 insertions(+), 23 deletions(-) diff --git a/uifx/src/modules/gmap/events/LinkEvent.as b/uifx/src/modules/gmap/events/LinkEvent.as index 168a9fd..75c6792 100644 --- a/uifx/src/modules/gmap/events/LinkEvent.as +++ b/uifx/src/modules/gmap/events/LinkEvent.as @@ -28,6 +28,7 @@ package modules.gmap.events public class LinkEvent extends Event { public static const SELECTED : String = "LinkSelected"; + public static const TRYON : String = "LinkTryOn"; public static const CHANGE : String = "LinkChange"; public static const ADD : String = "LinkAdd"; public static const SAVE : String = "LinkSave"; diff --git a/uifx/src/modules/gmap/mate/LinksEM.mxml b/uifx/src/modules/gmap/mate/LinksEM.mxml index 3ebee38..4db2b2e 100644 --- a/uifx/src/modules/gmap/mate/LinksEM.mxml +++ b/uifx/src/modules/gmap/mate/LinksEM.mxml @@ -23,6 +23,7 @@ > <mx:Script> <![CDATA[ + import modules.gmap.mediator.MapMD; import modules.gmap.mediator.MainMD; import modules.gmap.mediator.Poller; import modules.gmap.data.SettingsData; @@ -38,6 +39,10 @@ <MethodInvoker generator="{CurrentLink}" method="update" arguments="{event.link}"/> <MethodInvoker generator="{MainMD}" method="selectLink" arguments="{event.link}"/> </EventHandlers> + + <EventHandlers type="{LinkEvent.TRYON}"> + <MethodInvoker generator="{MapMD}" method="tryOnLink" arguments="{event.link}"/> + </EventHandlers> <EventHandlers type="{LinkEvent.ACTIVATE}"> <DataCopier destination="data" destinationKey="settings" source="{SettingsData}" sourceKey="settings"/> diff --git a/uifx/src/modules/gmap/mediator/MapMD.as b/uifx/src/modules/gmap/mediator/MapMD.as index b6e6ba6..0e700fc 100644 --- a/uifx/src/modules/gmap/mediator/MapMD.as +++ b/uifx/src/modules/gmap/mediator/MapMD.as @@ -23,12 +23,13 @@ package modules.gmap.mediator { import com.google.maps.LatLng; import com.google.maps.controls.ZoomControl; - + import flash.events.IEventDispatcher; - + + import modules.gmap.domain.Link; import modules.gmap.domain.Viewpoint; import modules.gmap.view.controls.GMapControl; - + import mx.controls.Alert; public class MapMD @@ -86,6 +87,17 @@ package modules.gmap.mediator if (MainMD.MODE_LOCATION_SEARCH == newMode) _view.locationsExtControl.visible = true; + + if(MainMD.MODE_LINK_EDIT == oldMode) + _view.linkTryOnControl.visible = false; + + if(MainMD.MODE_LINK_EDIT == newMode) + _view.linkTryOnControl.visible = true; + } + + public function tryOnLink(link:Link):void + { + _view.linkTryOnControl.link = link; } } } diff --git a/uifx/src/modules/gmap/view/DialogLink.mxml b/uifx/src/modules/gmap/view/DialogLink.mxml index ecec9f8..d07bac8 100644 --- a/uifx/src/modules/gmap/view/DialogLink.mxml +++ b/uifx/src/modules/gmap/view/DialogLink.mxml @@ -68,19 +68,20 @@ if (link) { - title.text = "Link - Edit Details"; lnkLocation1.selectedItem = link.location1; lnkLocation2.selectedItem = link.location2; lnkDescription.text = link.description; - if (link.id && link.id.length) + if (link.id && link.id.length > 0) { + title.text = "Link - Edit Details"; addButton.visible = false; saveButton.visible = true; deleteButton.visible = true; } else { + title.text = "Link - Connect Locations"; addButton.visible = true; saveButton.visible = false; deleteButton.visible = false; @@ -198,6 +199,7 @@ { lnkLocation1.selectedItem = lnkLocation2.selectedItem; lnkLocation2.selectedItem = location; + onLocationChanged(); } private function validate() : Boolean @@ -211,6 +213,20 @@ return true; } + private function onLocationChanged():void + { + if(lnkLocation1.selectedItem != null && lnkLocation2.selectedItem != null) + { + var ul : Link = new Link(); + ul.location1 = lnkLocation1.selectedItem as Location; + ul.location2 = lnkLocation2.selectedItem as Location; + + dispatchEvent( + new LinkEvent(LinkEvent.TRYON, ul) + ); + } + } + private function onAddClicked() : void { if (validate()) @@ -411,9 +427,11 @@ /> <mx:ComboBox id="lnkLocation1" dataProvider="{locations}" prompt="-" selectedIndex="-1" left="5" right="5" top="50" + change="onLocationChanged()" /> <mx:ComboBox id="lnkLocation2" dataProvider="{locations}" prompt="-" selectedIndex="-1" width="100%" left="5" right="5" top="80" + change="onLocationChanged()" /> </mx:Canvas> </mx:Canvas> diff --git a/uifx/src/modules/gmap/view/controls/GMapControl.mxml b/uifx/src/modules/gmap/view/controls/GMapControl.mxml index cceb860..37cf4e3 100644 --- a/uifx/src/modules/gmap/view/controls/GMapControl.mxml +++ b/uifx/src/modules/gmap/view/controls/GMapControl.mxml @@ -70,6 +70,7 @@ locationsExtControl.map = map; linkControl.map = map; + linkTryOnControl.map = map; linksControl.map = map; } @@ -84,5 +85,6 @@ <controls:GMapLocationsControl id="locationsControl"/> <controls:GMapLocationsExtControl id="locationsExtControl" visible="false"/> <controls:GMapLinkControl id="linkControl"/> + <controls:GMapLinkControl id="linkTryOnControl"/> <controls:GMapLinksControl id="linksControl"/> </mx:Canvas> diff --git a/uifx/src/modules/gmap/view/controls/GMapLinkControl.as b/uifx/src/modules/gmap/view/controls/GMapLinkControl.as index 0641ed3..2027f51 100644 --- a/uifx/src/modules/gmap/view/controls/GMapLinkControl.as +++ b/uifx/src/modules/gmap/view/controls/GMapLinkControl.as @@ -26,9 +26,9 @@ package modules.gmap.view.controls import com.google.maps.overlays.Polyline; import com.google.maps.overlays.PolylineOptions; import com.google.maps.styles.StrokeStyle; - + import modules.gmap.domain.Link; - + import mx.core.UIComponent; public class GMapLinkControl extends UIComponent @@ -72,34 +72,57 @@ package modules.gmap.view.controls reinitLine(); } + override public function set visible(value:Boolean):void + { + if(_map && _line) + { + if(value) + _map.addOverlay(_line); + else + _map.removeOverlay(_line); + } + + super.visible = value; + } + protected function reinitLine():void { if(_map) { + if (_line) + { + _map.removeOverlay(_line); + _line = null; + } + if(_link) { var point1 : LatLng = LatLng.fromUrlValue(_link.location1.point); var point2 : LatLng = LatLng.fromUrlValue(_link.location2.point); - var options : PolylineOptions = new PolylineOptions({ - strokeStyle: new StrokeStyle({ - color: 0xffffff, - thickness: 3, - alpha: 1 - }) - }); + var options : PolylineOptions = new PolylineOptions(); + if(_link.id && _link.id.length > 0) + { + options.strokeStyle = new StrokeStyle({ + color: 0x000000, + thickness: 1, + alpha: 1 + }); + } + else + { + options.strokeStyle = new StrokeStyle({ + color: 0x0000ff, + thickness: 3, + alpha: 0.5 + }); + } + _line = new Polyline([point1, point2], options); - _map.addOverlay(_line); - } - else - { - if (_line) - { - _map.removeOverlay(_line); - _line = null; - } + if(visible) + _map.addOverlay(_line); } } } ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
