/** * 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; }
/** * Apply the model's position, orientation, and scale to a COLLADA root. * * @param root COLLADA root to configure. */ protected void configureColladaRoot(ColladaRoot root) { root.setResourceResolver(this); Position refPosition = this.model.getLocation().getPosition(); root.setPosition(refPosition); root.setAltitudeMode(KMLUtil.convertAltitudeMode(this.model.getAltitudeMode())); KMLOrientation orientation = this.model.getOrientation(); if (orientation != null) { Double d = orientation.getHeading(); if (d != null) root.setHeading(Angle.fromDegrees(d)); d = orientation.getTilt(); if (d != null) root.setPitch(Angle.fromDegrees(-d)); d = orientation.getRoll(); if (d != null) root.setRoll(Angle.fromDegrees(-d)); } KMLScale scale = this.model.getScale(); if (scale != null) { Double x = scale.getX(); Double y = scale.getY(); Double z = scale.getZ(); Vec4 modelScale = new Vec4(x != null ? x : 1.0, y != null ? y : 1.0, z != null ? z : 1.0); root.setModelScale(modelScale); } }