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


Java Shape3D类代码示例

本文整理汇总了Java中javax.media.j3d.Shape3D的典型用法代码示例。如果您正苦于以下问题:Java Shape3D类的具体用法?Java Shape3D怎么用?Java Shape3D使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: RepresentationTin

import javax.media.j3d.Shape3D; //导入依赖的package包/类
public RepresentationTin(ITriangulatedSurface tin, Color[] colorShade,
    int method) {
  super();
  this.nbClasses = colorShade.length;
  Box3D b = new Box3D(tin.coord());
  this.zMin = b.getLLDP().getZ();
  this.zMax = b.getURDP().getZ();
  this.colorShade = toColor3f(colorShade);
  this.method = METHOD_LINEAR;
  this.tin = tin;
  GeometryInfo geoInfo = fromOrientableSToTriangleArray();

  Appearance app = new Appearance();

  ColoringAttributes at = new ColoringAttributes();
  at.setShadeModel(ColoringAttributes.NICEST);

  app.setColoringAttributes(at);

  this.bGRep.addChild(new Shape3D(geoInfo.getGeometryArray(), app));

}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:23,代码来源:RepresentationTin.java

示例2: setSelected

import javax.media.j3d.Shape3D; //导入依赖的package包/类
@Override
public void setSelected(boolean isSelected) {
  this.selected = isSelected;

  List<Shape3D> shapes = this.getShapes();
  int nbElem = shapes.size();
  // On récupère les différentes apparences et on affecte un facteur de
  // couleur
  for (int i = 0; i < nbElem; i++) {

    if (isSelected) {
      shapes.get(i).setAppearance(
          this.genereApparence(ConstantRepresentation.selectionColor, 0));

    } else {
      shapes.get(i).setAppearance(
          this.genereApparence(this.color, this.opacity));

    }

  }

}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:24,代码来源:BasicToponym3D.java

示例3: Symbol3D

import javax.media.j3d.Shape3D; //导入依赖的package包/类
/**
 * Create cubes center on the different points of the feature
 * 
 * @param feat entité à laquelle sera associée la représentation
 * @param width largeur du cube
 * @param color la couleur que l'on souhaite appliquer au cube
 */
