WXP C++ Library Version 6.74.6
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
WXP::Graph Class Reference

This class plots to a device independent graphics interface. More...

#include "../include/Graph.h"

Inheritance diagram for WXP::Graph:
WXP::Listener WXP::GraphAttr

Public Member Functions

 Graph ()
 
 Graph (const char *device, const char *param)
 
 ~Graph ()
 
int init ()
 
int setDevice (const char *device, const char *params)
 
int getDevice (String &str)
 
int open ()
 
int open (const char *dev, const char *params)
 
bool isOpen ()
 
int close ()
 
int update ()
 
int manage ()
 
int unmanage ()
 
bool isManaged ()
 
void callback (const char *ev_str, const char *ev_data, const void *data)
 
int doCallback (const char *ev_str, const char *ev_data)
 
int addCallback (const char *ev, Listener *list, const void *data)
 
int setFixed (bool val)
 
int setSize (float width, float height)
 
int setOffset (float rx, float ry)
 
int setInverse (bool val)
 
bool getInverse ()
 
int setBackground (const char *str)
 
int setIcon (bool val)
 
int setTitle (const char *str)
 
int setTran (int num)
 
int setViewportAspect (Rect &limit, float aspect, int halign, int valign)
 
int setViewportAspect (Rect &limit, float aspect)
 
int setViewport (int num, Rect &rect)
 
int setViewport (Rect &rect)
 
int getViewport (Rect &rect)
 
Rect getViewport ()
 
int getDeviceViewport (Rect &rect)
 
Rect getDeviceViewport ()
 
int getMaxViewport (Rect &rect)
 
Rect getMaxViewport ()
 
int setWindow (int num, Rect &rect)
 
int setWindow (Rect &rect)
 
int getWindow (Rect &rect)
 
Rect getWindow ()
 
int getTran ()
 
int activateTran ()
 
int activateTran (int val)
 
int tranPlotView (float x1, float y1, float &x2, float &y2)
 
int tranPlotWindow (float x1, float y1, float &x2, float &y2)
 
int tranPlotWindow (Point &pt1, Point &pt2)
 
int tranWindow (int tran1, float x1, float y1, int tran2, float &x2, float &y2)
 
int tranWindow (int tran1, Point &pt1, int tran2, Point &pt2)
 
int clear ()
 
int clearRect (Rect &rect)
 
int allocColor (float red, float grn, float blu)
 
int allocColor (RGB &rgb)
 
int drawLine (float x1, float y1, float x2, float y2)
 
int drawLine (Point &p1, Point &p2)
 
int drawLine (Points &data)
 
int drawRect (float x1, float y1, float x2, float y2)
 
int drawRect (Rect &rect)
 
int drawCircle (float x1, float y1, float rad)
 
int drawCircle (Point &pt, float rad)
 
int setLineColor (int index)
 
int setLineWidth (float width)
 
int setLineStyle (int style)
 
int drawFill (Rect &rect)
 
int drawFill (Points &data)
 
int drawFillarea (Points &data)
 
int setFillColor (int index)
 
int setFillStyle (int index)
 
int drawMarkLine (float x, float y, float size)
 
int drawMark (float x, float y)
 
int drawMark (Point pt)
 
int setMarkColor (int index)
 
int setMarkSize (float size)
 
int setMarkType (int type)
 
int setMarkWeight (float weight)
 
int drawText (float ox, float oy, const char *string)
 
int drawText (Point pt, const char *string)
 
int drawFormText (float x, float y, const char *format,...)
 
int drawFormText (Point pt, const char *format,...)
 
int setTextColor (int color)
 
int setFontSpec ()
 
int setFont (const char *str)
 
int setTextBoxColor (int index)
 
int setDropColor (int index)
 
int setDropShadow (int val)
 
int getDropShadow ()
 
int setDropWidth (int val)
 
int setTextExpansion (float expansion)
 
int setTextWeight (float weight)
 
int setTextHeight (float height)
 
int setTextDirection (float x, float y)
 
int setTextAlign (int hor, int vert)
 
int setTextCharWidth (float space)
 
int setTextSpacing (float space)
 
