Diffpack Documentation


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

GraphBasics Class Reference

toolbox for drawing text/line-segments. More...

#include <GraphBasics.h>

List of all members.

Public Methods

 GraphBasics (const String &filename, const int spacedim=3, const FieldPlotType pltype=UNSPECIFIED, const char *name_of_data_set="NONAME", const Format_type format=ASCII)
 ~GraphBasics ()
void penUp ()
void penDown ()
void move (const Ptv(real) &to)
void move (const real x, const real y, const real z)
void move (const real x, const real y)
void drawLine (const Ptv(real) &from, const Ptv(real) &to)
void drawLine (const real xfrom, const real yfrom, const real zfrom, const real xto, const real yto, const real zto)
void drawLine (const real xfrom, const real yfrom, const real xto, const real yto)
void drawLine (const Ptv(real) &to)
void drawLine (const real x, const real y, const real z)
void drawLine (const real x, const real y)
void fillPolygon (const Ptv(real) points[], const int npoints)
void markPoint (const Ptv(real) &point)
void markPoint (const real x, const real y, const real z)
void markPoint (const real x, const real y)
void writeText (const char *text, const Ptv(real) *start_pt=NULL, const Ptv(real) *end_pt=NULL)
void drawArrow (const Ptv(real) &start_pt, const Ptv(real) &vector)
void drawArrow (const real start_pt_x, const real start_pt_y, const real start_pt_z, const real vector_x, const real vector_y, const real vector_z)
void drawArrow (const real start_pt_x, const real start_pt_y, const real vector_x, const real vector_y)
void setValue (const real value)
void setMaxArrowLen (const real length)
void setColorScale (const real min_value, const Color &low, const real max_value, const Color &high)
void setColorScale (const real min_value, const real r_low, const real g_low, const real b_low, const real max_value, const real r_high, const real g_high, const real b_high)
void setCoordinateScalingFactors (const real xfactor=1, const real yfactor=1, const real zfactor=1)
int getDim () const
void close ()


Detailed Description

toolbox for drawing text/line-segments.

NAME: GraphBasics - toolbox for drawing text/line-segments

DESCRIPTION:

This class is a toolbox containing a collection of simple drawing commands for output to a device independent graphical format. The output in this format can then be filtered to a specific device dependent format by an export module.

Note that the "GraphBasics" functions do not normally flush or close the output file, and thus this file may be incomplete after a call to a "GraphBasics" function. To make the file complete and ready for reading, call the "close" function. The "close" function physically closes the file which means that the "GraphBasics" object cannot be used after this (errors will occur when trying to write to a closed file). Here is an example that illustrates the importance of closing a "GraphBasics" object before using the output file:

  GraphBasics plotter ("mygrid.gb", 2);
  DrawFE ::drawGrid (grid, plotter);          // make a grid plot
  plotter.close();                           // important!!!
  OpSysUtil ::execFilter("gb2mtv", "mygrid.gb", "mygrid.mtv");


Constructor & Destructor Documentation

GraphBasics::GraphBasics ( const String & filename,
const int spacedim = 3,
const FieldPlotType pltype = UNSPECIFIED,
const char * name_of_data_set = "NONAME",
const Format_type format = ASCII )
 

The constructor accepts the name of the output file, the number of space dimensions, the plot type, and the name of the data set as arguments. Only the name of the output file is strictly required, as the other parameters have sensible default values.

GraphBasics::~GraphBasics ( )
 


Member Function Documentation

void GraphBasics::close ( )
 

flushes all internal buffers and closes the output file. The function is usually used when it is desireable to finish and close the file at a particular point in a program. The destructor also calls "close", but since "GraphBasics" objects are usually deleted automatically when they go out of scope, it may be too late for the user to wait for the object to go out of scope before the output file can be used.

Most of the functions are overloaded, and can take point input either as a "Ptv(real)" vector, or as two or three real values, depending on the number of space dimensions.

void GraphBasics::drawArrow ( const real start_pt_x,
const real start_pt_y,
const real vector_x,
const real vector_y )
 

See documentation of one of the overloaded functions.

