From: Gerardo L. <mr....@gm...> - 2016-08-04 22:22:47
|
Yes I did it, but doesn't work. The model runs but the map is not charged. Thank you. Gerardo Tatara, Eric R. wrote > I don't recommend following the SugarScape model directly because it is > more complex than needs to be (it was a conversion of an earlier version > model). However, you will need to create a GridValueLayer in your > ContextBuilder similar to how it's done in the SugarSpace class and assign > the values from the file. > > You can put the following in your ContextBuilder class: > > GridValueLayer mySpace = new GridValueLayer("MySpace",true, new > WrapAroundBorders(), xdim, ydim); > > context.addValueLayer(mySpace) > > PGMReader reader = new PGMReader(myFile); > int matrix[][] = reader.getMatrix(); > > for (int x = 0; x < xdim; x++) { > for (int y = 0; y < ydim; y++) { > mySpace.set(matrix[x][y], x,y); > } > } > > And also be sure to update the context.xml file accordingly: > <projection id="MySpace" type="value layer" /> -- View this message in context: http://repast.10935.n7.nabble.com/Integrate-a-building-map-in-a-Repast-model-Evacuation-Simulation-tp11570p11612.html Sent from the repast-interest mailing list archive at Nabble.com. |