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
4
Merge Requests
4
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
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
450550be
Commit
450550be
authored
Jul 30, 2020
by
Christina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WIP] add V14 to MigrationAssistant
parent
b32529ce
Pipeline
#301682
failed with stages
in 2 minutes and 5 seconds
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
108 additions
and
14 deletions
+108
-14
Scenarios/Demos/Density_controller/scenarios/AbstractThreeCorridors.scenario
...sity_controller/scenarios/AbstractThreeCorridors.scenario
+10
-10
Scenarios/Demos/SocialDistancing/SocialDistancingBottleneck/scenarios/bottleneck_2m.scenario
...cialDistancingBottleneck/scenarios/bottleneck_2m.scenario
+1
-1
VadereGui/src/org/vadere/gui/projectview/view/AttributeType.java
...ui/src/org/vadere/gui/projectview/view/AttributeType.java
+5
-1
VadereGui/src/org/vadere/gui/projectview/view/ScenarioPanel.java
...ui/src/org/vadere/gui/projectview/view/ScenarioPanel.java
+10
-0
VadereGui/src/org/vadere/gui/projectview/view/TextView.java
VadereGui/src/org/vadere/gui/projectview/view/TextView.java
+8
-0
VadereSimulator/src/org/vadere/simulator/projects/Scenario.java
...Simulator/src/org/vadere/simulator/projects/Scenario.java
+9
-0
VadereSimulator/src/org/vadere/simulator/projects/migration/jsontranformation/JsonTransformationHook.java
...s/migration/jsontranformation/JsonTransformationHook.java
+1
-0
VadereSimulator/src/org/vadere/simulator/projects/migration/jsontranformation/json/TargetVersionV1_14.java
.../migration/jsontranformation/json/TargetVersionV1_14.java
+53
-0
VadereState/src/org/vadere/state/util/StateJsonConverter.java
...reState/src/org/vadere/state/util/StateJsonConverter.java
+9
-0
VadereUtils/src/org/vadere/util/version/Version.java
VadereUtils/src/org/vadere/util/version/Version.java
+2
-2
No files found.
Scenarios/Demos/Density_controller/scenarios/AbstractThreeCorridors.scenario
View file @
450550be
{
"name" : "AbstractThreeCorridors",
"description" : "",
"release" : "1.1
3
",
"release" : "1.1
4
",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.EventtimePedestrianIdOutputFile",
...
...
@@ -73,11 +73,7 @@
"isWriteMetaData" : false
},
"scenario" : {
"attributesStrategy" : {
"useStrategyModel" : false,
"strategyModel" : "RouteChoiceThreeCorridors"
},
"mainModel" : "org.vadere.simulator.models.osm.OptimalStepsModel",
"mainModel" : "org.vadere.simulator.models.osm.OptimalStepsModel",
"attributesModel" : {
"org.vadere.state.attributes.models.AttributesOSM" : {
"stepCircleResolution" : 4,
...
...
@@ -151,6 +147,10 @@
"cognition" : "SimpleCognitionModel"
}
},
"attributesStrategy" : {
"useStrategyModel" : false,
"strategyModel" : "RouteChoiceThreeCorridors"
},
"topography" : {
"attributes" : {
"bounds" : {
...
...
@@ -357,8 +357,8 @@
"id" : 5001,
"absorbing" : false,
"shape" : {
"x" : 64.
6
,
"y" : 1
0.2
,
"x" : 64.
5
,
"y" : 1
4.0
,
"width" : 5.0,
"height" : 5.0,
"type" : "RECTANGLE"
...
...
@@ -413,8 +413,8 @@
}, {
"id" : 9,
"shape" : {
"x" : 60.
1
,
"y" :
4.2
,
"x" : 60.
0
,
"y" :
10.0
,
"width" : 14.1,
"height" : 4.0,
"type" : "RECTANGLE"
...
...
Scenarios/Demos/SocialDistancing/SocialDistancingBottleneck/scenarios/bottleneck_2m.scenario
View file @
450550be
...
...
@@ -306,4 +306,4 @@
},
"stimulusInfos" : [ ]
}
}
\ No newline at end of file
}
VadereGui/src/org/vadere/gui/projectview/view/AttributeType.java
View file @
450550be
package
org.vadere.gui.projectview.view
;
public
enum
AttributeType
{
SIMULATION
,
MODEL
,
PSYCHOLOGY
,
PEDESTRIAN
,
CAR
,
TOPOGRAPHY
,
OUTPUTPROCESSOR
,
PERCEPTION
;
SIMULATION
,
MODEL
,
PSYCHOLOGY
,
PEDESTRIAN
,
CAR
,
TOPOGRAPHY
,
OUTPUTPROCESSOR
,
PERCEPTION
,
STRATEGY
;
public
final
static
String
simulationAttributes
=
"simulation attributes"
;
public
final
static
String
modelAttributes
=
"panelModel attributes"
;
...
...
@@ -10,6 +10,8 @@ public enum AttributeType {
public
final
static
String
scenarioAttributes
=
"scenario attributes"
;
public
final
static
String
carAttributes
=
"car attributes"
;
public
final
static
String
stimulusAttributes
=
"stimulus attributes"
;
public
final
static
String
strategyAttributes
=
"strategy attributes"
;
public
static
AttributeType
fromName
(
String
name
)
{
switch
(
name
)
{
...
...
@@ -27,6 +29,8 @@ public enum AttributeType {
return
CAR
;
case
stimulusAttributes:
return
PERCEPTION
;
case
strategyAttributes:
return
STRATEGY
;
default
:
throw
new
IllegalArgumentException
(
"name "
+
name
+
" does not match any attribute type."
);
}
...
...
VadereGui/src/org/vadere/gui/projectview/view/ScenarioPanel.java
View file @
450550be
...
...
@@ -39,6 +39,7 @@ public class ScenarioPanel extends JPanel implements IProjectChangeListener, Pro
// tabs
private
List
<
JMenu
>
menusInTabs
=
new
ArrayList
<>();
private
TextView
attributesSimulationView
;
// Simulation tab
private
TextView
attributesStrategyFileView
;
// Strategy tab
private
TextView
attributesModelView
;
// Model tab
private
TextView
attributesPsychologyView
;
// Psychology tab
private
TextView
topographyFileView
;
// Topography tab
...
...
@@ -210,6 +211,7 @@ public class ScenarioPanel extends JPanel implements IProjectChangeListener, Pro
attributesPsychologyView
.
isEditable
(
true
);
tabbedPane
.
addTab
(
Messages
.
getString
(
"Tab.Psychology.title"
),
attributesPsychologyView
);
topographyFileView
=
new
TextView
(
"ProjectView.defaultDirectoryScenarios"
,
AttributeType
.
TOPOGRAPHY
);
topographyFileView
.
setScenarioChecker
(
model
);
tabbedPane
.
addTab
(
Messages
.
getString
(
"Tab.Topography.title"
),
topographyFileView
);
...
...
@@ -218,6 +220,11 @@ public class ScenarioPanel extends JPanel implements IProjectChangeListener, Pro
perceptionFileView
.
isEditable
(
true
);
tabbedPane
.
addTab
(
Messages
.
getString
(
"Tab.Perception.title"
),
perceptionFileView
);
attributesStrategyFileView
=
new
TextView
(
"ProjectView.defaultDirectoryAttributes"
,
AttributeType
.
STRATEGY
);
attributesStrategyFileView
.
isEditable
(
true
);
tabbedPane
.
addTab
(
Messages
.
getString
(
"Tab.Strategy.title"
),
attributesStrategyFileView
);
dataProcessingGUIview
=
new
DataProcessingView
(
model
);
tabbedPane
.
addTab
(
Messages
.
getString
(
"Tab.OutputProcessors.title"
),
dataProcessingGUIview
);
...
...
@@ -311,6 +318,9 @@ public class ScenarioPanel extends JPanel implements IProjectChangeListener, Pro
this
.
perceptionFileView
.
setVadereScenario
(
scenario
);
this
.
perceptionFileView
.
isEditable
(
isEditable
);
this
.
attributesStrategyFileView
.
setVadereScenario
(
scenario
);
this
.
attributesStrategyFileView
.
isEditable
(
isEditable
);
this
.
dataProcessingGUIview
.
setVadereScenario
(
scenario
);
this
.
dataProcessingGUIview
.
isEditable
(
isEditable
);
}
...
...
VadereGui/src/org/vadere/gui/projectview/view/TextView.java
View file @
450550be
...
...
@@ -200,6 +200,10 @@ public class TextView extends JPanel implements IJsonView {
StimulusInfoStore
stimulusInfoStore
=
StateJsonConverter
.
deserializeStimuli
(
json
);
currentScenario
.
getScenarioStore
().
setStimulusInfoStore
(
stimulusInfoStore
);
break
;
case
STRATEGY:
currentScenario
.
setAttributesStrategy
(
StateJsonConverter
.
deserializeAttributesStrategyModel
(
json
));
break
;
default
:
throw
new
RuntimeException
(
"attribute type not implemented."
);
}
...
...
@@ -302,6 +306,10 @@ public class TextView extends JPanel implements IJsonView {
StimulusInfoStore
stimulusInfoStore
=
scenario
.
getScenarioStore
().
getStimulusInfoStore
();
textfileTextarea
.
setText
(
StateJsonConverter
.
serializeStimuli
(
stimulusInfoStore
));
break
;
case
STRATEGY:
textfileTextarea
.
setText
(
StateJsonConverter
.
serializeAttributesStrategyModel
(
scenario
.
getAttributesStrategyModel
()));
break
;
default
:
throw
new
RuntimeException
(
"attribute type not implemented."
);
}
...
...
VadereSimulator/src/org/vadere/simulator/projects/Scenario.java
View file @
450550be
...
...
@@ -10,6 +10,7 @@ import org.vadere.simulator.projects.io.JsonConverter;
import
org.vadere.state.attributes.Attributes
;
import
org.vadere.state.attributes.AttributesPsychology
;
import
org.vadere.state.attributes.AttributesSimulation
;
import
org.vadere.state.attributes.AttributesStrategyModel
;
import
org.vadere.state.attributes.scenario.AttributesAgent
;
import
org.vadere.state.scenario.Topography
;
import
org.vadere.util.io.IOUtils
;
...
...
@@ -138,6 +139,10 @@ public class Scenario {
return
scenarioStore
.
getAttributesPsychology
();
}
public
AttributesStrategyModel
getAttributesStrategyModel
()
{
return
scenarioStore
.
getAttributesStrategyModel
();
}
public
Topography
getTopography
()
{
return
scenarioStore
.
getTopography
();
}
...
...
@@ -158,6 +163,10 @@ public class Scenario {
this
.
scenarioStore
.
setAttributesPsychology
(
attributesPsychology
);
}
public
void
setAttributesStrategy
(
@NotNull
final
AttributesStrategyModel
attributesStrategyModel
)
{
this
.
scenarioStore
.
setAttributesStrategyModel
(
attributesStrategyModel
);
}
public
void
setTopography
(
@NotNull
final
Topography
topography
)
{
scenarioStore
.
setTopography
(
topography
);
}
...
...
VadereSimulator/src/org/vadere/simulator/projects/migration/jsontranformation/JsonTransformationHook.java
View file @
450550be
package
org.vadere.simulator.projects.migration.jsontranformation
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
org.vadere.simulator.projects.migration.MigrationException
;
...
...
VadereSimulator/src/org/vadere/simulator/projects/migration/jsontranformation/json/TargetVersionV1_14.java
0 → 100644
View file @
450550be
package
org.vadere.simulator.projects.migration.jsontranformation.json
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
org.vadere.annotation.factories.migrationassistant.MigrationTransformation
;
import
org.vadere.simulator.projects.migration.MigrationException
;
import
org.vadere.simulator.projects.migration.jsontranformation.SimpleJsonTransformation
;
import
org.vadere.state.attributes.AttributesPsychology
;
import
org.vadere.state.attributes.AttributesStrategyModel
;
import
org.vadere.state.util.StateJsonConverter
;
import
org.vadere.util.version.Version
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
/**
* Remove node "threatMemory" under "scenario.topography.dynamicElements.psychologyStatus"
*/
@MigrationTransformation
(
targetVersionLabel
=
"1.14"
)
public
class
TargetVersionV1_14
extends
SimpleJsonTransformation
{
public
TargetVersionV1_14
(){
super
(
Version
.
V1_14
);
}
@Override
protected
void
initDefaultHooks
()
{
addPostHookFirst
(
this
::
addStrategyLayer
);
addPostHookLast
(
this
::
sort
);
}
public
JsonNode
addStrategyLayer
(
JsonNode
node
)
throws
MigrationException
{
String
useStrategyModelKey
=
"attributesStrategy"
;
JsonNode
scenarioNode
=
path
(
node
,
"scenario"
);
JsonNode
strategyModel
=
path
(
scenarioNode
,
useStrategyModelKey
);
if
(
strategyModel
.
isMissingNode
())
{
ObjectNode
n
=
(
ObjectNode
)
scenarioNode
;
JsonNode
attributesStrategyNode
=
StateJsonConverter
.
serializeAttributesStrategyModelToNode
(
new
AttributesStrategyModel
());
n
.
set
(
useStrategyModelKey
,
attributesStrategyNode
);
}
return
node
;
}
}
VadereState/src/org/vadere/state/util/StateJsonConverter.java
View file @
450550be
...
...
@@ -129,6 +129,10 @@ public abstract class StateJsonConverter {
return
mapper
.
treeToValue
(
node
,
AttributesPsychology
.
class
);
}
public
static
AttributesStrategyModel
deserializeAttributesStrategyModel
(
String
json
)
throws
IOException
{
return
deserializeObjectFromJson
(
json
,
AttributesStrategyModel
.
class
);
}
public
static
AttributesStrategyModel
deserializeAttributesStrategyModelFromNode
(
JsonNode
node
)
throws
JsonProcessingException
{
return
mapper
.
treeToValue
(
node
,
AttributesStrategyModel
.
class
);
...
...
@@ -358,6 +362,11 @@ public abstract class StateJsonConverter {
return
prettyWriter
.
writeValueAsString
(
mapper
.
convertValue
(
attributesPsychology
,
JsonNode
.
class
));
}
public
static
String
serializeAttributesStrategyModel
(
AttributesStrategyModel
attributesStrategyModel
)
throws
JsonProcessingException
{
return
prettyWriter
.
writeValueAsString
(
mapper
.
convertValue
(
attributesStrategyModel
,
JsonNode
.
class
));
}
public
static
String
serializeTopography
(
Topography
topography
)
throws
JsonProcessingException
{
return
prettyWriter
.
writeValueAsString
(
serializeTopographyToNode
(
topography
));
}
...
...
VadereUtils/src/org/vadere/util/version/Version.java
View file @
450550be
...
...
@@ -44,8 +44,8 @@ public enum Version {
V1_10
(
1
,
10
),
V1_11
(
1
,
11
),
V1_12
(
1
,
12
),
V1_13
(
1
,
13
)
;
V1_13
(
1
,
13
)
,
V1_14
(
1
,
14
);
private
static
Logger
logger
=
Logger
.
getLogger
(
Version
.
class
);
...
...
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