int setSymbol (const char *file)
 
int drawSymbol (float ox, float oy, const char *string, float size)
 
int drawSymbol (Point pt, const char *string, float size)
 
int setImageAlign (int h, int v)
 
int drawImage (Image &image, float x, float y)
 
int drawImage (Image &image, int color, float x, float y)
 
int getImage (Image &image)
 
int setCursor (int type)
 
bool isLooping ()
 
int getFrame ()
 
int setFrame (int ind)
 
int newFrame ()
 
int deleteFrame (int ind)
 
int getNumFrames ()
 
int bell ()
 
int message (const char *str,...)
 
int printTran ()
 
virtual void callback (const char *ev_str, const char *ev_data, const void *data)=0
 

Static Public Attributes

static const int DEVICE_NONE = 0
 
static const int DEVICE_WINDOW = 1
 
static const int DEVICE_POSTSCRIPT = 2
 
static const int DEVICE_HPGL = 3
 
static const int DEVICE_METAFILE = 4
 
- Static Public Attributes inherited from WXP::GraphAttr
static const int HALIGN_NORMAL = 0
 
static const int HALIGN_LEFT = 1
 
static const int HALIGN_CENTER = 2
 
static const int HALIGN_RIGHT = 3
 
static const int VALIGN_NORMAL = 0
 
static const int VALIGN_TOP = 1
 
static const int VALIGN_CAP = 2
 
static const int VALIGN_HALF = 3
 
static const int VALIGN_BASE = 4
 
static const int VALIGN_BOTTOM = 5
 
static const int MARK_NONE = 0
 
static const int MARK_POINT = 1
 
static const int MARK_PLUS = 2
 
static const int MARK_STAR = 3
 
static const int MARK_O = 4
 
static const int MARK_CIRCLE = 4
 
static const int MARK_X = 5
 
static const int MARK_SQUARE = 6
 
static const int MARK_TRIANGLE = 7
 
static const int MARK_DOT = 8
 
static const int MARK_INVTRIANGLE = 9
 
static const int MARK_LIGHT = 10
 
static const int VIEW_HLEFT = 1
 
static const int VIEW_HCENTER = 2
 
static const int VIEW_HRIGHT = 3
 
static const int VIEW_VBOTTOM = 1
 
static const int VIEW_VCENTER = 2
 
static const int VIEW_VTOP = 3
 
static const int IMAGE_HLEFT = 1
 
static const int IMAGE_HCENTER = 2
 
static const int IMAGE_HRIGHT = 3
 
static const int IMAGE_VBOTTOM = 1
 
static const int IMAGE_VCENTER = 2
 
static const int IMAGE_VTOP = 3
 
static const int TRAN_MAX = 0
 
static const int TRAN_PLOT = 1
 
static const int CURSOR_X = 0
 
static const int CURSOR_PTR = 1
 
static const int CURSOR_MOVE = 2
 
static const int CURSOR_LOOP = 3
 
static const int CURSOR_STOP = 4
 
static const int CURSOR_DRAW = 5
 
static const int CURSOR_RECT = 6
 
static const int CURSOR_PLUS = 6
 
static const int CURSOR_TEXT = 7
 
static const int CURSOR_WAIT = 8
 

Detailed Description

This class plots to a device independent graphics interface.

Author
Dan Vietor

Constructor & Destructor Documentation

◆ Graph() [1/2]

Graph::Graph ( )

Constructor. Initializes class values

◆ Graph() [2/2]

Graph::Graph ( const char *  device,
const char *  params 
)

Constructor. Opens device with specified parameters

Parameters
deviceDevice to open (display, postscript, hpgl)
paramsA character string of device parameters

References setDevice().

◆ ~Graph()

Graph::~Graph ( )

Destructor

References close().

Member Function Documentation

◆ activateTran() [1/2]

int Graph::activateTran ( )

Activates the current transformation. This sets the clipping rectangle on the specific device.

Referenced by callback().

◆ activateTran() [2/2]

int Graph::activateTran ( int  val)

Activates a specific transformation.

Parameters
valThe transformation to activate

◆ addCallback()

