Class KmlNetworkLink


  • public final class KmlNetworkLink
    extends KmlNode
    A KML network link references other KML resources, locally or on the network.

    A KML network link can have a refresh interval defined to enable regular refresh of data. Alternatively, KML network links support a view refresh mode, which fetches network links based on the visible extent.

    Since:
    100.4.0
    • Constructor Detail

      • KmlNetworkLink

        public KmlNetworkLink​(java.lang.String uri)
        Constructs a KML network link for the given URI which references a KML/KMZ file on a local or remote network.
        Parameters:
        uri - a URI pointing to a local or remote KML source
        Throws:
        java.lang.IllegalArgumentException - if uri is null or empty
        Since:
        100.6.0
    • Method Detail

      • getListItemType

        public KmlContainer.ListItemType getListItemType()
        Get the network link's list item type, which defines how child nodes behave when setting visibility.
        Returns:
        the network link's list item type
        Since:
        100.4.0
      • setListItemType

        public void setListItemType​(KmlContainer.ListItemType listItemType)
        Sets the network link's list item type.

        This defines how visibility selection should work, enabling either single or multiple selection of child nodes when shown in a list (for example, a legend). When the item type is KmlContainer.ListItemType.RADIO_FOLDER, making a node visible will hide its sibling nodes. See the OGC specification for more details.

        Parameters:
        listItemType - a ListItemType
        Throws:
        java.lang.IllegalArgumentException - if listItemType is null
        Since:
        100.6.0
      • getChildNodes

        public java.util.List<KmlNode> getChildNodes()
        Gets the KML network link's child nodes. If this network link node is refreshed the list will be invalidated and this method should be called again to get the new list.
        Returns:
        an unmodifiable list of child nodes
        Since:
        100.4.0
      • isOpen

        public boolean isOpen()
        Gets a value indicating that the network link node should be shown expanded in a tree view.
        Returns:
        true if the node is open, false otherwise
        Since:
        100.4.0
      • setOpen

        public void setOpen​(boolean open)
        Sets whether the network link node should be shown expanded/collapsed in a tree view.
        Parameters:
        open - true to set the node open, false otherwise
        Since:
        100.4.0
      • isPartiallyVisible

        public boolean isPartiallyVisible()
        Gets a value indicating that the network link node has mixed visibility.

        A KmlNode is considered partially visible if some of its child KmlNodes are visible and some are not. Otherwise, it returns false if all child KmlNodes are either visible or invisible.

        Returns:
        true if the network link node is partially visible, false otherwise
        Since:
        100.4.0
      • canFlyToNode

        public boolean canFlyToNode()
        Gets a value indicating that the app should zoom to the viewpoint defined on the associated NetworkLinkControl or the network link's top-level <kml> node upon refresh of the link.

        It is the developer's responsibility to implement this behavior if desired; Runtime will not automatically fly to the node on network link refresh.

        The property is defined in the flyToView tag in the KML network link.

        Returns:
        true if the network link will fly to the link view after loading, false otherwise.
        Since:
        100.4.0
      • setCanFlyToNode

        public void setCanFlyToNode​(boolean canFlyToNode)
        Sets a flag indicating if the view is adjusted to the KML network link node when it refreshes.

        It is the developer's responsibility to implement this behavior if desired. Setting the flag will not automatically fly to the node on refresh. Developers can listen for the refresh status changed event to detect when the GeoView's viewpoint should be updated.

        Parameters:
        canFlyToNode - true the view shall be adjusted to the KML network link node, false the current view shall be unchanged when it refreshes
        Since:
        100.6.0
      • hasRefreshVisibility

        public boolean hasRefreshVisibility()
        Gets a value indicating that Runtime should attempt to maintain the visibility selection of child nodes in the network link after refresh.

        If true, Runtime will attempt to maintain any visibility selection for the network link's child nodes after refresh. This is the default behavior when refreshVisibility is set to 0 or unset in the source KML file.

        Returns:
        true if the KML network link will refresh child visibility after loading, false otherwise
        Since:
        100.4.0
      • setRefreshVisibility

        public void setRefreshVisibility​(boolean refreshVisibility)
        Sets a flag indicating if the visibility for nodes shall be reset or not when refreshing.

        When it is set to be true, the children nodes shall be set be to their original visibilities within the view when the network link is refreshed. This property corresponds to the refreshVisibility attribute in the source KML file.

        Parameters:
        refreshVisibility - true to make the children nodes visible when refreshing, false to leave the visibility of the children nodes unchanged
        Since:
        100.6.0
      • getUri

        public java.lang.String getUri()
        Gets the KML network link URI.
        Returns:
        the KML network link URI
        Since:
        100.4.0
        See Also:
        setUri(String)
      • setUri

        public void setUri​(java.lang.String uri)
        Sets the KML network link URI.

        After setting a new URI, you should call refresh() to fetch the data from the new URI. If the refresh mode of the network link is KmlRefreshMode.ON_INTERVAL when the URI is changed, the refresh operation executed on the following interval will use the new URI value.

        Parameters:
        uri - the KML network link URI
        Throws:
        java.lang.IllegalArgumentException - if uri is null or empty
        Since:
        100.6.0
        See Also:
        getUri()
      • refresh

        public void refresh()
        Refreshes the KML network link.
        Since:
        100.6.0
      • setRefreshMode

        public void setRefreshMode​(KmlRefreshMode refreshMode)
        Sets the KML network link refresh mode.
        Parameters:
        refreshMode - a KmlRefreshMode
        Throws:
        java.lang.IllegalArgumentException - if refreshMode is null
        Since:
        100.6.0
      • getRefreshMode

        public KmlRefreshMode getRefreshMode()
        Gets the KML network link refresh mode.
        Returns:
        a KmlRefreshMode
        Since:
        100.6.0
      • setRefreshInterval

        public void setRefreshInterval​(long refreshInterval)
        Sets the KML network link refresh interval.
        Parameters:
        refreshInterval - refresh interval in milliseconds
        Throws:
        java.lang.IllegalArgumentException - if refreshInterval is negative
        Since:
        100.6.0
      • getRefreshInterval

        public long getRefreshInterval()
        Gets the KML network link refresh interval.
        Returns:
        refresh interval in milliseconds
        Since:
        100.6.0
      • setViewRefreshMode

        public void setViewRefreshMode​(KmlViewRefreshMode viewRefreshMode)
        Sets the KML network link view refresh mode.
        Parameters:
        viewRefreshMode - a KmlViewRefreshMode
        Throws:
        java.lang.IllegalArgumentException - if viewRefreshMode is null
        Since:
        100.6.0
      • getViewRefreshMode

        public KmlViewRefreshMode getViewRefreshMode()
        Gets the KML network link view refresh mode.
        Returns:
        a KmlViewRefreshMode
        Since:
        100.6.0
      • setViewRefreshTime

        public void setViewRefreshTime​(long viewRefreshTime)
        Sets the KML network link view refresh time.
        Parameters:
        viewRefreshTime - view refresh time in milliseconds
        Throws:
        java.lang.IllegalArgumentException - if viewRefreshTime is negative
        Since:
        100.6.0
      • getViewRefreshTime

        public long getViewRefreshTime()
        Gets the KML network link view refresh time.
        Returns:
        the KML network link view refresh time in milliseconds
        Since:
        100.6.0