From 2df6e07a939e39e8ae8050ce62ae0e6390ec26a8 Mon Sep 17 00:00:00 2001 From: AlexisDrogoul Date: Wed, 16 Mar 2022 23:45:31 +0700 Subject: [PATCH] Minor additions and changes in some Library models --- .../Data Types And Structures/Fields.gaml | 6 +- .../models/Ant Foraging.gaml | 8 +- .../models/Building Elevation.gaml | 136 ++++++++---------- .../models/Camera Definitions.gaml | 2 +- .../models/Eroding Vulcano.gaml | 2 +- 5 files changed, 69 insertions(+), 85 deletions(-) diff --git a/msi.gama.models/models/GAML Syntax/Data Types And Structures/Fields.gaml b/msi.gama.models/models/GAML Syntax/Data Types And Structures/Fields.gaml index 5483086137..ebc3515a74 100644 --- a/msi.gama.models/models/GAML Syntax/Data Types And Structures/Fields.gaml +++ b/msi.gama.models/models/GAML Syntax/Data Types And Structures/Fields.gaml @@ -79,13 +79,13 @@ experiment Field_view type:gui{ output { layout #split; display "field through mesh" type:opengl { - mesh field_display grayscale:true scale: 0.05 refresh: false triangulation: true smooth: true; + mesh field_display grayscale:true scale: 0.05 triangulation: true smooth: true refresh: false; } display "rgb field through mesh" type:opengl { - mesh field_display color:field_display.bands scale: 0.0 refresh: false; + mesh field_display color:field_display.bands scale: 0.1 triangulation: true smooth: 4 refresh: false; } display "rnd field with palette mesh" type:opengl { - mesh field_display.bands[2] color:scale([#red::100, #yellow::115, #green::101, #darkgreen::105]) scale:0.1 refresh:false; + mesh field_display.bands[2] color:scale([#red::100, #yellow::115, #green::101, #darkgreen::105]) scale:0.2 refresh: false ; } display "var field" type:opengl { mesh var_field color:(brewer_colors("RdBu")) scale:0.0; diff --git a/msi.gama.models/models/Toy Models/Ants (Foraging and Sorting)/models/Ant Foraging.gaml b/msi.gama.models/models/Toy Models/Ants (Foraging and Sorting)/models/Ant Foraging.gaml index 12f324cb00..9dce6a0735 100644 --- a/msi.gama.models/models/Toy Models/Ants (Foraging and Sorting)/models/Ant Foraging.gaml +++ b/msi.gama.models/models/Toy Models/Ants (Foraging and Sorting)/models/Ant Foraging.gaml @@ -213,12 +213,12 @@ experiment "Classic" type: gui { output { - display Ants type: opengl synchronized: true antialias: false { + display Ants synchronized: false antialias: false type: opengl { light #ambient intensity: 127; light #default intensity: 127; - image terrain refresh: false; + image terrain refresh: true rotate: cycle; agents "Grid" transparency: 0.4 value: ant_grid where ((each.food > 0) or (each.road > 0) or (each.is_nest)); - species ant aspect: info; + species ant aspect: info rotate:-cycle; } } @@ -231,6 +231,8 @@ experiment "3D View" type: gui { parameter 'Grid dimension:' var: gridsize init: 100 unit: '(number of rows and columns)' category: 'Environment and Population'; parameter 'Number of food depots:' var: number_of_food_places init: 5 min: 1 category: 'Environment and Population'; output { + + display Ants3D type: opengl show_fps: true antialias: false{ grid ant_grid elevation: grid_values triangulation: true texture: terrain refresh: false; agents "Trail" transparency: 0.7 position: {0.05, 0.05, 0.02} size: {0.9, 0.9} value: (ant_grid as list) where ((each.food > 0) or (each.road > 0) or (each.is_nest)); diff --git a/msi.gama.models/models/Visualization and User Interaction/Visualization/3D Visualization/models/Building Elevation.gaml b/msi.gama.models/models/Visualization and User Interaction/Visualization/3D Visualization/models/Building Elevation.gaml index 58ff081619..e8bd23126b 100644 --- a/msi.gama.models/models/Visualization and User Interaction/Visualization/3D Visualization/models/Building Elevation.gaml +++ b/msi.gama.models/models/Visualization and User Interaction/Visualization/3D Visualization/models/Building Elevation.gaml @@ -9,9 +9,7 @@ */ model tutorial_gis_city_traffic - -global -{ +global { //Load of the different shapefiles used by the model file shape_file_buildings <- shape_file('../includes/building.shp', 0); file shape_file_roads <- shape_file('../includes/road.shp', 0); @@ -33,14 +31,13 @@ global //Declaration of a graph that will represent our road network graph the_graph; - init - { - create building from: shape_file_buildings with: [type:: string(read('NATURE'))] - { - if type = "Industrial" - { - color <- # blue; + + init { + create building from: shape_file_buildings with: [type:: string(read('NATURE'))] { + if type = "Industrial" { + color <- #blue; } + height <- 10 + rnd(90); } @@ -53,75 +50,62 @@ global } -species building -{ +species building { string type; - rgb color <- # gray; + rgb color <- #gray; int height; - aspect base - { + + aspect base { draw shape color: color depth: height; } } -species road -{ - rgb color <- # black; - aspect base - { +species road { + rgb color <- #black; + + aspect base { draw shape color: color; } } -species people skills: [moving] -{ +species people skills: [moving] { float speed <- min_speed + rnd(max_speed - min_speed); rgb color <- rnd_color(255); building living_place <- one_of(residential_buildings); building working_place <- one_of(industrial_buildings); - point location <- any_location_in(living_place) + { 0, 0, living_place.height }; + point location <- any_location_in(living_place) + {0, 0, living_place.height}; int start_work <- min_work_start + rnd(max_work_start - min_work_start); int end_work <- min_work_end + rnd(max_work_end - min_work_end); string objectif; point the_target; - reflex time_to_work when: day_time = start_work - { + + reflex time_to_work when: day_time = start_work { objectif <- 'working'; the_target <- any_location_in(working_place); } - reflex time_to_go_home when: day_time = end_work - { + reflex time_to_go_home when: day_time = end_work { objectif <- 'go home'; the_target <- any_location_in(living_place); } - reflex move when: the_target != nil - { - do goto( target: the_target ,on: the_graph); - switch the_target - { - match location - { + reflex move when: the_target != nil { + do goto(target: the_target, on: the_graph); + switch the_target { + match location { the_target <- nil; - location <- { location.x, location.y, objectif = 'go home' ? living_place.height : working_place.height }; + location <- {location.x, location.y, objectif = 'go home' ? living_place.height : working_place.height}; } - } - - } + } } - aspect default - { + aspect default { draw sphere(3) color: color; - } - -} + } } -experiment "Road Traffic" type: gui -{ +experiment "Road Traffic" type: gui { parameter 'Shapefile for the buildings:' var: shape_file_buildings category: 'GIS'; parameter 'Shapefile for the roads:' var: shape_file_roads category: 'GIS'; parameter 'Shapefile for the bounds:' var: shape_file_bounds category: 'GIS'; @@ -131,37 +115,36 @@ experiment "Road Traffic" type: gui parameter 'Latest hour to end work' var: max_work_end category: 'People'; parameter 'minimal speed' var: min_speed category: 'People'; parameter 'maximal speed' var: max_speed category: 'People'; - parameter 'Number of people agents' var: nb_people category: 'People' min: 0 max: 100000 - { + parameter 'Number of people agents' var: nb_people category: 'People' min: 0 max: 100000 { int nb <- length(people); - ask simulation - { - if (nb_people > nb) - { + ask simulation { + if (nb_people > nb) { create people number: nb_people - nb; - } else - { - ask (nb - nb_people) among people - { + } else { + ask (nb - nb_people) among people { do die; } + } + } + } - output - { - display city_display type: opengl light: true - { + + output { + display city_display type: opengl { + light #ambient intensity: 180; + light #default intensity: 180 direction: {0.5, 0.5, -1}; species building aspect: base refresh: false; species road aspect: base refresh: false; species people refresh: true; } + } } -experiment "Multiple Layers" type: gui -{ +experiment "Multiple Layers" type: gui { parameter 'Shapefile for the buildings:' var: shape_file_buildings category: 'GIS'; parameter 'Shapefile for the roads:' var: shape_file_roads category: 'GIS'; parameter 'Shapefile for the bounds:' var: shape_file_bounds category: 'GIS'; @@ -171,30 +154,29 @@ experiment "Multiple Layers" type: gui parameter 'Latest hour to end work' var: max_work_end category: 'People'; parameter 'minimal speed' var: min_speed category: 'People'; parameter 'maximal speed' var: max_speed category: 'People'; - parameter 'Number of people agents' var: nb_people category: 'People' min: 0 max: 1000 - { + parameter 'Number of people agents' var: nb_people category: 'People' min: 0 max: 1000 { int nb <- length(people); - ask simulation - { - if (nb_people > nb) - { + ask simulation { + if (nb_people > nb) { create people number: nb_people - nb; - } else - { - ask (nb - nb_people) among people - { + } else { + ask (nb - nb_people) among people { do die; } + } + } + } - output - { - display city_display type: opengl - { + + output { + display city_display type: opengl { species road aspect: base; - species building aspect: base position: { 0, 0, 0.25 }; - species people position: { 0, 0, 0.5 }; + species building aspect: base position: {0, 0, 0.25}; + species people position: {0, 0, 0.5}; } + } + } diff --git a/msi.gama.models/models/Visualization and User Interaction/Visualization/3D Visualization/models/Camera Definitions.gaml b/msi.gama.models/models/Visualization and User Interaction/Visualization/3D Visualization/models/Camera Definitions.gaml index 476cc632f1..c3d027d7c9 100644 --- a/msi.gama.models/models/Visualization and User Interaction/Visualization/3D Visualization/models/Camera Definitions.gaml +++ b/msi.gama.models/models/Visualization and User Interaction/Visualization/3D Visualization/models/Camera Definitions.gaml @@ -27,7 +27,7 @@ species object skills: [moving] { } experiment Display type: gui autorun: true { - float w -> simulation.shape.width; + float w -> simulation.shape.width; float h -> simulation.shape.height; point p -> first(object).location; float factor <- 1.0; diff --git a/simtools.gaml.extensions.physics/models/Physics Engine/models/Eroding Vulcano.gaml b/simtools.gaml.extensions.physics/models/Physics Engine/models/Eroding Vulcano.gaml index c6a63ea14a..36496a2ae3 100644 --- a/simtools.gaml.extensions.physics/models/Physics Engine/models/Eroding Vulcano.gaml +++ b/simtools.gaml.extensions.physics/models/Physics Engine/models/Eroding Vulcano.gaml @@ -113,7 +113,7 @@ experiment "3D view" type: gui { } } //The terrain is represented as a field (but could be equally represented as a grid - mesh patches texture: image_file("../images/DEM/Volcano Texture.jpg") triangulation: true ; + mesh patches texture: image_file("../images/DEM/Volcano Texture.jpg") triangulation: true smooth: true; //We add to the representation the individual 'aabb's (axis-aligned bounding boxes) of the patches if 'draw_inside' is true species patches; //Finally, each lava agent is represented (with its velocity if 'draw_inside' is true)