Class GLSearch


  • public class GLSearch
    extends globus.glmap.GLNativeObject
    GLSearchOffline contains a set of parameters that defines search in offline maps
    • Constructor Summary

      Constructors 
      Constructor Description
      GLSearch()
      Default constructor
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addFilter​(GLSearchFilter filter)
      Adds filter to search.
      void cancel()
      Cancels search operation.
      static int Collate​(long collator, java.lang.String a, java.lang.String b)
      Compare to string with collator
      static long CreateCollator()
      Creates ICU collator with strength set to Primary.
      static long CreateNumericCollator()
      Creates ICU collator with strength set to Primary and numeric collation is ON.
      static void DestroyCollator​(long collator)
      Destroy collator
      static void DestroyWords​(long words)
      Destroy native object returned by GLSearch#PrepareWords(long, String[]).
      static globus.glmap.GLMapValue FindWords​(long collator, java.lang.String string, long words)
      Split string into words.
      static globus.glmap.GLMapValue GetAddress​(globus.glmap.GLMapVectorObject object, int style, globus.glmap.GLMapLocaleSettings localeSettings)
      Returns address with given style
      static GLSearchCategory GetSearchCategory​(globus.glmap.GLMapVectorObject object)
      Detects category for vector object
      static void Initialize​(android.content.Context context)
      Call this method before using any other method from `globus.glsearch`
      static globus.glmap.GLMapVectorObject LoadMergedRelationLines​(globus.glmap.GLMapRelation relation, boolean isForward, globus.glmap.GLMapInfo map)
      Load all lines from relation in one
      static globus.glmap.GLMapValue[] LocalizedAddressNames​(globus.glmap.GLMapVectorObject object, globus.glmap.GLMapLocaleSettings localeSettings)
      Returns all address names associated with object
      static globus.glmap.GLMapVectorObject MapObjectNearPoint​(globus.glmap.GLMapViewRenderer mapView, globus.glmap.MapPoint point, double maxDistance)
      Returns object near point on map
      static android.util.SparseArray<globus.glmap.GLMapValue> MatchedCategoryTags​(globus.glmap.GLMapVectorObject object)  
      java.lang.Object[] merge​(globus.glmap.GLMapVectorObjectList searchResults, java.util.List customObjects, GLSearch.CustomObjectInfoCallback infoCallback)
      Merge search results with custom objects
      static globus.glmap.GLMapVectorObject Nearest​(double lat, double lon, double maxDist, java.util.List<GLSearchFilter> filters)  
      static globus.glmap.GLMapVectorObject Nearest​(double lat, double lon, double maxDist, java.util.List<GLSearchFilter> filters, GLSearchCategories categories)  
      static long PrepareWords​(long collator, java.lang.String[] words)
      Prepares words for collation
      static globus.glmap.GLMapRelation[] RelationsNearPoint​(globus.glmap.GLMapViewRenderer mapView, globus.glmap.MapPoint point, double maxDistance, GLSearchFilter[] filters)
      Search for relations near point on map
      globus.glmap.GLMapVectorObjectList search()
      Performs search synchronously
      void searchAsync​(GLSearch.ResultsCallback callback)
      Starts search.
      void setBBox​(globus.glmap.GLMapBBox bbox)
      Sets bounding box where search will be performed
      void setCenter​(globus.glmap.MapPoint center)
      Sets center of search.
      void setLimit​(int limit)
      Sets maximum number of results to fetch from map
      void setLocaleSettings​(globus.glmap.GLMapLocaleSettings localeSettings)
      Sets locale settings that used to sort results by importance.
      void setNeedEnclosingAreas​(boolean needEnclosingAreas)
      Set this value to `YES` if you plan to get address of objects.
      void setObjectTypes​(int objectTypes)
      Set object types
      void setTiles​(long[] tiles)
      Adds tile hashes to use for search (child tiles will be skipped)
      static java.lang.String[] SplitByWords​(java.lang.String string)
      Split string into words using ICU root rules
      • Methods inherited from class globus.glmap.GLNativeObject

        dispose
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GLSearch

        public GLSearch()
        Default constructor
    • Method Detail

      • Initialize

        public static void Initialize​(@NonNull
                                      android.content.Context context)
        Call this method before using any other method from `globus.glsearch`
        Parameters:
        context - context needed to load icu and categories data
      • MapObjectNearPoint

        public static globus.glmap.GLMapVectorObject MapObjectNearPoint​(@NonNull
                                                                        globus.glmap.GLMapViewRenderer mapView,
                                                                        @NonNull
                                                                        globus.glmap.MapPoint point,
                                                                        double maxDistance)
        Returns object near point on map
        Parameters:
        mapView - Map view
        point - Point on map
        maxDistance - Distance in points
        Returns:
        Vector object on map
      • RelationsNearPoint

        public static globus.glmap.GLMapRelation[] RelationsNearPoint​(@NonNull
                                                                      globus.glmap.GLMapViewRenderer mapView,
                                                                      @NonNull
                                                                      globus.glmap.MapPoint point,
                                                                      double maxDistance,
                                                                      @Nullable
                                                                      GLSearchFilter[] filters)
        Search for relations near point on map
        Parameters:
        mapView - Map view
        point - Point on map
        maxDistance - Distance in points
        filters - Filters for relations
        Returns:
        relations near point
      • LoadMergedRelationLines

        @Nullable
        public static globus.glmap.GLMapVectorObject LoadMergedRelationLines​(globus.glmap.GLMapRelation relation,
                                                                             boolean isForward,
                                                                             @Nullable
                                                                             globus.glmap.GLMapInfo map)
        Load all lines from relation in one
        Parameters:
        relation - relation to load
        isForward - true for forward route, false for backward route
        map - map from where to load relation. if null - will load from random map
        Returns:
        vector object with multiline
      • GetSearchCategory

        @Nullable
        public static GLSearchCategory GetSearchCategory​(@NonNull
                                                         globus.glmap.GLMapVectorObject object)
        Detects category for vector object
        Parameters:
        object - Vector object
        Returns:
        Category that matches to object
      • MatchedCategoryTags

        @Nullable
        public static android.util.SparseArray<globus.glmap.GLMapValue> MatchedCategoryTags​(@NonNull
                                                                                            globus.glmap.GLMapVectorObject object)
      • GetAddress

        @Nullable
        public static globus.glmap.GLMapValue GetAddress​(@NonNull
                                                         globus.glmap.GLMapVectorObject object,
                                                         int style,
                                                         @NonNull
                                                         globus.glmap.GLMapLocaleSettings localeSettings)
        Returns address with given style
        Parameters:
        object - vector object
        style - style of address
        localeSettings - locale settings
        Returns:
        address formatted with given style
      • LocalizedAddressNames

        @Nullable
        public static globus.glmap.GLMapValue[] LocalizedAddressNames​(@NonNull
                                                                      globus.glmap.GLMapVectorObject object,
                                                                      @NonNull
                                                                      globus.glmap.GLMapLocaleSettings localeSettings)
        Returns all address names associated with object
        Parameters:
        object - vector object
        localeSettings - Locale settings used to find name
        Returns:
        array of address names
      • SplitByWords

        @NonNull
        public static java.lang.String[] SplitByWords​(@NonNull
                                                      java.lang.String string)
        Split string into words using ICU root rules
        Parameters:
        string - string to split into words
        Returns:
        words from string
      • PrepareWords

        public static long PrepareWords​(long collator,
                                        @NonNull
                                        java.lang.String[] words)
        Prepares words for collation
        Parameters:
        collator - collator that will be used in collation
        words - words to prepare
        Returns:
        native object. Must be destroyed when not needed.
      • DestroyWords

        public static void DestroyWords​(long words)
        Destroy native object returned by GLSearch#PrepareWords(long, String[]).
        Parameters:
        words - native object
      • FindWords

        @Nullable
        public static globus.glmap.GLMapValue FindWords​(long collator,
                                                        @NonNull
                                                        java.lang.String string,
                                                        long words)
        Split string into words. Then checks if all prepared words are equal to start of any word in string
        Parameters:
        collator - collator to use
        string - string where prepared words will be checked
        words - prepared words
        Returns:
        value that contains same string, but with highlight information. Null if not all prepared words are in string
      • CreateCollator

        public static long CreateCollator()
        Creates ICU collator with strength set to Primary. For example "Straße" equal to "sTrassE" with this collator
        Returns:
        native collator object. Must be destroyed when not needed.
      • CreateNumericCollator

        public static long CreateNumericCollator()
        Creates ICU collator with strength set to Primary and numeric collation is ON. For example "Straße 10" greater "sTrassE 2" with this collator
        Returns:
        native collator object. Must be destroyed when not needed.
      • DestroyCollator

        public static void DestroyCollator​(long collator)
        Destroy collator
        Parameters:
        collator - native collator object
      • Collate

        public static int Collate​(long collator,
                                  @Nullable
                                  java.lang.String a,
                                  @Nullable
                                  java.lang.String b)
        Compare to string with collator
        Parameters:
        collator - collator to use
        a - the first object to be compared.
        b - the second object to be compared.
        Returns:
        a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
      • Nearest

        @Nullable
        public static globus.glmap.GLMapVectorObject Nearest​(double lat,
                                                             double lon,
                                                             double maxDist,
                                                             @Nullable
                                                             java.util.List<GLSearchFilter> filters)
      • Nearest

        @Nullable
        public static globus.glmap.GLMapVectorObject Nearest​(double lat,
                                                             double lon,
                                                             double maxDist,
                                                             @Nullable
                                                             java.util.List<GLSearchFilter> filters,
                                                             @NonNull
                                                             GLSearchCategories categories)
      • setTiles

        public void setTiles​(@NonNull
                             long[] tiles)
        Adds tile hashes to use for search (child tiles will be skipped)
        Parameters:
        tiles - Array of tile hashes public native void setTiles(long tiles[]);
      • setLocaleSettings

        public void setLocaleSettings​(@NonNull
                                      globus.glmap.GLMapLocaleSettings localeSettings)
        Sets locale settings that used to sort results by importance. Results in user language displayed on top.
        Parameters:
        localeSettings - Language priority settings.
      • setLimit

        public void setLimit​(int limit)
        Sets maximum number of results to fetch from map
        Parameters:
        limit - Results limit
      • setBBox

        public void setBBox​(@NonNull
                            globus.glmap.GLMapBBox bbox)
        Sets bounding box where search will be performed
        Parameters:
        bbox - Search bounding box.
      • setCenter

        public void setCenter​(@NonNull
                              globus.glmap.MapPoint center)
        Sets center of search. Distance from this center will define importance of object. Usually center is user location or center of the screen.
        Parameters:
        center - Center point.
      • addFilter

        public void addFilter​(@NonNull
                              GLSearchFilter filter)
        Adds filter to search. Result of search will contain objects that matches all filters
        Parameters:
        filter - filter to add.
      • setNeedEnclosingAreas

        public void setNeedEnclosingAreas​(boolean needEnclosingAreas)
        Set this value to `YES` if you plan to get address of objects. Loading address after search is much faster (cache reuse, bulk loading)
        Parameters:
        needEnclosingAreas - if `YES` search will load enclosing areas.
      • setObjectTypes

        public void setObjectTypes​(int objectTypes)
        Set object types
        Parameters:
        objectTypes - object types
      • searchAsync

        public void searchAsync​(@NonNull
                                GLSearch.ResultsCallback callback)
        Starts search.
        Parameters:
        callback - will be called when search is finished or when search needs information about custom object.
      • search

        @NonNull
        public globus.glmap.GLMapVectorObjectList search()
        Performs search synchronously
        Returns:
        result of search
      • merge

        public java.lang.Object[] merge​(@NonNull
                                        globus.glmap.GLMapVectorObjectList searchResults,
                                        @NonNull
                                        java.util.List customObjects,
                                        @NonNull
                                        GLSearch.CustomObjectInfoCallback infoCallback)
        Merge search results with custom objects
        Parameters:
        searchResults - search results
        customObjects - custom objects
        infoCallback - callback that will provide information about object
        Returns:
        merged array
      • cancel

        public void cancel()
        Cancels search operation.