List of usage examples for javax.media.j3d LineAttributes setLinePattern
public void setLinePattern(int linePattern)
From source file:LineTypes.java
Group createLineTypes() { Group lineGroup = new Group(); Appearance app = new Appearance(); ColoringAttributes ca = new ColoringAttributes(black, ColoringAttributes.SHADE_FLAT); app.setColoringAttributes(ca);/*from w w w .j ava2 s. c o m*/ // Plain line Point3f[] plaPts = new Point3f[2]; plaPts[0] = new Point3f(-0.9f, -0.7f, 0.0f); plaPts[1] = new Point3f(-0.5f, 0.7f, 0.0f); LineArray pla = new LineArray(2, LineArray.COORDINATES); pla.setCoordinates(0, plaPts); Shape3D plShape = new Shape3D(pla, app); lineGroup.addChild(plShape); // line pattern dot Point3f[] dotPts = new Point3f[2]; dotPts[0] = new Point3f(-0.4f, -0.7f, 0.0f); dotPts[1] = new Point3f(-0.0f, 0.7f, 0.0f); LineArray dot = new LineArray(2, LineArray.COORDINATES); dot.setCoordinates(0, dotPts); LineAttributes dotLa = new LineAttributes(); dotLa.setLineWidth(2.0f); dotLa.setLinePattern(LineAttributes.PATTERN_DOT); Appearance dotApp = new Appearance(); dotApp.setLineAttributes(dotLa); dotApp.setColoringAttributes(ca); Shape3D dotShape = new Shape3D(dot, dotApp); lineGroup.addChild(dotShape); // line pattern dash Point3f[] dashPts = new Point3f[2]; dashPts[0] = new Point3f(-0.0f, -0.7f, 0.0f); dashPts[1] = new Point3f(0.4f, 0.7f, 0.0f); LineArray dash = new LineArray(2, LineArray.COORDINATES); dash.setCoordinates(0, dashPts); LineAttributes dashLa = new LineAttributes(); dashLa.setLineWidth(4.0f); dashLa.setLinePattern(LineAttributes.PATTERN_DASH); Appearance dashApp = new Appearance(); dashApp.setLineAttributes(dashLa); dashApp.setColoringAttributes(ca); Shape3D dashShape = new Shape3D(dash, dashApp); lineGroup.addChild(dashShape); // line pattern dot-dash Point3f[] dotDashPts = new Point3f[2]; dotDashPts[0] = new Point3f(0.5f, -0.7f, 0.0f); dotDashPts[1] = new Point3f(0.9f, 0.7f, 0.0f); LineArray dotDash = new LineArray(2, LineArray.COORDINATES); dotDash.setCoordinates(0, dotDashPts); LineAttributes dotDashLa = new LineAttributes(); dotDashLa.setLineWidth(4.0f); dotDashLa.setLinePattern(LineAttributes.PATTERN_DASH_DOT); Appearance dotDashApp = new Appearance(); dotDashApp.setLineAttributes(dotDashLa); dotDashApp.setColoringAttributes(ca); Shape3D dotDashShape = new Shape3D(dotDash, dotDashApp); lineGroup.addChild(dotDashShape); return lineGroup; }