DEFINITION MODULE DrawAgePyram;
(*******************************************************************
Module DrawAgePyram (Version 1.0)
Copyright (c) 1990-2006 by Andreas Fischlin, Harald Bugmann and
ETH Zurich.
Purpose Draws within a separate window an age pyramid for
both sexes of an age structured population.
Remarks The programming style is object oriented, i.e.
it is sufficient to call MakePyramid, and all the age
pyramid's values will be defined, since inherited from a
mother age pyramid. Restoration and redefinition of window
content respectively window size implementations will
redraw the age pyramid from the client data, hence notice
that if they should have changed their values in the
meantime, or should no longer exist, the drawing will
change also or might even fail (latter case). Furthermore
note that the implementations of most procedures operating
on age pyramids require a preceeding successful
instantiation of the object (i.e. this is a precondition
for all procedures with value parameter AgePyramid, but the
existence of the object is not alwyas tested).
Typical usage with ModelWorks (source code excerpt):
----------------------------------------------------
FROM DrawAgePyram IMPORT MakePyramid, ShowPyramidWindow,
DrawPyramid, AgePyramid;
FROM SimBase IMPORT ..., DeclClientMonitoring, ...;
...
CONST maxClass = 10;
VAR ap : AgePyramid;
males, females : ARRAY [1..maxClass] OF REAL;
PROCEDURE Dummy; BEGIN END Dummy;
PROCEDURE PyramidMonitoring;
BEGIN
ShowPyramidWindow(ap);
DrawPyramid (ap, females, males);
END PyramidMonitoring;
...
PROCEDURE ModelDeclaration;
BEGIN
...
DeclClientMonitoring(Dummy, PyramidMonitoring, Dummy);
MakePyramid( ap );
...
END ModelDeclaration;
Programming
o Design
Andreas Fischlin 29/05/1990
o Implementation
Andreas Fischlin 29/05/1990
Harald Bugmann 22/06/1990
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: 16/11/1992 HB
*******************************************************************)
FROM DMWindows IMPORT WindowFrame;
TYPE AgePyramid;
PROCEDURE MakePyramid ( VAR ap: AgePyramid );
PROCEDURE SetPyramidParameters ( ap: AgePyramid; defltPlace, place: WindowFrame;
title, femaleLabel, maleLabel: ARRAY OF CHAR;
xMax: REAL; yTickInterval: INTEGER );
(* Meaning of parameters:
- defltPlace, place, title: default place, current place and title of the
pyramid window
- femaleLabel, maleLabel: x axis labels
- xMax: fixes the maximum value of the x axis to xMax, so that absolute age
pyramids can be compared. IF xMax ≤0, the scaling of the x axis is
automatically updated to the highest number found in any age class.
By default, xMax is 0 (automatic update)
- yTickInterval: interval for ticks and labels on the y axis of the pyramid;
the parameter is ignored if ≤0; the default yTickInterval is 10
*)
PROCEDURE GetPyramidParameters ( ap: AgePyramid; VAR defltPlace, place: WindowFrame;
VAR title, femaleLabel, maleLabel: ARRAY OF CHAR;
VAR xMax: REAL; VAR yTickInterval: INTEGER );
PROCEDURE ResetPyramid ( ap: AgePyramid );
(* makes default location and size current *)
PROCEDURE ShowPyramidWindow ( ap: AgePyramid );
PROCEDURE HidePyramidWindow ( ap: AgePyramid );
PROCEDURE DrawPyramid ( ap: AgePyramid; VAR females, males: ARRAY OF REAL);
(* VAR for speed-up reasons only *)
PROCEDURE DiscardPyramid ( VAR ap: AgePyramid );
END DrawAgePyram.