Commit 5fef1c70 authored by Matt Strum's avatar Matt Strum
Browse files

Better support for drawing

parent fe774206
......@@ -9,7 +9,7 @@
]]>
</mx:Script>
<mx:Label text="Displays resources from ProtoGENI"/>
<mx:Label text="Displays resources from ProtoGENI" fontSize="12"/>
<mx:HRule/>
<mx:Label text="Special thanks to" fontWeight="bold"/>
<mx:HBox width="100%" horizontalAlign="center">
......
......@@ -16,6 +16,8 @@ package pgmap
public static var hideColor:Object = 0xCCCCCC;
public static var linkColor:Object = 0xFFCFD1;
public static var linkBorderColor:Object = 0xFF00FF;
public static var tunnelColor:uint = 0xFFAEAE;
public static var tunnelBorderColor:Object = 0xFF0000;
public static var nodeColor:Object = 0x092B9F;
public static var nodeBorderColor:Object = 0xD2E1F0;
......@@ -120,6 +122,26 @@ package pgmap
return linkButton;
}
public static function getPointLinkButton(pl:PointLink):Button {
var linkButton:Button = new Button();
linkButton.label = pl.virtualId;
linkButton.setStyle("icon", Common.linkIcon);
linkButton.addEventListener(MouseEvent.CLICK,
function openLink(event:MouseEvent):void {
viewPointLink(pl);
}
);
return linkButton;
}
public static function viewPointLink(pl:PointLink):void {
var plWindow:PointLinkAdvancedWindow = new PointLinkAdvancedWindow();
plWindow.main = Main();
PopUpManager.addPopUp(plWindow, Main(), false);
PopUpManager.centerPopUp(plWindow);
plWindow.loadPointLink(pl);
}
public static function viewLink(l:Link):void {
var lgWindow:LinkAdvancedWindow = new LinkAdvancedWindow();
lgWindow.main = Main();
......
......@@ -63,11 +63,13 @@
endNode = pl.node1;
sliceLinksVbox.addChild(Common.getNodeButton(endNode));
//var pointLinkHbox:HBox = new HBox();
//var space:Spacer = new Spacer();
//space.width = 16;
//pointLinkHbox.addChild(space);
//sliceLinksVbox.addChild(pointLinkHbox);
var pointLinkHbox:HBox = new HBox();
var space:Spacer = new Spacer();
space.width = 16;
pointLinkHbox.addChild(space);
pointLinkHbox.addChild(Common.getPointLinkButton(pl));
sliceLinksVbox.addChild(pointLinkHbox);
}
} else if(linkTabs.getChildren().length > 1)
linkTabs.removeChild(sliceLinksVbox);
......
......@@ -82,8 +82,8 @@
function zoomin(evt:MouseEvent):void {
var map : Map = Common.Main().map;
var bzl : Number = map.getBoundsZoomLevel(bounds);
if(map.getZoom() != bzl)
map.setZoom(bzl);
if(map.getZoom() != bzl-1)
map.setZoom(bzl-1);
map.panTo( bounds.getCenter() );
});
......
......@@ -22,6 +22,9 @@
{
}
[Bindable]
public var virtualId:String;
[Bindable]
public var node1:Node;
......@@ -30,6 +33,9 @@
public var type:String;
[Bindable]
public var bandwidth:Number;
public var slice : Slice = null;
public var sliverRspec:XML;
......
......@@ -209,7 +209,7 @@ package pgmap
new LatLng(drawGroup.latitude1, drawGroup.longitude1),
new LatLng(drawGroup.latitude2, drawGroup.longitude2)
], new PolylineOptions({ strokeStyle: new StrokeStyle({
color: 0xFF00FF,
color: Common.linkBorderColor,
thickness: 4,
alpha:1})
}));
......@@ -220,10 +220,10 @@ package pgmap
// Add link marker
var ll:LatLng = new LatLng((drawGroup.latitude1 + drawGroup.latitude2)/2, (drawGroup.longitude1 + drawGroup.longitude2)/2);
var t:TooltipOverlay = new TooltipOverlay(ll, Common.kbsToString(drawGroup.TotalBandwidth()));
var t:TooltipOverlay = new TooltipOverlay(ll, Common.kbsToString(drawGroup.TotalBandwidth()), Common.linkBorderColor, Common.linkColor);
t.addEventListener(MouseEvent.CLICK, function(e:Event):void {
e.stopImmediatePropagation();
main.pgHandler.map.viewLinkGroup(drawGroup)
Common.viewLinkGroup(drawGroup)
});
main.map.addOverlay(t);
......@@ -250,19 +250,40 @@ package pgmap
return;
// Add line
var c:Object = 0x66FF00;
var backColor:Object = Common.linkColor;
var borderColor:Object = Common.linkBorderColor;
if(pl.type != "tunnel")
c = 0xFF00FF;
{
backColor = Common.tunnelColor;
borderColor = Common.tunnelBorderColor;
}
var firstll:LatLng = new LatLng(pl.node1.GetLatitude(), pl.node1.GetLongitude());
var secondll:LatLng = new LatLng(pl.node2.GetLatitude(), pl.node2.GetLongitude());
var polyline:Polyline = new Polyline([
new LatLng(pl.node1.GetLatitude(), pl.node1.GetLongitude()),
new LatLng(pl.node2.GetLatitude(), pl.node2.GetLongitude())
firstll,
secondll
], new PolylineOptions({ strokeStyle: new StrokeStyle({
color: c,
color: borderColor,
thickness: 4,
alpha:1})
}));
main.map.addOverlay(polyline);
linkLineOverlays.addItem(polyline);
// Add point link marker
var ll:LatLng = new LatLng((firstll.lat() + secondll.lat())/2, (firstll.lng() + secondll.lng())/2);
var t:TooltipOverlay = new TooltipOverlay(ll, Common.kbsToString(pl.bandwidth), borderColor, backColor);
t.addEventListener(MouseEvent.CLICK, function(e:Event):void {
e.stopImmediatePropagation();
Common.viewPointLink(pl)
});
main.map.addOverlay(t);
linkLabelOverlays.addItem(t);
}
public function drawAll():void {
......@@ -368,22 +389,5 @@ package pgmap
}
}
}
public function viewNodeGroup(group:NodeGroup):void {
var ngWindow:NodeGroupAdvancedWindow = new NodeGroupAdvancedWindow();
ngWindow.main = main;
PopUpManager.addPopUp(ngWindow, main, false);
PopUpManager.centerPopUp(ngWindow);
ngWindow.loadGroup(group);
}
public function viewLinkGroup(group:LinkGroup):void {
var lgWindow:LinkGroupAdvancedWindow = new LinkGroupAdvancedWindow();
lgWindow.main = main;
PopUpManager.addPopUp(lgWindow, main, false);
PopUpManager.centerPopUp(lgWindow);
lgWindow.loadGroup(group);
}
}
}
\ No newline at end of file
......@@ -45,6 +45,8 @@
public var Rspec:XML = null;
private var waiting:Boolean = false;
[Bindable]
public var Components:Array = null;
......@@ -537,8 +539,11 @@
var link:PointLink = new PointLink();
link.node1 = main.pgHandler.Nodes.GetByName(nodeNames[0]);
link.node2 = main.pgHandler.Nodes.GetByName(nodeNames[1]);
link.type = component.@link_type;
link.type = component.link_type;
link.bandwidth = component.bandwidth;
link.virtualId = component.virtual_id;
link.slice = slice;
link.sliverRspec = component;
slice.Links.addItem(link);
}
}
......
......@@ -58,7 +58,7 @@
switch(status) {
case "ready":
switch(sliverStatus) {
case "ready": returnString += " (All Ready)";
case "ready": returnString += " (Ready)";
break;
case "notready": returnString += " (Sliver Not Ready)";
break;
......
......@@ -24,9 +24,14 @@ public class TooltipOverlay extends OverlayBase {
private var textField:TextField;
private var dropShadow:Sprite;
private var button:Sprite;
private var borderColor:Object;
private var backgroundColor:Object;
public function TooltipOverlay(latLng:LatLng, label:String) {
public function TooltipOverlay(latLng:LatLng, label:String, edgeColor:Object, backColor:Object) {
super();
this.borderColor = edgeColor;
this.backgroundColor = backColor;
this.latLng = latLng;
this.label = label;
......@@ -46,11 +51,11 @@ public class TooltipOverlay extends OverlayBase {
this.textField.text = this.label;
this.textField.selectable = false;
this.textField.border = true;
this.textField.borderColor = 0xFF00FF;
this.textField.borderColor = borderColor as uint;
this.textField.background = true;
this.textField.multiline = false;
this.textField.autoSize = TextFieldAutoSize.CENTER;
this.textField.backgroundColor = 0xFFCFD1;
this.textField.backgroundColor = backgroundColor as uint;
this.textField.mouseEnabled = false;
this.textField.filters = [new DropShadowFilter()];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment