GLMapVectorObject
@interface GLMapVectorObject : NSObject <NSCopying>
GLMapVectorObject
is a bridge class, to work with GLMap internal representation of vector object.
-
Point that belongs to vector object.
Declaration
Objective-C
@property (atomic, readonly) GLMapPoint point;
-
Data previously loaded by
-[GLMapVectorObject initWithMultiline:]
Declaration
Objective-C
@property (atomic, readonly) NSArray<GLMapPointArray *> *_Nullable multiline;
-
Bounding box of an object
Declaration
Objective-C
@property (atomic, readonly) GLMapBBox bbox;
-
Contains kind of geometry loaded to object. GLMapVectorObjectType_Unknown means that no geomety is loaded.
Declaration
Objective-C
@property (atomic, readonly) GLMapVectorObjectType type;
-
Holds all properties set by setValue:forKey: or initialized from geoJSON
Declaration
Objective-C
@property (atomic, readonly) NSDictionary *_Nonnull properties;
-
Resolved draw attributes after last update.
Declaration
Objective-C
@property (atomic, readonly) GLMapDrawAttributes *_Nullable drawAttributes;
-
Creates array of vector object from GeoJSON data
Declaration
Objective-C
+ (GLMapVectorObjectArray *_Nullable) createVectorObjectsFromGeoJSONData:(nonnull NSData *)geoJSONData error:(NSError *_Nullable *_Nullable)error;
Parameters
geoJSONData
Data with GeoJSON inside
Return Value
Array of new vector objects
-
Creates array of vector object from GeoJSON string
Declaration
Objective-C
+ (GLMapVectorObjectArray *_Nullable) createVectorObjectsFromGeoJSON:(nonnull NSString *)geoJSON error:(NSError *_Nullable *_Nullable)error;
Parameters
geoJSON
String with GeoJSON inside
Return Value
Array of new vector objects
-
Creates array of vector object from GeoJSON file
Declaration
Objective-C
+ (GLMapVectorObjectArray *_Nullable) createVectorObjectsFromFile:(nonnull NSString *)filePath error:(NSError *_Nullable *_Nullable)error;
Parameters
filePath
Path to GeoJSON file
Return Value
Array of new vector objects
-
Streamed parsing of GeoJSON file
Declaration
Objective-C
+ (BOOL)enumVectorObjectsFromFile:(nonnull NSString *)filePath objectBlock:(nonnull GLMapVectorObjectBlock)objectBlock error:(NSError *_Nullable *_Nullable)error;
Parameters
objectBlock
block that is called when next object is ready
Return Value
NO if error happened
-
Creates vector object with point.
Declaration
Objective-C
- (nonnull instancetype)initWithPoint:(GLMapPoint)point;
Parameters
point
Point on the map.
-
Creates vector object with line
Declaration
Objective-C
- (nonnull instancetype)initWithLine:(nonnull GLMapPointArray *)line;
Parameters
line
line
-
Creates vector object with multiline
Declaration
Objective-C
- (nonnull instancetype)initWithMultiline: (nonnull NSArray<GLMapPointArray *> *)multiline;
Parameters
multiline
Multiline
-
Creates vector object with polygon
Declaration
Objective-C
- (nonnull instancetype) initWithPolygonOuterRings:(nonnull NSArray<GLMapPointArray *> *)outerRings innerRings:(NSArray<GLMapPointArray *> *_Nullable)innerRings;
Parameters
outerRings
exterior of polygon
innerRings
holes of polygon
-
Creates vector object with big circle line from
start
toend
. Useful to display plane routes.Declaration
Objective-C
- (nonnull instancetype)initWithGeoLineStart:(GLMapPoint)start end:(GLMapPoint)end quality:(double)quality;
Parameters
start
Start point
end
End point
quality
Maximum distance from point to line, used for simplification in Douglas Peucker algorithm. Units is map internal coordinates.
-
Sets properties of object. This can be used by mapcss to apply different styles.
In MapCSS style if you have for example rule
area|z9-[key=value]{ .. style params .. }
,[key=value]
part means, that it will be applied only to objects, which have key equal to value. And this function allows you to set key and value. Other option is to pass keys and values is set them as properties of Features in GeoJSON.Declaration
Objective-C
- (void)setValue:(NSString *_Nullable)value forKey:(nonnull NSString *)key;
Parameters
value
Value to be set, or nil to remove value
key
Key to be set
-
Returns value of object style
Declaration
Objective-C
- (GLMapValue *_Nullable)valueForKey:(nonnull NSString *)key;
Parameters
key
Key string
Return Value
Value that set by
[GLMapVectorObject setValue:forKey:]
or loaded from geojson -
Returns array of values of object style
Map data on OpenStreetMap could contain multiple values for same tag. According standard they should be divided with ;. Internally it’s represented as multiple values for same tag.
Declaration
Objective-C
- (NSArray<GLMapValue *> *_Nullable)valuesForKey:(nonnull NSString *)key;
Parameters
key
Key string
Return Value
Values that tag
-
Returns name of search result.
Declaration
Objective-C
- (GLMapValue *_Nullable)localizedName: (nonnull GLMapLocaleSettings *)localeSettings;
Parameters
localeSettings
Locale settings used to find name
Return Value
Object name
-
Finds nearest point of object to given point.
Declaration
Objective-C
- (BOOL)findNearestPoint:(nonnull GLMapPoint *)nearestPoint toPoint:(GLMapPoint)point maxDistance:(CGFloat)distance;
-
Compare with other object. *
Declaration
Objective-C
- (NSComparisonResult)compare:(nonnull id)object;
-
Usefull for debuging.
Declaration
Objective-C
- (nonnull NSString *)debugDescription;
-
Updates draw attributes of vector object. @mapView view where object is displayed @style style to resolve or null to use style of mapView
Declaration
Objective-C
- (BOOL)updateDrawAttributesOnMap:(nonnull GLMapView *)mapView withStyle:(GLMapVectorCascadeStyle *_Nullable)style;
Return Value
true if visible
-
Updates draw attributes of vector object with style of mapView. @mapView view where object is displayed
Declaration
Objective-C
- (BOOL)updateDrawAttributesOnMap:(nonnull GLMapView *)mapView;
Return Value
true if visible
-
GeoJSON representaion on vector object
Declaration
Objective-C
- (nonnull NSString *)asGeoJSON;
-
Category of the object.
Declaration
Objective-C
@property (atomic, readonly) GLSearchCategory *_Nullable searchCategory;
-
Returns all address names associated with object
Declaration
Objective-C
- (NSArray<GLMapValue *> *_Nullable)localizedAddressNames: (GLMapLocaleSettings *_Nonnull)localeSettings;
Parameters
localeSettings
Locale settings used to find name
Return Value
array of address names
-
Returns address for vector object
Declaration
Objective-C
- (GLMapValue *_Nullable)addressWithStyle:(GLSearchAddressStyle)style localeSettings: (GLMapLocaleSettings *_Nonnull)localeSettings;
Parameters
style
Address information requested
localeSettings
Locale settings to use
Return Value
Returns value with address data.
-
Search score of vector object obtained from GLSearch. Could be used to sort search results.
Declaration
Objective-C
- (NSInteger)searchScore;
Return Value
Some internal score value
-
Compares tags in vector objects and tag filters from category and returns dictonairy of matched tags.
Declaration
Objective-C
- (NSDictionary<NSNumber *, GLMapValue *> *_Nullable)matchedCategoryTags;
Return Value
Dictonairy of matched tags