Options
All
  • Public
  • Public/Protected
  • All
Menu

JMap.Application.Layer.Tree.Filter

You can manage the layer panel tree view filtering here.

Index

Functions

add

  • JMap.Application.Layer.Tree.Filter.add

    Adds a filter. The list of available metadata schema items can be retieved by calling JMap.Layer.getMetadataSchema.

    example
    
    // add a filter to the config
    JMap.Application.Layer.Tree.Filter.add({
     1,
     metadataItemId: 0,
     type: "date",
     operator: "between",
     value: [new Date("2021-06-02T00:00:00"),new Date("2021-06-22:T00:00:00")]
    })

    Parameters

    Returns JAppAnyLayerFilter

applyToMap

  • applyToMap(): void
  • JMap.Application.Layer.Tree.Filter.applyToMap

    Applies the current filter configuration on the map. All layers not matching the filter will be hidden, and only those that match the filter will stay visible on the map. If no filter is defined (or appliable), no change is applied on the map.

    example
    
    // Apply the current filter
    JMap.Application.Layer.Tree.Filter.applyToMap()

    Returns void

closeAddFilterDialog

  • closeAddFilterDialog(): void
  • JMap.Application.Layer.Tree.Filter.closeAddFilterDialog

    Closes the Add Filter dialog box (without saving the filter).

    example
    
    // close Add Filter UI
    JMap.Application.Layer.Tree.Filter.closeAddFilterDialog()

    Returns void

deleteById

  • JMap.Application.Layer.Tree.Filter.deleteById

    Removes the specified filter from the filter configuration.

    example
    
    // delete filter id=1
    JMap.Application.Layer.Tree.Filter.deleteById(1)

    Parameters

    • filterId: number

      the id of the filter to delete

    Returns JAppAnyLayerFilter

existById

  • existById(filterId: number): boolean
  • JMap.Application.Layer.Tree.Filter.existById

    Tests if the specified filter exists.

    example
    
    // create a filter
    JMap.Application.Layer.Tree.Filter.add({
     1,
     metadataItemId: 0,
     type: "date",
     operator: "between",
     value: [new Date("2021-06-02T00:00:00"),new Date("2021-06-22:T00:00:00")]
    })
    
    // will return true
    JMap.Application.Layer.Tree.Filter.existById(1)

    Parameters

    • filterId: number

      the filter id

    Returns boolean

getAll

  • JMap.Application.Layer.Tree.Filter.getAll

    Returns an object containing the current name filter and an array of all current filters.

    example
    
    // get filters configuration
    console.log(JMap.Application.Layer.Tree.Filter.getAll())
    // {
    //   "nameFilter":"Mont",
    //   "filters":[
    //     {"id":1,
    //       "metadataItemId":0,
    //       "operator":"between",
    //       "type":"date",
    //       "value":[
    //       "2021-06-01T10:25:00.000Z",
    //       "2021-06-22T10:25:00.000Z"
    //       ]
    //     }
    //   ]
    // }

    Returns JAppGetAllFiltersResult

getById

  • JMap.Application.Layer.Tree.Filter.getById

    Retrieves the specified filter by id.

    example
    
    // get filter id=1
    JMap.Application.Layer.Tree.Filter.getById(1)
    // {"id":1,
    //   "metadataItemId":0,
    //   "operator":"between",
    //   "type":"date",
    //   "value":[
    //     "2021-06-01T10:25:00.000Z",
    //     "2021-06-22T10:25:00.000Z"
    //   ]
    // }

    Parameters

    • filterId: number

      the filter id

    Returns JAppAnyLayerFilter

isActive

  • isActive(): boolean
  • JMap.Application.Layer.Tree.Filter.isActive

    Tests if the layer tree filters are active.

    Layer tree filters are active, but initially not applied, when the user activates the Filter user interface either by clicking on a button or by calling a JMap NG API method to activate it. See JMap.Application.Layer.Tree.Filter.isApplied for more details.

    example
    
    // activate the filters
    JMap.Application.Layer.Tree.Filter.setActive(false)
    
    // will return false
    JMap.Application.Layer.Tree.Filter.isActive()

    Returns boolean

isApplied

  • isApplied(): boolean
  • JMap.Application.Layer.Tree.Filter.isApplied

    Tests if the layer tree filters are applied.

    Layer tree filters are applied (in action) only if the filtering is active (JMap.Application.Layer.Tree.Filter.isActive returns true) and either one of those two conditions are met:

    a) the name filter contains at least 2 characters b) one of the layer filters has been added to the filtering configuration

    example
    
    // filter configuration is initially empty
    
    // activate the filters
    JMap.Application.Layer.Tree.Filter.setActive(true)
    
    // set the name filter to "a"
    JMap.Application.Layer.Tree.Filter.setName("a")
    
    // will return false
    const isFilterApplied = JMap.Application.Layer.Tree.Filter.isApplied()

    Returns boolean

oneFilterExistForMetadataId

  • oneFilterExistForMetadataId(metadataId: JId): boolean
  • JMap.Application.Layer.Tree.Filter.oneFilterExistForMetadataId

    Tests if at least one filter associated with the specified metadata id exists.

    example
    
    // filter collection is initially empty
    
    // create a filter
    JMap.Application.Layer.Tree.Filter.add({
     1,
     metadataItemId: 0,
     type: "date",
     operator: "between",
     value: [new Date("2021-06-02T00:00:00"),new Date("2021-06-22:T00:00:00")]
    })
    
    // will return false
    JMap.Application.Layer.Tree.Filter.oneFilterExistForMetadataId(6)

    Parameters

    • metadataId: JId

      the metadata id

    Returns boolean

openAddFilterDialog

  • openAddFilterDialog(): void
  • JMap.Application.Layer.Tree.Filter.openAddFilterDialog

    Opens the Add Filter dialog box, and activates the Layer panel if it is not already active.

    example
    
    // open Add Filter UI
    JMap.Application.Layer.Tree.Filter.openAddFilterDialog()

    Returns void

setActive

  • setActive(active: boolean): void
  • JMap.Application.Layer.Tree.Filter.setActive

    Tests if the layer tree filters are active.

    Layer tree filters are active, but initially not applied, when the user activates the Filter user interface either by clicking on a button or by calling a JMap NG API method to activate it. See JMap.Application.Layer.Tree.Filter.isApplied for more details

    example
    
    // activate the filters
    JMap.Application.Layer.Tree.Filter.setActive(false)
    
    // will return false
    JMap.Application.Layer.Tree.Filter.isActive()

    Parameters

    • active: boolean

      a boolean

    Returns void

setName

  • setName(nameFilter: string): void
  • JMap.Application.Layer.Tree.Filter.setName

    Sets the name filter. Name filter needs to have at least 2 characters to be applied.

    Panel layer will show only layers whose name matches the name filter. The name filter is case-insensitive and diacritical characters insensitive.

    example
    
    // In the layer panel will display only layers whose name matches "pro" (case-insensitive)
    JMap.Application.Layer.setName("pro")

    Parameters

    • nameFilter: string

      the name filter to apply

    Returns void