int Graph::addCallback ( const char *  ev,
Listener list,
const void *  data 
)

Adds a callback to list

Parameters
evEvent to trigger callback
listListener object
dataListener specific data

◆ allocColor() [1/2]

int Graph::allocColor ( float  red,
float  grn,
float  blu 
)

Allocates a color within the device.

Parameters
redRed value (0-1)
grnGreen value (0-1)
bluBlue value (0-1)
Returns
Device specific index value (use for future reference).

Referenced by WXP::Plot::allocColor(), and WXP::Plot::setColorMap().

◆ allocColor() [2/2]

int Graph::allocColor ( RGB rgb)

Allocates a color within the device.

Parameters
rgbThe RGB component colors
Returns
Device specific index value (use for future reference).

References WXP::RGB::blu, WXP::RGB::grn, and WXP::RGB::red.

◆ bell()

int Graph::bell ( )

Sends a bell command to device

Referenced by WXP::Plot::callback().

◆ callback()

void Graph::callback ( const char *  ev_str,
const char *  ev_data,
const void *  data 
)
virtual

Internal event callback to redraw window

Parameters
ev_strEvent name
ev_dataEvent specific data
dataUser specific data for the event

Implements WXP::Listener.

References activateTran(), and WXP::StrLib::equal().

◆ clear()

int Graph::clear ( )

Clears the window of all graphics

◆ clearRect()

int Graph::clearRect ( Rect rect)

Clears a rectangular region

Parameters
rectThe region to clear

References WXP::GTran::tranWindowPlotX(), WXP::GTran::tranWindowPlotY(), WXP::Rect::xmax, WXP::Rect::xmin, WXP::Rect::ymax, and WXP::Rect::ymin.

◆ close()

int Graph::close ( )

Closes the window

Referenced by WXP::Plot::callback(), WXP::Plot::close(), and ~Graph().

◆ deleteFrame()

int Graph::deleteFrame ( int  ind)

Deletes a frame in the loop

Parameters
indIndex of the frame to delete

◆ doCallback()

int Graph::doCallback ( const char *  ev_str,
const char *  ev_data 
)

Forces the triggering of callbacks

Parameters
ev_strType of event (can be random)
ev_dataAny extra data specific to event

Referenced by WXP::Plot::callback().

◆ drawCircle() [1/2]

int Graph::drawCircle ( float  x1,
float  y1,
float  rad 
)

Draws a circle

Parameters
x1X point of center
y1Y point of center
radRadius of circle

References WXP::Points::add(), and WXP::Const::DRC.

Referenced by drawCircle(), and WXP::Plot::drawCircle().

◆ drawCircle() [2/2]

int Graph::drawCircle ( Point pt,
float  rad 
)

Draws a circle

Parameters
ptCenter point
radRadius of circle

References drawCircle(), WXP::Point::x, and WXP::Point::y.

◆ drawFill() [1/2]

int Graph::drawFill ( Points data)

Draws a filled area to the window

Parameters
dataPoints array defining polygon

References WXP::Points::add(), WXP::Points::clear(), WXP::Points::getNum(), WXP::Points::getX1(), WXP::Points::getY1(), and WXP::GTran::tranWindowPlotY().

◆ drawFill() [2/2]

int Graph::drawFill ( Rect rect)

◆ drawFillarea()

int Graph::drawFillarea ( Points data)

Draws a filles area (depricated)

Parameters
dataData points

References drawFill().

◆ drawFormText() [1/2]

int Graph::drawFormText ( float  x,
float  y,
const char *  format,
  ... 
)

Draws formatted text to the window

Parameters
xX point to draw the text
yY point to draw the text
formatFormat of text to plot

References drawText().

◆ drawFormText() [2/2]

int Graph::drawFormText ( Point  pt,
const char *  format,
  ... 
)

Draws formatted text to the window

Parameters
ptPoint to draw the text
formatFormat of text to plot

References drawText(), WXP::Point::x, and WXP::Point::y.

◆ drawImage() [1/2]

int Graph::drawImage ( Image image,
float  x,
float  y 
)

Draws an image to the window at a specific location

