LED_SingleDigit

public class LED_SingleDigit : LED_Element

This class represents a single LED digit. It will create paths that represent the digit, from -1 to 15. -1 is just the center segment (minus sign), and 10 - 15 are A, b, C, d E, F

The size these paths are generated at is designed to produce a standard LED Display aspect with integer values.

Each digit is treated as a classic Hex LED, with values that go from 0-F. If you give it a value of -1, then only a minus sign (center segment) is displayed. If you give it a value of -2, then nothing is displayed.

  • These are indexes, used to make it a bit more apparent what segment is being sought.

    See more

    Declaration

    Swift

    enum SegmentIndexes
  • These provide the indexes for selected values

    Declaration

    Swift

    private static let _c_g_segmentSelection: [[LED_SingleDigit.SegmentIndexes]]
  • This is an array of points that maps out the standard element shape.

    Declaration

    Swift

    private static let _c_g_StandardShapePoints: [CGPoint]
  • This maps out the center element, which is a slightly different shape.

    Declaration

    Swift

    private static let _c_g_CenterShapePoints: [CGPoint]
  • This array of points dictates the layout of the display.

    Declaration

    Swift

    private static let _c_g_viewOffsets: [LED_SingleDigit.SegmentIndexes : CGPoint]
  • This is the size of the entire drawing area.

    Declaration

    Swift

    private static let _c_g_displaySize: CGSize
  • The bezier path for the top segment

    Declaration

    Swift

    private let _topSegment: UIBezierPath!
  • The bezier path for the top, left segment

    Declaration

    Swift

    private let _topLeftSegment: UIBezierPath!
  • The bezier path for the bottom, left segment

    Declaration

    Swift

    private let _bottomLeftSegment: UIBezierPath!
  • The bezier path for the top, right segment

    Declaration

    Swift

    private let _topRightSegment: UIBezierPath!
  • The bezier path for the bottom, right segment

    Declaration

    Swift

    private let _bottomRightSegment: UIBezierPath!
  • The bezier path for the bottom segment

    Declaration

    Swift

    private let _bottomSegment: UIBezierPath!
  • The bezier path for the center segment

    Declaration

    Swift

    private let _centerSegment: UIBezierPath!
  • The value of this digit

    Declaration

    Swift

    private var _value: Int
  • Instantiates each of the segments.

    Declaration

    Swift

    init(_ inValue: Int)

    Parameters

    A

    value, from -2 to 15 (-2 is nothing. -1 is the minus sign).

  • Public accessor for the value of this digit (-1 through 15).

    Declaration

    Swift

    public var value: Int { get set }
  • Get the bounding box of this segment.

    Declaration

    Swift

    public var drawingSize: CGSize { get }
  • Get all segments as one path.

    Declaration

    Swift

    public var allSegments: UIBezierPath { get }
  • Get active segments as one path.

    Declaration

    Swift

    public var activeSegments: UIBezierPath { get }
  • Get inactive segments as one path.

    Declaration

    Swift

    public var inactiveSegments: UIBezierPath { get }
  • Creates a path containing a segment shape.

    Declaration

    Swift

    private class func _newSegmentShape(inSegment: SegmentIndexes) -> UIBezierPath!

    Parameters

    inSegment

    This indicates which segment we want (Will affect rotation and selection of shape).

    Return Value

    a new path, in the shape of the requested segment

  • Returns true, if the segment is selected for the current value.

    Declaration

    Swift

    private func _isSegmentSelected(_ inSegment: SegmentIndexes) -> Bool

    Parameters

    inSegment

    This indicates which segment we want to test.

    Return Value

    true, if the segment is selected, false, otherwise