Previous: Showing Shapes, Up: Shape Reference


18.10 Outputting

— Pure virtual function: void output (void)

Called by Picture::output() for writing MetaPost code to out_stream for a Shape pointed to by a pointer on the vector<Shape*> shapes belonging to the Picture. Such a Shape will have been created by a drawing or filling function.

— Pure virtual function: vector<Shape*> extract (const Focus& f, const unsigned short proj, real factor)

Called in Picture::output(). It determines whether a Shape can be output. If it can, and an output() function for the type of the Shape exists, a vector<Shape*> containing a pointer to the Shape is returned.

On the other hand, it is possible to define a type derived from Shape, without an output() function of its own, and not derived from a type that has one. It may then consist of one or more objects of types that do have output() functions. In this case, the vector<Shape*> returned by extract() will contain pointers to all of these subsidiary Shapes, and Picture::output() will treat them as independent objects. In particular, if any one of them cannot be projected using the arguments passed to Picture::output(), this will have no effect on whether the others are outputted or not.

Currently, there are no Shapes without an output() function, either belonging to the class, or inherited. However, it's useful to be able to define Shapes in this way, so that they can be tested without having to define an output() function first.

— Pure virtual function: bool set_extremes (void)

Sets the values of projective_extremes for the Shape. This is needed in Picture::output() for determining the order in which objects are output.

const pure virtual functions: real get_minimum_z (void)
— : real get_maximum_z (void)
— : real get_mean_z (void)

These functions return the minimum, maximum, and mean z-value respectively of the projected Points belonging to the Shape, i.e., from projective_extremes. The values for the Shapes on the Picture are used for determining the order in which they are output

const pure virtual function: const valarray<real> get_extremes (void)

Returns projective_extremes.

— Pure virtual function: void suppress_output (void)

Sets do_output to false. This function is called in Picture::output(), if a Shape on a Picture cannot be output using the arguments passed to Picture::output().

— Pure virtual function: void unsuppress_output (void)

Sets do_output to true. Called in Picture::output() after output() is called on the Shapes. This way, output of Shapes that couldn't be output when Picture::output() was called with a particular set of arguments won't necessarily be suppressed when Picture::output() is called again with different arguments.

f