v1.0.0-rc.81
This commit is contained in:
@@ -252,6 +252,8 @@ void JFJochViewerImage::DrawSpots() {
|
||||
QColor pen_color = spot_color;
|
||||
if (s.indexed)
|
||||
pen_color = feature_color;
|
||||
else if (highlight_ice_rings && s.ice_ring)
|
||||
pen_color = ice_ring_color;
|
||||
|
||||
QPen pen(pen_color, 10);
|
||||
pen.setCosmetic(true);
|
||||
@@ -345,6 +347,8 @@ void JFJochViewerImage::DrawResolutionRings() {
|
||||
QVector<qreal> dashPattern = {10, 15};
|
||||
pen.setDashPattern(dashPattern);
|
||||
|
||||
float phi_offset = 0;
|
||||
|
||||
for (const auto &d: res_ring) {
|
||||
auto [x1,y1] = geom.ResPhiToPxl(d, 0);
|
||||
auto [x2,y2] = geom.ResPhiToPxl(d, M_PI_2);
|
||||
@@ -359,11 +363,15 @@ void JFJochViewerImage::DrawResolutionRings() {
|
||||
QRectF boundingRect(x_min, y_min, x_max - x_min, y_max-y_min);
|
||||
scene()->addEllipse(boundingRect, pen);
|
||||
|
||||
auto [x5,y5] = geom.ResPhiToPxl(d, phi_offset + 0);
|
||||
auto [x6,y6] = geom.ResPhiToPxl(d, phi_offset + M_PI_2);
|
||||
auto [x7,y7] = geom.ResPhiToPxl(d, phi_offset + M_PI);
|
||||
auto [x8,y8] = geom.ResPhiToPxl(d, phi_offset + 3.0 * M_PI_2);
|
||||
|
||||
QPointF point_1((x_max + x_min) / 2.0, y_min + 3);
|
||||
QPointF point_2((x_max + x_min) / 2.0, y_max + 3);
|
||||
QPointF point_3(x_min + 3, (y_max + y_min) / 2.0);
|
||||
QPointF point_4(x_max + 3, (y_max + y_min) / 2.0);
|
||||
QPointF point_1(x5, y5);
|
||||
QPointF point_2(x6,y6);
|
||||
QPointF point_3(x7, y7);
|
||||
QPointF point_4(x8, y8);
|
||||
std::optional<QPointF> point;
|
||||
|
||||
if (visibleRect.contains(point_1))
|
||||
@@ -376,13 +384,17 @@ void JFJochViewerImage::DrawResolutionRings() {
|
||||
point = point_4;
|
||||
|
||||
if (point) {
|
||||
QFont font("Arial", 8);
|
||||
QFont font("Arial", 16);
|
||||
|
||||
const qreal f = std::clamp(scale_factor, 0.5, 50.0);
|
||||
font.setPointSizeF(16.0 / sqrt(f)); // base 12pt around scale_factor ~10
|
||||
|
||||
QGraphicsTextItem *textItem = scene()->addText(
|
||||
QString("%1 A").arg(QString::number(d, 'g', 2)), font);
|
||||
QString("%1 Å").arg(QString::number(d, 'f', 2)), font);
|
||||
textItem->setDefaultTextColor(feature_color);
|
||||
textItem->setPos(point.value());
|
||||
}
|
||||
phi_offset += 4.0 / 180.0 * M_PI;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,3 +628,8 @@ void JFJochViewerImage::centerOnSpot(double x, double y) {
|
||||
if (x >= 0 && x < imgW && y >= 0 && y < imgH)
|
||||
centerOn(x, y);
|
||||
}
|
||||
|
||||
void JFJochViewerImage::highlightIceRings(bool input) {
|
||||
highlight_ice_rings = input;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user