void Grid::enableZeroLineY(bool enable) { Plot *d_plot = dynamic_cast<Plot *>(plot()); if (!d_plot) return; if (mrkY < 0 && enable) { QwtPlotMarker *m = new QwtPlotMarker(); mrkY = d_plot->insertMarker(m); m->setRenderHint(QwtPlotItem::RenderAntialiased, false); m->setAxis(xAxis(), yAxis()); m->setLineStyle(QwtPlotMarker::HLine); m->setValue(0.0, 0.0); double width = 1; if (d_plot->canvas()->lineWidth()) width = d_plot->canvas()->lineWidth(); else if (d_plot->axisEnabled(QwtPlot::xBottom) || d_plot->axisEnabled(QwtPlot::xTop)) width = d_plot->axesLinewidth(); m->setLinePen(QPen(Qt::black, width, Qt::SolidLine)); } else if (mrkY >= 0 && !enable) { d_plot->removeMarker(mrkY); mrkY = -1; } }
void Grid::enableZeroLineX(bool enable) { Plot *d_plot = (Plot *)plot(); if (!d_plot) return; if (mrkX<0 && enable) { QwtPlotMarker *m = new QwtPlotMarker(); mrkX = d_plot->insertMarker(m); m->setRenderHint(QwtPlotItem::RenderAntialiased, false); m->setAxis(xAxis(), yAxis()); m->setLineStyle(QwtPlotMarker::VLine); m->setValue(0.0, 0.0); double width = 1; if (d_plot->canvas()->lineWidth()) width = d_plot->canvas()->lineWidth(); else if (d_plot->axisEnabled (QwtPlot::yLeft) || d_plot->axisEnabled (QwtPlot::yRight)) width = d_plot->axesLinewidth(); m->setLinePen(QPen(Qt::black, width, Qt::SolidLine)); } else if (mrkX >= 0 && !enable) { d_plot->removeMarker(mrkX); mrkX=-1; } }
void QgsCurveEditorWidget::addPlotMarker( double x, double y, bool isSelected ) { QColor borderColor( 0, 0, 0 ); QColor brushColor = isSelected ? borderColor : QColor( 255, 255, 255, 0 ); QwtPlotMarker *marker = new QwtPlotMarker(); marker->setSymbol( new QwtSymbol( QwtSymbol::Ellipse, QBrush( brushColor ), QPen( borderColor, isSelected ? 2 : 1 ), QSize( 8, 8 ) ) ); marker->setValue( x, y ); marker->attach( mPlot ); marker->setRenderHint( QwtPlotItem::RenderAntialiased, true ); mMarkers << marker; }
void QgsGradientColorRampDialog::addPlotMarker( double x, double y, const QColor &color, bool isSelected ) { QColor borderColor = color.darker( 200 ); borderColor.setAlpha( 255 ); QColor brushColor = color; brushColor.setAlpha( 255 ); QwtPlotMarker *marker = new QwtPlotMarker(); marker->setSymbol( new QwtSymbol( QwtSymbol::Ellipse, QBrush( brushColor ), QPen( borderColor, isSelected ? 2 : 1 ), QSize( 8, 8 ) ) ); marker->setValue( x, y ); marker->attach( mPlot ); marker->setRenderHint( QwtPlotItem::RenderAntialiased, true ); mMarkers << marker; }
void QgsVectorGradientColorRampV2Dialog::addPlotMarker( double x, double y, const QColor& color, bool isSelected ) { QColor borderColor = color.darker( 200 ); borderColor.setAlpha( 255 ); QColor brushColor = color; brushColor.setAlpha( 255 ); QwtPlotMarker *marker = new QwtPlotMarker(); #if defined(QWT_VERSION) && QWT_VERSION>=0x060000 marker->setSymbol( new QwtSymbol( QwtSymbol::Ellipse, QBrush( brushColor ), QPen( borderColor, isSelected ? 2 : 1 ), QSize( 10, 10 ) ) ); #else marker->setSymbol( QwtSymbol( QwtSymbol::Ellipse, QBrush( brushColor ), QPen( borderColor, isSelected ? 2 : 1 ), QSize( 10, 10 ) ) ); #endif marker->setValue( x, y ); marker->attach( mPlot ); marker->setRenderHint( QwtPlotItem::RenderAntialiased, true ); mMarkers << marker; }