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


Java LineStripArray类代码示例

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


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

示例1: Object1d

import javax.media.j3d.LineStripArray; //导入依赖的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

示例2: PolyLine

import javax.media.j3d.LineStripArray; //导入依赖的package包/类
/** Create polyline.
  * @param points      array of <code>Point3D</code>s
  * @param appearance  object' Appearance 
  * @preconditions points.length > 1 */
public PolyLine(Point3d[] points,
                Appearance appearance) {
           
  if (points.length < 2) {
    return;
    }
         
  int[] counts = new int[1];
  counts[0] = points.length;
  LineStripArray lineArray = new LineStripArray(points.length, 
                                                GeometryArray.COORDINATES|
                                                GeometryArray.NORMALS,
                                                counts);
  float[] normal = {0, 0, 0};
  lineArray.setCoordinates(0, points);
  lineArray.setNormal(0, normal);
  setGeometry(lineArray);        
  setAppearance(appearance);
    
  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:25,代码来源:PolyLine.java

示例3: setupFinished

import javax.media.j3d.LineStripArray; //导入依赖的package包/类
/**
 * Notification that the construction phase of this node has finished.
 * If the node would like to do any internal processing, such as setting
 * up geometry, then go for it now.
 */
public void setupFinished() {
    if(!inSetup)
        return;

    super.setupFinished();

    int num_points = numLineSegments / 2;
    float[] coords = new float[num_points * 3];
    for(int i = 0; i < num_points; i++) {
        coords[i * 3] = vfLineSegments[i * 2];
        coords[i * 3 + 1] = vfLineSegments[i * 2 + 1];
        coords[i * 3 + 2] = 0;
    }

    implGeom = new LineStripArray(num_points,
                                  LineStripArray.COORDINATES,
                                  new int[] { num_points });
    implGeom.setCoordinates(0, coords);
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:25,代码来源:J3DPolyline2D.java

示例4: toLineGeometry

import javax.media.j3d.LineStripArray; //导入依赖的package包/类
/**
      * @return GeometryArray
      */
     public GeometryArray toLineGeometry() {
         LineStripArray a = new LineStripArray(size(),
             GeometryArray.COORDINATES, new int[] { size() });
a.setCoordinates(0, toArray(new Point3d[] {}));
return a;
     }
 
开发者ID:tsandmann,项目名称:ct-sim,代码行数:10,代码来源:CtBotShape.java

示例5: generateGeometry

import javax.media.j3d.LineStripArray; //导入依赖的package包/类
/**
 * Convenience method to generate new geometry.
 */
private void generateGeometry() {
    maxVertexCount = geometryData.vertexCount;

    int format = LineStripArray.COORDINATES;

    impl = new LineStripArray(geometryData.vertexCount,
                              format,
                              1,
                              TEX_SET_MAP,
                              geometryData.stripCounts);

    impl.setCapability(LineStripArray.ALLOW_COUNT_WRITE);
    impl.setCapability(LineStripArray.ALLOW_COORDINATE_WRITE);

    impl.setCoordinates(0, geometryData.coordinates);

    J3DUserData u_data = new J3DUserData();
    u_data.geometryData = geometryData;

    impl.setUserData(u_data);

    if(capReqdBits != null) {
        for(int i = 0; i < capReqdBits.length; i++)
            impl.setCapability(capReqdBits[i]);
    }

    if(J3DGlobalStatus.haveFreqBitsAPI && freqReqdBits != null) {
        for(int i = 0; i < freqReqdBits.length; i++)
            impl.setCapabilityIsFrequent(freqReqdBits[i]);
    }
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:35,代码来源:J3DNurbsCurve.java

示例6: geometryWithColor

import javax.media.j3d.LineStripArray; //导入依赖的package包/类
/**
 * Génère une géométrie Java3D à partir d'une couleur indiquée
 * 
 * @return
 */
private LineStripArray geometryWithColor(List<IOrientableCurve> lCurves) {
  // On créer un tableau contenant les lignes à représenter
  Color3f couleur3F = new Color3f(this.edgeColor);

  // Effectue la conversion de la géométrie

  // on compte le nombre de points
  int nPoints = 0;
  int nbLignes = lCurves.size();

  for (int i = 0; i < nbLignes; i++) {
    nPoints = nPoints + lCurves.get(i).coord().size();
  }

  // Problème de ligne vide
  if (nPoints < 2) {
    return null;
  }

  /*
   * Tableau permettant de définir le nombre de lignes représentées (cas des
   * multi-lignes Ici il y en a une contenant tous les points
   */
  int[] stripVertexCount = new int[nbLignes];

  // On indique de combien de points sera formé chaque fragment de lignes
  for (int i = 0; i < nbLignes; i++) {
    stripVertexCount[i] = lCurves.get(i).coord().size();


  }

  // On prépare la géométrie et ses autorisations
  LineStripArray geom = new LineStripArray(nPoints, GeometryArray.COORDINATES
      | GeometryArray.COLOR_3, stripVertexCount);

  geom.setCapability(GeometryArray.ALLOW_COLOR_READ);
  geom.setCapability(GeometryArray.ALLOW_COLOR_WRITE);
  geom.setCapability(Geometry.ALLOW_INTERSECT);

  // compteurs pour remplir le tableau de points
  int elementajoute = 0;

  for (int i = 0; i < nbLignes; i++) {
    // On récupère les points de chaque ligne
    IDirectPositionList lPoints = lCurves.get(i).coord();
    int nPointsTemp = lPoints.size();
    for (int j = 0; j < nPointsTemp; j++) {
      IDirectPosition dp = lPoints.get(j);
      Point3d point = new Point3d((float) dp.getX(), (float) dp.getY(),
          (float) dp.getZ());
      geom.setCoordinate(elementajoute, point);
      geom.setColor(elementajoute, couleur3F);

      elementajoute++;
    }
  }
  return geom;

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

示例7: outputShape

import javax.media.j3d.LineStripArray; //导入依赖的package包/类
private void outputShape(OrderedGroup triGroup, int orderDir, TexCoordGeneration tg, Texture2D texture, int numPts, Point3d[] pts, Color4f[] colrs)
{

	count[0] = numPts;
	TriangleFanArray pgonGeo = new TriangleFanArray(numPts,
			GeometryArray.COORDINATES | GeometryArray.COLOR_4, count);
	pgonGeo.setCoordinates(0, pts, 0, numPts);
	pgonGeo.setColors(0, colrs, 0, numPts);

	Appearance appearance = new Appearance();
	if (texture != null)
	{
		appearance.setTextureAttributes(texAttr);
		appearance.setTexture(texture);
	}
	appearance.setMaterial(m);
	appearance.setColoringAttributes(clr);
	appearance.setTransparencyAttributes(trans);
	appearance.setPolygonAttributes(p);
	appearance.setTexCoordGeneration(tg);
	appearance.setRenderingAttributes(r);
	Shape3D shape = new Shape3D(pgonGeo, appearance);

	Node child = shape;

	if (outputLines)
	{
		Group shapeGroup = new Group();
		shapeGroup.addChild(shape);
		count[0] = numPts + 1;
		pts[numPts] = pts[0];
		LineStripArray lineGeo = new LineStripArray(numPts + 1,
				GeometryArray.COORDINATES, count);
		lineGeo.setCoordinates(0, pts, 0, numPts + 1);
		Appearance lineAppearance = new Appearance();
		Shape3D lineShape = new Shape3D(lineGeo, lineAppearance);
		shapeGroup.addChild(lineShape);
		child = shapeGroup;
	}

	if (verbose)
	{
		System.out.println("shape is " + child);
	}

	if (orderDir == FRONT)
	{
		triGroup.insertChild(child, 0);
	} else
	{
		triGroup.addChild(child);
	}
}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:54,代码来源:SlicePlane2DRenderer.java

示例8: traiteGeom

import javax.media.j3d.LineStripArray; //导入依赖的package包/类
private BranchGroup traiteGeom(List<IOrientableSurface> lOS) {
  int nbSurf = lOS.size();

  LineStripArray lStrips = null;
  List<IOrientableCurve> lCurve = new ArrayList<IOrientableCurve>();

  for (int i = 0; i < nbSurf; i++) {
    IRing r1 = ((GM_Polygon) lOS.get(i)).getExterior();

    lCurve.add(r1.getPrimitive());

    int nbInt = ((GM_Polygon) lOS.get(i)).getInterior().size();

    for (int j = 0; j < nbInt; j++) {
      lCurve.addAll(((GM_Polygon) lOS.get(i)).getInterior().get(j)
          .getGenerator());

    }

  }

  lStrips = this.geometryWithColor(lCurve);

  Shape3D s = new Shape3D(ConversionJava3DGeOxygene
      .fromOrientableSToTriangleArray(lOS).getGeometryArray(),
      this.generateAppearance(true, this.color, this.coefOpacity, true));

  BranchGroup bg = new BranchGroup();

  bg.addChild(s);


    bg.addChild(new Shape3D(lStrips, this.generateAppearanceLine(true,
      this.edgeColor, 1, true)));

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

示例9: changeColor

import javax.media.j3d.LineStripArray; //导入依赖的package包/类
/**
 * Modifie la couleur de l'affichage mais pas l'attribut couleur (utile pour
 * des changements de couleur temporaires
 */
private void changeColor(Color color) {

  LineStripArray geom = (LineStripArray) this.getShapes().get(0)
      .getGeometry();

  if (color == null) {
    // Si il n'y a pas de couleur on applique la coloration aléatoire
    this.getShapes().get(0).setGeometry(this.geometryWithOutColor(), 0);

    return;
  }
  // On applique la coloration choisie
  Color3f couleur3F = new Color3f(color);

  IDirectPositionList lPoints = this.getFeature().getGeom().coord();

  int n = lPoints.size();
  Color3f[] tab = new Color3f[n];

  for (int i = 0; i < n; i++) {
    tab[i] = couleur3F;

  }

  geom.setColors(0, tab);

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

示例10: setCapabilityRequiredMap

import javax.media.j3d.LineStripArray; //导入依赖的package包/类
/**
 * Set the mapping of capability bits that the user would like to
 * make sure is set. The end output is that the capabilities are the union
 * of what the loader wants and what the user wants. Default implementation
 * does nothing.
 * <p>
 * If the map contains a key, but the value is  null or zero length, the
 * request is ignored.
 *
 * @param capBits The capability bits to be set
 * @param freqBits The frequency bits to be set
 */
public void setCapabilityRequiredMap(Map capBits, Map freqBits) {

    if(capBits != null && capBits.containsKey(LineStripArray.class))
        capReqdBits = (int[])capBits.get(LineStripArray.class);

    if(!J3DGlobalStatus.haveFreqBitsAPI || freqBits == null ||
       !freqBits.containsKey(LineStripArray.class))
        return;

    freqReqdBits = (int[])freqBits.get(LineStripArray.class);
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:24,代码来源:J3DNurbsCurve.java

示例11: traiteContour

import javax.media.j3d.LineStripArray; //导入依赖的package包/类
private BranchGroup traiteContour(List<Edge> lEdge){
  
  
  List<IOrientableCurve> lC = new ArrayList<IOrientableCurve>();
  
  
  for(Edge e:lEdge){
    
    
    List<Triangle> lT = e.getNeighbourTriangles();
    
    
    int size = lT.size();
    
    
    if(size < 2){
      
      lC.add(e.getLineString());
      
      
      
    }else if(size ==2){
      
      
      Triangle t1 = lT.get(0);
      Vecteur v = t1.getNormal().getNormalised();
      
      Triangle t2 = lT.get(1);
      Vecteur v2 = t2.getNormal().getNormalised();
      
      
      double prod  = v.prodScalaire(v2);
      
      if(Math.abs(prod) < 0.9){
        lC.add(e.getLineString());
      }
      
      
    }else{
      System.out.println("CartoMod2 : more than 3 face for an edge ????");
    }
    
    
    

    
    
    
  }
  
 // System.out.println("LCCCCCCCCC " + lC.size());
  
  
  if(lC.size() > 0){
    
    

    
    LineStripArray lAS =   geometryWithColor(lC);
    Appearance ap = generateAppearanceLine(true,this.edgeColor, 1, true);
      
    Shape3D s = new Shape3D(lAS, ap);
    
    BranchGroup bg = new BranchGroup();
    bg.addChild(s);
    return bg;
  }
  
  return new BranchGroup();
  
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:72,代码来源:CartooMod2.java


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