Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
vadere
vadere
Commits
e6c4c74c
Commit
e6c4c74c
authored
Sep 25, 2016
by
Jakob Schöttl
Browse files
Refactor method
parent
70035fda
Changes
1
Hide whitespace changes
Inline
Side-by-side
VadereSimulator/src/org/vadere/simulator/control/TargetController.java
View file @
e6c4c74c
...
...
@@ -16,6 +16,7 @@ import org.vadere.state.scenario.TargetListener;
import
org.vadere.state.scenario.Topography
;
import
org.vadere.state.types.TrafficLightPhase
;
import
org.vadere.util.geometry.shapes.VPoint
;
import
org.vadere.util.geometry.shapes.VShape
;
public
class
TargetController
{
...
...
@@ -62,7 +63,7 @@ public class TargetController {
}
if
(
isNextTargetForAgent
(
agent
)
&&
hasAgentReachedThisTarget
(
agent
,
reachedDistance
))
{
&&
hasAgentReachedThisTarget
(
agent
))
{
notifyListenersTargetReached
(
agent
);
...
...
@@ -103,9 +104,13 @@ public class TargetController {
return
topography
.
getSpatialMap
(
clazz
).
getObjects
(
center
,
radius
);
}
private
boolean
hasAgentReachedThisTarget
(
Agent
agent
,
double
reachedDistance
)
{
return
target
.
getShape
().
contains
(
agent
.
getPosition
())
||
target
.
getShape
().
distance
(
agent
.
getPosition
())
<
reachedDistance
;
private
boolean
hasAgentReachedThisTarget
(
Agent
agent
)
{
final
double
reachedDistance
=
target
.
getAttributes
().
getDeletionDistance
();
final
VPoint
agentPosition
=
agent
.
getPosition
();
final
VShape
targetShape
=
target
.
getShape
();
return
targetShape
.
contains
(
agentPosition
)
||
targetShape
.
distance
(
agentPosition
)
<
reachedDistance
;
}
private
TrafficLightPhase
getCurrentTrafficLightPhase
(
double
simTimeInSec
)
{
...
...
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