#include <Pen.h>
Public Member Functions | |
Qt::PenCapStyle | capStyle () const |
const QColor & | color () const |
Qt::PenJoinStyle | joinStyle () const |
Pen & | operator= (const Pen &o) |
bool | operator== (const Pen &o) const |
Pen () | |
Pen (Qt::PenStyle style) | |
Pen (const QColor &col, double width=0, Qt::PenStyle style=Qt::SolidLine) | |
Pen (const QColor &col, double width, Qt::PenStyle s, Qt::PenCapStyle c, Qt::PenJoinStyle j) | |
Pen (const Pen &o) | |
QPen | qpen (double dotpercm) const |
int | screenWidth (double dotpercm) const |
void | setCapStyle (Qt::PenCapStyle c) |
void | setColor (const QColor &c) |
void | setJoinStyle (Qt::PenJoinStyle j) |
void | setStyle (Qt::PenStyle s) |
void | setWidth (double w) |
Qt::PenStyle | style () const |
double | width () const |
virtual const QString & | xml_tagName () const |
virtual | ~Pen () |
Static Public Member Functions | |
static QString | capStyleName (Qt::PenCapStyle s) |
static Qt::PenCapStyle | capStyleValue (QString s) |
static QString | joinStyleName (Qt::PenJoinStyle s) |
static Qt::PenJoinStyle | joinStyleValue (QString s) |
static QString | styleName (Qt::PenStyle s) |
static Qt::PenStyle | styleValue (QString s) |
Static Public Attributes | |
static const Pen | null |
static const QString | xmlPenTag = "Pen" |
Protected Member Functions | |
virtual XMLMember | xml_member (XML_MEMBER_ARGS) |
virtual bool | xml_setProperty (XML_SETPROPERTY_ARGS) |
virtual void | xml_writeProperties (XML_WRITEPROPERTIES_ARGS) const |
SciFigs::Pen::Pen | ( | ) | [inline] |
{ _color=Qt::black; _style=Qt::SolidLine; _capStyle=Qt::FlatCap; _joinStyle=Qt::MiterJoin; _width=0.3; }
SciFigs::Pen::Pen | ( | Qt::PenStyle | style | ) | [inline] |
SciFigs::Pen::Pen | ( | const QColor & | col, |
double | width = 0 , |
||
Qt::PenStyle | style = Qt::SolidLine |
||
) | [inline] |
SciFigs::Pen::Pen | ( | const QColor & | col, |
double | width, | ||
Qt::PenStyle | s, | ||
Qt::PenCapStyle | c, | ||
Qt::PenJoinStyle | j | ||
) | [inline] |
SciFigs::Pen::Pen | ( | const Pen & | o | ) | [inline] |
: XMLClass() { _color=o._color; _style=o._style; _capStyle=o._capStyle; _joinStyle=o._joinStyle; _width=o._width; }
virtual SciFigs::Pen::~Pen | ( | ) | [inline, virtual] |
{}
Qt::PenCapStyle SciFigs::Pen::capStyle | ( | ) | const [inline] |
Referenced by xml_writeProperties().
{return _capStyle;}
QString SciFigs::Pen::capStyleName | ( | Qt::PenCapStyle | s | ) | [static] |
References TRACE.
Referenced by xml_writeProperties().
{ TRACE; switch (s) { case Qt::SquareCap: return "SquareCap"; case Qt::RoundCap: return "RoundCap"; default: return "FlatCap"; } }
Qt::PenCapStyle SciFigs::Pen::capStyleValue | ( | QString | s | ) | [static] |
Referenced by SciFigs::LineLayer::setPenStyle(), SciFigs::LineLayer::setSymPenStyle(), and xml_setProperty().
{ if(s=="SquareCap") return Qt::SquareCap; else if(s=="RoundCap") return Qt::RoundCap; else return Qt::FlatCap; }
const QColor& SciFigs::Pen::color | ( | ) | const [inline] |
Referenced by SciFigs::LegendTableItem::data(), SciFigs::SlopeEstimator::paintData(), SciFigs::PaletteInterpole::setColors(), and xml_writeProperties().
{return _color;}
Qt::PenJoinStyle SciFigs::Pen::joinStyle | ( | ) | const [inline] |
Referenced by xml_writeProperties().
{return _joinStyle;}
QString SciFigs::Pen::joinStyleName | ( | Qt::PenJoinStyle | s | ) | [static] |
References TRACE.
Referenced by xml_writeProperties().
{ TRACE; switch (s) { case Qt::BevelJoin: return "BevelJoin"; case Qt::RoundJoin: return "RoundJoin"; default: return "MiterJoin"; } }
Qt::PenJoinStyle SciFigs::Pen::joinStyleValue | ( | QString | s | ) | [static] |
Referenced by SciFigs::LineLayer::setPenStyle(), SciFigs::LineLayer::setSymPenStyle(), and xml_setProperty().
{ if(s=="BevelJoin") return Qt::BevelJoin; else if(s=="RoundJoin") return Qt::RoundJoin; else return Qt::MiterJoin; }
{ _color=o._color; _style=o._style; _capStyle=o._capStyle; _joinStyle=o._joinStyle; _width=o._width; return *this; }
bool SciFigs::Pen::operator== | ( | const Pen & | o | ) | const [inline] |
QPen SciFigs::Pen::qpen | ( | double | dotpercm | ) | const [inline] |
References TRACE.
Referenced by SciFigs::LegendItemDisplay::paint(), SciFigs::Symbol::paint(), SciFigs::LegendWidget::paint(), and SciFigs::ParallelBands::paintData().
{ TRACE; return QPen(QBrush( _color), round(0.1 * _width * dotpercm), _style, _capStyle, _joinStyle); }
int SciFigs::Pen::screenWidth | ( | double | dotpercm | ) | const [inline] |
Referenced by SciFigs::LegendItemDisplay::sizeHint().
{ return (int) floor(0.1 * _width * dotpercm + 0.5); }
void SciFigs::Pen::setCapStyle | ( | Qt::PenCapStyle | c | ) | [inline] |
Referenced by SciFigs::LineLayer::setPenStyle(), SciFigs::LineLayer::setSymPenStyle(), and xml_setProperty().
{_capStyle=c;}
void SciFigs::Pen::setColor | ( | const QColor & | c | ) | [inline] |
void SciFigs::Pen::setJoinStyle | ( | Qt::PenJoinStyle | j | ) | [inline] |
Referenced by SciFigs::LineLayer::setPenStyle(), SciFigs::LineLayer::setSymPenStyle(), and xml_setProperty().
{_joinStyle=j;}
void SciFigs::Pen::setStyle | ( | Qt::PenStyle | s | ) | [inline] |
Referenced by SciFigs::LegendTableItem::setData(), SciFigs::LineLayer::setPenStyle(), SciFigs::LineLayer::setSymPenStyle(), and xml_setProperty().
{_style=s;}
void SciFigs::Pen::setWidth | ( | double | w | ) | [inline] |
Referenced by SciFigs::LegendTableItem::setData(), SciFigs::LineLayer::setPenStyle(), and SciFigs::LineLayer::setSymPenStyle().
{_width=w;}
Qt::PenStyle SciFigs::Pen::style | ( | ) | const [inline] |
Referenced by SciFigs::LegendTableItem::data(), Pen(), and xml_writeProperties().
{return _style;}
QString SciFigs::Pen::styleName | ( | Qt::PenStyle | s | ) | [static] |
References TRACE.
Referenced by xml_writeProperties().
{ TRACE; switch (s) { case Qt::SolidLine: return "SolidLine"; case Qt::DashLine: return "DashLine"; case Qt::DotLine: return "DotLine"; case Qt::DashDotLine: return "DashDotLine"; case Qt::DashDotDotLine: return "DashDotDotLine"; default: return "NoPen"; } }
Qt::PenStyle SciFigs::Pen::styleValue | ( | QString | s | ) | [static] |
Referenced by SciFigs::LineLayer::setPenStyle(), SciFigs::LineLayer::setSymPenStyle(), and xml_setProperty().
{ if(s=="SolidLine") return Qt::SolidLine; else if(s=="DashLine") return Qt::DashLine; else if(s=="DotLine") return Qt::DotLine; else if(s=="DashDotLine") return Qt::DashDotLine; else if(s=="DashDotDotLine") return Qt::DashDotDotLine; else return Qt::NoPen; }
double SciFigs::Pen::width | ( | ) | const [inline] |
Referenced by SciFigs::LegendTableItem::data(), SciFigs::LegendWidget::paint(), and Pen().
{return _width;}
XMLMember SciFigs::Pen::xml_member | ( | XML_MEMBER_ARGS | ) | [protected, virtual] |
Re-implement this function to offer XML restore (children and properties) support to your class.
From tag and map (with contains the attibute value) return a unique identifier under the format of a XMLMember. XMLMember is initialized with 3 types of contructors:
Map of attributes can be inspected in this way (can be achived also in xml_setProperty()):
static const QString tmp("childrenName"); XMLRestoreAttributeIterator it=map.find(tmp); if(it!=map.end()) { // found attribute "childrenName" }
If the map of attributes is not used:
Q_UNUSED(attributes); if(tag=="x1") return XMLMember(0); else if(tag=="y1") return XMLMember(1); else if(tag=="x2") return XMLMember(2); else if(tag=="y2") return XMLMember(3); else return XMLMember(XMLMember::Unknown);
Arithmetic operations + and - apply to XMLMember to avoid confusion of property id numbers between inherited objects. Offset 3 corresponds to the number of properties defined in this object.
if(tag=="anInteger") return XMLMember(0); else if(tag=="aString") return XMLMember(1); else if(tag=="aDouble") return XMLMember(2); return AbstractLine::xml_member(tag, attributes, context)+3;
For the arguments of this function use Macro XML_MEMBER_ARGS.
Reimplemented from QGpCoreTools::XMLClass.
References TRACE.
{ TRACE; Q_UNUSED(attributes); Q_UNUSED(context); if(tag=="color") return XMLMember(0); else if(tag=="style") return XMLMember(1); else if(tag=="capStyle") return XMLMember(2); else if(tag=="joinStyle") return XMLMember(3); else if(tag=="width") return XMLMember(4); return XMLMember(XMLMember::Unknown); }
bool SciFigs::Pen::xml_setProperty | ( | XML_SETPROPERTY_ARGS | ) | [protected, virtual] |
Re-implement this function to offer XML restore properties support to your class.
From memberID set the corresponding property with value content. The map of attributes is given as a supplementary information (not useful in all cases).
For a general case:
Q_UNUSED(attributes); double val=content.toDouble(); switch (memberID) { case 0: _x1=val; return true; case 1: _y1=val; return true; case 2: _x2=val; return true; case 3: _y2=val; return true; default: return false; }
For classes inheriting other classes (see also xml_member())
switch (memberID) { case 0: _anInteger=content.toString(); return true; case 1: _aString=content.toInt(); return true; case 2: _aDouble=content.toDouble(); return true; default: return AbstractLine::xml_setProperty(memberID-3, map, content);
For the arguments of this function use Macro XML_SETPROPERTY_ARGS.
Reimplemented from QGpCoreTools::XMLClass.
References capStyleValue(), joinStyleValue(), setCapStyle(), setColor(), setJoinStyle(), setStyle(), styleValue(), and TRACE.
{ TRACE; Q_UNUSED(tag); Q_UNUSED(attributes); Q_UNUSED(context); switch (memberID) { case 0: { QColor col(content.toString()); setColor(col); return true; } case 1: setStyle(styleValue(content.toString())); return true; case 2: setCapStyle(capStyleValue(content.toString())); return true; case 3: setJoinStyle(joinStyleValue(content.toString())); return true; case 4: _width=content.toDouble(); return true; default: return false; } }
virtual const QString& SciFigs::Pen::xml_tagName | ( | ) | const [inline, virtual] |
Implements QGpCoreTools::XMLClass.
{return xmlPenTag;}
void SciFigs::Pen::xml_writeProperties | ( | XML_WRITEPROPERTIES_ARGS | ) | const [protected, virtual] |
Reimplemented from QGpCoreTools::XMLClass.
References capStyle(), capStyleName(), color(), joinStyle(), joinStyleName(), style(), styleName(), TRACE, and QGpCoreTools::XMLClass::writeProperty().
{ TRACE; Q_UNUSED(context); writeProperty(s, "color",color().name()); writeProperty(s, "width",_width); writeProperty(s, "style",styleName(style())); writeProperty(s, "capStyle",capStyleName(capStyle())); writeProperty(s, "joinStyle",joinStyleName(joinStyle())); }
const Pen SciFigs::Pen::null [static] |
Referenced by SciFigs::Legend::pen().
const QString SciFigs::Pen::xmlPenTag = "Pen" [static] |