/** * 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; }
protected RegionShape(Sector sector) { super(sector); // Create the default border shape. this.setBorder(new SurfaceSector(sector)); // The edges of the region shape should be constant lines of latitude and longitude. this.setPathType(AVKey.LINEAR); this.getBorder().setPathType(AVKey.LINEAR); // Setup default interior rendering attributes. Note that the interior rendering attributes // are // configured so only the SurfaceSector's interior is rendered. ShapeAttributes interiorAttrs = new BasicShapeAttributes(); interiorAttrs.setDrawOutline(false); interiorAttrs.setInteriorMaterial(new Material(Color.WHITE)); interiorAttrs.setInteriorOpacity(0.1); this.setAttributes(interiorAttrs); // Setup default border rendering attributes. Note that the border rendering attributes are // configured // so that only the SurfaceSector's outline is rendered. ShapeAttributes borderAttrs = new BasicShapeAttributes(); borderAttrs.setDrawInterior(false); borderAttrs.setOutlineMaterial(new Material(Color.RED)); borderAttrs.setOutlineOpacity(0.7); borderAttrs.setOutlineWidth(3); this.getBorder().setAttributes(borderAttrs); }
/** {@inheritDoc} Overridden to update symbol attributes. */ @Override protected void determineActiveAttributes() { super.determineActiveAttributes(); // Apply active attributes to the symbol. if (this.symbolAttributes != null) { ShapeAttributes activeAttributes = this.getActiveShapeAttributes(); this.symbolAttributes.setOpacity(activeAttributes.getInteriorOpacity()); this.symbolAttributes.setScale(this.activeOverrides.getScale()); } }
protected ShapeAttributes getInitialAttributes(String attrType) { ShapeAttributes attrs = new BasicShapeAttributes(); if (KMLConstants.HIGHLIGHT.equals(attrType)) { attrs.setOutlineMaterial(Material.RED); attrs.setInteriorMaterial(Material.PINK); } else { attrs.setOutlineMaterial(Material.WHITE); attrs.setInteriorMaterial(Material.LIGHT_GRAY); } return attrs; }
protected void addContourShapes( List<List<Position>> contourList, double value, RenderableLayer layer) { String text = this.textForValue(value); Color color = this.colorForValue(value, 1.0); // color for value at 100% brightness ShapeAttributes attrs = new BasicShapeAttributes(); attrs.setOutlineMaterial(new Material(color)); attrs.setOutlineWidth(2); for (List<Position> positions : contourList) { Path path = new Path(positions); path.setAttributes(attrs); path.setAltitudeMode(WorldWind.CLAMP_TO_GROUND); path.setFollowTerrain(true); path.setValue(AVKey.DISPLAY_NAME, text); layer.addRenderable(path); } }
/** {@inheritDoc} */ @Override protected void applyDefaultAttributes(ShapeAttributes attributes) { super.applyDefaultAttributes(attributes); // Enable the polygon interior for the "thick line" polygon. All other parts of the graphic are // drawn with Path, // so the draw interior setting will not affect them. attributes.setDrawInterior(true); }
public void preRender(KMLTraversalContext tc, DrawContext dc) { // If the attributes are not inline or internal then they might not be resolved until the // external KML // document is resolved. Therefore check to see if resolution has occurred. if (this.isHighlighted()) { if (!this.highlightAttributesResolved) { ShapeAttributes a = this.getHighlightAttributes(); if (a == null || a.isUnresolved()) { a = this.makeAttributesCurrent(KMLConstants.HIGHLIGHT); if (a != null) { this.setHighlightAttributes(a); if (!a.isUnresolved()) this.highlightAttributesResolved = true; } } } } else { if (!this.normalAttributesResolved) { ShapeAttributes a = this.getAttributes(); if (a == null || a.isUnresolved()) { a = this.makeAttributesCurrent(KMLConstants.NORMAL); if (a != null) { this.setAttributes(a); if (!a.isUnresolved()) this.normalAttributesResolved = true; } } } } this.preRender(dc); }
protected void showGridSightLines(List<Position> grid, Position cPos) { this.sightLinesLayer.removeAllRenderables(); // Display lines from the center to each grid point. ShapeAttributes lineAttributes; lineAttributes = new BasicShapeAttributes(); lineAttributes.setDrawOutline(true); lineAttributes.setDrawInterior(false); lineAttributes.setOutlineMaterial(Material.GREEN); lineAttributes.setOutlineOpacity(0.6); for (Position p : grid) { List<Position> endPoints = new ArrayList<Position>(); endPoints.add(cPos); endPoints.add(new Position(p.getLatitude(), p.getLongitude(), 0)); Path path = new Path(endPoints); path.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); path.setAttributes(lineAttributes); this.sightLinesLayer.addRenderable(path); } }
public AppFrame() { super(true, true, false); RenderableLayer layer = new RenderableLayer(); // Create and set an attribute bundle. ShapeAttributes attrs = new BasicShapeAttributes(); attrs.setOutlineMaterial(Material.RED); attrs.setOutlineWidth(2d); // Create a path, set some of its properties and set its attributes. ArrayList<Position> pathPositions = new ArrayList<Position>(); pathPositions.add(Position.fromDegrees(49.01653274909177, -122.7349081128505, 1)); pathPositions.add(Position.fromDegrees(49.01715024535254, -122.7596194200486, 10)); pathPositions.add(Position.fromDegrees(49.02781845803761, -122.7651733463364, 100)); pathPositions.add(Position.fromDegrees(49.05312411976134, -122.7926787136435, 1000)); pathPositions.add(Position.fromDegrees(49.0747697644625, -122.8224152286015, 1000)); pathPositions.add(Position.fromDegrees(49.09727187849899, -122.8187118695457, 1000)); pathPositions.add(Position.fromDegrees(49.1002974270654, -122.7348314826556, 100)); pathPositions.add(Position.fromDegrees(49.11190305133165, -122.7345541413842, 100)); pathPositions.add(Position.fromDegrees(49.11101764617014, -122.7455553490629, 10)); pathPositions.add(Position.fromDegrees(49.11509767012883, -122.7459193678911, 10)); pathPositions.add(Position.fromDegrees(49.11467371318521, -122.7563706291131, 10)); Path path = new DirectedPath(pathPositions); // To ensure that the arrowheads resize smoothly, refresh each time the path is drawn. path.setAttributes(attrs); path.setVisible(true); path.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); path.setPathType(AVKey.GREAT_CIRCLE); layer.addRenderable(path); // Add the layer to the model. insertBeforeCompass(getWwd(), layer); // Update layer panel this.getLayerPanel().update(this.getWwd()); }
protected void showSightLines(List<Position[]> sightLines) { this.sightLinesLayer.removeAllRenderables(); // Display the sight lines as green lines. ShapeAttributes lineAttributes; lineAttributes = new BasicShapeAttributes(); lineAttributes.setDrawOutline(true); lineAttributes.setDrawInterior(false); lineAttributes.setOutlineMaterial(Material.GREEN); lineAttributes.setOutlineOpacity(0.6); for (Position[] pp : sightLines) { List<Position> endPoints = new ArrayList<Position>(); endPoints.add(pp[0]); endPoints.add(pp[1]); Path path = new Path(endPoints); path.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); path.setAttributes(lineAttributes); this.sightLinesLayer.addRenderable(path); } }
/** * Create a surface polygon from a KML GroundOverlay. * * @param tc the current {@link KMLTraversalContext}. * @param overlay the {@link gov.nasa.worldwind.ogc.kml.KMLGroundOverlay} to render as a polygon. * @throws NullPointerException if the geometry is null. * @throws IllegalArgumentException if the parent placemark or the traversal context is null. */ public KMLSurfacePolygonImpl(KMLTraversalContext tc, KMLGroundOverlay overlay) { if (tc == null) { String msg = Logging.getMessage("nullValue.TraversalContextIsNull"); Logging.logger().severe(msg); throw new IllegalArgumentException(msg); } if (overlay == null) { String msg = Logging.getMessage("nullValue.ParentIsNull"); Logging.logger().severe(msg); throw new IllegalArgumentException(msg); } this.parent = overlay; // Positions are specified either as a kml:LatLonBox or a gx:LatLonQuad Position.PositionList corners = overlay.getPositions(); this.setOuterBoundary(corners.list); if (overlay.getName() != null) this.setValue(AVKey.DISPLAY_NAME, overlay.getName()); if (overlay.getDescription() != null) this.setValue(AVKey.BALLOON_TEXT, overlay.getDescription()); if (overlay.getSnippetText() != null) this.setValue(AVKey.SHORT_DESCRIPTION, overlay.getSnippetText()); String colorStr = overlay.getColor(); if (!WWUtil.isEmpty(colorStr)) { Color color = WWUtil.decodeColorABGR(colorStr); ShapeAttributes attributes = new BasicShapeAttributes(); attributes.setDrawInterior(true); attributes.setInteriorMaterial(new Material(color)); this.setAttributes(attributes); } }
public AppFrame() { super(true, true, false); // Add detail hint slider panel this.getLayerPanel().add(makeDetailHintControlPanel(), BorderLayout.SOUTH); RenderableLayer layer = new RenderableLayer(); // Create and set an attribute bundle. ShapeAttributes attrs = new BasicShapeAttributes(); attrs.setInteriorMaterial(Material.YELLOW); attrs.setInteriorOpacity(0.7); attrs.setEnableLighting(true); attrs.setOutlineMaterial(Material.RED); attrs.setOutlineWidth(2d); attrs.setDrawInterior(true); attrs.setDrawOutline(false); // Create and set an attribute bundle. ShapeAttributes attrs2 = new BasicShapeAttributes(); attrs2.setInteriorMaterial(Material.PINK); attrs2.setInteriorOpacity(1); attrs2.setEnableLighting(true); attrs2.setOutlineMaterial(Material.WHITE); attrs2.setOutlineWidth(2d); attrs2.setDrawOutline(false); // ********* sample Wedges ******************* // Wedge with equal axes, ABSOLUTE altitude mode Wedge wedge3 = new Wedge(Position.fromDegrees(40, -120, 80000), Angle.POS90, 50000, 50000, 50000); wedge3.setAltitudeMode(WorldWind.ABSOLUTE); wedge3.setAttributes(attrs); wedge3.setVisible(true); wedge3.setValue(AVKey.DISPLAY_NAME, "Wedge with equal axes, ABSOLUTE altitude mode"); layer.addRenderable(wedge3); // Wedge with equal axes, RELATIVE_TO_GROUND Wedge wedge4 = new Wedge(Position.fromDegrees(37.5, -115, 50000), Angle.POS90, 50000, 50000, 50000); wedge4.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); wedge4.setAttributes(attrs); wedge4.setVisible(true); wedge4.setValue( AVKey.DISPLAY_NAME, "Wedge with equal axes, RELATIVE_TO_GROUND altitude mode"); layer.addRenderable(wedge4); // Wedge with equal axes, CLAMP_TO_GROUND Wedge wedge5 = new Wedge(Position.fromDegrees(35, -110, 50000), Angle.POS90, 50000, 50000, 50000); wedge5.setAltitudeMode(WorldWind.CLAMP_TO_GROUND); wedge5.setAttributes(attrs); wedge5.setVisible(true); wedge5.setValue(AVKey.DISPLAY_NAME, "Wedge with equal axes, CLAMP_TO_GROUND altitude mode"); layer.addRenderable(wedge5); // Wedge with a texture, using Wedge(position, angle, height, radius) constructor Wedge wedge9 = new Wedge(Position.fromDegrees(0, -90, 600000), Angle.fromDegrees(225), 1200000, 600000); wedge9.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); wedge9.setImageSources("gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png"); wedge9.setAttributes(attrs); wedge9.setVisible(true); wedge9.setValue(AVKey.DISPLAY_NAME, "Wedge with a texture"); layer.addRenderable(wedge9); // Scaled Wedge with default orientation Wedge wedge = new Wedge(Position.ZERO, Angle.fromDegrees(125), 500000, 500000, 500000); wedge.setAltitudeMode(WorldWind.ABSOLUTE); wedge.setAttributes(attrs); wedge.setVisible(true); wedge.setValue(AVKey.DISPLAY_NAME, "Scaled Wedge with default orientation"); layer.addRenderable(wedge); // Scaled Wedge with a pre-set orientation Wedge wedge2 = new Wedge( Position.fromDegrees(0, 30, 750000), Angle.POS90, 500000, 500000, 500000, Angle.fromDegrees(90), Angle.fromDegrees(45), Angle.fromDegrees(30)); wedge2.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); wedge2.setAttributes(attrs2); wedge2.setVisible(true); wedge2.setValue(AVKey.DISPLAY_NAME, "Scaled Wedge with a pre-set orientation"); layer.addRenderable(wedge2); // Scaled Wedge with a pre-set orientation Wedge wedge6 = new Wedge( Position.fromDegrees(30, 30, 750000), Angle.POS90, 500000, 500000, 500000, Angle.fromDegrees(90), Angle.fromDegrees(45), Angle.fromDegrees(30)); wedge6.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); wedge6.setImageSources("gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png"); wedge6.setAttributes(attrs2); wedge6.setVisible(true); wedge6.setValue(AVKey.DISPLAY_NAME, "Scaled Wedge with a pre-set orientation"); layer.addRenderable(wedge6); // Scaled Wedge with a pre-set orientation Wedge wedge7 = new Wedge( Position.fromDegrees(60, 30, 750000), Angle.POS90, 500000, 500000, 500000, Angle.fromDegrees(90), Angle.fromDegrees(45), Angle.fromDegrees(30)); wedge7.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); wedge7.setAttributes(attrs2); wedge7.setVisible(true); wedge7.setValue(AVKey.DISPLAY_NAME, "Scaled Wedge with a pre-set orientation"); layer.addRenderable(wedge7); // Scaled, oriented Wedge in 3rd "quadrant" (-X, -Y, -Z) Wedge wedge8 = new Wedge( Position.fromDegrees(-45, -180, 750000), Angle.POS90, 500000, 1000000, 500000, Angle.fromDegrees(90), Angle.fromDegrees(45), Angle.fromDegrees(30)); wedge8.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); wedge8.setAttributes(attrs2); wedge8.setVisible(true); wedge8.setValue( AVKey.DISPLAY_NAME, "Scaled, oriented Wedge with in the 3rd 'quadrant' (-X, -Y, -Z)"); layer.addRenderable(wedge8); // Add the layer to the model. insertBeforeCompass(getWwd(), layer); // Update layer panel this.getLayerPanel().update(this.getWwd()); }
public void setBorderWidth(double width) { ShapeAttributes attr = this.getBorder().getAttributes(); attr.setOutlineWidth(width); this.getBorder().setAttributes(attr); }
public void setBorderOpacity(double opacity) { ShapeAttributes attr = this.getBorder().getAttributes(); attr.setOutlineOpacity(opacity); this.getBorder().setAttributes(attr); }
public void setInteriorOpacity(double opacity) { ShapeAttributes attr = this.getAttributes(); attr.setInteriorOpacity(opacity); this.setAttributes(attr); }
public void setInteriorColor(Color color) { ShapeAttributes attr = this.getAttributes(); attr.setInteriorMaterial(new Material(color)); this.setAttributes(attr); }
public void setBorderColor(Color color) { ShapeAttributes attr = this.getBorder().getAttributes(); attr.setOutlineMaterial(new Material(color)); this.getBorder().setAttributes(attr); }
private void update() { for (JComponent c : onTerrainOnlyItems) { c.setEnabled(currentFollowTerrain); } for (JComponent c : offTerrainOnlyItems) { c.setEnabled(!currentFollowTerrain); } if (this.currentShape instanceof SurfaceShape) { SurfaceShape shape = (SurfaceShape) currentShape; ShapeAttributes attr = shape.getAttributes(); if (attr == null) attr = new BasicShapeAttributes(); if (!currentBorderStyle.equals("None")) { float alpha = currentBorderOpacity >= 10 ? 1f : currentBorderOpacity <= 0 ? 0f : currentBorderOpacity / 10f; Color color = null; if (currentBorderColor.equals("Yellow")) color = new Color(1f, 1f, 0f); else if (currentBorderColor.equals("Red")) color = new Color(1f, 0f, 0f); else if (currentBorderColor.equals("Green")) color = new Color(0f, 1f, 0f); else if (currentBorderColor.equals("Blue")) color = new Color(0f, 0f, 1f); attr.setDrawOutline(true); attr.setOutlineMaterial(new Material(color)); attr.setOutlineOpacity(alpha); attr.setOutlineWidth(currentBorderWidth); } else { attr.setDrawOutline(false); } if (!currentInteriorStyle.equals("None")) { float alpha = currentInteriorOpacity >= 10 ? 1f : currentInteriorOpacity <= 0 ? 0f : currentInteriorOpacity / 10f; Color color = null; if (currentInteriorColor.equals("Yellow")) color = new Color(1f, 1f, 0f); else if (currentInteriorColor.equals("Red")) color = new Color(1f, 0f, 0f); else if (currentInteriorColor.equals("Green")) color = new Color(0f, 1f, 0f); else if (currentInteriorColor.equals("Blue")) color = new Color(0f, 0f, 1f); attr.setInteriorMaterial(new Material(color)); attr.setInteriorOpacity(alpha); attr.setDrawInterior(true); } else { attr.setDrawInterior(false); } shape.setAttributes(attr); } else { float alpha = currentPathOpacity >= 10 ? 1f : currentPathOpacity <= 0 ? 0f : currentPathOpacity / 10f; Color color = null; if (currentPathColor.equals("Yellow")) color = new Color(1f, 1f, 0f, alpha); else if (currentPathColor.equals("Red")) color = new Color(1f, 0f, 0f, alpha); else if (currentPathColor.equals("Green")) color = new Color(0f, 1f, 0f, alpha); else if (currentPathColor.equals("Blue")) color = new Color(0f, 0f, 1f, alpha); if (currentShape instanceof Polyline) { Polyline pl = (Polyline) currentShape; pl.setColor(color); pl.setLineWidth(currentPathWidth); pl.setFollowTerrain(currentFollowTerrain); pl.setTerrainConformance(currentTerrainConformance); pl.setNumSubsegments(currentNumSubsegments); if (currentPathType.equalsIgnoreCase("linear")) pl.setPathType(Polyline.LINEAR); else if (currentPathType.equalsIgnoreCase("rhumb line")) pl.setPathType(Polyline.RHUMB_LINE); else pl.setPathType(Polyline.GREAT_CIRCLE); pl.setOffset(currentOffset); if (currentPathStyle.equals("Dash")) { pl.setStippleFactor(5); pl.setStipplePattern((short) 0xAAAA); } else { pl.setStippleFactor(0); // solid } } } this.layer.removeAllRenderables(); if (this.currentShape != null) this.layer.addRenderable(this.currentShape); this.wwjPanel.getWwd().redraw(); }
protected void makeShapes() { RenderableLayer layer = new RenderableLayer(); layer.setName("Rigid Shapes"); // Create and set an attribute bundle. ShapeAttributes attrs = new BasicShapeAttributes(); attrs.setInteriorMaterial(Material.YELLOW); attrs.setInteriorOpacity(0.7); attrs.setEnableLighting(true); attrs.setOutlineMaterial(Material.RED); attrs.setOutlineWidth(2d); attrs.setDrawInterior(true); attrs.setDrawOutline(false); // Create and set a second attribute bundle. ShapeAttributes attrs2 = new BasicShapeAttributes(); attrs2.setInteriorMaterial(Material.PINK); attrs2.setInteriorOpacity(1); attrs2.setEnableLighting(true); attrs2.setOutlineMaterial(Material.WHITE); attrs2.setOutlineWidth(2d); attrs2.setDrawOutline(false); // Pyramid with equal axes, ABSOLUTE altitude mode. Pyramid pyramid = new Pyramid(Position.fromDegrees(40, -120, 220000), 200000, 200000, 200000); pyramid.setAltitudeMode(WorldWind.ABSOLUTE); pyramid.setAttributes(attrs); pyramid.setValue(AVKey.DISPLAY_NAME, "Pyramid with equal axes, ABSOLUTE altitude mode"); layer.addRenderable(pyramid); // Cone with equal axes, RELATIVE_TO_GROUND. Cone cone = new Cone(Position.fromDegrees(37.5, -115, 200000), 200000, 200000, 200000); cone.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); cone.setAttributes(attrs); cone.setValue(AVKey.DISPLAY_NAME, "Cone with equal axes, RELATIVE_TO_GROUND altitude mode"); layer.addRenderable(cone); // Wedge with equal axes, CLAMP_TO_GROUND. Wedge wedge = new Wedge( Position.fromDegrees(35, -110, 200000), Angle.fromDegrees(225), 200000, 200000, 200000); wedge.setAltitudeMode(WorldWind.CLAMP_TO_GROUND); wedge.setAttributes(attrs); wedge.setValue(AVKey.DISPLAY_NAME, "Wedge with equal axes, CLAMP_TO_GROUND altitude mode"); layer.addRenderable(wedge); // Box with a texture. Box box = new Box(Position.fromDegrees(0, -90, 600000), 600000, 600000, 600000); box.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); ArrayList<Object> imageSources = new ArrayList<Object>(); imageSources.add("images/32x32-icon-nasa.png"); imageSources.add(null); imageSources.add("gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png"); imageSources.add(null); imageSources.add("images/64x64-crosshair.png"); imageSources.add(null); box.setImageSources(imageSources); box.setAttributes(attrs); box.setValue(AVKey.DISPLAY_NAME, "Box with a texture"); layer.addRenderable(box); // Sphere with a texture. Ellipsoid sphere = new Ellipsoid(Position.fromDegrees(0, -110, 600000), 600000, 600000, 600000); sphere.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); sphere.setImageSources("gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png"); sphere.setAttributes(attrs); sphere.setValue(AVKey.DISPLAY_NAME, "Sphere with a texture"); layer.addRenderable(sphere); // Cylinder with a texture. Cylinder cylinder = new Cylinder(Position.fromDegrees(0, -130, 600000), 600000, 600000, 600000); cylinder.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); cylinder.setImageSources( "gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png"); cylinder.setAttributes(attrs); cylinder.setValue(AVKey.DISPLAY_NAME, "Cylinder with a texture"); layer.addRenderable(cylinder); // Cylinder with default orientation. cylinder = new Cylinder(Position.ZERO, 600000, 500000, 300000); cylinder.setAltitudeMode(WorldWind.ABSOLUTE); cylinder.setAttributes(attrs); cylinder.setValue(AVKey.DISPLAY_NAME, "Cylinder with default orientation"); layer.addRenderable(cylinder); // Ellipsoid with a pre-set orientation. Ellipsoid ellipsoid = new Ellipsoid( Position.fromDegrees(0, 30, 750000), 1000000, 500000, 100000, Angle.fromDegrees(90), Angle.fromDegrees(45), Angle.fromDegrees(30)); ellipsoid.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); ellipsoid.setAttributes(attrs2); ellipsoid.setValue(AVKey.DISPLAY_NAME, "Ellipsoid with a pre-set orientation"); layer.addRenderable(ellipsoid); // Ellipsoid with a pre-set orientation. ellipsoid = new Ellipsoid( Position.fromDegrees(30, 30, 750000), 1000000, 500000, 100000, Angle.fromDegrees(90), Angle.fromDegrees(45), Angle.fromDegrees(30)); ellipsoid.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); ellipsoid.setImageSources( "gov/nasa/worldwindx/examples/images/500px-Checkerboard_pattern.png"); ellipsoid.setAttributes(attrs2); ellipsoid.setValue(AVKey.DISPLAY_NAME, "Ellipsoid with a pre-set orientation"); layer.addRenderable(ellipsoid); // Ellipsoid with a pre-set orientation. ellipsoid = new Ellipsoid( Position.fromDegrees(60, 30, 750000), 1000000, 500000, 100000, Angle.fromDegrees(90), Angle.fromDegrees(45), Angle.fromDegrees(30)); ellipsoid.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); ellipsoid.setAttributes(attrs2); ellipsoid.setValue(AVKey.DISPLAY_NAME, "Ellipsoid with a pre-set orientation"); layer.addRenderable(ellipsoid); // Ellipsoid oriented in 3rd "quadrant" (-X, -Y, -Z). ellipsoid = new Ellipsoid( Position.fromDegrees(-45, -180, 750000), 1000000, 500000, 100000, Angle.fromDegrees(90), Angle.fromDegrees(45), Angle.fromDegrees(30)); ellipsoid.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); ellipsoid.setAttributes(attrs2); ellipsoid.setValue(AVKey.DISPLAY_NAME, "Ellipsoid oriented in 3rd \"quadrant\" (-X, -Y, -Z)"); layer.addRenderable(ellipsoid); // Add the layer to the model and update the layer panel. insertBeforePlacenames(getWwd(), layer); }