aboutsummaryrefslogtreecommitdiff
path: root/iosApp/WhirlyGlobeMaplyComponent.xcframework/ios-arm64/WhirlyGlobeMaplyComponent.framework/Headers/MaplyIconManager.h
blob: e6f545a4dde3c5d70ff460ff6ca4e11c999407ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
 *  MaplyIconManager.h
 *  WhirlyGlobe-MaplyComponent
 *
 *  Created by Steve Gifford on 1/11/14.
 *  Copyright 2011-2022 mousebird consulting
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */

#import <UIKit/UIKit.h>
#import <WhirlyGlobeMaplyComponent/MaplyRenderController.h>

/**
 Holds info about a single style from the MaplySimpleStyleManager.
 This is enough to build a marker (or other thing, if you like).
 */
@interface MaplySimpleStyle : NSObject

/// If there was a title, this is it
@property (nonatomic,nullable) NSString *title;

/// If there was a description, this is it
@property (nonatomic,nullable) NSString *desc;

/// Size (in pixels) of the marker to be built
@property (nonatomic) CGSize markerSize;

/// How big we consider the marker to be when doing layout.
/// By default, same as the marker size
@property (nonatomic) CGSize layoutSize;

/// Offset applied to marker
@property (nonatomic) CGPoint markerOffset;

/// Texture constructed for this icon, if there was a symbol
@property (nonatomic,nullable) MaplyTexture *markerTex;

/// If this was 0-9 or a-Z instead, this is that
@property (nonatomic,nullable) NSString *markerString;

/// Color to set for the markert
@property (nonatomic,nonnull) UIColor *color;

/// Stroke color if there is one
@property (nonatomic,nonnull) UIColor *strokeColor;

/// Stroke opacity
@property (nonatomic) float strokeOpacity;

/// Stroke width, if available.  Takes scale into account.
@property (nonatomic) float strokeWidth;

/// Fill color if available
@property (nonatomic,nonnull) UIColor *fillColor;

/// Fill opacity, if available
@property (nonatomic) float fillOpacity;

@end

/** Used to generate icons and parse styles for the GeoJSON simple Style spec.
    https://github.com/mapbox/simplestyle-spec
 
    Can also be used to define some very simple icon styles directly.
 */
@interface MaplySimpleStyleManager : NSObject

/** Fetch the simple UIImage for the icon with the given name.
  **/
+ (nullable UIImage *)iconForName:(NSString *__nonnull)name size:(CGSize)size;

/** Slightly more complex icon
  **/
+ (nullable UIImage *)iconForName:(NSString *__nullable)name size:(CGSize)size color:(UIColor *__nullable)color circleColor:(UIColor *__nullable)circleColor strokeSize:(float)strokeSize strokeColor:(UIColor *__nullable)strokeColor;

/** Clear the cache
 */
+ (void)clearIconCache;

/**
 Set up the icon manager this way to build textures associated with a particular view controller.
 */
- (nonnull id)initWithViewC:(NSObject<MaplyRenderControllerProtocol> * __nonnull)viewC;

/// Markers can be three different sizes.  These are the actual sizes associated
@property (nonatomic) CGSize smallSize,medSize,largeSize;

/// Normal scale from device (e.g. 2x for retina and so on)
@property (nonatomic) CGFloat scale;

/// We normally put a stroke around generated icons
/// This is the width (in pixels) of that stroek
@property (nonatomic) CGFloat strokeWidthForIcons;

/// If set (default) we'll center the marker.  If off we'll offset vertically
@property (nonatomic) bool centerIcon;

/**
 Mapbox defines a simple style spec that's usually associated with GeoJSON data.  Github is a prominent user.

 Pass in a dictionary parsed from JSON (or just make it up yourself) and this will produce (an optional) icon and parse out the rest.
 This takes screen scale and such into account.  It will also cache the same description when passed in multiple times.
*/
- (MaplySimpleStyle * __nonnull)makeStyle:(NSDictionary *__nonnull)dict;

/**
 Takes a single vector object.  It will parse out the simple style from the attributes (or provide a default if there is none)
   and then build the corresponding feature and return a MaplyComponentObject to represent it.
 
 mode controls if this work is done on this thread or another.
 */
- (MaplyComponentObject * __nullable)addFeature:(MaplyVectorObject * __nonnull)vecObj mode:(MaplyThreadMode)mode;

/**
  Takes an array of vector objects and calls addFeature: on each one.

 mode controls if this work is done on this thread or another.
 */
- (NSArray<MaplyComponentObject *> * __nonnull)addFeatures:(NSArray<MaplyVectorObject *> * __nonnull)vecObjs mode:(MaplyThreadMode)mode;

/** Clear the icon cache.
    Any references to the textures should already be cleared.
 */
- (void)clearCache;

/// Delete any cached textures and such
- (void)shutdown;

@end