/* Copyright (c) 2008-2022 Jan W. Krieger () This software is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License (LGPL) for more details. You should have received a copy of the GNU Lesser General Public License (LGPL) along with this program. If not, see . */ #include "jkqtplotter/graphs/jkqtpgeobase.h" #include "jkqtplotter/jkqtpbaseplotter.h" #include "jkqtplotter/jkqtplotter.h" #include #include #include #define SmallestGreaterZeroCompare_xvsgz() if ((xvsgz>10.0*DBL_MIN)&&((smallestGreaterZero<10.0*DBL_MIN) || (xvsgzgetCurrentPlotterStyle().graphsStyle.geometricStyle.fillColorDerivationMode, c)); } void JKQTPGeoBaseFilled::setStyle(QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle) { setLineColor(color); setLineWidth(lineWidth); setLineStyle(style); setFillColor(fillColor); setFillStyle(fillStyle); } void JKQTPGeoBaseFilled::setStyle(QColor color, double lineWidth, Qt::PenStyle style) { setLineColor(color); setLineWidth(lineWidth); setLineStyle(style); } void JKQTPGeoBaseFilled::setStyle(QColor color, Qt::PenStyle style) { setLineStyle(style); setLineColor(color); } void JKQTPGeoBaseFilled::setStyle(QColor color, double lineWidth) { setLineColor(color); setLineWidth(lineWidth); } void JKQTPGeoBaseFilled::setStyle(QColor color, QColor fillColor) { setLineColor(color); setFillColor(fillColor); } void JKQTPGeoBaseFilled::setStyleTransparentFill(QColor color, double lineWidth, Qt::PenStyle style) { setLineColor(color); setLineWidth(lineWidth); setLineStyle(style); setFillColor(Qt::transparent); setFillStyle(Qt::SolidPattern); } void JKQTPGeoBaseFilled::setStyleTransparentFill(QColor color, Qt::PenStyle style) { setLineColor(color); setLineStyle(style); setFillColor(Qt::transparent); setFillStyle(Qt::SolidPattern); } void JKQTPGeoBaseFilled::setStyleTransparentFill(QColor color, double lineWidth) { setLineColor(color); setLineWidth(lineWidth); setFillColor(Qt::transparent); setFillStyle(Qt::SolidPattern); } void JKQTPGeoBaseFilled::setStyleTransparentFill(QColor color) { setLineColor(color); setFillColor(Qt::transparent); setFillStyle(Qt::SolidPattern); } void JKQTPGeoBaseFilled::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) { painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); painter.setPen(getKeyLinePen(painter, rect, parent)); painter.setBrush(getFillBrush(painter, parent)); painter.drawRect(rect-QMarginsF(1,1,1,1)); } JKQTPGeoBaseDecoratedHeadLine::JKQTPGeoBaseDecoratedHeadLine(JKQTPLineDecoratorStyle headStyle, JKQTBasePlotter *parent, DrawMode drawMode): JKQTPGeometricPlotElement(drawMode, parent) { int parStyleDummy=0; initDecoratedHeadLineStyle(parent, parStyleDummy, JKQTPPlotStyleType::Geometric); setHeadDecoratorStyle(headStyle); } JKQTPGeoBaseDecoratedHeadLine::JKQTPGeoBaseDecoratedHeadLine(JKQTBasePlotter *parent, DrawMode drawMode): JKQTPGeometricPlotElement(drawMode, parent) { initDecoratedHeadLineStyle(parent, parentPlotStyle, JKQTPPlotStyleType::Geometric); } void JKQTPGeoBaseDecoratedHeadLine::setStyle(QColor color, double lineWidth) { setLineColor(color); setLineWidth(lineWidth); } void JKQTPGeoBaseDecoratedHeadLine::setStyle(QColor color, double lineWidth, Qt::PenStyle style) { setLineColor(color); setLineWidth(lineWidth); setLineStyle(style); } void JKQTPGeoBaseDecoratedHeadLine::setStyle(QColor color, Qt::PenStyle style) { setLineColor(color); setLineStyle(style); } void JKQTPGeoBaseDecoratedHeadLine::setAlpha(float alpha) { auto color=getLineColor(); color.setAlphaF(alpha); setLineColor(color); } void JKQTPGeoBaseDecoratedHeadLine::setColor(QColor c) { setLineColor(c); } void JKQTPGeoBaseDecoratedHeadLine::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect) { painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); painter.setPen(getLinePen(painter, parent)); const double y=rect.top()+rect.height()/2.0; painter.drawLine(QLineF(rect.left(), y, rect.right(), y)); } QColor JKQTPGeoBaseDecoratedHeadLine::getKeyLabelColor() const { return getLineColor(); } JKQTPGeoBaseDecoratedLine::JKQTPGeoBaseDecoratedLine(JKQTPLineDecoratorStyle headStyle, JKQTPLineDecoratorStyle tailStyle, JKQTBasePlotter *parent, DrawMode drawMode): JKQTPGeometricPlotElement(drawMode, parent) { int parStyleDummy=0; initDecoratedLineStyle(parent, parStyleDummy, JKQTPPlotStyleType::Geometric); setTailDecoratorStyle(tailStyle); setHeadDecoratorStyle(headStyle); } JKQTPGeoBaseDecoratedLine::JKQTPGeoBaseDecoratedLine(JKQTBasePlotter *parent, DrawMode drawMode): JKQTPGeometricPlotElement(drawMode, parent) { initDecoratedLineStyle(parent, parentPlotStyle, JKQTPPlotStyleType::Geometric); } void JKQTPGeoBaseDecoratedLine::setStyle(QColor color, double lineWidth) { setLineColor(color); setLineWidth(lineWidth); } void JKQTPGeoBaseDecoratedLine::setStyle(QColor color, double lineWidth, Qt::PenStyle style) { setLineColor(color); setLineWidth(lineWidth); setLineStyle(style); } void JKQTPGeoBaseDecoratedLine::setStyle(QColor color, Qt::PenStyle style) { setLineColor(color); setLineStyle(style); } void JKQTPGeoBaseDecoratedLine::setAlpha(float alpha) { auto color=getLineColor(); color.setAlphaF(alpha); setLineColor(color); } void JKQTPGeoBaseDecoratedLine::setColor(QColor c) { setLineColor(c); } void JKQTPGeoBaseDecoratedLine::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect) { painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); QPen p=getLinePen(painter, parent); p.setColor(getKeyLabelColor()); p.setWidthF(getKeyLineWidthPx(painter,rect,parent)); painter.setPen(p); const double y=rect.top()+rect.height()/2.0; painter.drawLine(QLineF(rect.left(), y, rect.right(), y)); } QColor JKQTPGeoBaseDecoratedLine::getKeyLabelColor() const { return getLineColor(); }