Ejemplo n.º 1
0
  /**
   * Determine and set the {@link Path} highlight attributes from the KML <i>Feature</i> fields.
   *
   * @param attrType the type of attributes, either {@link KMLConstants#NORMAL} or {@link
   *     KMLConstants#HIGHLIGHT}.
   * @return the new attributes.
   */
  protected ShapeAttributes makeAttributesCurrent(String attrType) {
    ShapeAttributes attrs =
        this.getInitialAttributes(
            this.isHighlighted() ? KMLConstants.HIGHLIGHT : KMLConstants.NORMAL);

    // Get the KML sub-style for Line attributes. Map them to Shape attributes.

    KMLAbstractSubStyle lineSubStyle = this.parent.getSubStyle(new KMLLineStyle(null), attrType);
    if (!this.isHighlighted() || KMLUtil.isHighlightStyleState(lineSubStyle)) {
      KMLUtil.assembleLineAttributes(attrs, (KMLLineStyle) lineSubStyle);
      if (lineSubStyle.hasField(AVKey.UNRESOLVED)) attrs.setUnresolved(true);
    }

    // Get the KML sub-style for interior attributes. Map them to Shape attributes.

    KMLAbstractSubStyle fillSubStyle = this.parent.getSubStyle(new KMLPolyStyle(null), attrType);
    if (!this.isHighlighted() || KMLUtil.isHighlightStyleState(lineSubStyle)) {
      KMLUtil.assembleInteriorAttributes(attrs, (KMLPolyStyle) fillSubStyle);
      if (fillSubStyle.hasField(AVKey.UNRESOLVED)) attrs.setUnresolved(true);
    }

    attrs.setDrawInterior(((KMLPolyStyle) fillSubStyle).isFill());
    attrs.setDrawOutline(((KMLPolyStyle) fillSubStyle).isOutline());

    return attrs;
  }