/* Copyright (c) 2008-2020 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/jkqtpspecialline.h" #include "jkqtplotter/jkqtpbaseplotter.h" #include #include #include #include "jkqtplotter/jkqtptools.h" #include "jkqtplotter/jkqtpimagetools.h" #include "jkqtplotter/graphs/jkqtpimage.h" #include "jkqtplotter/jkqtpbaseelements.h" #include "jkqtplotter/jkqtplotter.h" #define SmallestGreaterZeroCompare_xvsgz() if ((xvsgz>10.0*DBL_MIN)&&((smallestGreaterZero<10.0*DBL_MIN) || (xvsgzm_specialLineType = __value; } JKQTPSpecialLineType JKQTPSpecialLineGraphBase::getSpecialLineType() const { return this->m_specialLineType; } void JKQTPSpecialLineGraphBase::setColor(QColor c) { setLineColor(c); setSymbolColor(c); setSymbolFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphsStyle.defaultGraphStyle.symbolFillColorDerivationMode, c)); setFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphsStyle.defaultGraphStyle.fillColorDerivationMode, c)); c.setAlphaF(0.5); setHighlightingLineColor(c); } JKQTPSpecialLineHorizontalGraph::JKQTPSpecialLineHorizontalGraph(JKQTBasePlotter* parent): JKQTPSpecialLineGraphBase(parent) { } JKQTPSpecialLineHorizontalGraph::JKQTPSpecialLineHorizontalGraph(JKQTPlotter* parent): JKQTPSpecialLineHorizontalGraph(parent->getPlotter()) { } void JKQTPSpecialLineHorizontalGraph::draw(JKQTPEnhancedPainter& painter) { #ifdef JKQTBP_AUTOTIMER JKQTPAutoOutputTimer jkaaot("JKQTPSpecialLineHorizontalGraph::draw"); #endif if (parent==nullptr) return; JKQTPDatastore* datastore=parent->getDatastore(); if (datastore==nullptr) return; drawErrorsBefore(painter); QPen p=getLinePen(painter, parent); QPen ph=getHighlightingLinePen(painter, parent); QPen np(Qt::NoPen); QBrush b=getFillBrush(painter, parent); int imax=0; int imin=0; if (getIndexRange(imin, imax)) { QPainterPath pl, pf; QVector ps; double xold=-1; double yold=-1; double y0=transformY(getBaseline()); if (parent->getYAxis()->isLogAxis()) { y0=transformY(parent->getYAxis()->getMin()); if (getBaseline()>0 && getBaseline()>parent->getYAxis()->getMin()) y0=transformY(getBaseline()); else y0=transformY(parent->getYAxis()->getMin()); } bool subsequentItem=false; intSortData(); for (int iii=imin; iiiget(static_cast(xColumn),static_cast(i)); const double yv=datastore->get(static_cast(yColumn),static_cast(i)); //std::cout<<"(xv, yv) = ( "<getPlotter()) { } void JKQTPSpecialLineVerticalGraph::draw(JKQTPEnhancedPainter& painter) { #ifdef JKQTBP_AUTOTIMER JKQTPAutoOutputTimer jkaaot("JKQTPSpecialLineVerticalGraph::draw"); #endif if (parent==nullptr) return; JKQTPDatastore* datastore=parent->getDatastore(); if (datastore==nullptr) return; drawErrorsBefore(painter); QPen p=getLinePen(painter, parent); QPen ph=getHighlightingLinePen(painter, parent); QPen np(Qt::NoPen); QBrush b=getFillBrush(painter, parent); int imax=0; int imin=0; if (getIndexRange(imin, imax)) { QPainterPath pl, pf; QVector ps; double xold=-1; double yold=-1; double x0=transformX(getBaseline()); if (parent->getXAxis()->isLogAxis()) { if (getBaseline()>0 && getBaseline()>parent->getXAxis()->getMin()) x0=transformX(getBaseline()); else x0=transformX(parent->getXAxis()->getMin()); } bool first=false; intSortData(); for (int iii=imin; iiiget(static_cast(xColumn),static_cast(i)); const double yv=datastore->get(static_cast(yColumn),static_cast(i)); //std::cout<<"(xv, yv) = ( "<