Package globus.glmap

Class GLMapVectorObject

    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • createFromGeoJSONOrError

        public static java.lang.Object createFromGeoJSONOrError​(@NonNull
                                                                java.lang.String geoJSON)
        Creates an array of GLMapVectorObject from string
        Parameters:
        geoJSON - source string with geo JSON data
        Returns:
        objects constructed from geo JSON data
      • createFromGeoJSONOrThrow

        public static GLMapVectorObjectList createFromGeoJSONOrThrow​(@NonNull
                                                                     java.lang.String geoJSON)
                                                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • createFromGeoJSONStreamOrError

        @Nullable
        public static java.lang.Object createFromGeoJSONStreamOrError​(@NonNull
                                                                      java.io.InputStream geoJSON)
        Creates an array of GLMapVectorObject from stream
        Parameters:
        geoJSON - stream with geo JSON data
        Returns:
        objects constructed from geo JSON data
      • createFromGeoJSONStreamOrThrow

        @NonNull
        public static GLMapVectorObjectList createFromGeoJSONStreamOrThrow​(@NonNull
                                                                           java.io.InputStream geoJSON)
                                                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • createMultiline

        @NonNull
        public static GLMapVectorObject createMultiline​(@NonNull
                                                        MapPoint[][] multilinePoints)
        Loads multiline geometry to vector object
        
         MapPoint[] line1 = new MapPoint[5];
         line1[0] = new MapPoint(27.7151, 53.8869); // Minsk
         line1[1] = new MapPoint(30.5186, 50.4339); // Kiev
         line1[2] = new MapPoint(21.0103, 52.2251); // Warsaw
         line1[3] = new MapPoint(13.4102, 52.5037); // Berlin
         line1[4] = new MapPoint(2.3343, 48.8505); // Paris
         MapPoint[] line2 = new MapPoint[3];
         line2[0] = new MapPoint(4.9021, 52.3690); // Amsterdam
         line2[1] = new MapPoint(4.3458, 50.8263); // Brussel
         line2[2] = new MapPoint(6.1296, 49.6072); // Luxembourg
         MapPoint[][] multiline = {line1, line2};
         obj.loadMultiline(multiline);
         
        Parameters:
        multilinePoints - Data to load to vector object
        Returns:
        Created vector object with multiline
      • createPoint

        @NonNull
        public static GLMapVectorObject createPoint​(@NonNull
                                                    MapPoint point)
        Loads point to vector object
        Parameters:
        point - Data to load to vector object
        Returns:
        Created vector object with multiline
      • createPolygon

        @NonNull
        public static GLMapVectorObject createPolygon​(@NonNull
                                                      MapPoint[][] outerRings,
                                                      @Nullable
                                                      MapPoint[][] innerRings)
        Loads polygon geometry to vector object.
        
         MapPoint[][] outerRings = {outerRing1, outerRing2};
         MapPoint[][] innerRings = {innerRing}, innerRing2};
         obj.loadPolygon(outerRings, innerRings);
         
        Parameters:
        outerRings - outer rings of polygon.
        innerRings - inner rings of polygons (holes).
        Returns:
        Created vector object with polygon.
      • createGeoLine

        @NonNull
        public static GLMapVectorObject createGeoLine​(@NonNull
                                                      MapPoint start,
                                                      @NonNull
                                                      MapPoint end,
                                                      double quality)
        Adds big circle line from `start` to `end`. Useful to display plane routes. Should be used only on empty `GLMapVectorObject`
        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.
        Returns:
        Created vector object with geo-line.
      • getType

        public int getType()
        Returns type of object
        Returns:
        type of object
      • point

        @NonNull
        public MapPoint point()
        Returns:
        some point that belongs to vector object.
      • getBBox

        @NonNull
        public GLMapBBox getBBox()
        Returns bbox of object
        Returns:
        bbox of object
      • getMultilinePoints

        @Nullable
        public MapPoint[][] getMultilinePoints()
        Returns points of multiline for object with type of TYPE_LINE
        Returns:
        points of multiline
      • getMultilineGeoPoints

        @Nullable
        public MapGeoPoint[][] getMultilineGeoPoints()
      • asGeoJSON

        @Nullable
        public java.lang.String asGeoJSON()
        Serialize object as GeoJSON
        Returns:
        GeoJSON string
      • findNearestPoint

        @Nullable
        public MapPoint findNearestPoint​(@NonNull
                                         GLMapViewRenderer renderer,
                                         @NonNull
                                         MapPoint point,
                                         double distanceInPoints)
        Calculates nearest point of vector object from given point
        Parameters:
        renderer - where track is displayed
        point - Point from where calculate nearest point
        distanceInPoints - maximum distance from track in points
        Returns:
        nearest point on track from given point or null if track is too far from given point
      • valueForKey

        @Nullable
        public GLMapValue valueForKey​(java.lang.String key)
        Description copied from interface: GLMapTagsContainer
        Returns value for the key
        Specified by:
        valueForKey in interface GLMapTagsContainer
        Parameters:
        key - Key of requested value
        Returns:
        value associated with given key. (if loaded from geo JSON get values from "properties" section)
      • valuesForKey

        @Nullable
        public GLMapValue[] valuesForKey​(java.lang.String key)
        Description copied from interface: GLMapTagsContainer
        Returns values for the key
        Specified by:
        valuesForKey in interface GLMapTagsContainer
        Parameters:
        key - Key of requested values
        Returns:
        array of values associated with given key
      • setValueForKey

        public void setValueForKey​(@NonNull
                                   java.lang.String key,
                                   @Nullable
                                   java.lang.String value)
        Description copied from interface: GLMapTagsContainer
        Sets value for key
        Specified by:
        setValueForKey in interface GLMapTagsContainer
        Parameters:
        key - Key of value
        value - value to set
      • updateDrawAttributes

        public boolean updateDrawAttributes​(@NonNull
                                            GLMapViewRenderer mapView,
                                            @Nullable
                                            GLMapVectorCascadeStyle style)
        Updates draw attributes
        Parameters:
        mapView - view where object is displayed
        style - style of object or null to use map view style
        Returns:
        true if visible
      • updateDrawAttributes

        public boolean updateDrawAttributes​(@NonNull
                                            GLMapVectorCascadeStyle style,
                                            @NonNull
                                            GLMapLocaleSettings localeSettings,
                                            int zoomLevel)
        Updates draw attributes
        Parameters:
        style - style of object
        localeSettings - locale settings
        zoomLevel - zoom to test
        Returns:
        true if visible
      • updateDrawAttributes

        public boolean updateDrawAttributes​(@NonNull
                                            GLMapViewRenderer mapView)
        Updates draw attributes
        Parameters:
        mapView - view where object is displayed
        Returns:
        true if visible