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


Java BranchGroup类代码示例

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


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

示例1: generateRepresentation

import javax.media.j3d.BranchGroup; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static BranchGroup generateRepresentation(IGeometry geom,
    List<CG_AbstractSurfaceData> lCGA) {

  if (geom instanceof GM_MultiSolid<?>) {

    return CG_StylePreparator.generateRepresentation(
        (GM_MultiSolid<GM_Solid>) geom, lCGA);
  } else if (geom instanceof GM_Solid) {
    return CG_StylePreparator.generateRepresentation((GM_Solid) geom, lCGA);
  } else if (geom instanceof GM_MultiSurface<?>) {
    return CG_StylePreparator.generateRepresentation(
        (GM_MultiSurface<GM_OrientableSurface>) geom, lCGA);

  } else if (geom instanceof GM_OrientableSurface) {

    BranchGroup bg = new BranchGroup();
    bg.addChild(CG_StylePreparator.generateRepresentation(
        (GM_OrientableSurface) geom, lCGA));

    return bg;

  }
  return null;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:26,代码来源:CG_StylePreparator.java

示例2: Symbol2D

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

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

  int nbShapes = lShapes.size();

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

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

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

示例3: Default3DRep

import javax.media.j3d.BranchGroup; //导入依赖的package包/类
/**
 * Constructeur par défaut permettant de créer les autorisations nécessaires à
 * un BranchGroup attribut (ici BgRep attribut "protected")
 */
public Default3DRep() {
  // Association des BranchGroup des
  // faces
  this.bGRep = new BranchGroup();

  // Capacites du BranchGroup de l'objet geographique
  this.bGRep.setCapability(Node.ALLOW_PICKABLE_READ);
  this.bGRep.setCapability(Node.ALLOW_PICKABLE_WRITE);
  this.bGRep.setCapability(Node.ENABLE_PICK_REPORTING);

  this.bGRep.setCapability(Group.ALLOW_CHILDREN_READ);
  this.bGRep.setCapability(Group.ALLOW_CHILDREN_WRITE);
  this.bGRep.setCapability(Group.ALLOW_CHILDREN_EXTEND);

  this.bGRep.setCapability(BranchGroup.ALLOW_DETACH);
  this.bGRep.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);

  // Passer les informations de l'objet au BG
  this.bGRep.setUserData(this);
  this.bGRep.setPickable(true);
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:26,代码来源:Default3DRep.java

示例4: generation

import javax.media.j3d.BranchGroup; //导入依赖的package包/类
/**
 * Génère la représentation
 * @param feat
 * @param time
 * @param tMinLayer
 * @param tMaxLayer
 * @param alpha
 * @param b
 */
private void generation(IFeature feat, List<Double> time, double tMinLayer,
    double tMaxLayer, Alpha alpha, BranchGroup b) {

  this.feat = feat;
  // On génère des informations relatives à l'objet tMin et tMax

  int nbT = time.size();
  this.tMin = Double.POSITIVE_INFINITY;
  this.tMax = Double.NEGATIVE_INFINITY;
  for (int i = 0; i < nbT; i++) {
    if (time.get(i) > this.tMax) {
      this.tMax = time.get(i);
    }
    if (time.get(i) < this.tMin) {
      this.tMin = time.get(i);
    }

  }

  this.bGRep.addChild(this.generateBG(feat.getGeom().coord(), time,
      tMinLayer, tMaxLayer, alpha, b));

  this.bGRep.compile();

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

示例5: setVisible

import javax.media.j3d.BranchGroup; //导入依赖的package包/类
@Override
public void setVisible(boolean visible) {
  BranchGroup branch = this.getBranchGroup();
  if (branch == null) {
    return;
  }
  if (visible) {
    if (this.parent == null) {
      return;
    }
    if (this.getBranchGroup().getParent() != null) {
      return;
    }
    this.parent.addChild(this.getBranchGroup());
  } else {
    Node node = branch.getParent();
    if (node != null) {
      this.parent = (BranchGroup) node;
    }
    this.getBranchGroup().detach();
  }
  this.visible = visible;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:24,代码来源:VectorLayer.java

示例6: ModelManager

import javax.media.j3d.BranchGroup; //导入依赖的package包/类
private ModelManager()
{
	// This class is a singleton
	this.loadedModelNodes = new WeakHashMap<Content, BranchGroup>();
	this.loadingModelObservers = new HashMap<Content, List<ModelObserver>>();
	this.parsedShapes = new WeakHashMap<String, Shape>();
	// Load other optional Loader classes 
	List<Class<Loader>> loaderClasses = new ArrayList<Class<Loader>>();
	String loaderClassNames = System.getProperty(ADDITIONAL_LOADER_CLASSES);
	if (loaderClassNames != null)
	{
		for (String loaderClassName : loaderClassNames.split("\\s|:"))
		{
			try
			{
				loaderClasses.add(getLoaderClass(loaderClassName));
			}
			catch (IllegalArgumentException ex)
			{
				System.err.println("Invalid loader class " + loaderClassName + ":\n" + ex.getMessage());
			}
		}
	}
	this.additionalLoaderClasses = loaderClasses.toArray(new Class[loaderClasses.size()]);
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:26,代码来源:ModelManager.java

示例7: Room3D

import javax.media.j3d.BranchGroup; //导入依赖的package包/类
/**
 * Creates the 3D room matching the given home <code>room</code>.
 */
public Room3D(Room room, Home home, boolean ignoreCeilingPart, boolean waitTextureLoadingEnd)
{
	setUserData(room);
	this.home = home;
	
	// Allow room branch to be removed from its parent
	setCapability(BranchGroup.ALLOW_DETACH);
	// Allow to read branch shape children
	setCapability(BranchGroup.ALLOW_CHILDREN_READ);
	
	// Add room floor and cellar empty shapes to branch
	addChild(createRoomPartShape());
	addChild(createRoomPartShape());
	// Set room shape geometry and appearance
	updateRoomGeometry();
	updateRoomAppearance(waitTextureLoadingEnd);
	
	if (ignoreCeilingPart)
	{
		removeChild(CEILING_PART);
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:26,代码来源:Room3D.java

示例8: createSceneTree

import javax.media.j3d.BranchGroup; //导入依赖的package包/类
/**
 * Returns a new scene tree root.
 */
private BranchGroup createSceneTree(boolean displayShadowOnFloor, boolean listenToHomeUpdates,
		boolean waitForLoading)
{
	BranchGroup root = new BranchGroup();
	// Build scene tree
	root.addChild(createHomeTree(displayShadowOnFloor, listenToHomeUpdates, waitForLoading));
	root.addChild(createBackgroundNode(listenToHomeUpdates, waitForLoading));
	Node groundNode = createGroundNode(-0.5E7f, -0.5E7f, 1E7f, 1E7f, listenToHomeUpdates, waitForLoading);
	root.addChild(groundNode);
	
	this.defaultLights = createLights(groundNode, listenToHomeUpdates);
	for (Light light : this.defaultLights)
	{
		root.addChild(light);
	}
	
	return root;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:22,代码来源:HomeComponent3D.java

示例9: copyToTemporaryOBJContent

import javax.media.j3d.BranchGroup; //导入依赖的package包/类
/**
 * Returns a copy of a given <code>model</code> as a zip content at OBJ format.
 * Caution : this method must be thread safe because it can be called from model loader executor. 
 */
private Content copyToTemporaryOBJContent(BranchGroup model, String modelName) throws IOException
{
	try
	{
		setReadingState();
		String objFile = new File(modelName).getName();
		if (!objFile.toLowerCase().endsWith(".obj"))
		{
			objFile += ".obj";
		}
		// Ensure the file contains only letters, figures, underscores, dots, hyphens or spaces
		if (objFile.matches(".*[^a-zA-Z0-9_\\.\\-\\ ].*"))
		{
			objFile = "model.obj";
		}
		File tempZipFile = OperatingSystem.createTemporaryFile("import", ".zip");
		OBJWriter.writeNodeInZIPFile(model, tempZipFile, 0, objFile, "3D model import " + modelName);
		return new TemporaryURLContent(new URL("jar:" + tempZipFile.toURI().toURL() + "!/"
				+ URLEncoder.encode(objFile, "UTF-8").replace("+", "%20")));
	}
	finally
	{
		setDefaultState();
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:30,代码来源:ImportedFurnitureWizardStepsPanel.java

示例10: J3dTest

import javax.media.j3d.BranchGroup; //导入依赖的package包/类
public J3dTest(){  
  // 创建一个虚拟空间  
    SimpleUniverse universe = new SimpleUniverse();  
    // 创建一个用来包含对象的数据结构  
    BranchGroup group = new BranchGroup();  
     
    // 创建一个球并把它加入到group中  
    Sphere sphere = new Sphere(0.5f); // 小球的半径为0.5米  
    group.addChild(sphere);  
     
    Color3f light1Color = new Color3f(1.8f, 0.1f, 0.1f);  
    // 设置光线的颜色  
    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);  
    // 设置光线的作用范围  
    Vector3f light1Direction = new Vector3f(4.0f, -7.0f, -12.0f);  
    // 设置光线的方向  
    DirectionalLight light1= new DirectionalLight(light1Color, light1Direction);  
    // 指定颜色和方向,产生单向光源  
    light1.setInfluencingBounds(bounds);  
    // 把光线的作用范围加入光源中  
    group.addChild(light1);  
    // 将光源加入group组,安放观察点  
    universe.getViewingPlatform().setNominalViewingTransform();  
    // 把group加入到虚拟空间中  
    universe.addBranchGraph(group);  
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:27,代码来源:J3dTest.java

示例11: CheckerFloor

import javax.media.j3d.BranchGroup; //导入依赖的package包/类
public CheckerFloor()
// create tiles, add origin marker, then the axes labels
{
	ArrayList<Point3f> blueCoords = new ArrayList<Point3f>();
	ArrayList<Point3f> greenCoords = new ArrayList<Point3f>();
	floorBG = new BranchGroup();

	boolean isBlue;
	for (int z = -FLOOR_LEN / 2; z <= (FLOOR_LEN / 2) - 1; z++) {
		isBlue = (z % 2 == 0) ? true : false; // set colour for new row
		for (int x = -FLOOR_LEN / 2; x <= (FLOOR_LEN / 2) - 1; x++) {
			if (isBlue)
				createCoords(x, z, blueCoords);
			else
				createCoords(x, z, greenCoords);
			isBlue = !isBlue;
		}
	}
	floorBG.addChild(new ColouredTiles(blueCoords, blue));
	floorBG.addChild(new ColouredTiles(greenCoords, green));

	addOriginMarker();
	labelAxes();
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:25,代码来源:CheckerFloor.java

示例12: updateSensors

import javax.media.j3d.BranchGroup; //导入依赖的package包/类
/** Update sensor phase - called on each simulation step. */
protected void updateSensors(double elapsedSecond, BranchGroup pickableSceneBranch) {

	// don't want to sense its own body while picking (cause unnecessary
	// intersections)
	body.setPickable(false);
	for (int i = 0; i < sensors.size(); i++) {
		SensorDevice sd = (SensorDevice) sensors.get(i);
		if (sd == null)
			continue;
		if (sd instanceof PickSensor) {
			((PickSensor) sd).setPickableSceneBranch(pickableSceneBranch);
		}
		sd.update(elapsedSecond);
	}
	// we are pickable again.
	body.setPickable(true);
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:19,代码来源:SimpleAgent.java

示例13: setSliceGeo

import javax.media.j3d.BranchGroup; //导入依赖的package包/类
@Override
void setSliceGeo()
{

	BranchGroup polyGroup = new BranchGroup();
	polyGroup.setCapability(BranchGroup.ALLOW_DETACH);
	if (numSlicePts > 0)
	{
		// for each triangle...
		for (int i = 0; i < numSlicePts - 2; i++)
		{
			tesselateTri(polyGroup, slicePts[0], slicePts[i + 1], slicePts[i + 2]);
		}
	}
	sliceGroup.setChild(polyGroup, 0);
}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:17,代码来源:SlicePlane2DRenderer.java

示例14: createSceneGraph

import javax.media.j3d.BranchGroup; //导入依赖的package包/类
public BranchGroup createSceneGraph() {
    BranchGroup objRoot = new BranchGroup();
    /*
    mover = moveBack(1.0d);
    spinner = createSpinner();
    objRoot.addChild(mover);
    mover.addChild(spinner);
     *
     */
    spinner = createSpinner();
    objRoot.addChild(spinner);

    addNeurons(spinner);
    addRegion(spinner);
    //spinner.addChild(makeSpin(spinner));
    //setLightingNet(mover);
    setLightingNet(spinner);
    addBackground(objRoot);
    addKeyNavigator(objRoot);
    return objRoot;
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:22,代码来源:NeuGenVisualization.java

示例15: MainApp

import javax.media.j3d.BranchGroup; //导入依赖的package包/类
/** Creates a new instance of MainApp
 * Create a simple scene and attach it to the virtual universe
 *
 */
public MainApp(String[] args) {

    setLayout(new BorderLayout());
    GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();

    Canvas3D canvas3D = new Canvas3D(config);
    add("Center", canvas3D);

    // SimpleUniverse is a Convenience Utility class
    simpleU = new SimpleUniverse(canvas3D);

    // This will move the ViewPlatform back a bit so the
    // objects in the scene can be viewed.
    simpleU.getViewingPlatform().setNominalViewingTransform();

    BranchGroup scene = createSceneGraph(args.length > 0);
    orbitControls(canvas3D);
    simpleU.addBranchGraph(scene);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:24,代码来源:MainApp.java


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