PTColorDefaults

@interface PTColorDefaults : NSObject

Used to persist annotion properties to user defaults so that the next annotation of that type that is created can have the same properties.

  • Sets the default UIColor for a given annotation type and attribute.

    Declaration

    Objective-C

    + (void)setDefaultColor:(nonnull UIColor *)color
                forAnnotType:(PTExtendedAnnotType)type
                   attribute:(nonnull NSString *)attribute
        colorPostProcessMode:(PTColorPostProcessMode)mode;

    Swift

    class func setDefaultColor(_ color: UIColor, for type: PTExtendedAnnotType, attribute: String, colorPostProcessMode mode: PTColorPostProcessMode)

    Parameters

    type

    The type of annotation.

    attribute

    The annotation attribute. Arbitrary strings may be used to define attributes. Standard attributes are defined in the header as ATTRIBUTE_STROKE_COLOR, ATTRIBUTE_FILL_COLOR, ATTRIBUTE_OPACITY, ATTRIBUTE_BORDER_THICKNESS and ATTRIBUTE_FREETEXT_SIZE.

    mode

    The color post processing mode.

  • Gets the UIColor for a given annotation type and attribute.

    Declaration

    Objective-C

    + (nonnull UIColor *)defaultColorForAnnotType:(PTExtendedAnnotType)type
                                        attribute:(nonnull NSString *)attribute
                             colorPostProcessMode:(PTColorPostProcessMode)mode;

    Swift

    class func defaultColor(for type: PTExtendedAnnotType, attribute: String, colorPostProcessMode mode: PTColorPostProcessMode) -> UIColor

    Parameters

    type

    The type of annotation.

    attribute

    The annotation attribute. Arbitrary strings may be used to define attributes. Standard attributes are defined in the header as ATTRIBUTE_STROKE_COLOR, ATTRIBUTE_FILL_COLOR, ATTRIBUTE_OPACITY, ATTRIBUTE_BORDER_THICKNESS and ATTRIBUTE_FREETEXT_SIZE.

    mode

    The color post processing mode.

    Return Value

    The PTColorPt.

  • Gets the PTColorPt for a given annotation type and attribute.

    Declaration

    Objective-C

    + (nonnull PTColorPt *)defaultColorPtForAnnotType:(PTExtendedAnnotType)type
                                            attribute:(nonnull NSString *)attribute
                                 colorPostProcessMode:(PTColorPostProcessMode)mode;

    Swift

    class func defaultColorPt(for type: PTExtendedAnnotType, attribute: String, colorPostProcessMode mode: PTColorPostProcessMode) -> PTColorPt

    Parameters

    type

    The type of annotation.

    attribute

    The annotation attribute. Arbitrary strings may be used to define attributes. Standard attributes are defined in the header as ATTRIBUTE_STROKE_COLOR, ATTRIBUTE_FILL_COLOR, ATTRIBUTE_OPACITY, ATTRIBUTE_BORDER_THICKNESS and ATTRIBUTE_FREETEXT_SIZE.

    mode

    The color post processing mode.

    Return Value

    The PTColorPt.

  • Gets the number of color components for an attribute of an annotation type

    Declaration

    Objective-C

    + (int)numCompsInColorPtForAnnotType:(PTExtendedAnnotType)type
                               attribute:(nonnull NSString *)attribute;

    Swift

    class func numCompsInColorPt(for type: PTExtendedAnnotType, attribute: String) -> Int32

    Parameters

    type

    The type of annotaiton.

    attribute

    The annotation attribute. Arbitrary strings may be used to define attributes. Standard attributes are defined in the header as ATTRIBUTE_STROKE_COLOR, ATTRIBUTE_FILL_COLOR, ATTRIBUTE_OPACITY, ATTRIBUTE_BORDER_THICKNESS and ATTRIBUTE_FREETEXT_SIZE.

    Return Value

    The number of components: 0 or 3.

  • Gets the default opacity for an annotaiton of type type.

    Declaration

    Objective-C

    + (void)setDefaultOpacity:(double)opacity
                 forAnnotType:(PTExtendedAnnotType)type;

    Swift

    class func setDefaultOpacity(_ opacity: Double, for type: PTExtendedAnnotType)

    Parameters

    opacity

    The opacity of the annotation, from 0. (fully transparant) to 1. (fully opaque).

    type

    The type of annotaiton.

  • Sets the default opacity for an annotaiton of type type.

    Declaration

    Objective-C

    + (double)defaultOpacityForAnnotType:(PTExtendedAnnotType)type;

    Swift

    class func defaultOpacity(for type: PTExtendedAnnotType) -> Double

    Parameters

    type

    The type of annotaiton.

    Return Value

    The opacity of the annotation, from 0. (fully transparant) to 1. (fully opaque).

  • Sets the default border thickness for an annotaiton of type type.

    Declaration

    Objective-C

    + (void)setDefaultBorderThickness:(double)thickness
                         forAnnotType:(PTExtendedAnnotType)type;

    Swift

    class func setDefaultBorderThickness(_ thickness: Double, for type: PTExtendedAnnotType)

    Parameters

    thickness

    The thickness of the border in points.

    type

    The type of annotaiton.

  • Gets the default border thickness for an annotaiton of type type.

    Declaration

    Objective-C

    + (double)defaultBorderThicknessForAnnotType:(PTExtendedAnnotType)type;

    Swift

    class func defaultBorderThickness(for type: PTExtendedAnnotType) -> Double

    Parameters

    type

    The type of annotaiton.

    Return Value

    The border thickness in points.

  • Set the font size for a free text annotation.

    Declaration

    Objective-C

    + (void)setDefaultFreeTextSize:(double)size;

    Swift

    class func setDefaultFreeTextSize(_ size: Double)

    Parameters

    size

    The size of the font in points.

  • The font size for free text annotations. If one has not been previous set with setDefaultFreeTextSize: it will return 16.0.

    Declaration

    Objective-C

    + (double)defaultFreeTextSize;

    Swift

    class func defaultFreeTextSize() -> Double

    Return Value

    A font size.

  • Set the font name for a free text annotation. This must be the postscript font name, which is returned via myUIFontDescriptor.postscriptName or myUIFont.fontName.

    Declaration

    Objective-C

    + (void)setDefaultFreeTextFontName:(nullable NSString *)fontName;

    Swift

    class func setDefaultFreeTextFontName(_ fontName: String?)

    Parameters

    fontName

    The name of the font.

  • The font name for free text annotations. If one has not been previous set with setDefaultFreeTextFontName: it will return Helvetica.

    Declaration

    Objective-C

    + (nonnull NSString *)defaultFreeTextFontName;

    Swift

    class func defaultFreeTextFontName() -> String

    Return Value

    The name of the font.

  • Sets the default scale and precision for a ruler, perimeter, or area annotation.

    Declaration

    Objective-C

    + (void)setDefaultMeasurementScale:
                (nonnull PTMeasurementScale *)measurementScale
                          forAnnotType:(PTExtendedAnnotType)type;

    Swift

    class func setDefaultMeasurementScale(_ measurementScale: PTMeasurementScale, for type: PTExtendedAnnotType)

    Parameters

    measurementScale

    The PTMeasurementScale containing the scale and precision information.

  • The default scale and precision for a ruler, perimeter, or area annotation.

    Declaration

    Objective-C

    + (nonnull PTMeasurementScale *)defaultMeasurementScaleForAnnotType:
        (PTExtendedAnnotType)type;

    Swift

    class func defaultMeasurementScale(for type: PTExtendedAnnotType) -> PTMeasurementScale

    Return Value

    A a PTMeasurementScale.

  • Converts a UIColor to a PTColorPt

    Declaration

    Objective-C

    + (nonnull PTColorPt *)colorPtFromUIColor:(nonnull UIColor *)uiColor;

    Swift

    class func colorPt(from uiColor: UIColor) -> PTColorPt

    Parameters

    uiColor

    The UIColor to be converted

    Return Value

    A PTColorPt that represents the same color as the input uiColor

  • Gets the number of PTColorPt components for a given UIColor

    Declaration

    Objective-C

    + (int)numCompsInColorPtForUIColor:(nonnull UIColor *)color;

    Swift

    class func numCompsInColorPt(for color: UIColor) -> Int32

    Parameters

    color

    The UIColor to examine

    Return Value

    The number of PTColorPt components: 0 or 3.

  • Converts a ‘PTColorPTto aUIColor`

    Declaration

    Objective-C

    + (nullable UIColor *)uiColorFromColorPt:(nonnull PTColorPt *)colorpt
                                     compNum:(int)compNum;

    Swift

    class func uiColor(from colorpt: PTColorPt, compNum: Int32) -> UIColor?

    Parameters

    colorpt

    The PTColorPt to be converted

    compNum

    The number of colorants (tint components) used in the color point

    Return Value

    A UIColor that represents the same color as the input colorpt