当前位置: 首页>>代码示例>>Java>>正文


Java LineAttributes.setLinePattern方法代码示例

本文整理汇总了Java中javax.media.j3d.LineAttributes.setLinePattern方法的典型用法代码示例。如果您正苦于以下问题:Java LineAttributes.setLinePattern方法的具体用法?Java LineAttributes.setLinePattern怎么用?Java LineAttributes.setLinePattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.media.j3d.LineAttributes的用法示例。


在下文中一共展示了LineAttributes.setLinePattern方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createLineTypes

import javax.media.j3d.LineAttributes; //导入方法依赖的package包/类
Group createLineTypes() {

    Group lineGroup = new Group();

    Appearance app = new Appearance();
    ColoringAttributes ca = new ColoringAttributes(black,
        ColoringAttributes.SHADE_FLAT);
    app.setColoringAttributes(ca);

    // 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;

  }
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:67,代码来源:LineTypes.java

示例2: addKinectShape

import javax.media.j3d.LineAttributes; //导入方法依赖的package包/类
public void addKinectShape() {
	// create an appearance
	Appearance ap = new Appearance();

	// render as a wireframe
	PolygonAttributes polyAttrbutes = new PolygonAttributes();
	polyAttrbutes.setPolygonMode(PolygonAttributes.POLYGON_LINE);
	polyAttrbutes.setCullFace(PolygonAttributes.CULL_NONE);
	ap.setPolygonAttributes(polyAttrbutes);

	Box kinect = new Box(0.6f, 0.1f, 0.2f, ap);

	// scale and move start position to (-4,0,0) // change later
	TransformGroup posnTG = new TransformGroup();
	Transform3D t3d = new Transform3D();
	// t3d.setScale(0.5);
	t3d.setTranslation(new Vector3d(0f, 2.4f, 6.0f));
	posnTG.setTransform(t3d);
	posnTG.addChild(kinect);

	Color3f red = new Color3f(1.0f, 0.0f, 0.0f);

	// line pattern dot-dash
	ColoringAttributes ca = new ColoringAttributes(red, ColoringAttributes.NICEST);
	Point3f[] dotDashPts = new Point3f[2];
	dotDashPts[0] = new Point3f(0.0f, 0.0f, 0.0f);
	dotDashPts[1] = new Point3f(4.9f, 4.7f, -5.0f);
	LineArray dotDash = new LineArray(2, GeometryArray.COORDINATES);
	dotDash.setCoordinates(0, dotDashPts);
	LineAttributes dotDashLa = new LineAttributes();
	dotDashLa.setLineWidth(4.0f);
	dotDashLa.setLinePattern(LineAttributes.PATTERN_DASH);
	Appearance dotDashApp = new Appearance();
	dotDashApp.setLineAttributes(dotDashLa);
	dotDashApp.setColoringAttributes(ca);
	Shape3D dotDashShape = new Shape3D(dotDash, dotDashApp);
	posnTG.addChild(dotDashShape);

	// Shape3D pyramid = createPyramid();
	// posnTG.addChild(pyramid);

	sceneBG.addChild(posnTG);
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:44,代码来源:Points3DPanel.java

示例3: addKinectShape

import javax.media.j3d.LineAttributes; //导入方法依赖的package包/类
public void addKinectShape() {
  // create an appearance
  Appearance ap = new Appearance();

  // render as a wireframe
  PolygonAttributes polyAttrbutes = new PolygonAttributes();
  polyAttrbutes.setPolygonMode(PolygonAttributes.POLYGON_LINE);
  polyAttrbutes.setCullFace(PolygonAttributes.CULL_NONE);
  ap.setPolygonAttributes(polyAttrbutes);

  Box kinect = new Box(0.6f, 0.1f, 0.2f, ap);

  // scale and move start position to (-4,0,0) // change later
  TransformGroup posnTG = new TransformGroup();
  Transform3D t3d = new Transform3D();
  // t3d.setScale(0.5);
  t3d.setTranslation(new Vector3d(0f, 2.4f, 6.0f));
  posnTG.setTransform(t3d);
  posnTG.addChild(kinect);

  Color3f red = new Color3f(1.0f, 0.0f, 0.0f);

  // line pattern dot-dash
  ColoringAttributes ca = new ColoringAttributes(red, ColoringAttributes.NICEST);
  Point3f[] dotDashPts = new Point3f[2];
  dotDashPts[0] = new Point3f(0.0f, 0.0f, 0.0f);
  dotDashPts[1] = new Point3f(4.9f, 4.7f, -5.0f);
  LineArray dotDash = new LineArray(2, GeometryArray.COORDINATES);
  dotDash.setCoordinates(0, dotDashPts);
  LineAttributes dotDashLa = new LineAttributes();
  dotDashLa.setLineWidth(4.0f);
  dotDashLa.setLinePattern(LineAttributes.PATTERN_DASH);
  Appearance dotDashApp = new Appearance();
  dotDashApp.setLineAttributes(dotDashLa);
  dotDashApp.setColoringAttributes(ca);
  Shape3D dotDashShape = new Shape3D(dotDash, dotDashApp);
  posnTG.addChild(dotDashShape);

  // Shape3D pyramid = createPyramid();
  // posnTG.addChild(pyramid);

  sceneBG.addChild(posnTG);
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:44,代码来源:Points3DPanel.java

示例4: generateAppearanceLine

import javax.media.j3d.LineAttributes; //导入方法依赖的package包/类
/**
 * Methode pour l'apparence des lignes
 */
private Appearance generateAppearanceLine(boolean isClrd, Color color,
    double coefOpacity, boolean isSolid) {

  // Création de l'apparence
  Appearance apparenceFinale = new Appearance();

  // Autorisations pour l'apparence
  apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_WRITE);

  // Autorisations pour le material
  apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_WRITE);

  apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_WRITE);

  // Autorisations pour le material
  apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_WRITE);

  // Association à l'apparence des attributs de géométrie et de material

  // Création des attributs du polygone

  LineAttributes lp = new LineAttributes();

  lp.setLineAntialiasingEnable(true);
  lp.setLineWidth(this.widthEdge);
  if (isSolid) {
    lp.setLinePattern(LineAttributes.PATTERN_SOLID);

  } else {

    lp.setLinePattern(LineAttributes.PATTERN_DASH);

  }

  apparenceFinale.setLineAttributes(lp);

  if (isClrd) {

    // Création du material (gestion des couleurs et de l'affichage)
    Material material = new Material();

    material.setAmbientColor(new Color3f(color));
    material.setDiffuseColor(new Color3f(color));
    material.setEmissiveColor(new Color3f(color));
    material.setLightingEnable(true);
    material.setSpecularColor(new Color3f(color));
    material.setShininess(1);

    apparenceFinale.setMaterial(material);
  }

  if (coefOpacity != 1) {

    TransparencyAttributes t_attr =

    new TransparencyAttributes(TransparencyAttributes.FASTEST,
        (float) (1 - coefOpacity));

    apparenceFinale.setTransparencyAttributes(t_attr);
  }

  // Association à l'apparence des attributs de géométrie et de material

  return apparenceFinale;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:73,代码来源:ObjectCartoon.java

