Class KMLAbstractFeature

    • Field Detail

      • styleSelectors

        protected java.util.List<KMLAbstractStyleSelector> styleSelectors
        The style selectors specified in the KML Feature element. Is empty if no selectors were specified.
      • visibility

        protected java.lang.Boolean visibility
        The visibility flag for the feature. This field is determined from the visibility element of the KML feature initially, but the client may set it directly, in which case it may then differ from the visibility field in the fields table.
      • region

        protected KMLRegion region
        The region specified in the KML Feature element. Is null if no region was specified.
      • balloon

        protected Balloon balloon
        A balloon explicitly associated with this feature by the client. This is not a KML field of the Feature element.
    • Constructor Detail

      • KMLAbstractFeature

        protected KMLAbstractFeature​(java.lang.String namespaceURI)
        Construct an instance.
        Parameters:
        namespaceURI - the qualifying namespace URI. May be null to indicate no namespace qualification.
    • Method Detail

      • doAddEventContent

        protected void doAddEventContent​(java.lang.Object o,
                                         XMLEventParserContext ctx,
                                         javax.xml.stream.events.XMLEvent event,
                                         java.lang.Object... args)
                                  throws javax.xml.stream.XMLStreamException
        Overrides:
        doAddEventContent in class AbstractXMLEventParser
        Throws:
        javax.xml.stream.XMLStreamException
      • getName

        public java.lang.String getName()
      • getVisibility

        public java.lang.Boolean getVisibility()
        Indicates whether this KMLAbstractFeature is enabled for rendering. This returns null if no visibility is specified. This indicates the default visibility of true should be used.
        Returns:
        true or null to draw feature shape, otherwise false. The default value is true.
        See Also:
        setVisibility(Boolean)
      • setVisibility

        public void setVisibility​(java.lang.Boolean visibility)
        Specifies whether this KMLAbstractFeature is enabled for rendering.
        Parameters:
        visibility - true or null to draw this feature, otherwise false. The default value is true.
        See Also:
        getVisibility()
      • getOpen

        public java.lang.Boolean getOpen()
      • getAddress

        public java.lang.String getAddress()
      • getPhoneNumber

        public java.lang.String getPhoneNumber()
      • getSnippet

        public java.lang.Object getSnippet()
      • getSnippetText

        public java.lang.String getSnippetText()
      • getDescription

        public java.lang.String getDescription()
      • hasStyleSelectors

        public boolean hasStyleSelectors()
      • hasStyle

        public boolean hasStyle()
      • setRegion

        protected void setRegion​(KMLRegion region)
      • setBalloon

        public void setBalloon​(Balloon balloon)
        Set the balloon associated with this feature.

        Note: Balloon is not a field in the KML Feature element. It's a direct field of this class and enables the client to associate a balloon with the feature.

        Parameters:
        balloon - New balloon.
      • getBalloon

        public Balloon getBalloon()
        Get the balloon associated with this feature, if any.
        Returns:
        The balloon associated with the feature. Returns null if there is no associated balloon.
      • isFeatureActive

        protected boolean isFeatureActive​(KMLTraversalContext tc,
                                          DrawContext dc)
        Indicates whether this KMLAbstractFeature is active and should be rendered on the specified DrawContext. This returns true if the following conditions are all true:
        • This feature's visibility is unspecified (null) or is set to true.
        • This feature as no Region and does not inherit a Region from an ancestor, or its Region is active for the specified DrawContext.

        If this feature has no Region, this inherits the Region of its nearest ancestor by using the Region on the top of the KML traversal context's region stack (if any). If there is no ancestor Region this feature is assumed to be the DrawContext's view and is rendered according to its visibility flag. A Region is considered active if it is visible, and the DrawContext meets the Region's level of detail criteria.

        Parameters:
        tc - the current KML traversal context. Specifies an inherited Region (if any) and a detail hint.
        dc - the current draw context. Used to determine whether this feature's Region is active.
        Returns:
        true if this feature should be rendered, otherwise false.
      • doPreRender

        protected void doPreRender​(KMLTraversalContext tc,
                                   DrawContext dc)
        Called from preRender if this KMLAbstractFeature's visibility is not set to false. Subclasses should override this method to pre-render their content.
        Parameters:
        tc - the current KML traversal context.
        dc - the current draw context.
      • doRender

        protected void doRender​(KMLTraversalContext tc,
                                DrawContext dc)
        Called from render if this KMLAbstractFeature's visibility is not set to false. Subclasses should override this method to render their content.
        Parameters:
        tc - the current KML traversal context.
        dc - the current draw context.
      • renderBalloon

        protected void renderBalloon​(KMLTraversalContext tc,
                                     DrawContext dc)
        Draws the Balloon associated with this KML feature. This does nothing if there is no Balloon associated with this feature.
        Parameters:
        tc - the current KML traversal context.
        dc - the current draw context.
      • getSubStyle

        public KMLAbstractSubStyle getSubStyle​(KMLAbstractSubStyle subStyle,
                                               java.lang.String styleState)
        Obtains the effective values for a specified sub-style (IconStyle, ListStyle, etc.) and state (normal or highlight). The returned style is the result of merging values from this feature instance's style selectors and its styleUrl, if any, with precedence given to style selectors.

        A remote styleUrl that has not yet been resolved is not included in the result. In this case the returned sub-style is marked with the value AVKey.UNRESOLVED. The same is true when a StyleMap style selector contains a reference to an external Style and that reference has not been resolved.

        Parameters:
        styleState - the style mode, either \"normal\" or \"highlight\".
        subStyle - an instance of the sub-style desired, such as KMLIconStyle. The effective sub-style values are accumulated and merged into this instance. The instance should not be one from within the KML document because its values are overridden and augmented; it's just an independent variable in which to return the merged attribute values. For convenience, the instance specified is returned as the return value of this method.
        Returns:
        the sub-style values for the specified type and state. The reference returned is the one passed in as the subStyle argument.
      • mergeStyleSelectors

        protected void mergeStyleSelectors​(KMLAbstractFeature sourceFeature)
        Merge a list of incoming style selectors with the current list. If an incoming selector has the same ID as an existing one, replace the existing one, otherwise just add the incoming one.
        Parameters:
        sourceFeature - the incoming style selectors.