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

List of all members.

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 getDevice (String &str)
void callback (const char *ev_str, const char *ev_data, const void *data)
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 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 allocColor (int ind)
int setColorMap (ColorMap &cmap)
int setColorMap ()
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 setTextWidth (float width)
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 setMarkWidth (float width)
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 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 ()

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 (  ) 

Constructor.

Plot::~Plot (  ) 

Destructor - closes window

References close().


Member Function Documentation

int Plot::addLabel ( const char *  loc,
const char *  str 
)
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:
ind The index in the colormap to allocate.

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

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

void Plot::callback ( const char *  ev_str,
const char *  ev_data,
const void *  data 
) [virtual]
int Plot::close (  ) 

Close the window

References WXP::Graph::close().

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

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

Draws a circle relative to the projection

Parameters:
ept Center of circle
rad Radius of circle in km

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

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

Draws a circle

Parameters:
pt Center of circle
rad Radius of circle in projection units

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

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

int Plot::drawFill ( Rect data  ) 

Draws a filled rect

Parameters:
data Set of data points

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

int Plot::drawFill ( Points pts  ) 
int Plot::drawFillarea ( Points data  ) 

Draws a filled area

Parameters:
data Set of data points

References drawFill().

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

Draws formatted text

Parameters:
pt Data point
format Text to draw (like printf)

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

Referenced by WXP::UpaXSectPlot::draw(), and WXP::MdrPlot::draw().

int Plot::drawLine ( EarthPoints data  ) 

Draws a polyline

Parameters:
data Set of data points

References WXP::Points::add(), drawLine(), WXP::EarthPoints::get(), WXP::EarthPoints::getNum(), WXP::ColorMap::isColor(), and WXP::Domain::tran().

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

Draws a line

Parameters:
pt1 First point
pt2 Second point

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

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

Draws a line

Parameters:
x1 X coord of first point
y1 Y coord of first point
x2 X coord of second point
y2 Y coord of second point

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

Referenced by WXP::WatchPlot::draw(), WXP::UpaXSectPlot::draw(), WXP::UpaXSectCont::draw(), WXP::RedbookPlot::draw(), WXP::MetaPlot::draw(), WXP::CloudPlot::draw(), drawCircle(), WXP::NidsPlot::drawData(), WXP::MapPlot::drawLatLon(), and drawLine().

int Plot::drawMark ( Point pt  ) 

Draws a marker

Parameters:
pt Data point to put marker

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

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

Draws a marker

Parameters:
pt Data point to put marker

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

Referenced by WXP::RedbookPlot::draw(), WXP::LightPlot::draw(), and WXP::NidsPlot::drawData().

int Plot::drawRect ( Rect rect  ) 

Draws a rectangle

Parameters:
rect Coordinates of rectangle

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

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

Draws a rectangle

Parameters:
x1 X coord of first point
y1 Y coord of first point
x2 X coord of second point
y2 Y coord of second point

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

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

Draws text

Parameters:
pt Data point
text Text to draw

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

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

Draws text

Parameters:
x X location of text
y Y location of text
text Text to draw

References WXP::Point::set().

Referenced by WXP::WatchPlot::draw(), WXP::RedbookPlot::draw(), WXP::MapPlot::draw(), WXP::LightPlot::draw(), WXP::NidsPlot::drawData(), and WXP::MapPlot::drawLatLon().

int Plot::end (  ) 

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

References manage().

ColorMap Plot::getColorMap (  ) 

Returns the current active colormap

Return values:
The colormap class

Referenced by WXP::LightPlot::draw(), WXP::Lev2Plot::draw(), WXP::CityPlot::draw(), and WXP::ImagePlot::drawImage().

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().

int Plot::open (  ) 

Open the window with defaults

int Plot::setColorMap (  ) 

Resets the colormap to the default global colormap.

References WXP::ColorMap::set().

int Plot::setColorMap ( ColorMap cmap  ) 

Sets the current active colormap. Future color references will use this colormap rather than anything used prior.

Parameters:
cmap The colormap to use

References WXP::ColorMap::add(), WXP::Graph::allocColor(), WXP::ColorMap::getName(), WXP::ColorMap::getNum(), WXP::ColorMap::getRGB(), WXP::ColorMap::set(), and WXP::ColorMap::setValue().

Referenced by WXP::RcmPlot::draw(), WXP::Lev2Plot::draw(), and WXP::ImagePlot::drawImage().

int Plot::setFill ( PlotAttr attr  ) 
int Plot::setFill (  ) 
int Plot::setFillColor ( int  ind  ) 

Sets fill color from colormap index

Parameters:
ind Colormap index

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

int Plot::setFillColor ( const char *  name  ) 

Sets fill color from color name

Parameters:
ind Color name

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

Referenced by WXP::RedbookPlot::draw().

int Plot::setFillStyle ( int  index  ) 

Sets fill style

Parameters:
ind Style index

References WXP::Graph::setFillStyle().

Referenced by WXP::WatchPlot::draw(), WXP::RedbookPlot::draw(), and WXP::CloudPlot::draw().

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

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

Parameters:
loc The location (ul, uc, ur, ll, lc, lr)
str The label

References WXP::StrLib::copy().

int Plot::setLabelColor ( const char *  str  ) 

Sets the label color parameters

Parameters:
str Color string

References WXP::String::set().

int Plot::setLabelFormat ( const char *  str  ) 

Sets the label formatting for all subsequent labels

Parameters:
str Format string

References WXP::StrLib::copy().

int Plot::setLine ( PlotAttr attr  ) 
int Plot::setLine (  ) 
int Plot::setLineColor ( int  ind  ) 

Sets line color from color index

Parameters:
ind Colormap index

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

int Plot::setLineColor ( const char *  name  ) 

Sets line color from color name

Parameters:
ind Color name

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

Referenced by WXP::MapPlot::draw().

int Plot::setLineStyle ( int  style  ) 

Sets line style

Parameters:
style Line style

References WXP::Graph::setLineStyle().

int Plot::setLineWidth ( float  width  ) 

Sets line width

Parameters:
width Line width

References WXP::Graph::setLineWidth().

int Plot::setMark (  ) 
int Plot::setText (  ) 
int Plot::setTextColor ( int  ind  ) 

Sets text color from colormap index

Parameters:
ind Colormap index

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

int Plot::setTextColor ( const char *  name  ) 
int Plot::setTextDirection ( float  x,
float  y 
)

Sets text direction in terms of an up vector.

Parameters:
x Vector X value
y Vector Y value

References WXP::Graph::setTextDirection().

int Plot::update (  ) 

Updates the plot.

References WXP::Graph::update().


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

Generated on 8 Jan 2010 for WXP C++ Library by  doxygen 1.6.1