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
0d3494e7
Commit
0d3494e7
authored
Apr 15, 2019
by
Julian Zobel
Browse files
x and y for fixed ap
parent
d251b7dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/TwoPointFixedAttractionGenerator.java
View file @
0d3494e7
...
...
@@ -25,6 +25,7 @@ import de.tud.kom.p2psim.api.topology.Topology;
import
de.tud.kom.p2psim.impl.topology.util.PositionVector
;
import
de.tudarmstadt.maki.simonstrator.api.Binder
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.AttractionPoint
;
import
de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor
;
/**
* Implementation of the interface {@link AttractionGenerator}.
...
...
@@ -39,11 +40,19 @@ public class TwoPointFixedAttractionGenerator implements IAttractionGenerator {
private
PositionVector
worldDimension
;
public
TwoPointFixedAttractionGenerator
()
{
private
double
x1
,
x2
,
y1
,
y2
;
@XMLConfigurableConstructor
({
"x1"
,
"y1"
,
"x2"
,
"y2"
})
public
TwoPointFixedAttractionGenerator
(
double
x1
,
double
y1
,
double
x2
,
double
y2
)
{
this
.
worldDimension
=
Binder
.
getComponentOrNull
(
Topology
.
class
)
.
getWorldDimensions
();
this
.
x1
=
x1
;
this
.
y1
=
y1
;
this
.
x2
=
x2
;
this
.
y2
=
y2
;
createAttractionPoints
();
}
...
...
@@ -56,16 +65,16 @@ public class TwoPointFixedAttractionGenerator implements IAttractionGenerator {
}
private
void
createAttractionPoints
()
{
double
x
=
worldDimension
.
getX
();
double
y
=
worldDimension
.
getY
();
PositionVector
p1
=
new
PositionVector
(
0
+
0.1
*
x
,
y
/
2
);
PositionVector
p1
=
new
PositionVector
(
x1
,
y1
);
AttractionPoint
ap1
=
new
AttractionPointImpl
(
"AP1"
,
p1
);
ap1
.
setRadius
(
100
);
attractionPoints
.
add
(
ap1
);
PositionVector
p2
=
new
PositionVector
(
0.9
*
x
,
y
/
2
);
PositionVector
p2
=
new
PositionVector
(
x2
,
y2
);
AttractionPoint
ap2
=
new
AttractionPointImpl
(
"AP2"
,
p2
);
ap2
.
setRadius
(
100
);
attractionPoints
.
add
(
ap2
);
}
...
...
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