Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-stable
Commits
0ddfe310
Commit
0ddfe310
authored
Jun 21, 2002
by
Chad Barb
Browse files
Added features to help chris visualize assign mappings using renderer.
parent
d720bbd1
Changes
1
Show whitespace changes
Inline
Side-by-side
vis/render.in
View file @
0ddfe310
...
...
@@ -229,6 +229,8 @@ $lanicon = GD::Image->newFromPng("$ICONDIR/lanicon.png") || warn "lanicon.png n
$colors
{"
black
"}
=
$im
->
colorAllocate
(
0
,
0
,
0
);
$colors
{"
darkblue
"}
=
$im
->
colorAllocate
(
0
,
0
,
96
);
$colors
{"
darkred
"}
=
$im
->
colorAllocate
(
128
,
0
,
0
);
$colors
{"
red
"}
=
$im
->
colorAllocate
(
192
,
0
,
0
);
$colors
{"
blue
"}
=
$im
->
colorAllocate
(
0
,
0
,
192
);
$colors
{"
paleblue
"}
=
$im
->
colorAllocate
(
127
,
127
,
192
);
$colors
{"
green
"}
=
$im
->
colorAllocate
(
0
,
96
,
0
);
...
...
@@ -264,8 +266,41 @@ foreach $i (@links) {
(
$x1
,
$y1
)
=
(
$nodepos
{
$a
}[
0
],
$nodepos
{
$a
}[
1
]);
(
$x2
,
$y2
)
=
(
$nodepos
{
$b
}[
0
],
$nodepos
{
$b
}[
1
]);
$im
->
line
(
$x1
,
$y1
,
$x2
,
$y2
,
$colors
{"
paleblue
"}
);
# print "Link: $i\n";
if
(
exists
$linklabels
{
$i
})
{
my
$foo
=
$linklabels
{
$i
};
my
$red
=
$colors
{"
red
"};
my
$green
=
$colors
{"
green
"};
my
$blue
=
$colors
{"
blue
"};
my
$black
=
$colors
{"
black
"};
if
(
$foo
=~
/^\!rs/
)
{
$im
->
setStyle
(
$red
);
}
elsif
(
$foo
=~
/^\!bs/
)
{
$im
->
setStyle
(
$blue
);
}
elsif
(
$foo
=~
/^\!ks/
)
{
$im
->
setStyle
(
$black
);
}
elsif
(
$foo
=~
/^\!ro/
)
{
$im
->
setStyle
(
$red
,
gdTransparent
);
}
elsif
(
$foo
=~
/^\!bo/
)
{
$im
->
setStyle
(
$blue
,
gdTransparent
);
}
elsif
(
$foo
=~
/^\!ko/
)
{
$im
->
setStyle
(
$black
,
gdTransparent
);
}
elsif
(
$foo
=~
/^\!ra/
)
{
$im
->
setStyle
(
$red
,
$red
,
gdTransparent
);
}
elsif
(
$foo
=~
/^\!ba/
)
{
$im
->
setStyle
(
$blue
,
$blue
,
gdTransparent
);
}
elsif
(
$foo
=~
/^\!ka/
)
{
$im
->
setStyle
(
$black
,
$black
,
gdTransparent
);
}
else
{
$im
->
setStyle
(
$colors
{"
paleblue
"});
}
}
else
{
$im
->
setStyle
(
$colors
{"
paleblue
"});
}
#$im->line( $x1, $y1, $x2, $y2, $colors{"paleblue"} );
$im
->
line
(
$x1
,
$y1
,
$x2
,
$y2
,
gdStyled
);
}
# render nodes.
...
...
@@ -278,12 +313,21 @@ foreach $i (keys %nodes) {
$cname
=
$nodes
{
$i
}{"
color
"};
$c
=
$colors
{
$cname
}
||
$colors
{"
blue
"};
if
(
$cname
eq
"
red
")
{
$im
->
rectangle
(
$x
-
16
,
$y
-
16
,
$x
+
16
,
$y
+
16
,
$colors
{"
darkred
"}
);
$im
->
rectangle
(
$x
-
15
,
$y
-
15
,
$x
+
15
,
$y
+
15
,
$colors
{"
darkred
"}
);
}
else
{
$im
->
rectangle
(
$x
-
16
,
$y
-
16
,
$x
+
16
,
$y
+
16
,
$colors
{"
gray25
"}
);
$im
->
rectangle
(
$x
-
15
,
$y
-
15
,
$x
+
15
,
$y
+
15
,
$colors
{"
gray25
"}
);
}
$im
->
filledRectangle
(
$x
-
14
,
$y
-
14
,
$x
+
14
,
$y
+
14
,
$colors
{"
white
"}
);
if
(
$nodeicon
&&
(
$cname
eq
"
skyblue
"
||
$cname
eq
"
steelblue
"))
{
if
(
$nodeicon
&&
(
$cname
eq
"
skyblue
"
||
$cname
eq
"
steelblue
"
||
$cname
eq
"
blue
"
||
$cname
eq
"
red
"))
{
$im
->
copy
(
$nodeicon
,
$x
-
16
,
$y
-
16
,
0
,
0
,
32
,
32
);
}
elsif
(
$lanicon
&&
$cname
eq
"
green
")
{
$im
->
copy
(
$lanicon
,
$x
-
16
,
$y
-
16
,
0
,
0
,
32
,
32
);
...
...
@@ -304,6 +348,8 @@ foreach $i (@links) {
(
$x2
,
$y2
)
=
(
$nodepos
{
$b
}[
0
],
$nodepos
{
$b
}[
1
]);
(
$x
,
$y
)
=
(
(
$x1
+
$x2
)
/ 2, ($y1 + $y2) /
2
);
$linklabels
{
$i
}
=~
s/^\!..//
;
my
@lines
=
split
"
",
$linklabels
{
$i
};
$y
-=
(
0.5
*
(
@lines
*
gdTinyFont
->
height
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment