29 #include "../../../dataaccess/dataset/ObjectIdSet.h"
37 #include <qwt_symbol.h>
48 setStyle(QwtPlotCurve::NoCurve);
49 setPaintAttribute(QwtPlotCurve::FilterPoints );
53 m_selection->setPaintAttribute(QwtPlotCurve::FilterPoints);
64 newSymbol->setSize(QSize(2 , 2));
69 setSymbol(
new QwtSymbol( QwtSymbol::Ellipse, QBrush( Qt::gray ), QPen( Qt::black, 1 ), QSize( 8, 8 )));
85 m_selection->setPaintAttribute(QwtPlotCurve::FilterPoints);
89 setStyle(QwtPlotCurve::NoCurve);
90 setPaintAttribute(QwtPlotCurve::FilterPoints);
100 if(m_scatter->sizeX() < m_scatter->sizeY())
102 for (
size_t i = 0; i < m_scatter->sizeX(); i++)
104 samples += QPointF( m_scatter->getX(i), m_scatter->getY(i));
109 for (
size_t i = 0; i < m_scatter->sizeY(); i++)
111 samples += QPointF( m_scatter->getX(i), m_scatter->getY(i));
115 setSamples( samples );
121 delete m_scatterStyle;
138 m_scatter = newScatter;
143 return m_scatterStyle->
clone();
148 delete m_scatterStyle;
149 m_scatterStyle = newSymbol;
152 setSymbol(m_scatterStyle->getSymbol());
155 QwtSymbol* selSymbol =
new QwtSymbol( symbol()->style(), symbol()->brush().color().darker (180 ), symbol()->pen().color().darker( 180), symbol()->size());
156 QPixmap selPixmap = symbol()->pixmap();
157 selPixmap.fill(m_selColor);
158 selSymbol->setPixmap(selPixmap);
159 m_selection->setSymbol(selSymbol);
165 m_selection->detach();
167 std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >::const_iterator itObjSet;
168 QVector<QPointF> highlightedPoints;
170 for(itObjSet = oids->
begin(); itObjSet != oids->
end(); ++itObjSet)
172 std::pair<double, double> point = m_scatter->find((*itObjSet));
173 if(this->boundingRect().contains(point.first, point.second))
174 highlightedPoints.push_back(QPointF(point.first, point.second));
177 m_selection->setSamples(highlightedPoints);
179 m_selection->attach(plot());
185 const QwtScaleMap xMap = plot()->canvasMap( xAxis() );
186 const QwtScaleMap yMap = plot()->canvasMap( yAxis() );
188 const double cx = xMap.transform( point.rx());
189 const double cy = yMap.transform( point.ry() );
191 QPoint mappedPoint = QPoint(cx, cy);
193 int index = closestPoint( mappedPoint);
195 double x = sample(index).x();
196 double y = sample(index).y();
197 return m_scatter->find(x, y);
202 QwtSeriesData<QPointF>* values = data();
203 std::vector<QPointF> selected;
205 if(rect.width() == 0 && rect.height() == 0)
206 return highlight(QPoint(rect.x(), rect.y()));
209 for(
size_t i = 0; i < values->size(); ++i)
211 if( rect.contains(values->sample(i)))
212 selected.push_back(values->sample(i));
214 return m_scatter->find(selected);
219 m_selColor = selColor;
222 m_selColor.setAlpha(100);
A class used to define the style of a scatter's chart.
This class represents a set of unique ids created in the same context. i.e. from the same data set...
A class to represent a scatter's chart.
A class to represent a scatter.
std::set< ObjectId *, te::common::LessCmp< ObjectId * > >::const_iterator end() const
Returns an iterator for the object ids in container.
std::set< ObjectId *, te::common::LessCmp< ObjectId * > >::const_iterator begin() const
Returns an iterator for the object ids in container.