Skip to content

Commit

Permalink
fixed bugs with map overview window
Browse files Browse the repository at this point in the history
Change-Id: Ifb28cee4eff0a75209306c1b1ebd78ebbbc3e5b8
  • Loading branch information
adufilie committed Oct 15, 2012
1 parent af28e8c commit 6bbb5eb
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 50 deletions.
Binary file added WeaveClient/configurations/temp.weave
Binary file not shown.
2 changes: 1 addition & 1 deletion WeaveClient/launch files/temp.launch
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<stringAttribute key="com.adobe.flexbuilder.debug.ATTR_DEBUG_URL" value="http://localhost:8080/weave.html?file=temp.xml&amp;editable=true"/>
<stringAttribute key="com.adobe.flexbuilder.debug.ATTR_PROFILE_URL" value="http://localhost:8080/weave.html?file=temp.xml"/>
<stringAttribute key="com.adobe.flexbuilder.debug.ATTR_PROJECT" value="WeaveClient"/>
<stringAttribute key="com.adobe.flexbuilder.debug.ATTR_RUN_URL" value="http://localhost:8080/weave.html?file=test-scatterplot-reproject.weave&amp;editable=true"/>
<stringAttribute key="com.adobe.flexbuilder.debug.ATTR_RUN_URL" value="http://localhost:8080/weave.html?file=temp.weave&amp;editable=true"/>
<booleanAttribute key="com.adobe.flexbuilder.debug.ATTR_USE_DEFAULT_URLS" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/WeaveClient"/>
Expand Down
2 changes: 0 additions & 2 deletions WeaveCore/src/weave/core/LinkableHashMap.as
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ package weave.core
import flash.utils.getQualifiedClassName;

import weave.api.WeaveAPI;
import weave.api.copySessionState;
import weave.api.core.IChildListCallbackInterface;
import weave.api.core.ILinkableHashMap;
import weave.api.core.ILinkableObject;
import weave.api.disposeObjects;
import weave.api.getSessionState;
import weave.api.newLinkableChild;
import weave.api.registerLinkableChild;

