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

This class defines mid-level graphics commands. Calls the Graph object for actual graphics output. More...

#include "../include/Plot.h"

Inheritance diagram for WXP::Plot:
WXP::Listener

Public Types

enum  Output { WINDOW , IMAGE , PRINT }
 
enum  DrawingType {
  DRAW_PLOT , DRAW_DATA , DRAW_MAP , DRAW_TEXT_UL ,
  DRAW_TEXT_UC , DRAW_TEXT_UR , DRAW_TEXT_LL , DRAW_TEXT_LC ,
  DRAW_TEXT_LR , DRAW_BORD
}
 
enum  TranType { TRAN_BASE , TRAN_PROJ , TRAN_OVER }
 

Public Member Functions

 Plot ()
 
 Plot (const char *param)
 
 ~Plot ()
 
int init ()
 
int open (const char *param)
 
int open ()
 
int close ()
 
int setParam (const char *param)
 
int setLogo (const char *rlogo)
 
int setFixed (bool val)
 
int getDevice (String &str)
 
void callback (const char *ev_str, const char *ev_data, const void *data)
 
int permitCallbacks (int val)
 
int initPanel ()
 
int setDefaultPanel (const char *str)
 
int setPanel (Rect &offset, float aspect, int halign, int valign)
 
int setPanel (Rect &offset, float aspect)
 
int setPanel (Rect &offset, Domain &ndomain)
 
int setPanel (Domain &domain)
 
int setPanel (Rect &offset)
 
int setPanel ()
 
int setPanel (int ind)
 
int setPanelDomain (int ind, Domain &dom)
 
int getPanelDomain (int ind, Domain &dom)
 
int setDomain (Rect &offset, float aspect, int halign, int valign)
 
int setDomain (Rect &offset, float aspect)
 
int setDomain (Rect &offset, Domain &ndomain)
 
int setDomain (Domain &domain)
 
int setDomain (DomainVal &dv)
 
int setDomain (Rect &offset)
 
int setDomain ()
 
DomainVal getDomainVal ()
 
Domain getDomain ()
 
int getProj ()
 
float getPLat ()
 
float getPLon ()
 
float getDomVert ()
 
float getDomAspect ()
 
float getDomCLat ()
 
float getDomCLon ()
 
int getDomNx ()
 
int getDomNy ()
 
float getDomDx ()
 
float getDomDy ()
 
float getVert ()
 
bool withinDomain (Point &pt)
 
bool withinDomain (EarthPoint &ept)
 
bool withinDomainExt (Point &pt, int ext)
 
bool withinDomainExt (EarthPoint &ept, int ext)
 
int whereDomain (Point &pt)
 
int whereDomain (EarthPoint &ept)
 
int newPanel (const char *params)
 
int clear ()
 
int clearRect (Rect &rect)
 
int update ()
 
int manage ()
 
bool isManaged ()
 
int end ()
 
bool isTimeSync ()
 
int setTimeSync (bool val)
 
int setDate (Date &rdate)
 
bool isDateSet ()
 
int setForeHour (float val)
 
int setDataSource (const char *str)
 
ColorMap getColorMap ()
 
int getColorMap (ColorMap &map)
 
int allocColor (int ind)
 
int setColorMap (ColorMap &cmap)
 
int getColorRGB (int ind, float &r, float &g, float &b)
 
int getColorValue (const char *name)
 
int cropLine (Point &pt1, Point &pt2)
 
int cropLine (Points &pts)
 
int drawLine (float x1, float y1, float x2, float y2)
 
int drawLine (Point &pt1, Point &pt2)
 
int drawLine (EarthPoint &ept1, EarthPoint &ept2)
 
int drawLine (GridPoint &gpt1, GridPoint &gpt2)
 
int drawLine (Points &pts)
 
int drawLine (EarthPoints &data)
 
int drawSpline (Points &data)
 
int drawSpline (EarthPoints &data)
 
int drawRect (float x1, float y1, float x2, float y2)
 
int drawRect (Rect &rect)
 
int drawCircle (Point &pt, float rad)
 
int drawCircle (EarthPoint &ept, float rad)
 
int setLineColor (const char *name)
 
int setLineColor (int ind)
 
int setLineWidth (float width)
 
int setLineStyle (int style)
 
int setLine ()
 
