Skip to content

Commit

Permalink
Adds a new type to GAMA: field;
Browse files Browse the repository at this point in the history
Fields are 2D float matrices with additional attributes, which can be
created from image, raster files, CSV files, grids, or by hand. They can
also possess 'bands' (additional 'layers' sharing the same dimensions..)

The main purpose of fields is to replace grids when the latter ones are
only used for storing and reading/writing float discrete values.

Fields can be displayed using the new 'mesh' layer, which is also able
to take care of no_data values by default.

Fields are already usable as is, with a read/write access through
col/row (like matrices) or through a world location
(my_field[my_agent.location]).

They are already used for the generation of terrains in the physics
plugin and can be used as a replacement of grids in the diffusion
statement.

What's missing:
- obtaining a pseudo-shape for one cell (in order to verify
intersections, etc.) (my_field.cell_at(location))
- obtaining the list of values overlapping an existing geometry
(my_field[my_agent.shape]) or the list of pseudo-shapes
(my_field.cells_at(shape))
- specifying color schemes (gradients, palettes, scales) for drawing
meshes.
- more examples involving this new feature !
  • Loading branch information
AlexisDrogoul committed Jun 28, 2021
1 parent a506488 commit 1b2d173
Show file tree
Hide file tree
Showing 45 changed files with 1,418 additions and 447 deletions.
4 changes: 2 additions & 2 deletions msi.gama.core/src/msi/gama/common/interfaces/IGraphics.java
Expand Up @@ -22,9 +22,9 @@
import msi.gama.outputs.layers.OverlayLayer;
import msi.gama.outputs.layers.charts.ChartOutput;
import msi.gama.util.file.GamaFile;
import msi.gama.util.matrix.IField;
import msi.gaml.statements.draw.DrawingAttributes;
import msi.gaml.statements.draw.MeshDrawingAttributes;
import msi.gaml.statements.draw.DrawingAttributes;
import msi.gaml.statements.draw.TextDrawingAttributes;

/**
Expand Down Expand Up @@ -61,7 +61,7 @@ default boolean is2D() {

Rectangle2D drawFile(GamaFile<?, ?> file, DrawingAttributes attributes);

Rectangle2D drawField(final double[] values, final MeshDrawingAttributes attributes);
Rectangle2D drawField(final IField values, final MeshDrawingAttributes attributes);

Rectangle2D drawImage(final BufferedImage img, final DrawingAttributes attributes);

Expand Down
61 changes: 0 additions & 61 deletions msi.gama.core/src/msi/gama/common/util/FieldUtils.java

This file was deleted.

0 comments on commit 1b2d173

Please sign in to comment.