Expand Down
14 changes: 7 additions & 7 deletions WeaveMobileClient/.actionScriptProperties
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/spark_dmv.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_dmv.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_flashflexkit.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/air/applicationupdater_ui.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/air/airframework.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/air/applicationupdater_ui.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_flashflexkit.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_agent.swc" useDefaultLinkType="false"/>
</excludedEntries>
</libraryPathEntry>
Expand Down Expand Up @@ -92,32 +92,32 @@
<buildCSSFiles/>
<flashCatalyst validateFlashCatalystCompatibility="false"/>
<buildTargets>
<buildTarget buildTargetName="com.adobe.flexide.multiplatform.ios.platform" iosSettingsVersion="1" provisioningFile="" releasePackageType="">
<buildTarget buildTargetName="com.adobe.flexide.multiplatform.ios.platform" iosSettingsVersion="1" provisioningFile="d:/Dropbox/weave-mobile/Sanjay_Weave_IOS.mobileprovision" releasePackageType="ipa-ad-hoc">
<multiPlatformSettings enabled="true" includePlatformLibs="false" platformID="com.adobe.flexide.multiplatform.ios.platform" version="2"/>
<airSettings airCertificatePath="" airTimestamp="true" version="1">
<airSettings airCertificatePath="D:/Dropbox/weave-mobile/iphone_dev.p12" airTimestamp="true" version="1">
<airExcludes/>
</airSettings>
<actionScriptSettings version="1"/>
</buildTarget>
<buildTarget buildTargetName="com.qnx.flexide.multiplatform.qnx.platform">
<multiPlatformSettings enabled="true" includePlatformLibs="false" platformID="com.qnx.flexide.multiplatform.qnx.platform" version="2"/>
<airSettings airCertificatePath="" airTimestamp="true" version="1">
<airExcludes/>
</airSettings>
<multiPlatformSettings enabled="true" includePlatformLibs="false" platformID="com.qnx.flexide.multiplatform.qnx.platform" version="2"/>
<actionScriptSettings version="1"/>
</buildTarget>
<buildTarget androidSettingsVersion="1" buildTargetName="com.adobe.flexide.multiplatform.android.platform">
<multiPlatformSettings enabled="true" includePlatformLibs="false" platformID="com.adobe.flexide.multiplatform.android.platform" version="2"/>
<airSettings airCertificatePath="d:/Dropbox/weave-mobile/my-mobile-cert.p12" airTimestamp="true" version="1">
<airExcludes/>
</airSettings>
<multiPlatformSettings enabled="true" includePlatformLibs="false" platformID="com.adobe.flexide.multiplatform.android.platform" version="2"/>
<actionScriptSettings version="1"/>
</buildTarget>
<buildTarget buildTargetName="default">
<multiPlatformSettings enabled="false" includePlatformLibs="false" platformID="default" version="2"/>
<airSettings airCertificatePath="" airTimestamp="true" version="1">
<airExcludes/>
</airSettings>
<multiPlatformSettings enabled="false" includePlatformLibs="false" platformID="default" version="2"/>
<actionScriptSettings version="1"/>
</buildTarget>
</buildTargets>
Expand Down
87 changes: 49 additions & 38 deletions WeaveUI/src/weave/visualization/tools/MapOverviewWindow.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
<![CDATA[
import mx.containers.Canvas;
import weave.api.WeaveAPI;
import weave.api.getCallbackCollection;
import weave.api.newLinkableChild;
import weave.api.primitives.IBounds2D;
import weave.core.CallbackJuggler;
import weave.core.UIUtils;
import weave.primitives.Bounds2D;
import weave.primitives.ZoomBounds;
Expand Down Expand Up @@ -75,35 +77,50 @@
canvas.percentHeight= canvas.percentWidth = 100;
canvas.useHandCursor = true;
visualization.addChild(canvas);
UIUtils.spark_addChild(visualization,canvas);
canvas.toolTip = lang("Click or drag this rectangle to change the displayed area in the map");
visualization.addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
visualization.addEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
visualization.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove);
WeaveAPI.StageUtils.addEventCallback(MouseEvent.MOUSE_MOVE, this, handleMouseMove);
WeaveAPI.StageUtils.addEventCallback(MouseEvent.MOUSE_UP, this, handleMouseUp);
}
public const parentZoomBounds:ZoomBounds = newLinkableChild(this, ZoomBounds, drawBoundsRectangle, true);
public const parentScreenBounds:IBounds2D = new Bounds2D();
public function set parentZoomBounds(value:ZoomBounds):void
{
_parentZoomBoundsJuggler.target = value;
}
public function get parentZoomBounds():ZoomBounds
{
return _parentZoomBoundsJuggler.target as ZoomBounds;
}
private var _parentZoomBoundsJuggler:CallbackJuggler = new CallbackJuggler(this, drawBoundsRectangle, true);
public const parentScreenBounds:IBounds2D = new Bounds2D();
private var overviewDataBounds:IBounds2D = new Bounds2D();
private var screenBounds:IBounds2D = new Bounds2D();
private var tempBounds:IBounds2D = new Bounds2D();
private const tempShape:Shape = new Shape();
private var canvas:Canvas = new Canvas();
/**
* This function draws a rectangle around the area currently displayed in the parent MapTool.
*/
public function drawBoundsRectangle():void
{
parentScreenBounds.setRectangle(0,0,parent.width,parent.height);
screenBounds.setRectangle(0,0,width,height);
parentZoomBounds.getDataBounds(tempBounds);
if (!parent)
{
callLater(drawBoundsRectangle);
return;
}
visualization.plotManager.zoomBounds.getScreenBounds(screenBounds);
parentZoomBounds.getScreenBounds(parentScreenBounds);
parentZoomBounds.getDataBounds(tempBounds);
if( tempBounds.isEmpty()) return;
if( screenBounds.isEmpty()) return;
if (tempBounds.isEmpty())
return;
if (screenBounds.isEmpty())
return;
if(!parentScreenBounds.isEmpty())
_fixAspectRatio(tempBounds,parentScreenBounds);
Expand All @@ -112,59 +129,53 @@
overviewDataBounds.projectCoordsTo(tempBounds,screenBounds);
boundWidth = tempBounds.getWidth();
boundHeight = tempBounds.getHeight()
var graphics:Graphics = canvas.graphics;
graphics.clear();
graphics.lineStyle(2);
graphics.beginFill(0xcccccc,0.5);
graphics.drawRect(tempBounds.getXMin(),tempBounds.getYMin(),boundWidth = tempBounds.getWidth(),boundHeight = tempBounds.getHeight());
graphics.drawRect(tempBounds.getXMin(), tempBounds.getYMin(), boundWidth, boundHeight);
graphics.endFill();
// TEMPORARY SOLUTION to enforce clipContent (flex bug) so rectangle is not drawn outside the overview panel
canvas.width = width+1;
canvas.height = height+1;
}
private var tempPoint:Point = new Point();
private var boundWidth:Number;
private var boundHeight:Number;
private var mouseDown:Boolean = false;
private var enableSelection:Boolean ;
private function handleMouseDown(e:MouseEvent):void
private function handleMouseDown(e:MouseEvent):void
{
mouseDown = true;
handleMouseEvent(e);
handleMouseEvent();
}
private function handleMouseUp(e:MouseEvent):void
private function handleMouseMove():void
{
if (!mouseDown)
return;
handleMouseEvent(e);
mouseDown = false;
if (mouseDown)
handleMouseEvent();
}
private function handleMouseMove(e:MouseEvent):void
private function handleMouseUp():void
{
if (!mouseDown)
return;
handleMouseEvent(e);
if (mouseDown)
handleMouseEvent();
mouseDown = false;
}
private function handleMouseEvent(e:MouseEvent):void
private function handleMouseEvent():void
{
visualization.plotManager.zoomBounds.getScreenBounds(screenBounds);
tempPoint = visualization.globalToLocal(new Point(e.stageX, e.stageY));
tempBounds.setBounds(tempPoint.x, tempPoint.y, tempPoint.x+boundWidth,tempPoint.y+boundHeight);
tempBounds.setCenter(tempPoint.x,tempPoint.y);
tempBounds.setCenteredRectangle(visualization.mouseX, visualization.mouseY, boundWidth, boundHeight);
visualization.plotManager.zoomBounds.getDataBounds(overviewDataBounds);
screenBounds.projectCoordsTo(tempBounds, overviewDataBounds);
parentZoomBounds.setDataBounds(tempBounds);
parentZoomBounds.setBounds(tempBounds, parentScreenBounds, true);
}
/**
* This function was copied from ZoomBounds.as to get the correct dataBounds
* @param dataBounds data bounds to correct
Expand Down
2 changes: 1 addition & 1 deletion WeaveUI/src/weave/visualization/tools/MapTool.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@
(WeaveAPI.SessionManager as SessionManager).excludeLinkableChildFromSessionState(children, overviewPanel);
linkSessionState(visualization.plotManager.layerSettings, overviewPanel.visualization.plotManager.layerSettings);
linkSessionState(visualization.plotManager.plotters, overviewPanel.visualization.plotManager.plotters);
linkSessionState(visualization.plotManager.zoomBounds, overviewPanel.parentZoomBounds);
overviewPanel.parentZoomBounds = visualization.plotManager.zoomBounds;
children.addGroupedCallback(this, bringOverviewToTop);
}
else
Expand Down
1 change: 0 additions & 1 deletion WeaveUISpark/src/weave/visualization/layers/PlotManager.as
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ package weave.visualization.layers
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.utils.Dictionary;
import flash.utils.getTimer;

import weave.Weave;
import weave.api.WeaveAPI;
Expand Down

0 comments on commit 6bbb5eb

Please sign in to comment.