Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
acffd768
Commit
acffd768
authored
Apr 24, 2017
by
Christian Cabrera
Browse files
Adding service provider visualization
parent
176ded37
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/views/VisualizationTopologyView.java
View file @
acffd768
...
...
@@ -29,6 +29,7 @@ import java.awt.Font;
import
java.awt.Frame
;
import
java.awt.Graphics
;
import
java.awt.Graphics2D
;
import
java.awt.Polygon
;
import
java.awt.RenderingHints
;
import
java.awt.Stroke
;
import
java.awt.Toolkit
;
...
...
@@ -391,12 +392,14 @@ public class VisualizationTopologyView extends JFrame
protected
HashMap
<
INodeID
,
VisNodeInformation
>
staticGwNodeInformation
=
new
HashMap
<
INodeID
,
VisNodeInformation
>();
protected
HashMap
<
INodeID
,
VisNodeInformation
>
mobileGwNodeInformation
=
new
HashMap
<
INodeID
,
VisNodeInformation
>();
protected
HashMap
<
INodeID
,
VisNodeInformation
>
citizenNodeInformation
=
new
HashMap
<
INodeID
,
VisNodeInformation
>();
protected
HashMap
<
INodeID
,
VisNodeInformation
>
providerNodeInformation
=
new
HashMap
<
INodeID
,
VisNodeInformation
>();
protected
final
static
int
PADDING
=
16
;
protected
final
static
int
NODE_PAD
=
2
;
protected
final
static
int
STATIC_GW_NODE_PAD
=
3
;
protected
final
static
int
MOBILE_GW_NODE_PAD
=
2
;
protected
final
static
int
PROVIDER_NODE_PAD
=
2
;
protected
final
static
int
CITIZEN_NODE_PAD
=
2
;
private
static
final
long
serialVersionUID
=
-
3023020559483652110L
;
...
...
@@ -470,11 +473,20 @@ public class VisualizationTopologyView extends JFrame
}
}
else
{
if
(!
nodeInformation
.
containsKey
(
comp
.
getHost
().
getId
()))
{
VisNodeInformation
tVis
=
new
VisNodeInformation
(
comp
);
comp
.
requestLocationUpdates
(
null
,
tVis
);
System
.
out
.
println
(
"HERE: "
+
comp
.
getHost
().
toString
());
nodeInformation
.
put
(
comp
.
getHost
().
getId
(),
tVis
);
if
(
comp
.
getHost
().
toString
().
contains
(
"Provider"
)){
if
(!
providerNodeInformation
.
containsKey
(
comp
.
getHost
().
getId
()))
{
VisNodeInformation
tVis
=
new
VisNodeInformation
(
comp
);
comp
.
requestLocationUpdates
(
null
,
tVis
);
providerNodeInformation
.
put
(
comp
.
getHost
().
getId
(),
tVis
);
}
}
else
{
if
(!
nodeInformation
.
containsKey
(
comp
.
getHost
().
getId
()))
{
VisNodeInformation
tVis
=
new
VisNodeInformation
(
comp
);
comp
.
requestLocationUpdates
(
null
,
tVis
);
System
.
out
.
println
(
"HERE: "
+
comp
.
getHost
().
toString
());
nodeInformation
.
put
(
comp
.
getHost
().
getId
(),
tVis
);
}
}
}
}
...
...
@@ -586,6 +598,31 @@ public class VisualizationTopologyView extends JFrame
}
}
}
for
(
VisNodeInformation
node
:
providerNodeInformation
.
values
())
{
if
(
node
.
clicked
)
{
g2
.
setColor
(
Color
.
MAGENTA
);
g2
.
fillRect
((
int
)
node
.
position
.
getX
()
-
PROVIDER_NODE_PAD
,
(
int
)
node
.
position
.
getY
()
-
PROVIDER_NODE_PAD
,
PROVIDER_NODE_PAD
*
2
+
5
,
PROVIDER_NODE_PAD
*
2
);
g2
.
setColor
(
Color
.
BLACK
);
Font
font
=
new
Font
(
"Helvetica"
,
Font
.
BOLD
,
10
);
g2
.
setFont
(
font
);
g2
.
drawString
(
"P"
+
node
.
hostId
,
(
int
)
node
.
position
.
getX
()-
PROVIDER_NODE_PAD
,(
int
)
node
.
position
.
getY
()-
PROVIDER_NODE_PAD
);
}
else
{
if
(
showNodes
)
{
// Draw nodes
Color
col
=
new
Color
(
255
,
204
,
51
);
g2
.
setColor
(
col
);
g2
.
fillRect
((
int
)
node
.
position
.
getX
()
-
PROVIDER_NODE_PAD
,
(
int
)
node
.
position
.
getY
()
-
PROVIDER_NODE_PAD
,
PROVIDER_NODE_PAD
*
2
+
5
,
PROVIDER_NODE_PAD
*
2
);
g2
.
setColor
(
Color
.
BLACK
);
Font
font
=
new
Font
(
"Helvetica"
,
Font
.
BOLD
,
10
);
g2
.
setFont
(
font
);
g2
.
drawString
(
"P"
+
node
.
hostId
,
(
int
)
node
.
position
.
getX
()-
PROVIDER_NODE_PAD
,(
int
)
node
.
position
.
getY
()-
PROVIDER_NODE_PAD
);
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
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