34#include <NDEVR/Camera.h>
35#include <NDEVR/Unit.h>
53 class DESIGN_WIDGETS_API
Ruler :
public QWidget
72 Ruler(QWidget* parent =
nullptr);
79 Ruler(
bool is_horizontal,
bool is_left_or_top, QWidget* parent =
nullptr);
A specification of upper and lower bounds in N-dimensions.
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
A ResourceListener which will always be executed on the main UI thread and can be tied to a Qt Object...
Represents a color in the RGB space with optional alpha transparency.
A widget meant to be placed beside a camera view showing either directional or measurement markings d...
RGBColor labelBackground()
Returns the background color for the label.
QScrollArea * m_scroll_area_target
The scroll area this ruler is synchronized with.
Vector< 2, uint01 > m_label_axis
The axis mapping for label positioning.
LabelMode m_label_mode
The current label display mode.
String m_label_text
The current label text.
QTResourceListener * m_coordinate_listener
Listener for coordinate system changes.
Vector< 2, uint01 > m_axis
The axis mapping for ruler dimensions.
fltp08 labelPixelLocation() const
Returns the pixel location of the label along the ruler.
Bounds< 3, fltp08 > worldBounds() const
Returns the world-space bounding box visible in the camera view.
fltp08 m_last_world_offset
The world offset from the last paint operation.
const ConstPointer< Unit > & unit() const
Returns the unit associated with the ruler's camera.
fltp08 m_scroll_scale
The scale factor for scroll area synchronization.
void paintRuler(QPainter &g2D)
Paints the ruler tick marks and labels.
fltp08 scale() const
Returns the pixels-per-world-unit scale factor.
RGBColor m_label_background
The background color for the label.
Ruler(QWidget *parent=nullptr)
Constructs a horizontal Ruler widget.
QSize sizeHint() const override
Returns the recommended size for this widget.
bool m_is_opaque
Whether the ruler background is opaque.
void setLabelMode(LabelMode mode)
Sets the label display mode.
fltp08 m_last_world_spacing
The world grid spacing from the last paint operation.
LabelMode
Controls what information is displayed as a label on the ruler.
@ e_none
No label is displayed.
@ e_camera_location
Shows the current camera location on the ruler.
@ e_selection
Shows the current selection position on the ruler.
TranslatedString getFormattedTickText(fltp08 value, fltp08 spacing, uint01 dim)
Formats a tick mark value as a display string with appropriate precision.
fltp08 m_label_location
The current label position along the ruler.
Ruler(bool is_horizontal, bool is_left_or_top, QWidget *parent=nullptr)
Constructs a Ruler widget with the specified orientation and side.
bool m_is_left_or_top
Whether the ruler is on the left or top side.
void setLabel(const String &label, const Vector< 2, fltp08 > &location=Vector< 2, fltp08 >(0.0))
Sets a label to display on the ruler at the given location.
static const int MARGIN
The pixel margin around the ruler.
bool m_is_horizontal
Whether the ruler is oriented horizontally.
String label() const
Returns the current label text.
fltp08 m_last_paint_scale
The scale factor from the last paint operation.
void setScroller(QScrollArea *scroll_area_target, fltp08 scroll_scale=1.0)
Associates a scroll area with this ruler for synchronized scrolling.
RGBColor m_last_label_background
The label background from the last paint operation.
void setCamera(const DynamicPointer< Camera > &camera)
Sets the camera whose view this ruler reflects.
String m_last_label_text
The label text from the last paint operation.
void setHorizontal(bool is_horizontal)
Sets the orientation of the ruler.
ConstPointer< Camera > m_camera
The camera this ruler tracks.
QRect m_label_rect
The bounding rectangle for the current label.
fltp08 m_last_label_location
The label location from the last paint operation.
~Ruler()
Destroys this Ruler widget.
bool m_labels_visible
Whether tick mark labels are visible.
bool m_draw_minor
Whether to draw minor tick marks.
fltp08 worldGridSpacing() const
Returns the world-space spacing between grid lines or tick marks.
uint01 dimension() const
Returns the dimension index this ruler represents.
void setLabelsVisible(bool visible)
Sets whether tick mark labels are visible.
void setAxis()
Updates the axis mapping based on the current orientation.
QTResourceListener * m_camera_listener
Listener for camera property changes.
fltp08 worldOffset() const
Returns the world-space offset for the start of the ruler.
fltp08 worldSpan() const
Returns the world-space span along this ruler's dimension.
uint04 convertModelToPixel(uint04 dim, fltp08 model)
Converts a model-space coordinate to a pixel coordinate.
void paintBackground(QPainter &g2D)
Paints the ruler background.
void paintEvent(QPaintEvent *event) override
Paints the ruler including background, tick marks, and labels.
fltp08 convertPixelToModel(uint04 dim, uint04 pixel)
Converts a pixel coordinate to a model-space coordinate.
The core String class for the NDEVR API.
A Button that toggles between on and off.
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
double fltp08
Defines an alias representing an 8 byte floating-point number.
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...