ColorPaletteWidget is used to draw colored palettes in a GraphicSheet. More...
#include <ColorPaletteWidget.h>
Public Slots | |
| Q_SCRIPTABLE void | colorInterpole (int imin, int imax) |
| virtual Q_SCRIPTABLE void | deepUpdate () |
| Q_SCRIPTABLE void | defaultBW (int n) |
| Q_SCRIPTABLE void | defaultColors (int n) |
| Q_SCRIPTABLE void | defaultHSVColors (int sat, int value, int n=10, int transparency=255) |
| Q_SCRIPTABLE void | load (QString fileName) |
| Q_SCRIPTABLE void | save (QString fileName) |
| void | setFontString (QString fs) |
| void | setLineWeight (double val) |
| void | setNumberPrecision (int p) |
| void | setNumberType (QString t) |
| Q_SCRIPTABLE void | setNumColor (int n) |
| void | setPalette (const ColorPalette &pal) |
| void | setScaleType (Scale::Type t) |
| void | setTickSize (double val) |
| void | setTitle (QString s) |
| Q_SCRIPTABLE void | setVLinear (double min, double max) |
| Q_SCRIPTABLE void | setVLog (double min, double max) |
| virtual Q_SCRIPTABLE void | update () |
Signals | |
| void | changed (ColorPalette pal) |
Public Member Functions | |
| virtual void | addProperties (PropertyProxy *pp) |
| const Axis & | axis () const |
| ColorPaletteWidget (QWidget *parent=0, Qt::WFlags f=0) | |
| ColorPaletteWidget & | operator= (const ColorPaletteWidget &o) |
| Axis::Orientation | orientation () const |
| const ColorPalette & | palette () const |
| virtual void | properties (PropertyWidget *w) const |
| virtual void | removeProperties (PropertyProxy *pp) |
| virtual void | restoreScaleFonts (int *tmp) |
| virtual int * | scaleFonts (double factor) |
| void | setAxis (const Axis &a) |
| void | setOrientation (Axis::Orientation o) |
| virtual void | setProperty (uint wid, int pid, QVariant val) |
| virtual const QString & | xml_tagName () const |
| ~ColorPaletteWidget () | |
Static Public Attributes | |
| static const QString | xmlColorPaletteWidgetTag = "ColorPaletteWidget" |
Protected Member Functions | |
| virtual bool | eventFilter (QObject *obj, QEvent *e) |
| virtual void | print (QPainter &p, double dotpercm, int x0Sheet, int y0Sheet, bool mask) |
| virtual void | resizeEvent (QResizeEvent *) |
| XMLMember | xml_member (XML_MEMBER_ARGS) |
| void | xml_polishChild (XML_POLISHCHILD_ARGS) |
| void | xml_writeChildren (XML_WRITECHILDREN_ARGS) const |
Properties | |
| QString | font |
| double | lineWeight |
| int | numberPrecision |
| QString | numberType |
| int | numPrec |
| QString | numType |
| double | tickLenght |
| double | tickLength |
| QString | title |
ColorPaletteWidget is used to draw colored palettes in a GraphicSheet.
Usually color palettes are properties of certain types of GraphContentLayer like GridPlot. It is convenient to add a visual palette below or together with a colored grid or to any plot using colors for plotting values (the pseudo third dimension). It is possible to export the palette property to a ".pal" file and to import it to a freshly created ColorPaletteWidget.
Here is an example of color palette:
Here is a basic code that adds a new palette to an existing sheet:
ColorPaletteWidget * palette= static_cast<ColorPaletteWidget *>(sheet->addObject("ColorPaletteWidget")); // Initialize palette, by default the palette has 20 colors palette->setVLinear(0,1); // Interpole linearly between 0 and 1 palette->setNumberPrecision(2); // Two digits are shown for labels palette->setTitle("Title"); palette->setPrintWidth(15.0); // Set the width in cm palette->setPrintHeight(2.0); // Set the heigh in cm palette->setPrintAnchor(Point(5.0,10.0)); sheet->showObject(palette); // Show palette and finish docking to sheet sheet->autoResizeContent(); // adjust sheet's content
| SciFigs::ColorPaletteWidget::ColorPaletteWidget | ( | QWidget * | parent = 0, |
| Qt::WFlags | f = 0 |
||
| ) |
References QGpGuiTools::ColorPalette::defaultColors(), SciFigs::AxisWindow::graphContent(), SciFigs::Axis::North, SciFigs::GraphContent::setGridLines(), setOrientation(), SciFigs::Axis::setOrientationBlocked(), SciFigs::ColorPaletteLayer::setPalette(), SciFigs::GraphicObject::setPrintHeight(), SciFigs::GraphicObject::setPrintWidth(), SciFigs::Axis::setRange(), SciFigs::Axis::setTitle(), QGpGuiTools::ColorPalette::setVLinear(), QGpCoreTools::tr(), TRACE, w, SciFigs::AxisWindow::xAxis(), and SciFigs::AxisWindow::yAxis().
:
GraphicObject(parent, f)
{
TRACE;
AxisWindow * w=new AxisWindow(this);
w->yAxis()->setEnabled(false);
w->xAxis()->setTitle(tr( "Title" ));
w->xAxis()->setObjectName( "paletteAxis" );
w->graphContent()->setGridLines(false);
// Grab all mouse events
w->xAxis()->installEventFilter(this);
w->yAxis()->installEventFilter(this);
w->graphContent()->installEventFilter(this);
w->installEventFilter(this);
connect(w->xAxis(), SIGNAL(orientationChanged()), this, SLOT(setOrientation()));
w->xAxis()->setOrientationBlocked(false);
w->yAxis()->setOrientationBlocked(false);
_paletteLayer=new ColorPaletteLayer(w);
ColorPalette pal;
pal.defaultColors(128);
pal.setVLinear(0, 1);
_paletteLayer->setPalette(pal);
w->xAxis()->setRange(0,1);
setOrientation(Axis::North);
setPrintWidth(15);
setPrintHeight(2);
}
| void SciFigs::ColorPaletteWidget::addProperties | ( | PropertyProxy * | pp | ) | [virtual] |
Setup property editor
Reimplemented from SciFigs::GraphicObject.
References QGpGuiTools::PropertyProxy::addCategory(), SciFigs::Axis::addProperties(), QGpGuiTools::PropertyProxy::addReference(), QGpGuiTools::PropertyProxy::addTab(), axis(), QGpGuiTools::PropertyProxy::setCurrentCategory(), QGpGuiTools::PropertyProxy::setCurrentTab(), QGpCoreTools::tr(), and TRACE.
{
TRACE;
GraphicObject::addProperties(pp);
if( !pp->setCurrentCategory(_category) ) {
pp->addCategory(_category, tr("Palette"), QIcon( ":/images/ColorPaletteWidget.png"));
}
if(pp->setCurrentTab(_tabPalette)) {
pp->addReference(this);
} else {
PaletteProperties * w=new PaletteProperties;
pp->addTab(_tabPalette, tr("Palette"), w, this);
}
axis().addProperties(pp);
}
| const Axis & SciFigs::ColorPaletteWidget::axis | ( | ) | const |
| void SciFigs::ColorPaletteWidget::changed | ( | ColorPalette | pal | ) | [signal] |
Referenced by colorInterpole(), defaultBW(), defaultColors(), defaultHSVColors(), operator=(), setNumColor(), setPalette(), setProperty(), setVLinear(), setVLog(), and xml_polishChild().
| void SciFigs::ColorPaletteWidget::colorInterpole | ( | int | imin, |
| int | imax | ||
| ) | [slot] |
References changed(), QGpGuiTools::ColorPalette::colorHSVInterpole(), and SciFigs::ColorPaletteLayer::setPalette().
{
ColorPalette pal;
pal.colorHSVInterpole(imin, imax);
_paletteLayer->setPalette(pal);
emit changed(pal);
}
| void SciFigs::ColorPaletteWidget::deepUpdate | ( | ) | [virtual, slot] |
Forward deep update to internal graph
Reimplemented from SciFigs::GraphicObject.
References SciFigs::AxisWindow::deepUpdate(), SciFigs::GraphContentLayer::graph(), TRACE, SciFigs::GraphicObject::transparentMask(), and SciFigs::GraphicObject::updateMask().
{
TRACE;
_paletteLayer->graph()->deepUpdate();
if(transparentMask()) updateMask();
}
| void SciFigs::ColorPaletteWidget::defaultBW | ( | int | n | ) | [slot] |
References changed(), QGpGuiTools::ColorPalette::defaultBW(), and SciFigs::ColorPaletteLayer::setPalette().
{
ColorPalette pal;
pal.defaultBW(n);
_paletteLayer->setPalette(pal);
emit changed(pal);
}
| void SciFigs::ColorPaletteWidget::defaultColors | ( | int | n | ) | [slot] |
References changed(), QGpGuiTools::ColorPalette::defaultColors(), and SciFigs::ColorPaletteLayer::setPalette().
Referenced by ArrayGui::ArrayResponse::ArrayResponse().
{
ColorPalette pal;
pal.defaultColors(n);
_paletteLayer->setPalette(pal);
emit changed(pal);
}
| void SciFigs::ColorPaletteWidget::defaultHSVColors | ( | int | sat, |
| int | value, | ||
| int | n = 10, |
||
| int | transparency = 255 |
||
| ) | [slot] |
References changed(), QGpGuiTools::ColorPalette::defaultHSVColors(), and SciFigs::ColorPaletteLayer::setPalette().
Referenced by MonoStation::AbstractSummary::createBubbleGraph(), MonoStation::AbstractSummary::createSpectrumGridGraph(), DinverDCGui::DCModelViewer::DCModelViewer(), and PSViewer::PSViewer().
{
ColorPalette pal;
pal.defaultHSVColors(sat, value, n, transparency);
_paletteLayer->setPalette(pal);
emit changed(pal);
}
| bool SciFigs::ColorPaletteWidget::eventFilter | ( | QObject * | obj, |
| QEvent * | e | ||
| ) | [protected, virtual] |
References SciFigs::GraphContentLayer::graph(), SciFigs::GraphicObject::mouseDoubleClickEvent(), SciFigs::GraphicObject::mouseMoveEvent(), SciFigs::GraphicObject::mousePressEvent(), SciFigs::GraphicObject::mouseReleaseEvent(), and TRACE.
{
TRACE;
QMouseEvent * me;
switch(e->type()) {
case QEvent::MouseButtonDblClick:
me=convertMouseEvent(obj,e);
GraphicObject::mouseDoubleClickEvent(me);
delete me;
return true;
case QEvent::MouseButtonPress:
me=convertMouseEvent(obj,e);
GraphicObject::mousePressEvent(me);
delete me;
return true;
case QEvent::MouseButtonRelease:
me=convertMouseEvent(obj,e);
GraphicObject::mouseReleaseEvent(me);
delete me;
return true;
case QEvent::MouseMove:
if(obj==_paletteLayer->graph()) {
GraphicObject::mouseMoveEvent(static_cast<QMouseEvent *>(e));
return true;
} else {
return false;
}
default:
return false;
}
}
| void SciFigs::ColorPaletteWidget::load | ( | QString | fileName | ) | [slot] |
References SciFigs::XMLSciFigs::Data, QGpCoreTools::XMLErrorReport::exec(), SciFigs::XMLSciFigs::restoreFile(), QGpCoreTools::XMLErrorReport::setFileName(), setPalette(), QGpCoreTools::XMLErrorReport::setTitle(), QGpCoreTools::tr(), and TRACE.
{
TRACE;
if(fileName.length()>0) {
XMLErrorReport xmler(XMLErrorReport::Read);
xmler.setTitle(tr("Load palette"));
xmler.setFileName(fileName);
XMLSciFigs s;
ColorPalette pal;
if(xmler.exec(s.restoreFile(fileName,&pal,XMLSciFigs::Data))) {
setPalette(pal);
}
}
}
| ColorPaletteWidget & SciFigs::ColorPaletteWidget::operator= | ( | const ColorPaletteWidget & | o | ) |
References SciFigs::ColorPaletteLayer::axisType, changed(), SciFigs::GraphContentLayer::graph(), SciFigs::ColorPaletteLayer::palette(), palette(), SciFigs::ColorPaletteLayer::setAxisType(), SciFigs::ColorPaletteLayer::setPalette(), TRACE, w, SciFigs::AxisWindow::xAxis(), and SciFigs::AxisWindow::yAxis().
{
TRACE;
_paletteLayer->setPalette(o._paletteLayer->palette());
_paletteLayer->setAxisType(o._paletteLayer->axisType());
AxisWindow * w=_paletteLayer->graph();
AxisWindow * ow=o._paletteLayer->graph();
*w->xAxis()=*ow->xAxis();
*w->yAxis()=*ow->yAxis();
GraphicObject::operator=(o);
emit changed(palette());
return *this;
}
| Axis::Orientation SciFigs::ColorPaletteWidget::orientation | ( | ) | const [inline] |
Referenced by setAxis().
{return axis().orientation();}
| const ColorPalette & SciFigs::ColorPaletteWidget::palette | ( | ) | const |
References SciFigs::ColorPaletteLayer::palette(), and TRACE.
Referenced by MonoStation::AbstractSummary::createBubbleGraph(), ArrayGui::ArrayResponse::createObjects(), MonoStation::AbstractSummary::createSpectrumGridGraph(), DinverDCGui::DCModelViewer::initGraphs(), operator=(), PSViewer::palette(), properties(), save(), setProperty(), HVRotateWinResults::setStations(), SpectrumRotateWinResults::setStations(), xml_polishChild(), and xml_writeChildren().
| void SciFigs::ColorPaletteWidget::print | ( | QPainter & | p, |
| double | dotpercm, | ||
| int | x0Sheet, | ||
| int | y0Sheet, | ||
| bool | mask | ||
| ) | [protected, virtual] |
Print the object to a Qpainter using relative coordinates. Relative coordinates are usefull for printing various pages. This basic implementation call the virtual function paint() to draw the object's content.
Reimplemented from SciFigs::GraphicObject.
References SciFigs::GraphContentLayer::graph(), SciFigs::AxisWindow::print(), SciFigs::GraphicObject::printHeight(), SciFigs::GraphicObject::printResolution(), SciFigs::GraphicObject::printWidth(), SciFigs::GraphicObject::printXAnchor(), SciFigs::GraphicObject::printYAnchor(), SciFigs::GraphicObject::setPrintResolution(), SciFigs::GraphicObject::setPrintXAnchor(), SciFigs::GraphicObject::setPrintYAnchor(), SciFigs::Axis::setSizeInfo(), SciFigs::Axis::setSizeType(), SciFigs::Axis::TotalSize, w, SciFigs::AxisWindow::xAxis(), and SciFigs::AxisWindow::yAxis().
{
AxisWindow * w=_paletteLayer->graph();
w->setPrintXAnchor(printXAnchor());
w->setPrintYAnchor(printYAnchor());
w->xAxis()->setSizeType(Axis::TotalSize);
w->xAxis()->setSizeInfo(printWidth());
w->yAxis()->setSizeType(Axis::TotalSize);
w->yAxis()->setSizeInfo(printHeight());
w->setPrintResolution(printResolution());
w->print(p, dotpercm, x0Sheet, y0Sheet, mask);
}
| void SciFigs::ColorPaletteWidget::properties | ( | PropertyWidget * | w | ) | const [virtual] |
Reimplemented from SciFigs::GraphicObject.
References QGpGuiTools::PropertyWidget::id(), SciFigs::PaletteProperties::Palette, palette(), and QGpGuiTools::PropertyWidget::setValue().
{
if(w->id()==_tabPalette) {
w->setValue(PaletteProperties::Palette, QVariant::fromValue(palette()));
} else {
GraphicObject::properties(w);
}
}
| void SciFigs::ColorPaletteWidget::removeProperties | ( | PropertyProxy * | pp | ) | [virtual] |
Cleanup property editor
Reimplemented from SciFigs::GraphicObject.
References axis(), SciFigs::Axis::removeProperties(), QGpGuiTools::PropertyProxy::removeTab(), QGpGuiTools::PropertyProxy::setCurrentCategory(), and TRACE.
{
TRACE;
GraphicObject::removeProperties(pp);
if(pp->setCurrentCategory(_category) ) {
pp->removeTab(_tabPalette, this);
axis().removeProperties(pp);
}
}
| void SciFigs::ColorPaletteWidget::resizeEvent | ( | QResizeEvent * | ) | [protected, virtual] |
Intercept resize events and forward them to its internal AxisWindow
References SciFigs::GraphContentLayer::graph(), and TRACE.
| void SciFigs::ColorPaletteWidget::restoreScaleFonts | ( | int * | fontSizeStorage | ) | [virtual] |
Restore a saved scale for fonts
Reimplemented from SciFigs::GraphicObject.
References SciFigs::GraphContentLayer::graph(), SciFigs::AxisWindow::restoreScaleFonts(), and TRACE.
{
TRACE;
_paletteLayer->graph()->restoreScaleFonts(fontSizeStorage);
}
| void SciFigs::ColorPaletteWidget::save | ( | QString | fileName | ) | [slot] |
References SciFigs::XMLSciFigs::Data, palette(), SciFigs::XMLSciFigs::saveFile(), and TRACE.
{
TRACE;
if(fileName.length()>0) {
XMLSciFigs s;
s.saveFile(fileName,&palette(),XMLSciFigs::Data);
}
}
| int * SciFigs::ColorPaletteWidget::scaleFonts | ( | double | scale | ) | [virtual] |
For some high resolution bitmap image, fonts must scaled
Re-implentation to scale fonts in sub-widgets (axis and content)
Reimplemented from SciFigs::GraphicObject.
References SciFigs::GraphContentLayer::graph(), SciFigs::AxisWindow::scaleFonts(), and TRACE.
{
TRACE;
return _paletteLayer->graph()->scaleFonts(scale);
}
| void SciFigs::ColorPaletteWidget::setAxis | ( | const Axis & | a | ) |
References axis(), orientation(), SciFigs::Axis::orientation, setOrientation(), and TRACE.
{
TRACE;
if(orientation()!=a.orientation()) {
setOrientation(a.orientation());
}
axis()=a;
}
| void SciFigs::ColorPaletteWidget::setFontString | ( | QString | fs | ) | [inline, slot] |
{axis().setFontString(fs);}
| void SciFigs::ColorPaletteWidget::setLineWeight | ( | double | val | ) | [inline, slot] |
{axis().setLineWeight(val);}
| void SciFigs::ColorPaletteWidget::setNumberPrecision | ( | int | p | ) | [inline, slot] |
Referenced by MonoStation::AbstractSummary::createBubbleGraph(), MonoStation::AbstractSummary::createSpectrumGridGraph(), DinverDCGui::DCModelViewer::DCModelViewer(), PSViewer::PSViewer(), HVRotateWinResults::setStations(), and SpectrumRotateWinResults::setStations().
{axis().setCurrentNumberPrecision(p);}
| void SciFigs::ColorPaletteWidget::setNumberType | ( | QString | t | ) | [inline, slot] |
{axis().setNumberType(Number::type(t.toAscii().data()[0]));}
| void SciFigs::ColorPaletteWidget::setNumColor | ( | int | n | ) | [slot] |
References QGpGuiTools::ColorPalette::allocate(), changed(), and SciFigs::ColorPaletteLayer::setPalette().
{
ColorPalette pal;
pal.allocate(n);
_paletteLayer->setPalette(pal);
emit changed(pal);
}
| void SciFigs::ColorPaletteWidget::setOrientation | ( | Axis::Orientation | o | ) | [inline] |
| void SciFigs::ColorPaletteWidget::setPalette | ( | const ColorPalette & | pal | ) | [slot] |
References SciFigs::ColorPaletteLayer::axisType, SciFigs::ColorPaletteLayer::boundingRect(), changed(), SciFigs::AxisWindow::deepUpdate(), SciFigs::GraphContentLayer::graph(), SciFigs::ColorPaletteLayer::setPalette(), SciFigs::Axis::setRange(), TRACE, w, QGpCoreTools::Rect::x1(), QGpCoreTools::Rect::x2(), QGpCoreTools::XAxis, SciFigs::AxisWindow::xAxis(), QGpCoreTools::Rect::y1(), QGpCoreTools::Rect::y2(), and SciFigs::AxisWindow::yAxis().
Referenced by load(), setProperty(), SpectrumRotateWinResults::setStations(), HVRotateWinResults::setStations(), and xml_polishChild().
{
TRACE;
static bool locked=false;
if(!locked) {
locked=true;
_paletteLayer->setPalette(pal);
// Adjust range of axis
AxisWindow * w=_paletteLayer->graph();
Rect r=_paletteLayer->boundingRect();
if(_paletteLayer->axisType()==XAxis) {
w->xAxis()->setRange(r.x1(), r.x2());
} else {
w->yAxis()->setRange(r.y1(), r.y2());
}
w->deepUpdate();
emit changed(pal);
locked=false;
}
}
| void SciFigs::ColorPaletteWidget::setProperty | ( | uint | wid, |
| int | pid, | ||
| QVariant | val | ||
| ) | [virtual] |
Reimplemented from SciFigs::GraphicObject.
References changed(), SciFigs::GraphContent::deepUpdate(), SciFigs::GraphContentLayer::graphContent(), SciFigs::PaletteProperties::Palette, palette(), and setPalette().
{
if(wid==_tabPalette) {
switch(pid) {
case PaletteProperties::Palette:
setPalette(val.value<ColorPalette>());
emit changed(palette());
_paletteLayer->graphContent()->deepUpdate();
break;
default:
break;
}
} else {
GraphicObject::setProperty(wid, pid, val);
}
}
| void SciFigs::ColorPaletteWidget::setScaleType | ( | Scale::Type | t | ) | [inline, slot] |
Referenced by DinverDCGui::DCModelViewer::setLimits().
{axis().setScaleType(t);}
| void SciFigs::ColorPaletteWidget::setTickSize | ( | double | val | ) | [inline, slot] |
{axis().setTickSize(val);}
| void SciFigs::ColorPaletteWidget::setTitle | ( | QString | s | ) | [inline, slot] |
Referenced by TFAResults::createObjects(), ArrayGui::ArrayResponse::createObjects(), MonoStation::AbstractSummary::createSpectrumGridGraph(), DinverDCGui::DCModelViewer::DCModelViewer(), PSViewer::PSViewer(), MonoStation::AbstractSummary::setBubbleValues(), HVRotateWinResults::setStations(), and SpectrumRotateWinResults::setStations().
{axis().setCurrentTitle(s);}
| void SciFigs::ColorPaletteWidget::setVLinear | ( | double | min, |
| double | max | ||
| ) | [slot] |
References changed(), SciFigs::ColorPaletteLayer::palette(), SciFigs::ColorPaletteLayer::setPalette(), and QGpGuiTools::ColorPalette::setVLinear().
Referenced by ArrayGui::ArrayResponse::createObjects(), DinverDCGui::DCModelViewer::DCModelViewer(), PSViewer::PSViewer(), SpectrumRotateWinResults::setLimits(), HVRotateWinResults::setLimits(), DinverDCGui::DCModelViewer::setLimits(), and PSViewer::setLimits().
{
ColorPalette pal=_paletteLayer->palette();
pal.setVLinear(min, max);
_paletteLayer->setPalette(pal);
emit changed(pal);
}
| void SciFigs::ColorPaletteWidget::setVLog | ( | double | min, |
| double | max | ||
| ) | [slot] |
References changed(), SciFigs::ColorPaletteLayer::palette(), SciFigs::ColorPaletteLayer::setPalette(), and QGpGuiTools::ColorPalette::setVLog().
Referenced by DinverDCGui::DCModelViewer::setLimits(), and PSViewer::setLimits().
{
ColorPalette pal=_paletteLayer->palette();
pal.setVLog(min, max);
_paletteLayer->setPalette(pal);
emit changed(pal);
}
| void SciFigs::ColorPaletteWidget::update | ( | ) | [virtual, slot] |
Forward update to internal graph
Reimplemented from SciFigs::GraphicObject.
References SciFigs::GraphContentLayer::graph(), TRACE, SciFigs::GraphicObject::transparentMask(), SciFigs::AxisWindow::update(), and SciFigs::GraphicObject::updateMask().
{
TRACE;
_paletteLayer->graph()->update();
if(transparentMask()) updateMask();
}
| XMLMember SciFigs::ColorPaletteWidget::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 SciFigs::GraphicObject.
References axis(), SciFigs::XMLSciFigs::data(), and TRACE.
{
TRACE;
XMLSciFigs * scifigsContext=static_cast<XMLSciFigs *>(context);
if(scifigsContext->data()) {
if(tag=="ColorPalette") return XMLMember(new ColorPalette, true);
}
if(tag=="Axis") {
return XMLMember(&axis());
}
return GraphicObject::xml_member(tag, attributes, context);
}
| void SciFigs::ColorPaletteWidget::xml_polishChild | ( | XML_POLISHCHILD_ARGS | ) | [protected, virtual] |
Reimplemented from QGpCoreTools::XMLClass.
References axis(), changed(), SciFigs::Axis::East, SciFigs::GraphContentLayer::graph(), SciFigs::Axis::North, SciFigs::Axis::orientation, palette(), SciFigs::GraphicObject::printHeight(), SciFigs::GraphicObject::printWidth(), setPalette(), SciFigs::GraphicObject::setPrintHeight(), SciFigs::GraphicObject::setPrintWidth(), SciFigs::GraphicObject::sizeChanged(), SciFigs::Axis::South, SciFigs::Axis::West, and SciFigs::AxisWindow::xml_polish().
{
if(child->xml_tagName()=="ColorPalette") {
ColorPalette * pal=static_cast<ColorPalette *>(child);
setPalette(*pal);
emit changed(palette());
} else if(child->xml_tagName()=="Axis") {
double tmp;
switch(axis().orientation()) {
case Axis::West:
case Axis::East:
tmp=printWidth();
setPrintWidth(printHeight());
setPrintHeight(tmp);
emit sizeChanged();
case Axis::South:
case Axis::North:
break;
}
// Only one axis is restored but the hidden Axiswindow must be polish
// (e.g. visible range)
_paletteLayer->graph()->xml_polish(context);
}
}
| virtual const QString& SciFigs::ColorPaletteWidget::xml_tagName | ( | ) | const [inline, virtual] |
Reimplemented from SciFigs::GraphicObject.
{return xmlColorPaletteWidgetTag;}
| void SciFigs::ColorPaletteWidget::xml_writeChildren | ( | XML_WRITECHILDREN_ARGS | ) | const [protected, virtual] |
Reimplemented from QGpCoreTools::XMLClass.
References axis(), SciFigs::XMLSciFigs::data(), palette(), TRACE, and QGpCoreTools::XMLClass::xml_save().
const QString SciFigs::ColorPaletteWidget::xmlColorPaletteWidgetTag = "ColorPaletteWidget" [static] |
QString SciFigs::ColorPaletteWidget::font [read, write] |
double SciFigs::ColorPaletteWidget::lineWeight [read, write] |
int SciFigs::ColorPaletteWidget::numberPrecision [read, write] |
QString SciFigs::ColorPaletteWidget::numberType [read, write] |
int SciFigs::ColorPaletteWidget::numPrec [read, write] |
QString SciFigs::ColorPaletteWidget::numType [read, write] |
double SciFigs::ColorPaletteWidget::tickLenght [read, write] |
double SciFigs::ColorPaletteWidget::tickLength [read, write] |
QString SciFigs::ColorPaletteWidget::title [read, write] |