--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
To post to this group, send email to gama-p...@googlegroups.com.
Visit this group at https://groups.google.com/group/gama-platform.
For more options, visit https://groups.google.com/d/optout.
model simone
global {
int nbRandwpeople <- 10;
float speed <- 8.0 #km/#h;
float step <-1 #minutes;
file roads_shapefile <- file("../includes/Roads_utm.shp");
//file Randw_shapefile <- file ("../includes/Randwick.shp");
//file dest_sydney_shapefile <- file ("../includes/Dest_Sydney4.shp");
//file ocean_shapefile <- file ("../includes/Ocean2.shp");
geometry shape <- envelope(roads_shapefile);
graph road_network;
init {
create road from: roads_shapefile;
road_network <- as_edge_graph(road);
//create ZnRandw from: Randw_shapefile;
//create ocean from: ocean_shapefile;
//create dest from: dest_sydney_shapefile;
create Randwpeople number: nbRandwpeople {
speed <- speed + rnd(6);
location <- any_location_in(one_of(road));
target <- any_location_in(one_of(road));
}
}
reflex end_simulation when: empty(Randwpeople where (not each.is_arrived)){
ask Randwpeople {
shape <- my_path;
}
file fold <- new_folder("../results/");
save Randwpeople type:"shp" to: "../results/paths.shp" ;
do pause;
}
}
species Randwpeople skills:[moving]{
geometry my_path;
point target;
bool is_arrived <- false;
reflex move when: not is_arrived{
path the_path <- goto (target: target, on: road_network, return_path: true);
if (the_path != nil and the_path.shape != nil) {
list<point> pts <- (the_path.segments accumulate each.points);
if (first(pts) != last(pts)) {
my_path <-my_path = nil ? the_path.shape :union(my_path,the_path.shape);
}
}
is_arrived <- location = target;
}
aspect circle {
draw circle(10) color: #red;
draw my_path color: #blue;
}
}
species road {
aspect geom{
draw shape color: #gray;
}
}
species ZnRandw {
aspect geom{
draw shape color: #gray;
}
}
species dest {
aspect geom{
draw shape color: #red;
}
}
species ocean {
aspect geom{
draw shape color: #lightblue;
}
}
experiment main_experiment type:gui {
output{
display map type: opengl{
species road aspect: geom transparency: 0.5 refresh: false;
species ZnRandw aspect: geom transparency: 0.8 refresh: false;
species dest aspect: geom transparency: 0.8 refresh: false;
species ocean aspect: geom transparency: 0.7 refresh: false;
species Randwpeople aspect: circle;
}
}
}
Hi,Oke it means you objective from gama is to just have the path. I just added 3 lines of code to your original code. I add additional lines so that you can see continuum with your code. :) :)
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platform+unsubscribe@googlegroups.com.