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.
-
The colour palette used in the colour picker to stroke and fill different annotations. The colours are:
F1A099, #FFC680, #FFE6A2, #80E5B1, #92E8E8, #A6BEF4, #E2A1E6,
E44234, #FF8D00, #FFCD45, #00CC63, #25D2D1, #4E7DE9, #C544CE,
88271F, #B54800, #D69A00, #007A3B, #167E7D, #2E4B8B, #76287B,
00000000, #FFFFFF, #CDCDCD, #9C9C9C, #696969, #373737, #000000.
Declaration
Objective-C
@property (class, nonatomic, copy) NSArray<UIColor *> *_Nonnull defaultColorPickerColors;
Swift
class var defaultColorPickerColors: [UIColor] { get set }
-
The colour palette used in the colour picker for highlight and freehand highlight annotations. The colours are:
ff0000, #ff7f02, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff,
ff6666, #ffb267, #ffff66, #66ff66, #6bfcfc, #6666ff, #ff66ff,
ff9999, #ffcb99, #ffff99, #99ff99, #b2ffff, #9999ff, #ff99ff,
ffcccc, #ffe5cc, #ffffcc, #ccffcc, #dcffff, #ccccff, #ffccff.
Declaration
Objective-C
@property (class, nonatomic, copy) NSArray<UIColor *> *_Nonnull highlightColorPickerColors;
Swift
class var highlightColorPickerColors: [UIColor] { get set }
-
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
andATTRIBUTE_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
andATTRIBUTE_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
andATTRIBUTE_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
andATTRIBUTE_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.
-
Sets the default stroke style for an annotation of type
type
.Declaration
Objective-C
+ (void)setDefaultStrokeStyle:(PTStrokeStyle)strokeStyle forAnnotType:(PTExtendedAnnotType)type;
Swift
class func setDefaultStrokeStyle(_ strokeStyle: PTAnnotStyle.StrokeStyle, for type: PTExtendedAnnotType)
Parameters
strokeStyle
The stroke style of the annotation.
type
The type of annotaiton.
-
Gets the default stroke style for an annotation of type
type
.Declaration
Objective-C
+ (PTStrokeStyle)defaultStrokeStyleForAnnotType:(PTExtendedAnnotType)type;
Swift
class func defaultStrokeStyle(for type: PTExtendedAnnotType) -> PTAnnotStyle.StrokeStyle
Parameters
type
The type of annotaiton.
Return Value
The stroke style.
-
Sets the default border effect for an annotation of type
type
.Declaration
Objective-C
+ (void)setDefaultBorderEffect:(PTBorderEffect)borderEffect forAnnotType:(PTExtendedAnnotType)type;
Swift
class func setDefaultBorderEffect(_ borderEffect: PTBorderEffect, for type: PTExtendedAnnotType)
Parameters
borderEffect
The border effect of the annotation.
type
The type of annotaiton.
-
Gets the default border effect for an annotation of type
type
.Declaration
Objective-C
+ (PTBorderEffect)defaultBorderEffectForAnnotType:(PTExtendedAnnotType)type;
Swift
class func defaultBorderEffect(for type: PTExtendedAnnotType) -> PTBorderEffect
Parameters
type
The type of annotaiton.
Return Value
The border effect.
-
Gets the default dash pattern.
Declaration
Objective-C
+ (nonnull NSMutableArray *)defaultDashEffectForWidth:(CGFloat)width;
Swift
class func defaultDashEffect(forWidth width: CGFloat) -> NSMutableArray
Parameters
width
The border width of annotaiton.
Return Value
The dash pattern.
-
Sets the default border effect intensity for an annotation of type
type
.Declaration
Objective-C
+ (void)setDefaultBorderEffectIntensity:(double)borderEffectIntensity forAnnotType:(PTExtendedAnnotType)type;
Swift
class func setDefaultBorderEffectIntensity(_ borderEffectIntensity: Double, for type: PTExtendedAnnotType)
Parameters
borderEffectIntensity
The border effect of the annotation.
type
The type of annotaiton.
-
Gets the default border effect intensity for an annotation of type
type
.Declaration
Objective-C
+ (double)defaultBorderEffectIntensityForAnnotType:(PTExtendedAnnotType)type;
Swift
class func defaultBorderEffectIntensity(for type: PTExtendedAnnotType) -> Double
Parameters
type
The type of annotaiton.
Return Value
The border effect intensity.
-
Set the font size for a free text annotation.
Declaration
Objective-C
+ (void)setDefaultFreeTextSize:(double)size forAnnotType:(PTExtendedAnnotType)type;
Swift
class func setDefaultFreeTextSize(_ size: Double, for type: PTExtendedAnnotType)
Parameters
size
The size of the font 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.
-
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)defaultFreeTextSizeForAnnotType:(PTExtendedAnnotType)annotType;
Swift
class func defaultFreeTextSize(for annotType: PTExtendedAnnotType) -> 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
ormyUIFont.fontName
.Declaration
Objective-C
+ (void)setDefaultFreeTextFontName:(nullable NSString *)fontName;
Swift
class func setDefaultFreeTextFontName(_ fontName: String?)
Parameters
fontName
The name of the font.
-
Set the font name for a free text annotation. This must be the postscript font name, which is returned via
myUIFontDescriptor.postscriptName
ormyUIFont.fontName
.Declaration
Objective-C
+ (void)setDefaultFreeTextFontName:(nullable NSString *)fontName forAnnotType:(PTExtendedAnnotType)type;
Swift
class func setDefaultFreeTextFontName(_ fontName: String?, for type: PTExtendedAnnotType)
Parameters
fontName
The name of the font.
-
The vertical alignment for free text annotations. If one has not been previous set with
setDefaultFreeTextVerticalAlignment:
it will return 0.Declaration
Objective-C
+ (NSInteger)defaultFreeTextVerticalAlignment;
Swift
class func defaultFreeTextVerticalAlignment() -> Int
Return Value
An integer represents vertical alignment. 0 - top alignment; 1 - center alignment; 2 - bottom alignment.
-
Set the vertical alignment for a free text annotation.
Declaration
Objective-C
+ (void)setDefaultFreeTextVerticalAlignment:(NSInteger)verticalAlignment;
Swift
class func setDefaultFreeTextVerticalAlignment(_ verticalAlignment: Int)
Parameters
verticalAlignment
An integer represents vertical alignment. 0 - top alignment; 1 - center alignment; 2 - bottom alignment.
-
The horizontal alignment for free text annotations. If one has not been previous set with
setDefaultFreeTextVerticalAlignment:
it will return 0.Declaration
Objective-C
+ (NSInteger)defaultFreeTextHorizontalAlignment;
Swift
class func defaultFreeTextHorizontalAlignment() -> Int
Return Value
An integer represents vertical alignment. 0 - left alignment; 1 - center alignment; 2 - right alignment; 3 - justify alignment.
-
Set the horizontal alignment for a free text annotation.
Declaration
Objective-C
+ (void)setDefaultFreeTextHorizontalAlignment:(NSInteger)horizontalAlignment;
Swift
class func setDefaultFreeTextHorizontalAlignment(_ horizontalAlignment: Int)
Parameters
horizontalAlignment
An integer represents horizontal alignment. 0 - left alignment; 1 - center alignment; 2 - right alignment; 3 - justify alignment.
-
Set the date format for a date text annotation.
Declaration
Objective-C
+ (void)setDefaultDateTextFormat:(nonnull NSString *)format;
Swift
class func setDefaultDateTextFormat(_ format: String)
Parameters
format
The format of the date.
-
The date format for date text annotations. If one has not been previously set with
setDefaultDateTextFormat:
it will return “MMMM dd, yyyy”.Declaration
Objective-C
+ (nonnull NSString *)defaultDateTextFormat;
Swift
class func defaultDateTextFormat() -> String
Return Value
A date format.
-
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.
-
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 *)defaultFreeTextFontNameForAnnotType: (PTExtendedAnnotType)annotType;
Swift
class func defaultFreeTextFontName(for annotType: PTExtendedAnnotType) -> 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
. -
The default group label for a count annotation.
Declaration
Objective-C
+ (nullable NSString *)defaultCountGroupLabel;
Swift
class func defaultCountGroupLabel() -> String?
Return Value
The label of the group.
-
Sets the default group labael for a count annotation.
Declaration
Objective-C
+ (void)setDefaultCountGroupLabel:(nullable NSString *)label;
Swift
class func setDefaultCountGroupLabel(_ label: String?)
Parameters
label
The group label to be set.
-
Sets the default line ending styles for a line annotation.
Declaration
Objective-C
+ (void)setDefaultLineEndStyles:(nonnull NSArray *)lineEndStyles forAnnotType:(PTExtendedAnnotType)type;
Swift
class func setDefaultLineEndStyles(_ lineEndStyles: [Any], for type: PTExtendedAnnotType)
Parameters
lineEndStyles
An array of
PTEndingStyles
, e.g. @[@(e_ptl_None),@(e_ptOpenArrow)]type
The annotation type.
-
The default line ending styles for a line annotation.
Declaration
Objective-C
+ (nonnull NSArray *)defaultLineEndStylesForAnnotType:(PTExtendedAnnotType)type;
Swift
class func defaultLineEndStyles(for type: PTExtendedAnnotType) -> [Any]
Return Value
The line ending styles of the annotation.
-
Converts a
UIColor
to aPTColorPt
Declaration
Objective-C
+ (nonnull PTColorPt *)colorPtFromUIColor:(nonnull UIColor *)uiColor;
Swift
class func colorPt(from uiColor: UIColor) -> PTColorPt
Parameters
uiColor
The
UIColor
to be convertedReturn Value
A
PTColorPt
that represents the same color as the inputuiColor
-
Gets the number of
PTColorPt
components for a givenUIColor
Declaration
Objective-C
+ (int)numCompsInColorPtForUIColor:(nonnull UIColor *)color;
Swift
class func numCompsInColorPt(for color: UIColor) -> Int32
Parameters
color
The
UIColor
to examineReturn Value
The number of
PTColorPt
components: 0 or 3. -
Converts a ‘PTColorPT
to a
UIColor`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 convertedcompNum
The number of colorants (tint components) used in the color point
Return Value
A
UIColor
that represents the same color as the inputcolorpt