Overview
TheTelescopeScopeController class provides telescope/camera framing visualization with interactive field-of-view controls. It supports circular and rectangular framing modes with configurable focal length, sensor size, and movement controls.
Class Definition
Constants
Shape Types
SHAPE_CIRCLE: str = "circle"- Circular field-of-viewSHAPE_RECT: str = "rectangle"- Rectangular field-of-view
Speed Modes
SPEED_SLOW: str = "slow"- Slow, precise movementSPEED_FAST: str = "fast"- Fast movement
Movement Rates
SLOW_HOLD_DEG_PER_S: float = 0.5 / 60.0- Slow continuous movement rate (0.5 arcmin/s)FAST_HOLD_DEG_PER_S: float = 0.5- Fast continuous movement rate (0.5 deg/s)SLOW_STEP_DEG: float = 0.05 / 60.0- Slow single step size (0.05 arcmin)FAST_STEP_DEG: float = 0.05- Fast single step size (0.05 deg)
SkyCoord Type
SensorPreset Dataclass
Available Presets
Constructor
Attributes
enabled: bool- Whether scope mode is activeawaiting_center_click: bool- Waiting for user to set center pointshape: str- Current shape mode (SHAPE_CIRCLE or SHAPE_RECT)speed_mode: str- Current speed mode (SPEED_SLOW or SPEED_FAST)focal_mm: float- Focal length in millimeters (default: 250.0)sensor_key: str- Selected sensor preset key (default: “tiny”)aspect_ratio_override: Optional[float]- Custom aspect ratio (width/height) for rectangle modecenter: Optional[SkyCoord]- Current scope center position in sky coordinatesdragging: bool- Whether user is currently dragging the scopelast_mouse: QPointF- Last mouse position during dragmanual_override: Optional[Tuple[float, float]]- Manual FOV override (width_deg, height_deg)
Methods
Activation and Configuration
shape(str) - Must be SHAPE_CIRCLE or SHAPE_RECT
mode(str) - Must be SPEED_SLOW or SPEED_FAST
focal_mm(float) - Focal length in millimeters (minimum: 1.0)
key(str) - Sensor preset key from SENSOR_PRESETS
ratio(Optional[float]) - Aspect ratio (width/height), clamped to 0.2-5.0 range, or None to use sensor dimensions
width_deg(float) - Field-of-view width in degreesheight_deg(Optional[float]) - Field-of-view height in degrees (defaults to width_deg if None)
Field of View Calculations
- Tuple of (width_deg: FOV width in degrees, height_deg: FOV height in degrees)
- float - Step size in degrees (SLOW_STEP_DEG or FAST_STEP_DEG)
- float - Movement rate in degrees per second (SLOW_HOLD_DEG_PER_S or FAST_HOLD_DEG_PER_S)
Interaction Methods
sx(float) - Screen X coordinatesy(float) - Screen Y coordinateunproject_fn(Callable) - Function to convert screen coords to sky coords
- bool - True if event was consumed
sky(SkyCoord) - Sky coordinates (alt_deg, az_deg)
sx(float) - Screen X coordinatesy(float) - Screen Y coordinate
sx(float) - Screen X coordinatesy(float) - Screen Y coordinateunproject_fn(Callable) - Function to convert screen coords to sky coords
- bool - True if event was consumed
d_alt_deg(float) - Altitude offset in degreesd_az_deg(float) - Azimuth offset in degrees
Rendering
painter(QPainter) - Qt painter objectwidth(int) - Viewport width in pixelsheight(int) - Viewport height in pixelsproject_fn(Callable) - Function to project sky coords (alt, az) to screen coords (x, y)hud_extra_lines(Optional[List[str]]) - Additional HUD text lines to display
Usage Example
Custom Sensor Example
Integration Notes
- The controller handles all FOV calculations, interaction logic, and rendering
- Requires
unproject_fnto convert screen coordinates to sky coordinates (alt, az) - Requires
project_fnto convert sky coordinates to screen coordinates (x, y) - Uses
screen_to_sky()fromspherical_mathmodule internally - Boundaries are rendered using geodesic arcs via
slerp_arc_points()for spherical accuracy - HUD panels automatically reposition to avoid overlapping the scope center
- Dark overlay uses QPainterPath subtraction to preserve interior clarity