Parameters
imageImage to draw to window
xX location of upper left corner
yY location of upper left corner

References WXP::GTran::tranWindowPlotX(), and WXP::GTran::tranWindowPlotY().

◆ drawImage() [2/2]

int Graph::drawImage ( Image image,
int  color,
float  x,
float  y 
)

Draws an image to the window at a specific location using a transparent color

Parameters
imageImage to draw to window
colorTransparent color value
xX location of upper left corner
yY location of upper left corner

References WXP::GTran::tranWindowPlotX(), and WXP::GTran::tranWindowPlotY().

◆ drawLine() [1/3]

int Graph::drawLine ( float  x1,
float  y1,
float  x2,
float  y2 
)

Draws a line between two points

Parameters
x1First X value
y1First Y value
x2Second X value
y2Second Y value

Referenced by WXP::Plot::drawLine(), drawLine(), WXP::Plot::drawSpline(), and drawSymbol().

◆ drawLine() [2/3]

int Graph::drawLine ( Point p1,
Point p2 
)

Draws a line between two points

Parameters
p1First point
p2Second point

References drawLine(), WXP::Point::x, and WXP::Point::y.

◆ drawLine() [3/3]

int Graph::drawLine ( Points data)

Draws a line between a set of points

Parameters
dataThe set of points

References WXP::Points::add(), WXP::Points::clear(), WXP::Points::getNum(), WXP::Points::getX1(), WXP::Points::getY1(), WXP::Points::offset(), and WXP::GTran::tranWindowPlotY().

◆ drawMark() [1/2]

int Graph::drawMark ( float  x,
float  y 
)

Draws a marker. This manages drawing the marker and calls drawMarkLine to do actual plotting.

Parameters
xX location of marker
yY location of marker

References drawMarkLine(), WXP::GTran::tranWindowPlotX(), and WXP::GTran::tranWindowPlotY().

Referenced by WXP::Plot::drawMark(), and drawMark().

◆ drawMark() [2/2]

int Graph::drawMark ( Point  pt)

Draws a marker

Parameters
ptLocation of marker

References drawMark(), WXP::Point::x, and WXP::Point::y.

◆ drawMarkLine()

int Graph::drawMarkLine ( float  x,
float  y,
float  size 
)

Draws a marker at a specific location

Parameters
xX location of marker
yY location of marker
sizeSize of marker

References WXP::Points::add(), and WXP::Points::clear().

Referenced by drawMark().

◆ drawRect() [1/2]

int Graph::drawRect ( float  x1,
float  y1,
float  x2,
float  y2 
)

Draws a rectangle between two points

Parameters
x1First X value
y1First Y value
x2Second X value
y2Second Y value

References WXP::Points::add().

Referenced by WXP::Plot::drawRect(), and drawRect().

◆ drawRect() [2/2]

int Graph::drawRect ( Rect rect)

Draws a rectangle

Parameters
rectRectangle coordinates

References drawRect(), WXP::Rect::xmax, WXP::Rect::xmin, WXP::Rect::ymax, and WXP::Rect::ymin.

◆ drawSymbol() [1/2]

int Graph::drawSymbol ( float  rx,
float  ry,
const char *  string,
float  size 
)

Draws a symbol to the window

Parameters
rxX location of symbol
ryY location of symbol
stringString defining symbol to plot
sizeSize of symbol

References WXP::Points::add(), WXP::Points::clear(), drawFill(), drawLine(), WXP::Point::x, and WXP::Point::y.

Referenced by drawSymbol().

◆ drawSymbol() [2/2]

int Graph::drawSymbol ( Point  pt,
const char *  string,
float  size 
)

Draws a symbol

Parameters
ptLocation of symbol
stringString defining symbol to plot
sizeSize of symbol

References drawSymbol(), WXP::Point::x, and WXP::Point::y.

◆ drawText() [1/2]

int Graph::drawText ( float  rx,
float  ry,
const char *  string 
)

Draws text to the window. This handles both hard and soft fonts. Soft fonts go to drawTextLine for output. Hard fonts get rendered to the device in Device::drawText

Parameters
rxX location of text
ryY location of text
stringText to draw