void GraphBasics::drawArrow ( const real start_pt_x,
const real start_pt_y,
const real start_pt_z,
const real vector_x,
const real vector_y,
const real vector_z )
 

See documentation of one of the overloaded functions.

void GraphBasics::drawArrow ( const Ptv(real) & start_pt,
const Ptv(real) & vector )
 

draws an arrow from the given point along the given vector.

void GraphBasics::drawLine ( const real x,
const real y )
 

See documentation of one of the overloaded functions.

void GraphBasics::drawLine ( const real x,
const real y,
const real z )
 

See documentation of one of the overloaded functions.

void GraphBasics::drawLine ( const Ptv(real) & to )
 

See documentation of one of the overloaded functions.

void GraphBasics::drawLine ( const real xfrom,
const real yfrom,
const real xto,
const real yto )
 

See documentation of one of the overloaded functions.

void GraphBasics::drawLine ( const real xfrom,
const real yfrom,
const real zfrom,
const real xto,
const real yto,
const real zto )
 

See documentation of one of the overloaded functions.

void GraphBasics::drawLine ( const Ptv(real) & from,
const Ptv(real) & to )
 

draws a line. If two points are given, a line will be drawn from the first to the last. If only one point is given, a line will be drawn from the last point given, if any, to the given point.

void GraphBasics::fillPolygon ( const Ptv(real) points[],
const int npoints )
 

fills the area defined by the points given with the current color (value). There are no restrictions on the number of points that can be specified, so the problems that might arise if the number of points is bigger than the number of space dimensions has to be handled by the export modules or by the visualization tools.

int GraphBasics::getDim ( ) const [inline]
 

void GraphBasics::markPoint ( const real x,
const real y )
 

See documentation of one of the overloaded functions.

void GraphBasics::markPoint ( const real x,
const real y,
const real z )
 

See documentation of one of the overloaded functions.

void GraphBasics::markPoint ( const Ptv(real) & point )
 

marks the given point.

void GraphBasics::move ( const real x,
const real y )
 

See documentation of one of the overloaded functions.

void GraphBasics::move ( const real x,
const real y,
const real z )
 

See documentation of one of the overloaded functions.

void GraphBasics::move ( const Ptv(real) & to )
 

moves pen to the given position. If the pen is down, a line will be drawn from the last position to the new. If the pen is up, the pen will be moved to the new position without drawing. Value of the line (e.g. represented as a color) will be as specified in the last call to "setValue".

void GraphBasics::penDown ( ) [inline]
 

sets the artificial pen to DOWN position.

void GraphBasics::penUp ( ) [inline]
 

sets the artificial pen to UP position.

void GraphBasics::setColorScale ( const real min_value,
const real r_low,
const real g_low,
const real b_low,
const real max_value,
const real r_high,
const real g_high,
const real b_high )
 

See documentation of one of the overloaded functions.

void GraphBasics::setColorScale ( const real min_value,
const Color & low,
const real max_value,
const Color & high )
 

sets a minimum and maximum scalar value, and one color associated with each of these two values. This scale is the basis for interpolations performed by the export modules or the visualization tools. The function is overloaded, and can take a color as input both as a "Color" structure or as three separate real values (RGB).

void GraphBasics::setCoordinateScalingFactors ( const real xfactor = 1,
const real yfactor = 1,
const real zfactor = 1 )
 

sets scaling factors for each coordinate direction. The scaling factors default to 1, but can be set explicitly with this function.

void GraphBasics::setMaxArrowLen ( const real length )
 

sets a maximum length for the arrows that will be drawn by "drawArrow".

void GraphBasics::setValue ( const real value )
 

specifies a scalar value to be associated with all primitives drawn until the next "setValue" call. This value will typically be used by the export modules to find an absolute color for the primitives, but some visualization tools have the ability to do this themselves, and will therefore need only the values.

void GraphBasics::writeText ( const char * text,
const Ptv(real) * start_pt = NULL,
const Ptv(real) * end_pt = NULL )
 

writes the given text between two given points. If no points are given, origo will be used for both the start point and the end point. The result of this will depend on the chosen filter and the visualization tool.


The documentation for this class was generated from the following file:
Copyright © 2003 inuTech GmbH. All rights reserved.