Source
506
506
(thisx != lastx)) {
507
507
508
508
bool reversed(m_maskedData->reverseConnect(i));
509
509
if (diffColorLine) { // set pen for colorized plot
510
510
QPen linePen;
511
511
if (!drawMaskedLine || samePen)
512
512
linePen = m_line.asQPen();
513
513
if (!drawLine)
514
514
linePen = m_maskedLine.asQPen();
515
515
thisColorBin = m_coloredData->binAt(i);
516
-
thisConnectBin = m_coloredData->connectBinAt(i);
516
+
thisConnectBin = m_coloredData->connectBinAt(i);
517
517
sameBin = (thisConnectBin==lastConnectBin);
518
518
unsigned int colorBin = thisColorBin % numBins;
519
519
QBrush coloredBrush = m_coloredBrushes[colorBin];
520
520
linePen.setBrush(coloredBrush);
521
521
QColor brushColor = coloredBrush.color();
522
522
linePen.setColor(brushColor);
523
523
p->setPen(linePen);
524
524
// compare connect bins then save for next point
525
525
if (reversed)
526
526
sameLine = sameBin && (thisx < lastx); // for colorized data
669
669
#if QWT_VERSION >= 0x060000
670
670
bool symIsPixel(m_symbol.symbol()==PlotSymbol::PIXEL),
671
671
msymIsPixel(m_maskedSymbol.symbol()==PlotSymbol::PIXEL);
672
672
std::vector<QPointF> upoints, mpoints;
673
673
QPoint qpt;
674
674
for(unsigned int i = drawIndex; i < n; i++) {
675
675
m_maskedData->xyAndMaskAt(i, tempx, tempy, mask);
676
676
// don't plot nan and inf !
677
677
if (!casacore::isNaN(tempx) && !casacore::isNaN(tempy) &&
678
678
!casacore::isInf(tempx) && !casacore::isInf(tempy)) {
679
-
if(drawSymbol && !mask) {
679
+
if(drawSymbol && !mask) { // unflagged points
680
680
for (unsigned int pt=0; pt<ptsToDraw; ++pt) {
681
+
// set point position
681
682
if (pt==0) {
682
683
qpt = QPoint(xMap.transform(tempx),yMap.transform(tempy));
683
684
} else { // conjugate for uv plot
684
685
qpt = QPoint(xMap.transform(-tempx),yMap.transform(-tempy));
685
686
}
687
+
QPointF qptf = QPointF(qpt);
688
+
689
+
// check if point is in drawing area
686
690
rect.moveCenter(qpt);
687
-
if(!brect.intersects(rect)) continue;
691
+
if (!brect.intersects(rect)) {
692
+
continue;
693
+
}
694
+
695
+
// if drawing mixed symbols, set back to unmasked pen/brush
688
696
if(drawMaskedSymbol) {
689
697
if(!samePen) p->setPen(pen);
690
698
if(!sameBrush) p->setBrush(brush);
691
699
}
692
-
if(diffColor) {
700
+
701
+
if (diffColor) {
702
+
// set pen/brush for color bin and draw point/symbol
693
703
unsigned int colorBin = (m_coloredData->binAt(i)) % numBins;
694
704
QBrush coloredBrush = m_coloredBrushes[colorBin];
695
705
QColor brushColor = coloredBrush.color();
696
706
p->setBrush(coloredBrush);
697
707
p->setPen(brushColor);
698
-
QPSymbol* coloredSym = coloredSymbol(brushColor);
699
-
coloredSym->draw(p, rect);
700
-
delete coloredSym;
708
+
if (symIsPixel) {
709
+
p->drawPoint(qptf);
710
+
} else {
711
+
QPSymbol* coloredSym = coloredSymbol(brushColor);
712
+
coloredSym->drawSymbol(p, qptf);
713
+
delete coloredSym;
714
+
}
701
715
} else {
702
-
QPointF qptf = QPointF(qpt);
716
+
// draw point/symbol in batch mode
703
717
upoints.push_back(qptf);
704
-
if (upoints.size()==15000) {
705
-
if (symIsPixel) p->drawPoints(&upoints[0], upoints.size());
706
-
else m_symbol.drawSymbols(p, &upoints[0], upoints.size());
718
+
if (upoints.size() == 15000) {
719
+
if (symIsPixel) {
720
+
p->drawPoints(&upoints[0], upoints.size());
721
+
} else {
722
+
m_symbol.drawSymbols(p, &upoints[0], upoints.size());
723
+
}
707
724
upoints.clear();
708
725
}
709
726
}
710
727
}
711
-
} else if(drawMaskedSymbol && mask) {
728
+
} else if (drawMaskedSymbol && mask) { // flagged points
712
729
for (unsigned int pt=0; pt<ptsToDraw; ++pt) {
730
+
// set point position
713
731
if (pt==0) {
714
732
qpt = QPoint(xMap.transform(tempx), yMap.transform(tempy));
715
733
} else {
716
734
qpt = QPoint(xMap.transform(-tempx), yMap.transform(-tempy));
717
735
}
736
+
QPointF qptf = QPointF(qpt);
737
+
738
+
// check if point is in drawing area
718
739
mRect.moveCenter(qpt);
719
-
if(!brect.intersects(mRect)) continue;
720
-
if(drawMaskedSymbol) {
740
+
if (!brect.intersects(mRect)) {
741
+
continue;
742
+
}
743
+
744
+
// if drawing mixed symbols, set back to masked pen/brush
745
+
if (drawSymbol) {
721
746
if(!samePen) p->setPen(mpen);
722
747
if(!sameBrush) p->setBrush(mbrush);
723
748
}
724
-
if(diffColor) {
749
+
750
+
if (diffColor) {
751
+
// set pen/brush for color bin and draw point/symbol
725
752
unsigned int colorBin = (m_coloredData->binAt(i)) % numBins;
726
753
QBrush coloredBrush = m_coloredBrushes[colorBin];
727
754
QColor brushColor = coloredBrush.color();
728
755
p->setBrush(coloredBrush);
729
756
p->setPen(brushColor);
730
-
QPSymbol* coloredSym = coloredSymbol(brushColor);
731
-
coloredSym->draw(p, mRect);
757
+
if (symIsPixel) {
758
+
p->drawPoint(qptf);
759
+
} else {
760
+
QPSymbol* coloredSym = coloredSymbol(brushColor);
761
+
coloredSym->drawSymbol(p, qptf);
762
+
delete coloredSym;
763
+
}
732
764
} else {
733
-
QPointF qptf = QPointF(qpt);
734
765
mpoints.push_back(qptf);
735
-
if (mpoints.size()==15000) {
736
-
if (msymIsPixel) p->drawPoints(&mpoints[0], mpoints.size());
737
-
else m_maskedSymbol.drawSymbols(p, &mpoints[0], mpoints.size());
766
+
if (mpoints.size() == 15000) {
767
+
if (msymIsPixel) {
768
+
p->drawPoints(&mpoints[0], mpoints.size());
769
+
} else {
770
+
m_maskedSymbol.drawSymbols(p, &mpoints[0], mpoints.size());
771
+
}
738
772
mpoints.clear();
739
773
}
740
774
}
741
775
}
742
776
}
743
777
}
744
778
}
745
779
// draw the rest
746
780
if (!diffColor && drawSymbol) {
747
781
if (symIsPixel) p->drawPoints(&upoints[0], upoints.size());