References WXP::StrLib::copy(), WXP::Strings::getNum(), WXP::Strings::getString(), WXP::Point::set(), WXP::GTran::tranWindowPlotX(), and WXP::GTran::tranWindowPlotY().

Referenced by drawFormText(), WXP::Plot::drawFormText(), WXP::Plot::drawText(), and drawText().

◆ drawText() [2/2]

int Graph::drawText ( Point  pt,
const char *  string 
)

Draws text to the window

Parameters
ptPoint to draw the text
stringString to plot

References drawText(), WXP::Point::x, and WXP::Point::y.

◆ getDevice()

int Graph::getDevice ( String str)

Gets the device specifications

Parameters
strSpecification string

◆ getDeviceViewport() [1/2]

Rect Graph::getDeviceViewport ( )

Gets the device viewport/clip rectangle

Returns
The viewport

◆ getDeviceViewport() [2/2]

int Graph::getDeviceViewport ( Rect rect)

Gets the device viewport/clip rectangle

Return values
rectThe viewport

◆ getDropShadow()

int Graph::getDropShadow ( )

Gets drop shadow scale value. This is the amount of drop shadowing to appear. 0 means no shadowing.

◆ getFrame()

int Graph::getFrame ( )

Returns current frame index

Returns
Index of the current frame

Referenced by WXP::Plot::callback().

◆ getImage()

int Graph::getImage ( Image image)

Retrieves an image from the window

Return values
imageImage class to put window snapshot

◆ getInverse()

bool Graph::getInverse ( )

Gets the inverse setting

Returns
True if inverse

◆ getMaxViewport() [1/2]

Rect Graph::getMaxViewport ( )

Gets the maximum possible viewport on the display

Returns
The viewport

References WXP::GTran::getNdc().

◆ getMaxViewport() [2/2]

int Graph::getMaxViewport ( Rect rect)

Gets the maximum possible viewport on the display

Return values
rectThe viewport

References WXP::GTran::getNdc().

◆ getNumFrames()

int Graph::getNumFrames ( )

Returns the number of frames in the loop

Returns
Number of frames

Referenced by WXP::Plot::callback().

◆ getTran()

int Graph::getTran ( )

Gets the current transformation number

Returns
Current transformation number

Referenced by WXP::Plot::drawFill(), and WXP::Plot::drawLine().

◆ getViewport() [1/2]

Rect Graph::getViewport ( )

Returns the current viewport

Returns
The viewport rectangle

References WXP::GTran::getViewport().

◆ getViewport() [2/2]

int Graph::getViewport ( Rect rect)

Gets the current viewport

Return values
rectThe viewport rectangle

References WXP::GTran::getViewport().

◆ getWindow() [1/2]

Rect Graph::getWindow ( )

Gets the current window coordinates.

Returns
The limits of the window

References WXP::GTran::getWindow().

◆ getWindow() [2/2]

int Graph::getWindow ( Rect rect)

Gets the current window coordinates.

Return values
rectThe limits of the window

References WXP::GTran::getWindow().

◆ init()

int Graph::init ( )

Initializes the class values

Referenced by open().

◆ isLooping()

bool Graph::isLooping ( )

Returns if looping

Returns
True if looping

Referenced by WXP::Plot::callback().

◆ isManaged()

bool WXP::Graph::isManaged ( )
inline

Returns true if window managed

◆ isOpen()

bool Graph::isOpen ( )

Returns whether graphics interface is open.

Returns
True if open

◆ manage()

int Graph::manage ( )

Manages the window. Goes into a loop waiting for device events

Referenced by WXP::Plot::manage().

◆ message()

int Graph::message ( const char *  format,
  ... 
)

Outputs a message to the device

Parameters
formatFormat (see sprintf)

◆ newFrame()

int Graph::newFrame ( )

Creates a new frame on the device to plot to. Print devices its a new page. Display devices its a new frame in a loop.

Parameters
rsecsSeconds since 1/1/1970 (Unix time)

◆ open() [1/2]

int Graph::open ( )

Opens a window for drawing