int setLine (PlotAttr &plot)
 
int setLine (const char *str)
 
int drawFill (Points &pts)
 
int drawFill (EarthPoints &data)
 
int drawFill (Rect &data)
 
int drawFillarea (Points &data)
 
int setFillColor (const char *name)
 
int setFillColor (int ind)
 
int setFillStyle (int index)
 
int setFill ()
 
int setFill (PlotAttr &plot)
 
int setFill (const char *str)
 
int drawText (float x, float y, const char *text)
 
int drawText (Point &pt, const char *text)
 
int drawText (EarthPoint &ept, const char *text)
 
int drawText (GridPoint &gpt, const char *text)
 
int drawFormText (Point &pt, const char *format,...)
 
int drawFormText (EarthPoint &ept, const char *format,...)
 
int setTextHeight (float height)
 
int setTextWeight (float weight)
 
int setTextAlign (int hor, int vert)
 
int setTextColor (const char *name)
 
int setTextColor (int ind)
 
int setTextExpansion (float expansion)
 
int setTextSpacing (float space)
 
int setTextCharWidth (float width)
 
int setTextDirection (float x, float y)
 
int setFont (const char *str)
 
int setDropShadow (int val)
 
int getDropShadow ()
 
int setText ()
 
int setText (PlotAttr &plot)
 
int setText (PlotAttr &plot, float scale)
 
int setText (const char *str)
 
int drawMark (float x, float y)
 
int drawMark (Point &pt)
 
int drawMark (EarthPoint &ept)
 
int drawMark (GridPoint &gpt)
 
int setMarkColor (const char *name)
 
int setMarkColor (int ind)
 
int setMarkType (const char *type)
 
int setMarkType (int type)
 
int setMarkSize (float size)
 
int setMarkWeight (float weight)
 
int setMark ()
 
int setMark (PlotAttr &plot)
 
int setMark (PlotAttr &plot, float scale)
 
int setMark (const char *str)
 
int setSymbol (const char *symbol)
 
int drawSymbol (Point pt, const char *string, float size)
 
int setImageAlign (int h, int v)
 
int drawImage (Image &image)
 
int drawImage (Image &image, int bgcolor)
 
int drawImage (Image &image, float x, float y)
 
int drawImage (Image &image, int bgcolor, float x, float y)
 
int drawImage (const char *file, float x, float y)
 
int drawImage (const char *file, float x, float y, const char *option)
 
int getTran ()
 
int activateTran (int val)
 
int setViewport (int num, Rect rect)
 
int getViewport (Rect &lim)
 
int setWindow (int num, Rect rect)
 
int getWindow (Rect &lim)
 
int tran (EarthPoint &ept, Point &pt)
 
int tran (Point &pt, EarthPoint &ept)
 
int tran (GridPoint &gpt, Point &pt)
 
int tran (Point &pt, GridPoint &gpt)
 
int tran (EarthPoint &ept, GridPoint &gpt)
 
int tran (GridPoint &gpt, EarthPoint &ept)
 
int tran (int val, Point &pt)
 
int tran (int val, GridPoint &gpt)
 
int tran (int val, EarthPoint &ept)
 
int tran (Domain &dom, Point &pt1, Point &pt2)
 
int tranPlotWindow (float x1, float y1, float &x2, float &y2)
 
int tranWindow (int tran1, Point &pt1, int tran2, Point &pt2)
 
int adjustDom (Point &pt)
 
int adjustDom (Points &pts)
 
float adjustDir (float dir, Point &pt)
 
int offsetPoint (Point pt, float dir, float rad, Point &opt)
 
int offsetPoint (EarthPoint pt, float dir, float rad, EarthPoint &opt)
 
float getMapFactor (EarthPoint ept)
 
int getInverse ()
 
int addCallback (const char *ev, Listener *list, const void *data)
 
int message (const char *str,...)
 
int getViewDomain (Domain &domain)
 
int drawBorder ()
 
int saveImage (const char *file, const char *type)
 
int saveImage (const char *file)
 
int getImage (Image &image)
 
int setLabelColor (const char *str)
 
int setLabelFormat (const char *str)
 
int addLabel (const char *loc, const char *label)
 
int setLabel (const char *loc, const char *label)
 
int getLabelPosIndex (const char *str)
 
int printLabels ()
 