示例5: generateAppearance

import javax.media.j3d.LineAttributes; //导入方法依赖的package包/类
/**
 * Methode pour l'apparence des triangles pleins
 */
private Appearance generateAppearance(boolean isClrd, Color color,
    double coefOpacite, boolean isSolid) {

  this.isColored = isClrd;
  this.opacity = coefOpacite;
  this.isSolid = isSolid;

  // Création de l'apparence
  Appearance apparenceFinale = new Appearance();

  // Autorisations pour l'apparence
  apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_WRITE);

  // Autorisations pour le material
  apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_WRITE);

  apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_POLYGON_ATTRIBUTES_WRITE);

  // Autorisations pour le material
  apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_READ);
  apparenceFinale.setCapability(Appearance.ALLOW_MATERIAL_WRITE);

  // Association à l'apparence des attributs de géométrie et de material

  // Création des attributs du polygone

  LineAttributes lp = new LineAttributes();

  lp.setLineAntialiasingEnable(true);
  lp.setLineWidth(Object1d.width);
  if (isSolid) {
    lp.setLinePattern(LineAttributes.PATTERN_SOLID);

  } else {

    lp.setLinePattern(LineAttributes.PATTERN_DASH);

  }

  apparenceFinale.setLineAttributes(lp);

  if (isClrd) {

    // Création du material (gestion des couleurs et de l'affichage)
    Material material = new Material();

    material.setAmbientColor(0.2f, 0.2f, 0.2f);
    material.setDiffuseColor(new Color3f(color));
    material.setSpecularColor(new Color3f(1.0f, 1.0f, 1.0f));
    material.setShininess(128);

    apparenceFinale.setMaterial(material);
  }

  if (coefOpacite != 1) {

    TransparencyAttributes t_attr =

    new TransparencyAttributes(TransparencyAttributes.BLENDED,
        (float) coefOpacite,

        TransparencyAttributes.BLEND_SRC_ALPHA,

        TransparencyAttributes.BLENDED);

    apparenceFinale.setTransparencyAttributes(t_attr);
  }

  // Association à l'apparence des attributs de géométrie et de material

  return apparenceFinale;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:79,代码来源:Object1d.java


注:本文中的javax.media.j3d.LineAttributes.setLinePattern方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。