diff --git a/TerroristNetworkModel.yml b/TerroristNetworkModel.yml index 1cb0e29..5b4affb 100644 --- a/TerroristNetworkModel.yml +++ b/TerroristNetworkModel.yml @@ -1,6 +1,6 @@ name: TerroristNetworkModel_sim load_module: TerroristNetworkModel -max_time: 100 +max_time: 150 num_trials: 1 network_params: generator: random_geometric_graph @@ -30,7 +30,7 @@ environment_params: # TerroristSpreadModel information_spread_intensity: 0.7 terrorist_additional_influence: 0.035 - max_vulnerability: 0.5 + max_vulnerability: 0.6 prob_interaction: 0.5 # TrainingAreaModel and HavenModel @@ -38,7 +38,7 @@ environment_params: haven_influence: 0.20 # TerroristNetworkModel - vision_range: 0.50 + vision_range: 0.30 sphere_influence: 2 weight_social_distance: 0.035 weight_link_distance: 0.035 @@ -49,10 +49,12 @@ visualization_params: shapes: TrainingAreaModel: target HavenModel: home + TerroristNetworkModel: person colors: - attr_id: 0 - color: green + color: '#40de40' - attr_id: 1 color: red - attr_id: 2 color: '#c16a6a' + background_image: 'map.png' diff --git a/run.py b/run.py index b096c01..14b63f9 100644 --- a/run.py +++ b/run.py @@ -14,7 +14,7 @@ if __name__ == "__main__": parser = argparse.ArgumentParser(description='Visualization of a Graph Model') - parser.add_argument('--name', '-n', nargs=1, default='SOIL Model', help='name of the simulation') + parser.add_argument('--name', '-n', nargs=1, default='SOIL', help='name of the simulation') parser.add_argument('--dump', '-d', help='dumping results in folder output', action='store_true') parser.add_argument('--verbose', '-v', help='verbose mode', action='store_true') args = parser.parse_args() diff --git a/server.py b/server.py index 2f5f23b..254f68f 100644 --- a/server.py +++ b/server.py @@ -94,10 +94,11 @@ class SocketHandler(tornado.websocket.WebSocketHandler): settings = [] for key in self.config['environment_params']: - if type(self.config['environment_params'][key]) == float: - setting_type = 'number' - elif type(self.config['environment_params'][key]) == int: - setting_type = 'number' + if type(self.config['environment_params'][key]) == float or type(self.config['environment_params'][key]) == int: + if self.config['environment_params'][key] <= 1: + setting_type = 'number' + else: + setting_type = 'great_number' elif type(self.config['environment_params'][key]) == bool: setting_type = 'boolean' else: @@ -122,7 +123,6 @@ class SocketHandler(tornado.websocket.WebSocketHandler): elif msg['type'] == 'run_simulation': if self.application.verbose: logger.info('Running new simulation for {name}'.format(name=self.config['name'])) - print(msg['data']) self.send_log('INFO.soil', 'Running new simulation for {name}'.format(name=self.config['name'])) self.config['environment_params'] = msg['data'] self.run_simulation() @@ -209,7 +209,7 @@ class ModularServer(tornado.web.Application): settings = {'debug': True, 'template_path': os.path.dirname(__file__) + '/templates'} - def __init__(self, model, visualization_element, name='SOIL Model', verbose=True, + def __init__(self, model, visualization_element, name='SOIL', verbose=True, *args, **kwargs): self.verbose = verbose diff --git a/templates/css/main.css b/templates/css/main.css index ff1e823..9db8a51 100644 --- a/templates/css/main.css +++ b/templates/css/main.css @@ -33,6 +33,25 @@ html, body { cursor: pointer; } +.wrapper-heading { + display: flex; + flex-direction: row; + padding: 0 !important; +} + +.soil_logo { + padding: 0 !important; + border-left: none !important; + border-right: none !important; + display: flex; + justify-content: flex-end; + background-color: rgb(88, 88, 88); +} + +.soil_logo > img { + max-height: 100%; +} + .node { stroke: #fff; stroke-width: 1.5px; @@ -292,7 +311,7 @@ table#link-distance .max { /* Console */ -#update, .console { +#update, .console, .soil_logo { padding: 10px 15px; height: 135px; border: 1px solid #585858; @@ -317,6 +336,7 @@ table#link-distance .max { overflow: auto; border-top-left-radius: 5px; border-bottom-left-radius: 5px; + width: 100%; } .console::-webkit-scrollbar { diff --git a/templates/img/background/map.png b/templates/img/background/map.png new file mode 100644 index 0000000..84709e0 Binary files /dev/null and b/templates/img/background/map.png differ diff --git a/templates/img/logo_soil.png b/templates/img/logo_soil.png new file mode 100644 index 0000000..1e6f620 Binary files /dev/null and b/templates/img/logo_soil.png differ diff --git a/templates/index.html b/templates/index.html index ebe917d..6bac09a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -74,7 +74,7 @@ ); if ( file['type'] !== "application/x-yaml" ) { - console.log('File format not supported. Sorry for the inconvenience.'); + console.error('File format not supported. Sorry for the inconvenience.'); _socket.error('File format not supported. Sorry for the inconvenience.'); return; } else { @@ -142,13 +142,21 @@
- -
- Please, upload a YAML file that defines all the parameters of a simulation.
- If you don't know how to write the file, please visit this page:
- http://soilsim.readthedocs.io/en/latest/quickstart.html
+
+ +
+ Please, upload a YAML file that defines all the parameters of a simulation.
+ If you don't know how to write the file, please visit this page:
+ http://soilsim.readthedocs.io/en/latest/quickstart.html
+
+ + + + +
-
@@ -210,7 +218,7 @@
- +
diff --git a/templates/js/socket.js b/templates/js/socket.js index c05a788..2a92013 100755 --- a/templates/js/socket.js +++ b/templates/js/socket.js @@ -26,12 +26,12 @@ ws.onmessage = function(message) { self.GraphVisualization.import(convertJSON(msg['data']), function() { reset_configuration(); set_configuration(); - $('#home_menu').click(function() { - setTimeout(function() { - reset_timeline(); - set_timeline(msg['data']); - }, 1000); - }); + // $('#home_menu').click(function() { + // setTimeout(function() { + // reset_timeline(); + // set_timeline(msg['data']); + // }, 1000); + // }); reset_timeline(); set_timeline(msg['data']); $('#load').hide(); @@ -52,7 +52,7 @@ ws.onmessage = function(message) { break; case 'error': - console.log(msg['error']); + console.error(msg['error']); _socket.error(msg['error']); $('#load').removeClass('loader'); break; @@ -65,10 +65,18 @@ ws.onmessage = function(message) { case 'visualization_params': console.log(msg['data']); self.GraphVisualization.set_params(msg['data']['shape_property'], msg['data']['shapes'], msg['data']['colors']); + + if ( msg['data']['background_image'] ) { + // $('svg#graph').css('background-image', 'linear-gradient(to bottom, rgba(0,0,0,0.4) 0%,rgba(0,0,0,0.4) 100%), url(img/background/' + msg['data']['background_image']) + // .css('background-size', '130%').css('background-position', '5% 30%').css('background-repeat', 'no-repeat'); + $('