public Symbol3D(IFeature feat, double width, Color color) {
  super();
  this.feat = feat;
  this.width = width;
  this.color = color;

  List<Shape3D> lShapes = this.generateAllCube();

  int nbShapes = lShapes.size();

  for (int i = 0; i < nbShapes; i++) {

    this.bGRep.addChild(lShapes.get(i));

  }
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:24,代码来源:Symbol3D.java

示例4: Object1d

import javax.media.j3d.Shape3D; //导入依赖的package包/类
/**
 * créer la représentation d'un objet avec une géométrie de type linéaire.
 * créer le lien entre la représentation et l'objet indispensable pour pouvoir
 * effectuer des sélections
 * 
 * @param feat l'entité dont la géométrie servira à créer la représentation et
 *          à laquelle sera attachée la représentation
 * @param isClrd indique si une couleur unique sera appliquée ou non (si false
 *          une couleur différente par face)
 * @param color couleur appliquée si isClrd == true
 * @param coefOpacity coefficient d'opacité appliqué à l'objet
 * @param isSolid propose un mode de représentation filaire (false) ou
 *          surfacique (true)
 */
public Object1d(IFeature feat, boolean isClrd, Color color,
    double coefOpacity, boolean isSolid) {
  super(feat, isClrd, color, coefOpacity, isSolid);
  // Génère en fonction du cas la géométrie Java3D
  LineStripArray geomInfo = null;
  if (isClrd) {
    geomInfo = this.geometryWithColor();
  } else {
    geomInfo = this.geometryWithOutColor();
  }

  if (geomInfo == null) {
    Object1d.logger.warn(Messages.getString("Representation.RepNulle"));
    return;
  }
  // Génère l'apparence et l'applique
  Shape3D shapepleine = new Shape3D(geomInfo, this.generateAppearance(isClrd,
      color, coefOpacity, isSolid));

  // Autorisations sur la Shape3D
  shapepleine.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
  shapepleine.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
  shapepleine.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
  shapepleine.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
  shapepleine.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
  shapepleine.setCapability(Node.ALLOW_LOCALE_READ);
  shapepleine.setCapability(Node.ALLOW_PICKABLE_READ);
  shapepleine.setCapability(Node.ALLOW_PICKABLE_WRITE);

  this.bGRep.addChild(shapepleine);

  // Optimisation
  this.bGRep.compile();
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:49,代码来源:Object1d.java

示例5: getShapes

import javax.media.j3d.Shape3D; //导入依赖的package包/类
/**
 * @return Permet de renvoyer la liste des géométries Java3D stockées dans les
 *         différentes représentations
 */
protected ArrayList<Shape3D> getShapes() {

  ArrayList<Shape3D> shapes = new ArrayList<Shape3D>(1);
  Enumeration<?> enumGroup = this.bGRep.getAllChildren();

  while (enumGroup.hasMoreElements()) {

    Object objTemp = enumGroup.nextElement();
    // Théoriquement la géométrie Java3D n'est rattachée qu'au premier
    // noeud
    if (objTemp instanceof Shape3D) {
      shapes.add((Shape3D) objTemp);
    }
  }

  return shapes;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:22,代码来源:BasicRep3D.java

示例6: setSelected

import javax.media.j3d.Shape3D; //导入依赖的package包/类
@Override
public void setSelected(boolean isSelected) {
  this.selected = isSelected;

  List<Shape3D> shapesTemp = this.getShapes();
  int nbElem = shapesTemp.size();
  if (isSelected) {
    // Si l'objet est sélectionné on applique
    // la couleur de sélection
    for (int i = 0; i < nbElem; i++) {
      shapesTemp.get(i).setAppearance(
          this.generateAppearance(true,
              ConstantRepresentation.selectionColor, this.opacity,
              this.isSolid));
    }
  } else {
    // Sinon on applique la couleur initiale
    for (int i = 0; i < nbElem; i++) {
      shapesTemp.get(i).setAppearance(
          this.generateAppearance(this.isColored, this.color, this.opacity,
              this.isSolid));
    }
  }
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:25,代码来源:Object3d.java

示例7: getShapes

import javax.media.j3d.Shape3D; //导入依赖的package包/类
/**
 * Renvoie les géométries générées pour un objet
 * 
 * @return
 */
private ArrayList<Shape3D> getShapes() {

  ArrayList<Shape3D> shapes = new ArrayList<Shape3D>(1);
  Enumeration<?> enumGroup = this.bGRep.getAllChildren();

  while (enumGroup.hasMoreElements()) {

    Object objTemp = enumGroup.nextElement();
    // Théoriquement la géométrie Java3D n'est rattachée qu'au premier
    // noeud
    if (objTemp instanceof Shape3D) {
      shapes.add((Shape3D) objTemp);
    }
  }

  return shapes;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:23,代码来源:TexturedSurface.java

示例8: searchMaterials

import javax.media.j3d.Shape3D; //导入依赖的package包/类
private void searchMaterials(Node node, Set<Appearance> appearances)
{
	if (node instanceof Group)
	{
		// Enumerate children
		Enumeration<?> enumeration = ((Group) node).getAllChildren();
		while (enumeration.hasMoreElements())
		{
			searchMaterials((Node) enumeration.nextElement(), appearances);
		}
	}
	else if (node instanceof Link)
	{
		searchMaterials(((Link) node).getSharedGroup(), appearances);
	}
	else if (node instanceof Shape3D)
	{
		Appearance appearance = ((Shape3D) node).getAppearance();
		if (appearance != null)
		{
			appearances.add(appearance);
		}
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:25,代码来源:ModelManager.java

示例9: updateRoomPartGeometry

import javax.media.j3d.Shape3D; //导入依赖的package包/类
private void updateRoomPartGeometry(int roomPart, HomeTexture texture)
{
	Shape3D roomShape = (Shape3D) getChild(roomPart);
	int currentGeometriesCount = roomShape.numGeometries();
	Room room = (Room) getUserData();
	if (room.getLevel() == null || room.getLevel().isViewableAndVisible())
	{
		for (Geometry roomGeometry : createRoomGeometries(roomPart, texture))
		{
			roomShape.addGeometry(roomGeometry);
		}
	}
	for (int i = currentGeometriesCount - 1; i >= 0; i--)
	{
		roomShape.removeGeometry(i);
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:18,代码来源:Room3D.java

示例10: getShapesCount

import javax.media.j3d.Shape3D; //导入依赖的package包/类
private int getShapesCount(Node node) {
  if (node instanceof Group) {
    int shapesCount = 0;
    Enumeration<?> enumeration = ((Group)node).getAllChildren();
    while (enumeration.hasMoreElements ()) {
      shapesCount += getShapesCount((Node)enumeration.nextElement());
    }
    return shapesCount;
  } else if (node instanceof Link) {
    return getShapesCount(((Link)node).getSharedGroup());
  } else if (node instanceof Shape3D) {
    return 1;
  } else {
    return 0;
  }
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:17,代码来源:ModelManagerTest.java

示例11: Triangle3dCreator

import javax.media.j3d.Shape3D; //导入依赖的package包/类
/**
     * Creates a new instance of Triangle3dCreator color the color of the
     * triangle
     */
    public Triangle3dCreator(Color3f color) {
        this.triangleColor = color;
        this.triangleAppearance = new Appearance();

        // ca werden nicht benoetigt
        // ColoringAttributes ca = new ColoringAttributes();
        // ca.setColor(triangleColor);
        // this.triangleAppearance.setColoringAttributes(ca);

        TransparencyAttributes ta = new TransparencyAttributes(TransparencyAttributes.FASTEST, 0.5f);
        this.triangleAppearance.setTransparencyAttributes(ta);

//		Material material = new Material();
//		material.setAmbientColor(color);
//		material.setShininess(0.5f);
//		material.setLightingEnable(true);
//		this.triangleAppearance.setMaterial(material);

        this.triangleContainer = new Shape3D();
        this.triangleContainer.setAppearance(triangleAppearance);
        triangleContainer.removeGeometry(0);
    }
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:27,代码来源:Triangle3dCreator.java

示例12: Triangle3dCreator

import javax.media.j3d.Shape3D; //导入依赖的package包/类
/**
 * Creates a new instance of Triangle3dCreator color the color of the
 * triangle
 */
public Triangle3dCreator(Color3f color) {
    this.triangleColor = color;
    this.triangleAppearance = new Appearance();

    ColoringAttributes ca = new ColoringAttributes();
    ca.setColor(triangleColor);
    this.triangleAppearance.setColoringAttributes(ca);

    TransparencyAttributes ta = new TransparencyAttributes();
    ta.setTransparency(0.5f);
    this.triangleAppearance.setTransparencyAttributes(ta);

    this.triangleContainer = new Shape3D();
    triangleContainer.removeGeometry(0);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:20,代码来源:Triangle3dCreator.java

示例13: manifestationSwitched

import javax.media.j3d.Shape3D; //导入依赖的package包/类
@Override
public void manifestationSwitched( RenderedManifestation from, RenderedManifestation to )
{
    BranchGroup target = (BranchGroup) from .getGraphicsObject();
    if ( target == null ) {
        return;
    }
    TransformGroup tg = (TransformGroup) target .getChild( 0 );
    Shape3D poly = (Shape3D) tg .getChild( 0 );
    poly .setUserData( to );
    if ( this .isSticky )
    {
        to .setGraphicsObject( target );
        from .setGraphicsObject( null );
    }
}
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:17,代码来源:Java3dSceneGraph.java

示例14: refreshPolygonOutlines

import javax.media.j3d.Shape3D; //导入依赖的package包/类
private void refreshPolygonOutlines() {
	Collection<BranchGroup> bgs = new ArrayList<>();
       for ( int i = 0; i < mScene .numChildren(); i++ ) {
           BranchGroup bg = (BranchGroup) mScene .getChild( i );
           bgs .add( bg );
       }
       for (BranchGroup branchGroup : bgs) {
           TransformGroup tg = (TransformGroup) branchGroup .getChild( 0 );
       	Shape3D solidPoly = (Shape3D) tg .getChild( 0 );
       	RenderedManifestation rm = (RenderedManifestation) solidPoly .getUserData();
       	if ( rm != null ) {
       		this .manifestationRemoved( rm );
       		this .manifestationAdded( rm );
       	}
	}
}
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:17,代码来源:Java3dSceneGraph.java

示例15: DebugVector

import javax.media.j3d.Shape3D; //导入依赖的package包/类
public DebugVector( Point3f location , Vector3f extent , Color3f color )
{
	ColoringAttributes ca = new ColoringAttributes( );
	ca.setCapability( ColoringAttributes.ALLOW_COLOR_WRITE );
	RenderingAttributes ra = new RenderingAttributes( );
	ra.setCapability( RenderingAttributes.ALLOW_VISIBLE_WRITE );
	TransparencyAttributes ta = new TransparencyAttributes( );
	ta.setTransparency( 0.3f );
	Appearance app = new Appearance( );
	app.setColoringAttributes( ca );
	app.setCapability( Appearance.ALLOW_COLORING_ATTRIBUTES_READ );
	app.setRenderingAttributes( ra );
	app.setCapability( Appearance.ALLOW_RENDERING_ATTRIBUTES_READ );
	shape.setAppearance( app );
	shape.setCapability( Shape3D.ALLOW_APPEARANCE_READ );
	shape.setCapability( Shape3D.ALLOW_GEOMETRY_WRITE );
	
	setVector( location , extent );
	setColor( color );
	
	addChild( shape );
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:23,代码来源:DebugVector.java


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