References WXP::FileTool::addPath(), WXP::String::get(), WXP::Wxp::getDatabasePath(), and init().

Referenced by open().

◆ open() [2/2]

int Graph::open ( const char *  dev,
const char *  params 
)

Opens a window for drawing

References open(), and setDevice().

◆ printTran()

int Graph::printTran ( )

Prints the transformation matrices

◆ setBackground()

int Graph::setBackground ( const char *  str)

Sets the background color

Parameters
strString specifying color name

◆ setCursor()

int Graph::setCursor ( int  type)

Sets the cursor type

◆ setDevice()

int Graph::setDevice ( const char *  dev,
const char *  params 
)

Sets the device and its parameters

Parameters
devDevice
paramsString containing device specific setup commands

References WXP::StrLib::equal(), WXP::Strings::equal(), and WXP::Strings::getNum().

Referenced by Graph(), and open().

◆ setDropColor()

int Graph::setDropColor ( int  index)

Sets drop color. This is the color of the drop shadowing on drawing primitives

Parameters
indexColor index

◆ setDropShadow()

int Graph::setDropShadow ( int  val)

Sets drop shadow scale value. This is the amount of drop shadowing to appear. 0 means no shadowing.

Parameters
valDrop shadow value

Referenced by WXP::Plot::setLine().

◆ setDropWidth()

int Graph::setDropWidth ( int  val)

Sets drop shadow width. This is the width of lines to be drawn in the drop shadowing.

Parameters
valLine width

◆ setFillColor()

int Graph::setFillColor ( int  index)

Sets the fill color

Parameters
indexColor index

Referenced by WXP::Plot::setFill(), and WXP::Plot::setFillColor().

◆ setFillStyle()

int Graph::setFillStyle ( int  index)

Sets the fill style

Parameters
indexFill pattern index

Referenced by WXP::Plot::setFill(), and WXP::Plot::setFillStyle().

◆ setFixed()

int Graph::setFixed ( bool  val)

Sets whether the window is fixed in size

Parameters
val1=fixed, 0=adjustable

◆ setFont()

int Graph::setFont ( const char *  str)

Sets up fonts. Takes font specification and searches for font name in wxp.fnl file. Then, determines if font is hard or soft font.
If soft font, reads in WXP font file. If hard font, calls setFontSpec

Parameters
strFont specification string

References WXP::FileTool::addPath(), WXP::StrLib::copy(), WXP::StrLib::equal(), WXP::String::get(), WXP::Wxp::getDatabasePath(), WXP::File::getLine(), WXP::StrLib::index(), WXP::File::isOpen(), WXP::File::open(), WXP::Wxp::outWarning(), and setFontSpec().

Referenced by WXP::Plot::setText().

◆ setFontSpec()

int Graph::setFontSpec ( )

◆ setFrame()

int Graph::setFrame ( int  ind)

Specified the current drawing frame

Parameters
indIndex of the frame to draw to

Referenced by WXP::Plot::callback().

◆ setIcon()

int Graph::setIcon ( bool  val)

Sets up icon mode. This will attempt to open window in iconic state

Parameters
valTrue if icon

◆ setImageAlign()

int Graph::setImageAlign ( int  h,
int  v 
)

Specifies alignment of image (default LEFT, BOTTOM)

Parameters
hHorizontal alignment (IMAGE_HLEFT, IMAGE_HCENTER, IMAGE_HRIGHT)
vVertical alignment (IMAGE_VTOP, IMAGE_VCENTER, IMAGE_VBOTTOM)

◆ setInverse()

int Graph::setInverse ( bool  val)

Sets up inverse tag. This will invert default foreground and background colors.

Parameters
valTrue for inverse

◆ setLineColor()

int Graph::setLineColor ( int  index)

Sets the line color

Parameters
indexColor index

Referenced by WXP::Plot::setLine(), and WXP::Plot::setLineColor().

◆ setLineStyle()

int Graph::setLineStyle ( int  style)

Sets the line style

Parameters
styleStyle index

Referenced by WXP::Plot::setLine(), and WXP::Plot::setLineStyle().

◆ setLineWidth()

int Graph::setLineWidth ( float  width)

