Skip to content

Commit

Permalink
opencsp/common/lib/cv/annotations: test docs
Browse files Browse the repository at this point in the history
  • Loading branch information
e10harvey committed Nov 12, 2024
1 parent 925998e commit 1de16ec
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
40 changes: 40 additions & 0 deletions opencsp/common/lib/cv/annotations/HotspotAnnotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
13 changes: 13 additions & 0 deletions opencsp/common/lib/cv/annotations/PointAnnotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions opencsp/test/test_DocStringsExist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit 1de16ec

Please sign in to comment.