@@ -163,7 +163,7 @@ void ColormapPreview::mousePressEvent(QMouseEvent* event)
163163
164164void ColormapPreview::addDefaultLine ()
165165{
166- scene ()-> removeItem (alphaPath_ );
166+ removeDefaultLine ( );
167167 alphaPath_ = scene ()->addLine (defaultStart_.x (), defaultStart_.y (),
168168 defaultEnd_.x (), defaultEnd_.y (),
169169 alphaLinePen);
@@ -173,8 +173,7 @@ void ColormapPreview::addDefaultLine()
173173
174174void ColormapPreview::removeDefaultLine ()
175175{
176- scene ()->removeItem (alphaPath_);
177- // delete alphaPath_;
176+ delete alphaPath_;
178177 alphaPath_ = nullptr ;
179178}
180179
@@ -199,7 +198,6 @@ void ColormapPreview::addPoint(const QPointF& point)
199198
200199void ColormapPreview::drawAlphaPolyline ()
201200{
202- // qDebug() << "start drawAlphaPolyline";
203201 removeDefaultLine ();
204202 auto pathItem = new QGraphicsPathItem ();
205203 alphaPath_ = pathItem;
@@ -217,7 +215,6 @@ void ColormapPreview::drawAlphaPolyline()
217215 pathItem->setPath (path);
218216 pathItem->setZValue (0 );
219217 scene ()->addItem (alphaPath_);
220- // qDebug() << "end drawAlphaPolyline";
221218}
222219
223220void ColormapPreview::clearAlphaPoints ()
@@ -237,12 +234,6 @@ void ColormapPreview::updateAlphaFunction()
237234{
238235 // from v4, color endpoints (0 and 1) are fixed at alpha = 0.5.
239236 // alphaFunction_ will sample from in between these endpoints, evenly spaced throughout open interval (0,1)
240- // qDebug() << "Updating alpha function.";
241-
242-
243- // qDebug() << "alpha point set:";
244- // for (const auto& p : alphaPoints_)
245- // qDebug() << p;
246237
247238 for (int i = 0 ; i < static_cast <int >(alphaFunction_.size ()); ++i)
248239 {
@@ -256,7 +247,6 @@ void ColormapPreview::updateAlphaFunction()
256247 else
257248 {
258249 alphaFunction_[i] = DEFAULT_ALPHA;
259- // qDebug() << "Color: " << color << "Alpha: " << 0.5;
260250 }
261251 }
262252}
@@ -266,7 +256,6 @@ std::pair<QPointF,QPointF> ColormapPreview::alphaLineEndpointsAtColor(double col
266256 auto rightIter = alphaPoints_.upper_bound (colorToPoint (color));
267257 auto right = *rightIter;
268258 auto left = *(--rightIter);
269- // qDebug() << "alphaLineEndpointsAtColor: " << color << " sceneX " << sceneX << "left point " << left << " right point " << right;
270259 return {left, right};
271260}
272261
@@ -279,7 +268,6 @@ double ColormapPreview::interpolateAlphaLineValue(const QPointF& leftEndpoint, c
279268 const double intercept = rightEndpoint.y () - slope * rightEndpoint.x ();
280269 double alpha = pointYToAlpha (slope * colorToPoint (color).x () + intercept);
281270
282- // qDebug() << "interpolateAlphaLineValue: " << color << "Alpha: " << alpha << "between points" << leftEndpoint << rightEndpoint;
283271 return alpha;
284272}
285273
0 commit comments