int formatLabel (const char *form, char *str, int len)
 
int clearLabels ()
 
int drawLabels ()
 
int setBarLocate (const char *str)
 
int setBarRange (Range &rrange)
 
int setBar (ColorFill &rfile, Range &rrange)
 
int setBar (ColorFill &rfill)
 
int setBar (Enhance &renh)
 
int drawBar (Range &rrange)
 
int drawEnhBar ()
 
int drawBar ()
 
int setCursor (int type)
 
int done ()
 
int newFrame ()
 
int clearFrame ()
 
int deleteFrame (int ind)
 
int deleteAllFrames ()
 
int setFull (int val)
 
int getFull ()
 
int setDrawing (const char *str)
 
bool isDrawing (int ind)
 
int printDrawing ()
 
int wrapLine (Points &pts)
 
int offsetLine (Points &pts, int flag)
 
int printTran ()
 
int printDomain ()
 
virtual void callback (const char *ev_str, const char *ev_data, const void *data)=0
 

Static Public Member Functions

static int decodeGeometryStr (const char *str, GeomBox &geom)
 
static int decodePanelStr (Rect rect, const char *str, GeomBox &geom)
 

Detailed Description

This class defines mid-level graphics commands. Calls the Graph object for actual graphics output.

Author
Dan Vietor

Constructor & Destructor Documentation

◆ Plot()

Plot::Plot ( )

Constructor.

◆ ~Plot()

Plot::~Plot ( )

Destructor - closes window

References close().

Member Function Documentation

◆ addLabel()

int Plot::addLabel ( const char *  loc,
const char *  str 
)

◆ allocColor()

int Plot::allocColor ( int  ind)

Allocates a color in the color table. Looks in colormap and gets RGB values and then adds them to the device color table. The return is the hardware color value that is then saved in the colormap.

Parameters
indThe index in the colormap to allocate.

References WXP::Graph::allocColor(), WXP::ColorMap::get(), WXP::ColorMap::getNum(), and WXP::ColorMap::setValue().

Referenced by setFill(), setFillColor(), setLine(), setLineColor(), and setTextColor().

◆ callback()

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

◆ close()

int Plot::close ( )

Close the window

References WXP::Graph::close().

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

◆ drawCircle() [1/2]

int Plot::drawCircle ( EarthPoint ept,
float  rad 
)

Draws a circle relative to the projection

Parameters
eptCenter of circle
radRadius of circle in km

References WXP::Points::add(), drawLine(), WXP::ColorMap::isColor(), and WXP::Domain::offsetLatLon().

◆ drawCircle() [2/2]

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

Draws a circle

Parameters
ptCenter of circle
radRadius of circle in projection units

References WXP::Graph::drawCircle(), and WXP::ColorMap::isColor().

Referenced by WXP::NidsPlot::drawData().

◆ drawFill() [1/2]

int Plot::drawFill ( Points pts)

◆ drawFill() [2/2]

int Plot::drawFill ( Rect data)

Draws a filled rect

Parameters
dataSet of data points

References WXP::Graph::drawFill(), and WXP::ColorMap::isColor().

◆ drawFillarea()

int Plot::drawFillarea ( Points data)

Draws a filled area

Parameters
dataSet of data points

References drawFill().

◆ drawFormText()

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

◆ drawLine() [1/4]

int Plot::drawLine ( EarthPoints data)

◆ drawLine() [2/4]

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

◆ drawLine() [3/4]

int Plot::drawLine ( Point pt1,
Point pt2 
)

Draws a line

Parameters
pt1First point
pt2Second point

References WXP::Graph::drawLine(), WXP::Graph::getTran(), WXP::ColorMap::isColor(), WXP::Domain::offsetLine(), and WXP::Domain::wrapLine().

◆ drawLine() [4/4]

int Plot::drawLine ( Points pts)

◆ drawMark() [1/2]

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

◆ drawMark() [2/2]

int Plot::drawMark ( Point pt)

Draws a marker

Parameters
ptData point to put marker

References WXP::Graph::drawMark(), and WXP::ColorMap::isColor().

◆ drawRect() [1/2]

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

Draws a rectangle

Parameters
x1X coord of first point
y1Y coord of first point
x2X coord of second point
y2Y coord of second point

