/* Copyright (c) 2008-2018 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 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 . */ /** \file jkqtpdrawingtools.cpp * \ingroup jkqtptools */ #include "jkqtplottertools/jkqtpdrawingtools.h" #include "jkqtplottertools/jkqtpenhancedpainter.h" void JKQTPplotSymbol(QPaintDevice& paintDevice, double x, double y, JKQTPgraphSymbols symbol, double size, double symbolLineWidth, QColor color, QColor fillColor) { JKQTPEnhancedPainter p(&paintDevice); JKQTPplotSymbol(p, x, y, symbol, size, symbolLineWidth, color, fillColor); } void JKQTPplotSymbol(JKQTPEnhancedPainter& painter, double x, double y, JKQTPgraphSymbols symbol, double symbolSize, double symbolLineWidth, QColor color, QColor fillColor) { painter.save(); QPen p=painter.pen(); p.setColor(color); p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, symbolLineWidth)); p.setStyle(Qt::SolidLine); painter.setPen(p); QBrush b=painter.brush(); b.setColor(fillColor); b.setStyle(Qt::SolidPattern); const double w=symbolSize; const double w2=w/2.0; const double w3=w/3.0; // calculate star cordinates as static values static int star_items=0; static double starcordsx[10]; static double starcordsy[10]; if (star_items==0) { star_items=5; double angle=360.0/double(star_items)/180.0*M_PI; for (int i=0; i lines; lines< lines; lines< lines; lines< lines; QPainterPath path; for (int i=0; i JKQTPdrawEllipse(double x, double y, double a, double b, double angle_start, double angle_end, double alpha, int controlPoints, QPointF* x_start, QPointF* x_end) { QVector result; double start=angle_start*M_PI/180.0; double stop=angle_end*M_PI/180.0; double step=(stop-start)/(double)controlPoints; while (fabs(stop-start)/step<10) step=step/2.0; double sina=sin(1.0*alpha/180.0*M_PI); double cosa=cos(1.0*alpha/180.0*M_PI); QPointF xp(x+a*cos(start)*cosa-b*sin(start)*sina, y+a*cos(start)*sina+b*sin(start)*cosa); result.append(xp); if (x_start) *x_start = xp; double t=start+step; for (int i=1; i