From 1de16ecde61bc1a2d178a7e9067cb1d9908b5514 Mon Sep 17 00:00:00 2001 From: Evan Harvey Date: Tue, 12 Nov 2024 13:50:51 -0700 Subject: [PATCH] opencsp/common/lib/cv/annotations: test docs --- .../lib/cv/annotations/HotspotAnnotation.py | 40 +++++++++++++++++++ .../lib/cv/annotations/PointAnnotations.py | 13 ++++++ opencsp/test/test_DocStringsExist.py | 3 ++ 3 files changed, 56 insertions(+) diff --git a/opencsp/common/lib/cv/annotations/HotspotAnnotation.py b/opencsp/common/lib/cv/annotations/HotspotAnnotation.py index f3c789475..f9b0a9601 100644 --- a/opencsp/common/lib/cv/annotations/HotspotAnnotation.py +++ b/opencsp/common/lib/cv/annotations/HotspotAnnotation.py @@ -4,7 +4,47 @@ class HotspotAnnotation(PointAnnotations): + """ + A class representing a hotspot annotation in a graphical context. + + This class extends the `PointAnnotations` class to create a specific type of annotation + that represents a hotspot, which can be rendered with a specific style and point location. + + Attributes + ---------- + style : rcps.RenderControlPointSeq + The rendering style of the hotspot annotation. + point : p2.Pxy + The point location of the hotspot annotation. + """ + def __init__(self, style: rcps.RenderControlPointSeq = None, point: p2.Pxy = None): + """ + A class representing a hotspot annotation in a graphical context. + + This class extends the `PointAnnotations` class to create a specific type of annotation + that represents a hotspot, which can be rendered with a specific style and point location. + + Parameters + ---------- + style : rcps.RenderControlPointSeq, optional + The rendering style for the hotspot annotation. If not provided, a default style with + blue color, 'x' marker, and a marker size of 1 will be used. + point : p2.Pxy, optional + The point location of the hotspot annotation, represented as a Pxy object. If not provided, + the annotation will not have a specific point location. + + Examples + -------- + >>> hotspot = HotspotAnnotation() + >>> print(hotspot.style.color) + 'blue' + + >>> point = p2.Pxy(10, 20) + >>> hotspot_with_point = HotspotAnnotation(point=point) + >>> print(hotspot_with_point.point) + Pxy(10, 20) + """ if style is None: style = rcps.RenderControlPointSeq(color='blue', marker='x', markersize=1) super().__init__(style, point) diff --git a/opencsp/common/lib/cv/annotations/PointAnnotations.py b/opencsp/common/lib/cv/annotations/PointAnnotations.py index a5dc3e024..d8277360f 100644 --- a/opencsp/common/lib/cv/annotations/PointAnnotations.py +++ b/opencsp/common/lib/cv/annotations/PointAnnotations.py @@ -3,4 +3,17 @@ class PointAnnotations(pf.PointFiducials, AbstractAnnotations): + """ + A class representing point annotations in a graphical context. + + This class extends both `PointFiducials` and `AbstractAnnotations` to provide functionality + for managing and rendering point annotations, which can be used to mark specific locations + in a visual representation. + + Inherits from: + --------------- + pf.PointFiducials : Provides methods and attributes related to point fiducials. + AbstractAnnotations : Provides an abstract base for annotation classes. + """ + pass diff --git a/opencsp/test/test_DocStringsExist.py b/opencsp/test/test_DocStringsExist.py index 0a1099632..4e0b3c6d6 100644 --- a/opencsp/test/test_DocStringsExist.py +++ b/opencsp/test/test_DocStringsExist.py @@ -175,6 +175,9 @@ def test_docstrings_exist_for_methods(): opencsp.common.lib.cv.SpotAnalysis, opencsp.common.lib.cv.image_filters, opencsp.common.lib.cv.image_reshapers, + opencsp.common.lib.cv.annotations.AbstractAnnotations, + opencsp.common.lib.cv.annotations.HotspotAnnotation, + opencsp.common.lib.cv.annotations.PointAnnotations, ] deflectometry_class_list = [