Let us first consider how to create a ZoomMapZoomMap. This is done very simply as follows:
The first step is to include the header file “ast.h” which declares
the interface to the AST library. We then declare a pointer of type
AstZoomMap to receive the result and invoke the function astZoomMapastZoomMap
to create the ZoomMap. The pattern is the same for all other classes
of AST ObjectObject—you simply prefix “ast” to the class name to obtain
the function that creates the Object and prefix “Ast” to obtain the
type of the returned pointer.
These functions are called constructor functions, or simply constructors (you can find an individual description of all AST functions in Appendix B) and the arguments passed to the constructor are used to initialise the new Object. In this case, we specify 2 as the number of coordinates (i.e. we are going to work in a 2-dimensional space) and 5.0 as the ZoomZoom factor to be applied. Note that this is a C double value. We will return to the final argument, an empty string, shortly (ยง4.6).
The value returned by the constructor is termed an Object pointer or, in this case, a ZoomMap pointer and is used to refer to the Object. You perform all subsequent operations on the Object by passing this pointer to other AST functions.