137 m_thinBorderPen.setWidth (1); |
137 m_thinBorderPen.setWidth (1); |
138 |
138 |
139 // Init camera icons |
139 // Init camera icons |
140 for (const GL::EFixedCamera cam : g_Cameras) |
140 for (const GL::EFixedCamera cam : g_Cameras) |
141 { |
141 { |
142 str iconname = fmt ("camera-%1", tr (g_CameraNames[cam]).toLower()); |
142 QString iconname = fmt ("camera-%1", tr (g_CameraNames[cam]).toLower()); |
143 |
143 |
144 CameraIcon* info = &m_cameraIcons[cam]; |
144 CameraIcon* info = &m_cameraIcons[cam]; |
145 info->img = new QPixmap (getIcon (iconname)); |
145 info->img = new QPixmap (getIcon (iconname)); |
146 info->cam = cam; |
146 info->cam = cam; |
147 } |
147 } |
616 srcRect (0, 0, overlay.img->width(), overlay.img->height()); |
616 srcRect (0, 0, overlay.img->width(), overlay.img->height()); |
617 paint.drawImage (targRect, *overlay.img, srcRect); |
617 paint.drawImage (targRect, *overlay.img, srcRect); |
618 } |
618 } |
619 |
619 |
620 // Paint the coordinates onto the screen. |
620 // Paint the coordinates onto the screen. |
621 str text = fmt (tr ("X: %1, Y: %2, Z: %3"), m_hoverpos[X], m_hoverpos[Y], m_hoverpos[Z]); |
621 QString text = fmt (tr ("X: %1, Y: %2, Z: %3"), m_hoverpos[X], m_hoverpos[Y], m_hoverpos[Z]); |
622 |
622 |
623 QFontMetrics metrics = QFontMetrics (font()); |
623 QFontMetrics metrics = QFontMetrics (font()); |
624 QRect textSize = metrics.boundingRect (0, 0, m_width, m_height, Qt::AlignCenter, text); |
624 QRect textSize = metrics.boundingRect (0, 0, m_width, m_height, Qt::AlignCenter, text); |
625 |
625 |
626 paint.setPen (textpen); |
626 paint.setPen (textpen); |
695 const int j = (i + 1 < numverts) ? i + 1 : 0; |
695 const int j = (i + 1 < numverts) ? i + 1 : 0; |
696 const int h = (i - 1 >= 0) ? i - 1 : numverts - 1; |
696 const int h = (i - 1 >= 0) ? i - 1 : numverts - 1; |
697 |
697 |
698 if (gl_linelengths) |
698 if (gl_linelengths) |
699 { |
699 { |
700 const str label = str::number (poly3d[i].distanceTo (poly3d[j])); |
700 const QString label = QString::number (poly3d[i].distanceTo (poly3d[j])); |
701 QPoint origin = QLineF (poly[i], poly[j]).pointAt (0.5).toPoint(); |
701 QPoint origin = QLineF (poly[i], poly[j]).pointAt (0.5).toPoint(); |
702 paint.drawText (origin, label); |
702 paint.drawText (origin, label); |
703 } |
703 } |
704 |
704 |
705 if (gl_drawangles) |
705 if (gl_drawangles) |
710 double angle = 180 - l0.angleTo (l1); |
710 double angle = 180 - l0.angleTo (l1); |
711 |
711 |
712 if (angle < 0) |
712 if (angle < 0) |
713 angle = 180 - l1.angleTo (l0); |
713 angle = 180 - l1.angleTo (l0); |
714 |
714 |
715 str label = str::number (angle) + str::fromUtf8 (QByteArray ("\302\260")); |
715 QString label = QString::number (angle) + QString::fromUtf8 (QByteArray ("\302\260")); |
716 QPoint pos = poly[i]; |
716 QPoint pos = poly[i]; |
717 pos.setY (pos.y() + metrics.height()); |
717 pos.setY (pos.y() + metrics.height()); |
718 |
718 |
719 paint.drawText (pos, label); |
719 paint.drawText (pos, label); |
720 } |
720 } |
797 paint.drawPolygon (QPolygon (circlepoints)); |
797 paint.drawPolygon (QPolygon (circlepoints)); |
798 paint.drawPolygon (QPolygon (circle2points)); |
798 paint.drawPolygon (QPolygon (circle2points)); |
799 |
799 |
800 { // Draw the current radius in the middle of the circle. |
800 { // Draw the current radius in the middle of the circle. |
801 QPoint origin = coordconv3_2 (m_drawedVerts[0]); |
801 QPoint origin = coordconv3_2 (m_drawedVerts[0]); |
802 str label = str::number (dist0); |
802 QString label = QString::number (dist0); |
803 paint.setPen (textpen); |
803 paint.setPen (textpen); |
804 paint.drawText (origin.x() - (metrics.width (label) / 2), origin.y(), label); |
804 paint.drawText (origin.x() - (metrics.width (label) / 2), origin.y(), label); |
805 |
805 |
806 if (m_drawedVerts.size() >= 2) |
806 if (m_drawedVerts.size() >= 2) |
807 { |
807 { |
808 label = str::number (dist1); |
808 label = QString::number (dist1); |
809 paint.drawText (origin.x() - (metrics.width (label) / 2), origin.y() + metrics.height(), label); |
809 paint.drawText (origin.x() - (metrics.width (label) / 2), origin.y() + metrics.height(), label); |
810 } |
810 } |
811 } |
811 } |
812 } |
812 } |
813 } |
813 } |
829 continue; |
829 continue; |
830 |
830 |
831 paint.drawPixmap (info.destRect, *info.img, info.srcRect); |
831 paint.drawPixmap (info.destRect, *info.img, info.srcRect); |
832 } |
832 } |
833 |
833 |
834 str fmtstr = tr ("%1 Camera"); |
834 QString fmtstr = tr ("%1 Camera"); |
835 |
835 |
836 // Draw a label for the current camera in the bottom left corner |
836 // Draw a label for the current camera in the bottom left corner |
837 { |
837 { |
838 const int margin = 4; |
838 const int margin = 4; |
839 |
839 |
840 str label; |
840 QString label; |
841 label = fmt (fmtstr, tr (g_CameraNames[camera()])); |
841 label = fmt (fmtstr, tr (g_CameraNames[camera()])); |
842 paint.setPen (textpen); |
842 paint.setPen (textpen); |
843 paint.drawText (QPoint (margin, height() - (margin + metrics.descent())), label); |
843 paint.drawText (QPoint (margin, height() - (margin + metrics.descent())), label); |
844 } |
844 } |
845 |
845 |
848 { |
848 { |
849 if (m_cameraIcons[m_toolTipCamera].destRect.contains (m_pos) == false) |
849 if (m_cameraIcons[m_toolTipCamera].destRect.contains (m_pos) == false) |
850 m_drawToolTip = false; |
850 m_drawToolTip = false; |
851 else |
851 else |
852 { |
852 { |
853 str label = fmt (fmtstr, tr (g_CameraNames[m_toolTipCamera])); |
853 QString label = fmt (fmtstr, tr (g_CameraNames[m_toolTipCamera])); |
854 QToolTip::showText (m_globalpos, label); |
854 QToolTip::showText (m_globalpos, label); |
855 } |
855 } |
856 } |
856 } |
857 } |
857 } |
858 |
858 |
1833 return (y) ? cam->axisY : cam->axisX; |
1833 return (y) ? cam->axisY : cam->axisX; |
1834 } |
1834 } |
1835 |
1835 |
1836 // ============================================================================= |
1836 // ============================================================================= |
1837 // ----------------------------------------------------------------------------- |
1837 // ----------------------------------------------------------------------------- |
1838 bool GLRenderer::setupOverlay (EFixedCamera cam, str file, int x, int y, int w, int h) |
1838 bool GLRenderer::setupOverlay (EFixedCamera cam, QString file, int x, int y, int w, int h) |
1839 { |
1839 { |
1840 QImage* img = new QImage (QImage (file).convertToFormat (QImage::Format_ARGB32)); |
1840 QImage* img = new QImage (QImage (file).convertToFormat (QImage::Format_ARGB32)); |
1841 LDGLOverlay& info = getOverlay (cam); |
1841 LDGLOverlay& info = getOverlay (cam); |
1842 |
1842 |
1843 if (img->isNull()) |
1843 if (img->isNull()) |