Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
V
vadere
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
110
Issues
110
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
3
Merge Requests
3
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vadere
vadere
Commits
15699d73
Commit
15699d73
authored
Jul 03, 2018
by
Stefan Schuhbaeck
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rebase group_models to develop branch
parent
27380b79
Pipeline
#59642
passed with stage
in 52 seconds
Changes
24
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
253 additions
and
269 deletions
+253
-269
VadereGui/src/org/vadere/gui/components/view/ScenarioElementView.java
...c/org/vadere/gui/components/view/ScenarioElementView.java
+3
-4
VadereGui/src/org/vadere/gui/onlinevisualization/OnlineVisualization.java
...g/vadere/gui/onlinevisualization/OnlineVisualization.java
+2
-1
VadereGui/src/org/vadere/gui/onlinevisualization/control/ActionGenerateTikz.java
...e/gui/onlinevisualization/control/ActionGenerateTikz.java
+4
-2
VadereGui/src/org/vadere/gui/postvisualization/control/ActionGenerateTikz.java
...ere/gui/postvisualization/control/ActionGenerateTikz.java
+1
-0
VadereGui/src/org/vadere/gui/postvisualization/utils/TikzGenerator.java
...org/vadere/gui/postvisualization/utils/TikzGenerator.java
+146
-148
VadereGui/src/org/vadere/gui/topographycreator/model/AgentWrapper.java
.../org/vadere/gui/topographycreator/model/AgentWrapper.java
+1
-1
VadereSimulator/src/org/vadere/simulator/control/Simulation.java
...imulator/src/org/vadere/simulator/control/Simulation.java
+5
-5
VadereSimulator/src/org/vadere/simulator/entrypoints/ScenarioBuilder.java
...src/org/vadere/simulator/entrypoints/ScenarioBuilder.java
+13
-13
VadereSimulator/src/org/vadere/simulator/models/osm/optimization/StepCircleOptimizerDiscrete.java
.../models/osm/optimization/StepCircleOptimizerDiscrete.java
+1
-1
VadereSimulator/src/org/vadere/simulator/models/potential/PotentialFieldPedestrianCompactSoftshell.java
...s/potential/PotentialFieldPedestrianCompactSoftshell.java
+1
-1
VadereSimulator/src/org/vadere/simulator/projects/ScenarioRun.java
...ulator/src/org/vadere/simulator/projects/ScenarioRun.java
+5
-4
VadereState/src/org/vadere/state/attributes/AttributesEmbedShape.java
...src/org/vadere/state/attributes/AttributesEmbedShape.java
+6
-5
VadereState/src/org/vadere/state/scenario/Agent.java
VadereState/src/org/vadere/state/scenario/Agent.java
+1
-1
VadereState/src/org/vadere/state/scenario/Obstacle.java
VadereState/src/org/vadere/state/scenario/Obstacle.java
+1
-1
VadereState/src/org/vadere/state/scenario/Source.java
VadereState/src/org/vadere/state/scenario/Source.java
+1
-1
VadereState/src/org/vadere/state/scenario/Stairs.java
VadereState/src/org/vadere/state/scenario/Stairs.java
+1
-1
VadereState/src/org/vadere/state/scenario/Target.java
VadereState/src/org/vadere/state/scenario/Target.java
+1
-1
VadereState/tests/org/vadere/state/scenario/TestStairs.java
VadereState/tests/org/vadere/state/scenario/TestStairs.java
+2
-2
VadereUtils/src/org/vadere/util/geometry/GeometryUtils.java
VadereUtils/src/org/vadere/util/geometry/GeometryUtils.java
+18
-21
VadereUtils/src/org/vadere/util/geometry/shapes/VCircle.java
VadereUtils/src/org/vadere/util/geometry/shapes/VCircle.java
+12
-25
VadereUtils/src/org/vadere/util/geometry/shapes/VCircleSector.java
...ls/src/org/vadere/util/geometry/shapes/VCircleSector.java
+8
-9
VadereUtils/src/org/vadere/util/geometry/shapes/VPoint.java
VadereUtils/src/org/vadere/util/geometry/shapes/VPoint.java
+2
-3
VadereUtils/src/org/vadere/util/math/pso/PSO.java
VadereUtils/src/org/vadere/util/math/pso/PSO.java
+14
-15
VadereUtils/src/org/vadere/util/math/pso/Particle.java
VadereUtils/src/org/vadere/util/math/pso/Particle.java
+4
-4
No files found.
VadereGui/src/org/vadere/gui/components/view/ScenarioElementView.java
View file @
15699d73
...
...
@@ -106,8 +106,7 @@ public class ScenarioElementView extends JPanel implements ISelectScenarioElemen
}
@Override
public
void
removeUpdate
(
DocumentEvent
e
)
{
public
void
removeUpdate
(
DocumentEvent
e
)
{
updateModel
();
}
...
...
@@ -186,8 +185,8 @@ public class ScenarioElementView extends JPanel implements ISelectScenarioElemen
}
else
if
(
scenarioElement
instanceof
Pedestrian
)
{
this
.
txtrTextfiletextarea
.
setText
(
StateJsonConverter
.
serializeObject
(
scenarioElement
));
}
else
{
this
.
txtrTextfiletextarea
.
setText
(
StateJsonConverter
.
serializeObject
(
scenarioElement
.
getAttributes
()));
this
.
txtrTextfiletextarea
.
setText
(
StateJsonConverter
.
serializeObject
(
scenarioElement
.
getAttributes
()));
}
}
}
...
...
VadereGui/src/org/vadere/gui/onlinevisualization/OnlineVisualization.java
View file @
15699d73
...
...
@@ -36,7 +36,8 @@ public class OnlineVisualization implements PassiveCallback {
private
OnlineVisualisationWindow
onlineVisualisationPanel
;
private
OnlineVisualizationModel
model
;
private
Topography
scenario
;
private
@Nullable
IPotentialFieldTarget
potentialFieldTarget
;
private
@Nullable
IPotentialFieldTarget
potentialFieldTarget
;
private
boolean
enableVisualization
;
public
OnlineVisualization
(
boolean
enableVisualization
)
{
...
...
VadereGui/src/org/vadere/gui/onlinevisualization/control/ActionGenerateTikz.java
View file @
15699d73
...
...
@@ -12,6 +12,7 @@ import org.vadere.gui.postvisualization.utils.SVGGenerator;
import
org.vadere.gui.postvisualization.utils.TikzGenerator
;
import
javax.swing.*
;
import
java.awt.event.ActionEvent
;
import
java.io.File
;
import
java.text.SimpleDateFormat
;
...
...
@@ -25,7 +26,7 @@ public class ActionGenerateTikz extends AbstractAction implements IRendererChang
private
final
SimulationModel
<?
extends
DefaultSimulationConfig
>
model
;
public
ActionGenerateTikz
(
final
String
name
,
final
Icon
icon
,
final
SimulationRenderer
renderer
,
final
SimulationModel
<?
extends
DefaultSimulationConfig
>
model
)
{
final
SimulationModel
<?
extends
DefaultSimulationConfig
>
model
)
{
super
(
name
,
icon
);
this
.
tikzGenerator
=
new
TikzGenerator
(
renderer
,
model
);
this
.
model
=
model
;
...
...
@@ -55,5 +56,6 @@ public class ActionGenerateTikz extends AbstractAction implements IRendererChang
}
@Override
public
void
update
(
SimulationRenderer
renderer
)
{}
public
void
update
(
SimulationRenderer
renderer
)
{
}
}
VadereGui/src/org/vadere/gui/postvisualization/control/ActionGenerateTikz.java
View file @
15699d73
...
...
@@ -8,6 +8,7 @@ import org.vadere.gui.postvisualization.utils.TikzGenerator;
import
org.vadere.gui.postvisualization.view.PostvisualizationRenderer
;
import
javax.swing.*
;
import
java.awt.event.ActionEvent
;
import
java.io.File
;
import
java.text.SimpleDateFormat
;
...
...
VadereGui/src/org/vadere/gui/postvisualization/utils/TikzGenerator.java
View file @
15699d73
...
...
@@ -19,70 +19,68 @@ import static java.awt.geom.PathIterator.*;
* Convert the (Java) scenario description into a TikZ representation.
*
* Usually, each (Java) scenario element is represented as a path via
* @see PathIterator This PathSeparator must be converted into its TikZ
* representation.
*
* For example, traversing a Java path with PathIterator returns two
* segments:
* @see PathIterator This PathSeparator must be converted into its TikZ representation.
*
* For example, traversing a Java path with PathIterator returns two segments:
*
* segment type= 0 (SEG_MOVETO) with coords: [1.0, 1.0, 0.0, 0.0, 0.0, 0.0]
* segment type= 3 (SEG_LINETO) with coords: [2.0, 2.0, 0.0, 0.0, 0.0, 0.0]
*
* segment type= 0 (SEG_MOVETO) with coords: [1.0, 1.0, 0.0, 0.0, 0.0, 0.0] segment type= 3
* (SEG_LINETO) with coords: [2.0, 2.0, 0.0, 0.0, 0.0, 0.0]
*
* This must be transformed to TikZ:
*
*
(1.0,1.0) to (2.0,2.0)
* (1.0,1.0) to (2.0,2.0)
*
* The TikZGenerator should also respect the GUI settings (e.g., enabled
* elements, colors etc.).
* The TikZGenerator should also respect the GUI settings (e.g., enabled elements, colors etc.).
*/
public
class
TikzGenerator
{
private
final
static
Logger
logger
=
LogManager
.
getLogger
(
TikzGenerator
.
class
);
private
final
SimulationRenderer
renderer
;
private
final
SimulationModel
<?
extends
DefaultSimulationConfig
>
model
;
private
final
String
[]
translationTable
;
private
final
String
[]
translationTable
;
public
TikzGenerator
(
final
SimulationRenderer
renderer
,
final
SimulationModel
<?
extends
DefaultSimulationConfig
>
model
)
{
final
SimulationModel
<?
extends
DefaultSimulationConfig
>
model
)
{
this
.
renderer
=
renderer
;
this
.
model
=
model
;
this
.
translationTable
=
new
String
[
SEG_CLOSE
+
1
];
initializeTranslationTable
(
translationTable
);
}
private
void
initializeTranslationTable
(
String
[]
translationTable
)
{
// Map Java path commands to TikZ commands.
translationTable
[
SEG_MOVETO
]
=
"(%f,%f) "
;
translationTable
[
SEG_LINETO
]
=
"to (%f,%f) "
;
translationTable
[
SEG_QUADTO
]
=
".. controls (%f,%f) .. (%f,%f) "
;
translationTable
[
SEG_CUBICTO
]
=
".. controls (%f,%f) and (%f,%f) .. (%f,%f) "
;
translationTable
[
SEG_CLOSE
]
=
"to cycle;"
;
}
public
void
generateTikz
(
final
File
file
,
final
boolean
generateCompleteDocument
)
{
String
texTemplate
=
""
+
"\\documentclass{standalone}\n"
+
"\\usepackage{tikz}\n\n"
+
"\\begin{document}\n"
+
"\\begin{tikzpicture}\n"
+
"%s"
+
"\\end{tikzpicture}\n"
+
"\\end{document}\n"
;
String
tikzCode
=
""
;
tikzCode
+=
generateTikzColorDefinitions
(
model
);
tikzCode
+=
convertScenarioElementsToTikz
();
String
output
=
(
generateCompleteDocument
)
?
String
.
format
(
texTemplate
,
tikzCode
)
:
tikzCode
;
// TODO: maybe uses Java's resources notation (in general, writing the file should be done by the caller not here).
this
.
translationTable
=
new
String
[
SEG_CLOSE
+
1
];
initializeTranslationTable
(
translationTable
);
}
private
void
initializeTranslationTable
(
String
[]
translationTable
)
{
// Map Java path commands to TikZ commands.
translationTable
[
SEG_MOVETO
]
=
"(%f,%f) "
;
translationTable
[
SEG_LINETO
]
=
"to (%f,%f) "
;
translationTable
[
SEG_QUADTO
]
=
".. controls (%f,%f) .. (%f,%f) "
;
translationTable
[
SEG_CUBICTO
]
=
".. controls (%f,%f) and (%f,%f) .. (%f,%f) "
;
translationTable
[
SEG_CLOSE
]
=
"to cycle;"
;
}
public
void
generateTikz
(
final
File
file
,
final
boolean
generateCompleteDocument
)
{
String
texTemplate
=
""
+
"\\documentclass{standalone}\n"
+
"\\usepackage{tikz}\n\n"
+
"\\begin{document}\n"
+
"\\begin{tikzpicture}\n"
+
"%s"
+
"\\end{tikzpicture}\n"
+
"\\end{document}\n"
;
String
tikzCode
=
""
;
tikzCode
+=
generateTikzColorDefinitions
(
model
);
tikzCode
+=
convertScenarioElementsToTikz
();
String
output
=
(
generateCompleteDocument
)
?
String
.
format
(
texTemplate
,
tikzCode
)
:
tikzCode
;
// TODO: maybe uses Java's resources notation (in general, writing the file should be done by the caller not here).
try
{
file
.
createNewFile
();
Writer
out
=
new
OutputStreamWriter
(
new
FileOutputStream
(
file
),
"UTF-8"
);
out
.
write
(
output
);
out
.
flush
();
Writer
out
=
new
OutputStreamWriter
(
new
FileOutputStream
(
file
),
"UTF-8"
);
out
.
write
(
output
);
out
.
flush
();
logger
.
info
(
"generate new TikZ: "
+
file
.
getAbsolutePath
());
}
catch
(
IOException
e1
)
{
logger
.
error
(
e1
.
getMessage
());
...
...
@@ -90,130 +88,130 @@ public class TikzGenerator {
}
}
private
String
generateTikzColorDefinitions
(
SimulationModel
<?
extends
DefaultSimulationConfig
>
model
)
{
String
colorDefinitions
=
"% Color Definitions\n"
;
private
String
generateTikzColorDefinitions
(
SimulationModel
<?
extends
DefaultSimulationConfig
>
model
)
{
String
colorDefinitions
=
"% Color Definitions\n"
;
String
colorTextPattern
=
"\\definecolor{%s}{RGB}{%d,%d,%d}\n"
;
String
colorTextPattern
=
"\\definecolor{%s}{RGB}{%d,%d,%d}\n"
;
Color
sourceColor
=
model
.
getConfig
().
getSourceColor
();
colorDefinitions
+=
String
.
format
(
colorTextPattern
,
"SourceColor"
,
sourceColor
.
getRed
(),
sourceColor
.
getGreen
(),
sourceColor
.
getBlue
());
Color
sourceColor
=
model
.
getConfig
().
getSourceColor
();
colorDefinitions
+=
String
.
format
(
colorTextPattern
,
"SourceColor"
,
sourceColor
.
getRed
(),
sourceColor
.
getGreen
(),
sourceColor
.
getBlue
());
Color
targetColor
=
model
.
getConfig
().
getTargetColor
();
colorDefinitions
+=
String
.
format
(
colorTextPattern
,
"TargetColor"
,
targetColor
.
getRed
(),
targetColor
.
getGreen
(),
targetColor
.
getBlue
());
Color
targetColor
=
model
.
getConfig
().
getTargetColor
();
colorDefinitions
+=
String
.
format
(
colorTextPattern
,
"TargetColor"
,
targetColor
.
getRed
(),
targetColor
.
getGreen
(),
targetColor
.
getBlue
());
Color
obstacleColor
=
model
.
getConfig
().
getObstacleColor
();
colorDefinitions
+=
String
.
format
(
colorTextPattern
,
"ObstacleColor"
,
obstacleColor
.
getRed
(),
obstacleColor
.
getGreen
(),
obstacleColor
.
getBlue
());
Color
obstacleColor
=
model
.
getConfig
().
getObstacleColor
();
colorDefinitions
+=
String
.
format
(
colorTextPattern
,
"ObstacleColor"
,
obstacleColor
.
getRed
(),
obstacleColor
.
getGreen
(),
obstacleColor
.
getBlue
());
Color
stairColor
=
model
.
getConfig
().
getStairColor
();
colorDefinitions
+=
String
.
format
(
colorTextPattern
,
"StairColor"
,
stairColor
.
getRed
(),
stairColor
.
getGreen
(),
stairColor
.
getBlue
());
Color
stairColor
=
model
.
getConfig
().
getStairColor
();
colorDefinitions
+=
String
.
format
(
colorTextPattern
,
"StairColor"
,
stairColor
.
getRed
(),
stairColor
.
getGreen
(),
stairColor
.
getBlue
());
Color
agentColor
=
model
.
getConfig
().
getPedestrianDefaultColor
();
colorDefinitions
+=
String
.
format
(
colorTextPattern
,
"AgentColor"
,
agentColor
.
getRed
(),
agentColor
.
getGreen
(),
agentColor
.
getBlue
());
Color
agentColor
=
model
.
getConfig
().
getPedestrianDefaultColor
();
colorDefinitions
+=
String
.
format
(
colorTextPattern
,
"AgentColor"
,
agentColor
.
getRed
(),
agentColor
.
getGreen
(),
agentColor
.
getBlue
());
return
colorDefinitions
;
}
return
colorDefinitions
;
}
private
String
convertScenarioElementsToTikz
()
{
String
generatedCode
=
""
;
DefaultSimulationConfig
config
=
model
.
getConfig
();
Topography
topography
=
model
.
getTopography
();
// Draw background elements first, then agents.
generatedCode
+=
"% Ground\n"
;
String
groundTextPattern
=
(
config
.
isShowGrid
())
?
"\\draw[help lines] (%f,%f) grid (%f,%f);\n"
:
"\\fill[white] (%f,%f) rectangle (%f,%f);\n"
;
generatedCode
+=
String
.
format
(
groundTextPattern
,
topography
.
getBounds
().
x
,
topography
.
getBounds
().
y
,
topography
.
getBounds
().
x
+
topography
.
getBounds
().
width
,
topography
.
getBounds
().
y
+
topography
.
getBounds
().
height
);
if
(
config
.
isShowSources
())
{
generatedCode
+=
"% Sources\n"
;
for
(
Source
source
:
topography
.
getSources
())
{
generatedCode
+=
String
.
format
(
"\\fill[SourceColor] %s\n"
,
generatePathForScenarioElement
(
source
));
}
}
else
{
generatedCode
+=
"% Sources (not enabled in config)\n"
;
}
if
(
config
.
isShowTargets
())
{
generatedCode
+=
"% Targets\n"
;
for
(
Target
target
:
topography
.
getTargets
())
{
generatedCode
+=
String
.
format
(
"\\fill[TargetColor] %s\n"
,
generatePathForScenarioElement
(
target
));
}
}
else
{
generatedCode
+=
"% Targets (not enabled in config)\n"
;
}
if
(
config
.
isShowObstacles
())
{
generatedCode
+=
"% Obstacles\n"
;
for
(
Obstacle
obstacle
:
topography
.
getObstacles
())
{
generatedCode
+=
String
.
format
(
"\\fill[ObstacleColor] %s\n"
,
generatePathForScenarioElement
(
obstacle
));
}
}
else
{
generatedCode
+=
"% Obstacles (not enabled in config)\n"
;
}
if
(
config
.
isShowStairs
())
{
generatedCode
+=
"% Stairs\n"
;
for
(
Stairs
stair
:
topography
.
getStairs
())
{
generatedCode
+=
String
.
format
(
"\\fill[StairColor] %s\n"
,
generatePathForScenarioElement
(
stair
));
}
}
else
{
generatedCode
+=
"% Stairs (not enabled in config)\n"
;
}
// TODO: maybe, draw also trajectories.
if
(
config
.
isShowPedestrians
())
{
generatedCode
+=
"% Agents\n"
;
for
(
Agent
agent
:
model
.
getAgents
())
{
String
agentTextPattern
=
"\\fill[AgentColor] (%f,%f) circle [radius=%fcm];\n"
;
generatedCode
+=
String
.
format
(
agentTextPattern
,
agent
.
getPosition
().
x
,
agent
.
getPosition
().
y
,
agent
.
getRadius
());
// Do not draw agents as path for performance reasons. Usually, agents have a circular shape.
// generatedCode += String.format("\\fill[AgentColor] %s\n", generatePathForScenarioElement(agent));
}
}
else
{
generatedCode
+=
"% Agents (not enabled in config)\n"
;
}
return
generatedCode
;
}
String
generatedCode
=
""
;
DefaultSimulationConfig
config
=
model
.
getConfig
();
Topography
topography
=
model
.
getTopography
();
// Draw background elements first, then agents.
generatedCode
+=
"% Ground\n"
;
String
groundTextPattern
=
(
config
.
isShowGrid
())
?
"\\draw[help lines] (%f,%f) grid (%f,%f);\n"
:
"\\fill[white] (%f,%f) rectangle (%f,%f);\n"
;
generatedCode
+=
String
.
format
(
groundTextPattern
,
topography
.
getBounds
().
x
,
topography
.
getBounds
().
y
,
topography
.
getBounds
().
x
+
topography
.
getBounds
().
width
,
topography
.
getBounds
().
y
+
topography
.
getBounds
().
height
);
if
(
config
.
isShowSources
())
{
generatedCode
+=
"% Sources\n"
;
for
(
Source
source
:
topography
.
getSources
())
{
generatedCode
+=
String
.
format
(
"\\fill[SourceColor] %s\n"
,
generatePathForScenarioElement
(
source
));
}
}
else
{
generatedCode
+=
"% Sources (not enabled in config)\n"
;
}
if
(
config
.
isShowTargets
())
{
generatedCode
+=
"% Targets\n"
;
for
(
Target
target
:
topography
.
getTargets
())
{
generatedCode
+=
String
.
format
(
"\\fill[TargetColor] %s\n"
,
generatePathForScenarioElement
(
target
));
}
}
else
{
generatedCode
+=
"% Targets (not enabled in config)\n"
;
}
if
(
config
.
isShowObstacles
())
{
generatedCode
+=
"% Obstacles\n"
;
for
(
Obstacle
obstacle
:
topography
.
getObstacles
())
{
generatedCode
+=
String
.
format
(
"\\fill[ObstacleColor] %s\n"
,
generatePathForScenarioElement
(
obstacle
));
}
}
else
{
generatedCode
+=
"% Obstacles (not enabled in config)\n"
;
}
if
(
config
.
isShowStairs
())
{
generatedCode
+=
"% Stairs\n"
;
for
(
Stairs
stair
:
topography
.
getStairs
())
{
generatedCode
+=
String
.
format
(
"\\fill[StairColor] %s\n"
,
generatePathForScenarioElement
(
stair
));
}
}
else
{
generatedCode
+=
"% Stairs (not enabled in config)\n"
;
}
// TODO: maybe, draw also trajectories.
if
(
config
.
isShowPedestrians
())
{
generatedCode
+=
"% Agents\n"
;
for
(
Agent
agent
:
model
.
getAgents
())
{
String
agentTextPattern
=
"\\fill[AgentColor] (%f,%f) circle [radius=%fcm];\n"
;
generatedCode
+=
String
.
format
(
agentTextPattern
,
agent
.
getPosition
().
x
,
agent
.
getPosition
().
y
,
agent
.
getRadius
());
// Do not draw agents as path for performance reasons. Usually, agents have a circular shape.
// generatedCode += String.format("\\fill[AgentColor] %s\n", generatePathForScenarioElement(agent));
}
}
else
{
generatedCode
+=
"% Agents (not enabled in config)\n"
;
}
return
generatedCode
;
}
private
String
generatePathForScenarioElement
(
ScenarioElement
element
)
{
String
generatedPath
=
""
;
String
generatedPath
=
""
;
AffineTransform
noTransformation
=
new
AffineTransform
();
PathIterator
pathIterator
=
element
.
getShape
().
getPathIterator
(
noTransformation
);
while
(!
pathIterator
.
isDone
())
{
float
[]
coords
=
new
float
[
6
];
int
type
=
pathIterator
.
currentSegment
(
coords
);
float
[]
coords
=
new
float
[
6
];
int
type
=
pathIterator
.
currentSegment
(
coords
);
generatedPath
+=
convertJavaToTikzPath
(
type
,
coords
);
pathIterator
.
next
();
generatedPath
+=
convertJavaToTikzPath
(
type
,
coords
);
pathIterator
.
next
();
}
return
generatedPath
;
}
private
String
convertJavaToTikzPath
(
int
type
,
float
[]
coords
)
{
if
(
type
<
SEG_MOVETO
||
type
>
SEG_CLOSE
)
{
throw
new
IllegalStateException
(
String
.
format
(
"Cannot process path segment type: %d (coordinates: %s)"
,
type
,
Arrays
.
toString
(
coords
)));
}
String
convertedPath
=
translationTable
[
type
];
if
(
type
==
SEG_MOVETO
)
{
convertedPath
=
String
.
format
(
convertedPath
,
coords
[
0
],
coords
[
1
]);
}
else
if
(
type
==
SEG_LINETO
)
{
convertedPath
=
String
.
format
(
convertedPath
,
coords
[
0
],
coords
[
1
]);
}
else
if
(
type
==
SEG_QUADTO
)
{
convertedPath
=
String
.
format
(
convertedPath
,
coords
[
0
],
coords
[
1
],
coords
[
2
],
coords
[
3
]);
}
else
if
(
type
==
SEG_CUBICTO
)
{
convertedPath
=
String
.
format
(
convertedPath
,
coords
[
0
],
coords
[
1
],
coords
[
2
],
coords
[
3
],
coords
[
4
],
coords
[
5
]);
}
return
convertedPath
;
}
if
(
type
<
SEG_MOVETO
||
type
>
SEG_CLOSE
)
{
throw
new
IllegalStateException
(
String
.
format
(
"Cannot process path segment type: %d (coordinates: %s)"
,
type
,
Arrays
.
toString
(
coords
)));
}
String
convertedPath
=
translationTable
[
type
];
if
(
type
==
SEG_MOVETO
)
{
convertedPath
=
String
.
format
(
convertedPath
,
coords
[
0
],
coords
[
1
]);
}
else
if
(
type
==
SEG_LINETO
)
{
convertedPath
=
String
.
format
(
convertedPath
,
coords
[
0
],
coords
[
1
]);
}
else
if
(
type
==
SEG_QUADTO
)
{
convertedPath
=
String
.
format
(
convertedPath
,
coords
[
0
],
coords
[
1
],
coords
[
2
],
coords
[
3
]);
}
else
if
(
type
==
SEG_CUBICTO
)
{
convertedPath
=
String
.
format
(
convertedPath
,
coords
[
0
],
coords
[
1
],
coords
[
2
],
coords
[
3
],
coords
[
4
],
coords
[
5
]);
}
return
convertedPath
;
}
}
VadereGui/src/org/vadere/gui/topographycreator/model/AgentWrapper.java
View file @
15699d73
...
...
@@ -72,7 +72,7 @@ public final class AgentWrapper extends ScenarioElement {
}
@Override
public
void
setAttributes
(
Attributes
attributes
){
public
void
setAttributes
(
Attributes
attributes
)
{
this
.
agent
.
setAttributes
(
attributes
);
}
...
...
VadereSimulator/src/org/vadere/simulator/control/Simulation.java
View file @
15699d73
...
...
@@ -135,7 +135,7 @@ public class Simulation {
c
.
preLoop
(
simTimeInSec
);
}
if
(
attributesSimulation
.
isWriteSimulationData
())
{
if
(
attributesSimulation
.
isWriteSimulationData
())
{
processorManager
.
preLoop
(
this
.
simulationState
);
}
}
...
...
@@ -151,7 +151,7 @@ public class Simulation {
c
.
postLoop
(
simTimeInSec
);
}
if
(
attributesSimulation
.
isWriteSimulationData
())
{
if
(
attributesSimulation
.
isWriteSimulationData
())
{
processorManager
.
postLoop
(
this
.
simulationState
);
}
topographyController
.
postLoop
(
this
.
simTimeInSec
);
...
...
@@ -162,7 +162,7 @@ public class Simulation {
*/
public
void
run
()
{
try
{
if
(
attributesSimulation
.
isWriteSimulationData
())
{
if
(
attributesSimulation
.
isWriteSimulationData
())
{
processorManager
.
setMainModel
(
mainModel
);
processorManager
.
initOutputFiles
();
}
...
...
@@ -194,7 +194,7 @@ public class Simulation {
updateCallbacks
(
simTimeInSec
);
updateWriters
(
simTimeInSec
);
if
(
attributesSimulation
.
isWriteSimulationData
())
{
if
(
attributesSimulation
.
isWriteSimulationData
())
{
processorManager
.
update
(
this
.
simulationState
);
}
...
...
@@ -224,7 +224,7 @@ public class Simulation {
// this is necessary to free the resources (files), the SimulationWriter and processor are writing in!
postLoop
();
if
(
attributesSimulation
.
isWriteSimulationData
())
{
if
(
attributesSimulation
.
isWriteSimulationData
())
{
processorManager
.
writeOutput
();
}
logger
.
info
(
"Finished writing all output files"
);
...
...
VadereSimulator/src/org/vadere/simulator/entrypoints/ScenarioBuilder.java
View file @
15699d73
...
...
@@ -66,20 +66,20 @@ public class ScenarioBuilder {
store
.
attributesSimulation
=
(
AttributesSimulation
)
builder
.
build
();
}
else
if
(
AttributesAgent
.
class
==
clazz
){
builder
=
new
AttributesBuilder
<>((
E
)
store
.
getTopography
().
getAttributesPedestrian
());
builder
=
new
AttributesBuilder
<>((
E
)
store
.
getTopography
().
getAttributesPedestrian
());
builder
.
setField
(
fieldName
,
value
);
setAttributesAgent
((
AttributesAgent
)
builder
.
build
());
}
else
if
(
AttributesCar
.
class
==
clazz
){
builder
=
new
AttributesBuilder
<>((
E
)
store
.
getTopography
().
getAttributesCar
());
builder
=
new
AttributesBuilder
<>((
E
)
store
.
getTopography
().
getAttributesCar
());
builder
.
setField
(
fieldName
,
value
);
setAttributesCar
((
AttributesCar
)
builder
.
build
());
}
else
if
(
AttributesTopography
.
class
==
clazz
){
builder
=
new
AttributesBuilder
<>((
E
)
store
.
getTopography
().
getAttributes
());
builder
=
new
AttributesBuilder
<>((
E
)
store
.
getTopography
().
getAttributes
());
builder
.
setField
(
fieldName
,
value
);
ReflectionAttributeModifier
reflectionAttributeModifier
=
new
ReflectionAttributeModifier
();
reflectionAttributeModifier
.
setAttributes
(
store
.
getTopography
(),
builder
.
build
());
reflectionAttributeModifier
.
setAttributes
(
store
.
getTopography
(),
builder
.
build
());
}
else
{
builder
=
new
AttributesBuilder
<>(
store
.
getAttributes
(
clazz
));
...
...
@@ -92,9 +92,9 @@ public class ScenarioBuilder {
private
void
setAttributesCar
(
@NotNull
final
AttributesCar
attributesCar
)
{
Field
field
;
try
{
field
=
store
.
getTopography
().
getClass
().
getDeclaredField
(
"attributesCar"
);
field
=
store
.
getTopography
().
getClass
().
getDeclaredField
(
"attributesCar"
);
field
.
setAccessible
(
true
);
field
.
set
(
store
.
getTopography
(),
attributesCar
);
field
.
set
(
store
.
getTopography
(),
attributesCar
);
}
catch
(
NoSuchFieldException
|
SecurityException
|
IllegalArgumentException
|
IllegalAccessException
e
)
{
e
.
printStackTrace
();
logger
.
error
(
e
);
...
...
@@ -104,9 +104,9 @@ public class ScenarioBuilder {
private
void
setAttributesAgent
(
@NotNull
final
AttributesAgent
attributesAgent
)
{
Field
field
;
try
{
field
=
store
.
getTopography
().
getClass
().
getDeclaredField
(
"attributesPedestrian"
);
field
=
store
.
getTopography
().
getClass
().
getDeclaredField
(
"attributesPedestrian"
);
field
.
setAccessible
(
true
);
field
.
set
(
store
.
getTopography
(),
attributesAgent
);
field
.
set
(
store
.
getTopography
(),
attributesAgent
);
}
catch
(
NoSuchFieldException
|
SecurityException
|
IllegalArgumentException
|
IllegalAccessException
e
)
{
e
.
printStackTrace
();
logger
.
error
(
e
);
...
...
@@ -253,11 +253,11 @@ public class ScenarioBuilder {
attBuilder
.
setField
(
fieldName
,
value
);
E
clone
=
(
E
)
element
.
clone
();
//NOTE see issue #91:
//This class is not tested - revert change by uncommenting reflextion and comment in
//clone.setAttributes
//reflectionAttributeModifier.setAttributes(clone, attBuilder.build());
clone
.
setAttributes
(
attBuilder
.
build
());
//NOTE see issue #91:
//This class is not tested - revert change by uncommenting reflextion and comment in
//clone.setAttributes
//reflectionAttributeModifier.setAttributes(clone, attBuilder.build());
clone
.
setAttributes
(
attBuilder
.
build
());
return
clone
;
}
...
...
VadereSimulator/src/org/vadere/simulator/models/osm/optimization/StepCircleOptimizerDiscrete.java
View file @
15699d73
...
...
@@ -105,7 +105,7 @@ public class StepCircleOptimizerDiscrete implements StepCircleOptimizer {
random
,
attributesOSM
.
isVaryStepDirection
(),
new
VCircle
(
pedestrian
.
getPosition
(),
pedestrian
.
getStepSize
()),
pedestrian
.
getStepSize
()),
numberOfCircles
,
attributesOSM
.
getStepCircleResolution
(),
anchorAngle
,
...
...
VadereSimulator/src/org/vadere/simulator/models/potential/PotentialFieldPedestrianCompactSoftshell.java
View file @
15699d73
...
...
@@ -56,7 +56,7 @@ public class PotentialFieldPedestrianCompactSoftshell implements PotentialFieldA
double
distanceSq
=
otherPedestrian
.
getPosition
().
distanceSq
(
pos
);
double
maxDistanceSq
=
(
Math
.
max
(
personalWidth
,
intimateWidth
)
+
radii
)
*
(
Math
.
max
(
personalWidth
,
intimateWidth
)
+
radii
);
if
(
distanceSq
<
maxDistanceSq
)
{
if
(
distanceSq
<
maxDistanceSq
)
{
double
distance
=
otherPedestrian
.
getPosition
().
distance
(
pos
);
// Euclidean distance d_j(x) between agent j and position x
int
intPower
=
this
.
attributes
.
getIntimateSpacePower
();
// b_p
...
...
VadereSimulator/src/org/vadere/simulator/projects/ScenarioRun.java
View file @
15699d73
...
...
@@ -41,7 +41,8 @@ public class ScenarioRun implements Runnable {
private
Simulation
simulation
;
// the processor is null if no output is written i.e. if scenarioStore.attributesSimulation.isWriteSimulationData() is false.
private
@Nullable
ProcessorManager
processorManager
;
private
@Nullable
ProcessorManager
processorManager
;
private
final
Scenario
scenario
;
private
final
ScenarioStore
scenarioStore
;
// contained in scenario, but here for convenience
...
...
@@ -84,12 +85,12 @@ public class ScenarioRun implements Runnable {
final
Random
random
=
modelBuilder
.
getRandom
();
// prepare processors and simulation data writer
if
(
scenarioStore
.
attributesSimulation
.
isWriteSimulationData
())
{
if
(
scenarioStore
.
attributesSimulation
.
isWriteSimulationData
())
{
processorManager
=
dataProcessingJsonManager
.
createProcessorManager
(
mainModel
);
}
// Only create output directory and write .scenario file if there is any output.
if
(
processorManager
!=
null
&&
!
processorManager
.
isEmpty
())
{
if
(
processorManager
!=
null
&&
!
processorManager
.
isEmpty
())
{
createAndSetOutputDirectory
();
scenario
.
saveToOutputPath
(
outputPath
);
}
...
...
@@ -178,7 +179,7 @@ public class ScenarioRun implements Runnable {
private
void
sealAllAttributes
()
{
scenarioStore
.
sealAllAttributes
();
if
(
processorManager
!=
null
)
{