Sets the line width

Parameters
widthLine width scale factor

Referenced by WXP::Plot::setLine(), and WXP::Plot::setLineWidth().

◆ setMarkColor()

int Graph::setMarkColor ( int  index)

Sets marker color

Parameters
indexColor index

Referenced by WXP::Plot::setMark().

◆ setMarkSize()

int Graph::setMarkSize ( float  size)

Sets marker size

Parameters
sizeSize of marker in plot coordinates

Referenced by WXP::Plot::setMark().

◆ setMarkType()

int Graph::setMarkType ( int  type)

Sets the marker type

Parameters
typeMarker type index

◆ setMarkWeight()

int Graph::setMarkWeight ( float  weight)

Sets the marker line weight

Parameters
widthLine weight

Referenced by WXP::Plot::setMark().

◆ setOffset()

int Graph::setOffset ( float  rx,
float  ry 
)

Sets the offset of the window on the screen

Parameters
rxX location
ryY location

◆ setSize()

int Graph::setSize ( float  width,
float  height 
)

Sets the size of the window

Parameters
widthWidth in pixels
heightHeight in pixels

◆ setSymbol()

int Graph::setSymbol ( const char *  file)

Sets up the symbol set to use. This will read the symbols in from file.

Parameters
fileFilename of symbol data

References WXP::FileTool::addPath(), WXP::StrLib::copy(), WXP::StrLib::equal(), WXP::String::get(), and WXP::Wxp::getDatabasePath().

◆ setTextAlign()

int Graph::setTextAlign ( int  hor,
int  vert 
)

Sets the text alignment

Parameters
horHorizontal alignment: HALIGN_LEFT, HALIGN_CENTER, HALIGN_RIGHT
vertVertical alignment: VALIGN_CAP, VALIGN_TOP, VALIGN_HALF, VALIGN_BOTTOM, VALIGN_BASE

Referenced by WXP::Plot::setText().

◆ setTextBoxColor()

int Graph::setTextBoxColor ( int  index)

Sets text box color. This is the color of a box surrounding text (unimplemented)

Parameters
indexColor index

◆ setTextCharWidth()

int Graph::setTextCharWidth ( float  width)

Sets the text character width. This is used if a fixed spacing is needed for text such as use in tables, etc.

Parameters
widthCharacter width

Referenced by WXP::Plot::setText().

◆ setTextColor()

int Graph::setTextColor ( int  index)

Sets the text color

Parameters
indexColor index

Referenced by WXP::Plot::setText(), and WXP::Plot::setTextColor().

◆ setTextDirection()

int Graph::setTextDirection ( float  x,
float  y 
)

Sets text direction in terms of an up vector.

Parameters
xVector X value
yVector Y value

Referenced by WXP::Plot::setText(), and WXP::Plot::setTextDirection().

◆ setTextExpansion()

int Graph::setTextExpansion ( float  expansion)

Sets the text horizontal expansion factor

Parameters
expansionExpansion scale factor (def=1)

Referenced by WXP::Plot::setText().

◆ setTextHeight()

int Graph::setTextHeight ( float  height)

Sets the text height

Parameters
heightHeight of text in plot coordinates

References setFontSpec().

Referenced by WXP::Plot::setText().

◆ setTextSpacing()

int Graph::setTextSpacing ( float  space)

Sets text spacing. This is the amount of space between each character

Parameters
spaceSpacing value

◆ setTextWeight()

int Graph::setTextWeight ( float  weight)

Sets text line width factor. This is the width used in drawing soft font text.

Parameters
widthLine width

Referenced by WXP::Plot::setText().

◆ setTitle()

int Graph::setTitle ( const char *  str)

Sets the window title

Parameters
strWindow title

◆ setTran()

int Graph::setTran ( int  val)

Sets the current tranformation number

Parameters
valTransform number

◆ setViewport() [1/2]

int Graph::setViewport ( int  num,
Rect rect 
)

Sets the viewport for a specific transformation

Parameters
numThe transformation number
rectThe rectangle specifying viewport extent

References WXP::GTran::setViewport().

◆ setViewport() [2/2]

