Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Extension

JMap.Extension

We introduced the notion of extension in JMap.

We designed a mecanism for our needs, that could loads optional plugins for JMap.

This mecanism provide a clean way to integrate in JMap your own extension plugin.

You can create an object that implement the interface JCoreExtension, and register it from this section.

By example you register an extension with id="MyCompany"".

You can defined your own Redux reducer that will react to all actions trigerred. In the store your data will be located at external.MyCompany.

You can defined your own JMap related services, that will be accessible at this location : JMap.Extension.MyCompany

And you also can integrate your own mouseover (for more details look in JMap.MouseOver documentation).

Index

Functions

getAllRegisteredIds

  • getAllRegisteredIds(): string[]
  • JMap.Extension.getAllRegisteredIds

    Returns all registered extension ids.

    example
    
    // Could returns [ "Document", "MyCustomExtension" ]
    JMap.Extension.getAllRegisteredIds()

    Returns string[]

hasMouseOver

  • hasMouseOver(): boolean
  • JMap.Extension.hasMouseOver

    Returns true if any of the currently registered extension has defined a "renderMouseOver" method.

    example
    
    const hasMouseOver = JMap.Extension.hasMouseOver()
    if (hasMouseOver) {
       console.log("some extensions have defined mouseOvers")
    } else {
       console.log("there is currently no extension defining mouseOvers")
    }

    Returns boolean

isRegistered

  • isRegistered(extensionId: string): boolean
  • JMap.Extension.isRegistered

    Tell if an extension has been registered or not.

    It can be useful to know if a JMap extension is in use or not.

    throws

    Error if extensionId format is not correct

    example
    
    // returns true if the JMap Document extension is in use or not
    JMap.Extension.isRegistered("Document")

    Parameters

    • extensionId: string

      The extension id

    Returns boolean

register

  • JMap.Extension.register

    Register your own extension.

    throws

    Error if a parameter is not correct

    example
    
    JMap.Extension.register({
     id: "MyExtension", // Unique id
     initFn: () => {
       // here you can start your UI component if needed
       console.log("JMap is started and my extension has been successfuly started")
     }
    })

    Parameters

    Returns void

renderMouseOver

  • JMap.Extension.renderMouseOver

    It returns all extension mouseover data for a specific layer and feature.

    example
    
    const feature = ...
    // returns all extension mouseover data for the feature
    JMap.Extension.renderMouseOver(2, feature)

    Parameters

    • layer: JLayer

      The JMap layer

    • feature: Feature

      A geoJSON feature

    Returns Array<JExtensionMouseOver | undefined>

    an empty array if no extension is registered