References WXP::Graph::drawRect(), and WXP::ColorMap::isColor().

Referenced by WXP::ThermPlot::draw(), and WXP::XSectionPlot::draw().

◆ drawRect() [2/2]

int Plot::drawRect ( Rect rect)

Draws a rectangle

Parameters
rectCoordinates of rectangle

References WXP::Graph::drawRect(), and WXP::ColorMap::isColor().

◆ drawSpline()

int Plot::drawSpline ( Points data)

◆ drawText() [1/2]

int Plot::drawText ( float  x,
float  y,
const char *  text 
)

◆ drawText() [2/2]

int Plot::drawText ( Point pt,
const char *  text 
)

Draws text

Parameters
ptData point
textText to draw

References WXP::Graph::drawText(), and WXP::ColorMap::isColor().

◆ end()

int Plot::end ( )

Ends the plot. Draws border, adds labels and calls manage

References manage().

◆ getColorMap()

ColorMap Plot::getColorMap ( )

◆ manage()

int Plot::manage ( )

Manages the plot. This processes events coming in from the keyboard and mouse.

References WXP::StrLib::equal(), and WXP::Graph::manage().

Referenced by end(), and WXP::Figure::manage().

◆ open()

int Plot::open ( )

Open the window with defaults

References open().

Referenced by open().

◆ setColorMap()

int Plot::setColorMap ( ColorMap cmap)

◆ setFill() [1/2]

int Plot::setFill ( )

◆ setFill() [2/2]

int Plot::setFill ( PlotAttr attr)

◆ setFillColor() [1/2]

int Plot::setFillColor ( const char *  name)

◆ setFillColor() [2/2]

int Plot::setFillColor ( int  ind)

Sets fill color from colormap index

Parameters
indColormap index

References allocColor(), WXP::ColorMap::getValue(), WXP::ColorMap::isColor(), and WXP::Graph::setFillColor().

◆ setFillStyle()

int Plot::setFillStyle ( int  index)

◆ setLabel()

int Plot::setLabel ( const char *  loc,
const char *  str 
)

Set a label on the plot for a location (overrides any other labels)

Parameters
locThe location (ul, uc, ur, ll, lc, lr)
strThe label

References WXP::StrLib::copy(), and WXP::PlotLabel::layer.

◆ setLabelColor()

int Plot::setLabelColor ( const char *  str)

Sets the label color parameters

Parameters
strColor string

References WXP::String::set().

◆ setLabelFormat()

int Plot::setLabelFormat ( const char *  str)

Sets the label formatting for all subsequent labels

Parameters
strFormat string

References WXP::StrLib::copy().

◆ setLine() [1/2]

int Plot::setLine ( )

◆ setLine() [2/2]

int Plot::setLine ( PlotAttr attr)

◆ setLineColor() [1/2]

int Plot::setLineColor ( const char *  name)

◆ setLineColor() [2/2]

int Plot::setLineColor ( int  ind)

Sets line color from color index

Parameters
indColormap index

References allocColor(), WXP::ColorMap::getValue(), WXP::ColorMap::isColor(), and WXP::Graph::setLineColor().

◆ setLineStyle()

int Plot::setLineStyle ( int  style)

Sets line style

Parameters
styleLine style

References WXP::Graph::setLineStyle().

Referenced by WXP::ContPlot::drawLine().

◆ setLineWidth()

int Plot::setLineWidth ( float  width)

Sets line width

Parameters
widthLine width

References WXP::Graph::setLineWidth().

Referenced by WXP::MetaPlot::draw(), WXP::DatumPlot::draw(), and WXP::ContPlot::drawLine().

◆ setMark()

int Plot::setMark ( )

◆ setText()

int Plot::setText ( )

◆ setTextColor() [1/2]

int Plot::setTextColor ( const char *  name)

◆ setTextColor() [2/2]

int Plot::setTextColor ( int  ind)

Sets text color from colormap index

Parameters
indColormap index

References allocColor(), WXP::ColorMap::getValue(), WXP::ColorMap::isColor(), and WXP::Graph::setTextColor().

◆ setTextDirection()

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

Sets text direction in terms of an up vector.

Parameters
xVector X value
yVector Y value

References WXP::Graph::setTextDirection().

◆ update()

int Plot::update ( )

Updates the plot.

References WXP::Graph::update().


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