int Graph::setViewport ( Rect rect)

Sets the viewport for the current transformation

Parameters
rectThe rectangle specifying viewport extent

References WXP::GTran::setViewport().

◆ setViewportAspect() [1/2]

int Graph::setViewportAspect ( Rect limit,
float  aspect 
)

Sets the viewport based on drawing area specifics. The output is the largest area centered within limit of an area with aspect ratio aspect.

Parameters
limitOuter limit of drawing area
aspectAspect ratio of plot

References setViewportAspect().

◆ setViewportAspect() [2/2]

int Graph::setViewportAspect ( Rect limit,
float  aspect,
int  halign,
int  valign 
)

Sets the viewport based on drawing area specifics. The output is the largest area within limit of an area with aspect ratio aspect.

Parameters
limitOuter limit of drawing area
aspectAspect ratio of plot
halignHorizontal alignment of area
valignVertical alignment of area

References WXP::GTran::getNdc(), WXP::Wxp::isDebug(), WXP::Rect::print(), WXP::GTran::setViewport(), WXP::Rect::xmax, WXP::Rect::xmin, WXP::Rect::ymax, and WXP::Rect::ymin.

Referenced by setViewportAspect().

◆ setWindow() [1/2]

int Graph::setWindow ( int  num,
Rect rect 
)

Sets the window coordinate system for the viewport

Parameters
numThe transformation number to set
rectThe limits of the window

References WXP::GTran::setWindow().

◆ setWindow() [2/2]

int Graph::setWindow ( Rect rect)

Sets the window coordinate system for the current viewport

Parameters
rectThe limits of the window

References WXP::GTran::setWindow().

◆ tranPlotView()

int Graph::tranPlotView ( float  x1,
float  y1,
float &  x2,
float &  y2 
)

Converts plot coordinates to view coordinates

Parameters
x1The X plot coordinate
y1The Y plot coordinate
Return values
x2The X view coordinate
y2The Y view coordinate

References WXP::GTran::tranPlotNdcX(), and WXP::GTran::tranPlotNdcY().

◆ tranPlotWindow() [1/2]

int Graph::tranPlotWindow ( float  x1,
float  y1,
float &  x2,
float &  y2 
)

Converts plot coordinates to window coordinates

Parameters
x1The X plot coordinate
y1The Y plot coordinate
Return values
x2The X window coordinate
y2The Y window coordinate

References WXP::GTran::tranPlotWindowX(), and WXP::GTran::tranPlotWindowY().

Referenced by tranPlotWindow().

◆ tranPlotWindow() [2/2]

int Graph::tranPlotWindow ( Point pt1,
Point pt2 
)

Converts plot coordinates to window coordinates

Parameters
pt1The plot coordinate
Return values
pt2The window coordinate

References tranPlotWindow(), WXP::Point::x, and WXP::Point::y.

◆ tranWindow() [1/2]

int Graph::tranWindow ( int  tran1,
float  x1,
float  y1,
int  tran2,
float &  x2,
float &  y2 
)

Converts window coordinates from one transformation to another

Parameters
tran1The initial transformation
x1The initial X window coordinate
y1The initial Y window coordinate
tran2The final transformation
Return values
x2The X window coordinate
y2The Y window coordinate

References WXP::GTran::tranPlotWindowX(), WXP::GTran::tranPlotWindowY(), WXP::GTran::tranWindowPlotX(), and WXP::GTran::tranWindowPlotY().

Referenced by tranWindow().

◆ tranWindow() [2/2]

int Graph::tranWindow ( int  tran1,
Point pt1,
int  tran2,
Point pt2 
)

Converts window coordinates from one transformation to another

Parameters
tran1The initial transformation
pt1The initial window coordinates
tran2The final transformation
Return values
pt2The window coordinates

References tranWindow(), WXP::Point::x, and WXP::Point::y.

◆ unmanage()

int Graph::unmanage ( )

Unmanages the window and returns control back to the program

Referenced by WXP::Plot::callback().

◆ update()

int Graph::update ( )

Update the window.

Referenced by WXP::Plot::update().


The documentation for this class was generated from the following files: