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 (readonly, atomic) GLMapPoint point;
  • Data previously loaded by -[GLMapVectorObject loadMultiLine:] or

    -[GLMapVectorObject loadGeoMultiLine:]
    .

    Declaration

    Objective-C

    @property (readonly, atomic) NSArray<NSData *> *_Nullable multilineData;
  • Bounding box of an object

    Declaration

    Objective-C

    @property (readonly, atomic) GLMapBBox bbox;
  • Contains kind of geometry loaded to object. GLMapVectorObjectType_Unknown means that no geomety is loaded.

    Declaration

    Objective-C

    @property (readonly, atomic) GLMapVectorObjectType type;
  • Holds all properties set by setValue:forKey: or initialized from geoJSON

    Declaration

    Objective-C

    @property (readonly, atomic) NSDictionary *_Nonnull properties;
  • Creates array of vector object from GeoJSON data

    Declaration

    Objective-C

    + (GLMapVectorObjectArray *_Nullable)createVectorObjectsFromGeoJSONData:
        (NSData *_Nonnull)geoJSONData;

    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:
        (NSString *_Nonnull)geoJSON;

    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:
        (NSString *_Nonnull)filePath;

    Parameters

    filePath

    Path to GeoJSON file

    Return Value

    Array of new vector objects

  • Streamed parsing of GeoJSON file

    Declaration

    Objective-C

    + (BOOL)enumVectorObjectsFromFile:(NSString *_Nonnull)filePath
                          objectBlock:(GLMapVectorObjectBlock _Nonnull)objectBlock;

    Parameters

    objectBlock

    block that is called when next object is ready

    Return Value

    NO if error happened

  • Sets geometry data for point object.

    Declaration

    Objective-C

    - (void)loadPoint:(GLMapPoint)point;

    Parameters

    point

    Point on the map.

  • Loads geometry data into vector object.

    Example of creation of multiLineData with one line:

    NSMutableArray *multilineData = [[NSMutableArray alloc] init];

    int pointCount = 5; NSMutableData *data = [NSMutableData dataWithLength:sizeof(GLMapGeoPoint)*pointCount]; GLMapGeoPoint *pts= (GLMapGeoPoint *)data.mutableBytes;

    pts[0] = GLMapGeoPointMake(53.8869, 27.7151); // Minsk pts[1] = GLMapGeoPointMake(50.4339, 30.5186); // Kiev pts[2] = GLMapGeoPointMake(52.2251, 21.0103); // Warsaw pts[3] = GLMapGeoPointMake(52.5037, 13.4102); // Berlin pts[4] = GLMapGeoPointMake(48.8505, 2.3343); // Paris [multilineData addObject:data];

    Declaration

    Objective-C

    - (void)loadMultiLine:(NSArray<NSData *> *_Nonnull)multiLineData;

    Parameters

    multiLineData

    NSArray of the NSData objects. Each NSData contains array of GLMapPoint objects.

  • Loads geometry data into vector object.

    Declaration

    Objective-C

    - (void)loadGeoMultiLine:(NSArray<NSData *> *_Nonnull)multiLineData;

    Parameters

    multiLineData

    NSArray of the NSData objects. Each NSData contains array of GLMapGeoPoint objects.

  • Adds line

    Declaration

    Objective-C

    - (void)addLine:(const GLMapPoint *_Nonnull)lineArray
         pointCount:(NSInteger)pointCount;

    Parameters

    lineArray

    Array of GLMapPoint objects

    pointCount

    Number of points inside the lineArray

  • Adds geo line

    Declaration

    Objective-C

    - (void)addGeoLine:(const GLMapGeoPoint *_Nonnull)geoLineArray
            pointCount:(NSInteger)pointCount;

    Parameters

    geoLineArray

    Array of GLMapGeoPoint objects

    pointCount

    Number of points inside the lineArray

  • Sets geometry data for vector object.

    Creation of polygonData will looks like this:

    NSMutableArray *outerRings = [[NSMutableArray alloc] init];
    NSMutableArray *innerRings = [[NSMutableArray alloc] init];
    
    GLMapPoint *pts= (GLMapPoint *)malloc(sizeof(GLMapPoint)*pointCount);
    
    [outerRings addObject:[NSData dataWithBytesNoCopy:pts length:sizeof(GLMapPoint)*pointCount]];
    
    pts= (GLMapPoint *)malloc(sizeof(GLMapPoint)*pointCount);
    
    [innerRings addObject:[NSData dataWithBytesNoCopy:pts length:sizeof(GLMapPoint)*pointCount]];
    polygonData = @[outerRings, innerRings];
    

    See

    [GLMapVectorObject addPolygonOuterRing:pointCount:]

    See

    [GLMapVectorObject addPolygonInnerRing:pointCount:]

    Declaration

    Objective-C

    - (void)loadPolygon:(NSArray<NSArray<NSData *> *> *_Nonnull)polygonData;

    Parameters

    polygonData

    NSArray with 2 objects. First one contains outer rings of polygons. Second contains inner rings. Format of rings is same as for multiline.

  • Sets geometry data for vector object.

    See

    [GLMapVectorObject addGeoPolygonOuterRing:pointCount:]

    See

    [GLMapVectorObject addGeoPolygonInnerRing:pointCount:]

    Declaration

    Objective-C

    - (void)loadGeoPolygon:(NSArray<NSArray<NSData *> *> *_Nonnull)polygonData;

    Parameters

    polygonData

    NSArray with 2 objects. First one contains outer rings of polygons. Second contains inner rings. Format of rings is same as for geo multiline.

  • Adds one outer ring from GLMapPoint array

    Declaration

    Objective-C

    - (void)addPolygonOuterRing:(const GLMapPoint *_Nonnull)outerRing
                     pointCount:(NSInteger)pointCount;

    Parameters

    outerRing

    Array of GLMapPoint objects

    pointCount

    Number of points inside the lineArray

  • Adds one inner ring from GLMapPoint array

    Declaration

    Objective-C

    - (void)addPolygonInnerRing:(const GLMapPoint *_Nonnull)innerRing
                     pointCount:(NSInteger)pointCount;

    Parameters

    innerRing

    Array of GLMapPoint objects

    pointCount

    Number of points inside the lineArray

  • Adds one outer ring from GLMapGeoPoint array

    Declaration

    Objective-C

    - (void)addGeoPolygonOuterRing:(const GLMapGeoPoint *_Nonnull)outerRing
                        pointCount:(NSInteger)pointCount;

    Parameters

    outerRing

    Array of GLMapPoint objects

    pointCount

    Number of points inside the lineArray

  • Adds one inner ring from GLMapGeoPoint array

    Declaration

    Objective-C

    - (void)addGeoPolygonInnerRing:(const GLMapGeoPoint *_Nonnull)innerRing
                        pointCount:(NSInteger)pointCount;

    Parameters

    innerRing

    Array of GLMapGeoPoint objects

    pointCount

    Number of points inside the lineArray

  • Adds big circle line from start to end. Useful to display plane routes. Should be used only on empty GLMapVectorObject

    Declaration

    Objective-C

    - (void)setGeoLineStart:(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:(NSString *_Nonnull)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

    - (NSString *_Nullable)valueForKey:(NSString *_Nonnull)key;

    Parameters

    key

    Key string

    Return Value

    Value that set by [GLMapVectorObject setValue:forKey:] or loaded from geojson

  • Used for objects returned by offline search. When part of an object name is matched during search, this functions returns NSAttributedString with higlighted parts.

    Declaration

    Objective-C

    - (NSAttributedString *_Nullable)
    attributedName:(NSDictionary *_Nonnull)normalAttributes
         highlight:(NSDictionary *_Nonnull)highlightAttributes
    localeSettings:(GLMapLocaleSettings *_Nonnull)localeSettings;

    Parameters

    normalAttributes

    Normal attributes

    highlightAttributes

    Highlight attributes

    localeSettings

    Locale settings used to find first matched name

    Return Value

    Name with highlighted parts

  • Undocumented

    Declaration

    Objective-C

    -(NSAttributedString *_Nullable) attributedValueForKey:(id _Nonnull)key normal:(NSDictionary *_Nonnull)normalAttributes highlight:(NSDictionary *_Nonnull)highlightAttributes;
  • Returns name of search result.

    Declaration

    Objective-C

    - (NSString *_Nullable)nameWithLocaleSettings:
        (GLMapLocaleSettings *_Nonnull)localeSettings;

    Parameters

    localeSettings

    Locale settings used to find first matched name

    Return Value

    Object name

  • Finds nearest point of object to given point

    Declaration

    Objective-C

    - (BOOL)findNearestPoint:(GLMapPoint *_Nonnull)nearestPoint
                     toPoint:(GLMapPoint)point
                 maxDistance:(CGFloat)distance;