/** {@inheritDoc} */ public void render(KMLTraversalContext tc, DrawContext dc) { ColladaRoot root = this.getColladaRoot(); if (root != null) { this.colladaTraversalContext.initialize(); root.render(this.colladaTraversalContext, dc); } }
/** {@inheritDoc} */ public void preRender(KMLTraversalContext tc, DrawContext dc) { if (this.mustRetrieveResource()) this.requestResource(dc); ColladaRoot root = this.getColladaRoot(); if (root != null) { this.colladaTraversalContext.initialize(); root.preRender(this.colladaTraversalContext, dc); } }
/** * 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); } }
/** * Initiates a retrieval of the model referenced by this placemark. Once the resource is retrieved * and loaded, this calls <code>{@link #setColladaRoot(ColladaRoot)}</code> to specify this link's * new network resource, and sends an <code> * {@link gov.nasa.worldwind.avlist.AVKey#RETRIEVAL_STATE_SUCCESSFUL}</code> property change event * to this link's property change listeners. * * <p>This does nothing if this <code>KMLNetworkLink</code> has no <code>KMLLink</code>. * * @param address the address of the resource to retrieve */ protected void retrieveModel(String address) throws IOException, XMLStreamException { Object o = this.parent.getRoot().resolveReference(address); if (o == null) return; ColladaRoot root = ColladaRoot.createAndParse(o); if (root == null) return; this.setColladaRoot(root); this.resourceRetrievalTime.set(System.currentTimeMillis()); this.parent.getRoot().requestRedraw(); }