ETHZ_Logo RAMSES_Logo_Right   RAMSES   RAMSES_Logo_Left Systems Ecology  
Start    search button      Modules:   A-Z   Function   Layer        QuickRefs:   DM   AuxLib   AuxLibE   SciLib   EasyMW   MW   ISIS   RMSLib

DEFINITION MODULE CellAutoOut;

  (*******************************************************************

    Module  CellAutoOut     (Version 0.4)

      Copyright (c) 1988-2006 by Andreas Fischlin, Thomas Nemecek, Olivier
      Roth and ETH Zurich.

    Purpose   Display of 2-dimensional cellular patterns.
              Typically used to plot cellular automatons.

    Remarks   This module is best used together with the modules
              CAModBase and CAMonit.


    Programming

      o Design
        Andreas Fischlin          01/07/1988
        Thomas Nemecek            01/07/1988
        Olivier Roth              01/07/1988

      o Implementation
        Thomas Nemecek            01/07/1988


    ETH Zurich
    Systems Ecology
    CHN E 35.1
    Universitaetstrasse 16
    8092 Zurich
    SWITZERLAND

    URLs:
        <mailto:RAMSES@env.ethz.ch>
        <http://www.sysecol.ethz.ch>
        <http://www.sysecol.ethz.ch/SimSoftware/RAMSES>


    Last revision of definition:  01/06/2000  AF

  *******************************************************************)


  FROM DMWindows    IMPORT      Window, WindowFrame, RectArea;
  FROM DMWindIO     IMPORT      Pattern, Color;

  TYPE
    CellAutoID;
    Symbol     = CHAR;
    UnderlayMode = (underlayWhite, dontUnderlay);
    CellProcess = PROCEDURE (INTEGER, INTEGER);


  VAR
    notExistingCA:              CellAutoID;

  (***********************************)
  (*#####   Object management   #####*)
  (***********************************)
  PROCEDURE DeclCellOutput(VAR caID: CellAutoID; VAR outWindow: Window;
               plotFrame: RectArea; numbX, numbY: INTEGER;
               withGridLines: BOOLEAN);

  (* caID: name of the CA
   * outW: associated output window (must be open, when the procedure
   * is called
   * plotFrame: maximal area, which may be occupied by the grid.
   * The effective area is <= plotFrame. It is put on the lower left
   * corner of the plotFrame.
   * numX, numY: number of cells in the width (X) and in the height (Y)
   * withgridLines: determines, whether the black grid of 1 pixel width is
   * drawn or not. Use FALSE if is the number of cells
   * is very large.
   * The new CA is automatically the currentCA. *)

  PROCEDURE RemoveCellOutput(VAR caID: CellAutoID);
   (* If this procedure is called the grid is erased on the screen.
    * Call it every time, when the associated window is closed! *)

  PROCEDURE RemoveAllCellOutputs;

  PROCEDURE CellOutputExists(caID: CellAutoID): BOOLEAN;

  (***********************************)
  (*#####   Output procedures   #####*)
  (***********************************)
  PROCEDURE SelectCellOutput(caID: CellAutoID);
   (*. selects caID as current output CA and the associated window as
    *  current output window.
    *  IMPORTANT: Use this procedure each time, when you take the control
    *  from DM or when another window was chosen as output window,
    *  otherwise the output is drawn in a false window! .*)

  PROCEDURE GetCurCellOutput(VAR caID: CellAutoID);

  PROCEDURE ClearCell(x,y: INTEGER);
  (* erases the contents of the cell with the coordinates x, y.
   * The COORDINATE SYSTEM is definded as to be 1,1 in the bottom left corner
   * of the CA. The x-axis is showing at right, the y-axis upwards.
   * This procedure only calls FillCell with pattern light. *)

  PROCEDURE FillCell(x,y: INTEGER; pattern: Pattern; col: Color);
  (* fills the contents of the cell with the coordinates x, y with
   * the "pattern" and 'color'. *)

  PROCEDURE DrawInCell(x, y: INTEGER; sym: Symbol;
                     underlay: UnderlayMode);
  (* writes the symbol sym in the middle of the cell with
   * the coordinates x, y.
   * 'underlay' defines, if the cell where the character is written
   * is underlaid with a white area in the middle or not. *)

  PROCEDURE DoForAllCells(doCellProc: CellProcess);
  (*. allows executing of procedures with all cells of the current CA .*)

  (**************************************)
  (*#####   Auxiliary procedures   #####*)
  (**************************************)
  PROCEDURE CalcCellArea(x,y: INTEGER): RectArea;
  (* calculates the area of the cell x,y without gridLines.
   * This procedure allows to use Procedures
   * like e.g. RectClicked. *)

  PROCEDURE CalcCellMiddle(x, y: INTEGER;
                         VAR xCoord,yCoord: INTEGER);
  (* calculates the middle of the cell x,y in absolute coordinates.
   * The values are round off. *)

  PROCEDURE GetPlotFrame(caID: CellAutoID): RectArea;
  (*. returnes the effective area of the grid included the border
   *  lines. .*)

END CellAutoOut.

  Contact RAMSES@env.ethz.ch Last updated: 25-Jul-2011 [Top of page]