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


Java MouseRotate.setSchedulingBounds方法代码示例

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


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

示例1: getMouseTransform

import com.sun.j3d.utils.behaviors.mouse.MouseRotate; //导入方法依赖的package包/类
private TransformGroup getMouseTransform() {
    MouseRotate mouseRotate = new MouseRotate();
    MouseZoom mouseZoom = new MouseZoom();
    MouseTranslate mouseTranslate = new MouseTranslate();

    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);

    mouseRotate.setSchedulingBounds(bounds);
    mouseZoom.setSchedulingBounds(bounds);
    mouseTranslate.setSchedulingBounds(bounds);

    TransformGroup mouseTransform = new TransformGroup();
    mouseTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
    mouseTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

    mouseRotate.setTransformGroup(mouseTransform);
    mouseTransform.addChild(mouseRotate);
    mouseZoom.setTransformGroup(mouseTransform);
    mouseTransform.addChild(mouseZoom);
    mouseTranslate.setTransformGroup(mouseTransform);
    mouseTransform.addChild(mouseTranslate);

    return mouseTransform;
}
 
开发者ID:sleepyprof,项目名称:Fractal,代码行数:25,代码来源:Fractal3DPictureView.java

示例2: enableMouseNavigation

import com.sun.j3d.utils.behaviors.mouse.MouseRotate; //导入方法依赖的package包/类
/**
 * Create a TransformGroup where it is possible to navigate through using the mouse.
 * Move
 * <li>+ Left Click : Rotate</li>
 * <li>+ Right Click: Translate</li>
 * <li>+ Left Click + Right Click: Zoom In/Out</li>
 *
 * MouseWheel:
 * <li>Zoom In/out</li>
 * @param root First Branch Group of the 3D scene
 * @param bounds bounds of the scene
 * @return return a Transform Group when navigation with mouse is possible
 */
private TransformGroup enableMouseNavigation(BranchGroup root, BoundingSphere bounds) {
    TransformGroup manipulator = new TransformGroup();
    manipulator.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

    // Rotation a la souris
    MouseRotate rotateBehavior = new MouseRotate();
    rotateBehavior.setTransformGroup(manipulator);
    rotateBehavior.setSchedulingBounds(bounds);
    manipulator.addChild(rotateBehavior);

    // Translation
    MouseTranslate translateBehavior = new MouseTranslate();
    translateBehavior.setTransformGroup(manipulator);
    translateBehavior.setSchedulingBounds(bounds);
    manipulator.addChild(translateBehavior);

    // Zoom Molette
    MouseWheelZoom wheelZoomBehavior = new MouseWheelZoom();
    wheelZoomBehavior.setTransformGroup(manipulator);
    wheelZoomBehavior.setSchedulingBounds(bounds);
    manipulator.addChild(wheelZoomBehavior);

    // Zoom Souris
    MouseZoom zoomBehavior = new MouseZoom();
    zoomBehavior.setTransformGroup(manipulator);
    zoomBehavior.setSchedulingBounds(bounds);
    manipulator.addChild(zoomBehavior);

    root.addChild(manipulator);
    return manipulator;
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:45,代码来源:NBody3DFrame.java

示例3: setupNavigation

import com.sun.j3d.utils.behaviors.mouse.MouseRotate; //导入方法依赖的package包/类
/**
 * Setup the navigation system.  We use a simple examine behavior
 */
private void setupNavigation() {

    sceneRoot = new BranchGroup();
    sceneRoot.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND);

    examineGroup = new TransformGroup();
    examineGroup.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND);
    examineGroup.setCapability(TransformGroup.ALLOW_CHILDREN_READ);
    examineGroup.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE);
    examineGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
    examineGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    examineGroup.setCapability(TransformGroup.ALLOW_LOCAL_TO_VWORLD_READ);
    sceneRoot.addChild(examineGroup);

    BoundingSphere behaviorBounds = new BoundingSphere(new Point3d(),
        Double.MAX_VALUE);

    MouseRotate mr = new MouseRotate();
    mr.setTransformGroup(examineGroup);
    mr.setSchedulingBounds(behaviorBounds);
    sceneRoot.addChild(mr);

    MouseTranslate mt = new MouseTranslate();
    mt.setTransformGroup(examineGroup);
    mt.setSchedulingBounds(behaviorBounds);
    sceneRoot.addChild(mt);

    MouseZoom mz = new MouseZoom();
    mz.setTransformGroup(examineGroup);
    mz.setSchedulingBounds(behaviorBounds);
    sceneRoot.addChild(mz);

    universe.addBranchGraph(sceneRoot);
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:38,代码来源:Java3DLoaderDemo.java

示例4: createSceneGraph

import com.sun.j3d.utils.behaviors.mouse.MouseRotate; //导入方法依赖的package包/类
BranchGroup createSceneGraph() {
  // Create the root of the branch graph
  BranchGroup objRoot = new BranchGroup();

  // Create a TransformGroup to scale the scene down by 3.5x
  // TODO: move view platform instead of scene using orbit behavior
  TransformGroup objScale = new TransformGroup();
  Transform3D scaleTrans = new Transform3D();
  //scaleTrans.set(1 / 3.5f); // scale down by 3.5x
  objScale.setTransform(scaleTrans);
  objRoot.addChild(objScale);

  // Create a TransformGroup and initialize it to the
  // identity. Enable the TRANSFORM_WRITE capability so that
  // the mouse behaviors code can modify it at runtime. Add it to the
  // root of the subgraph.
  TransformGroup objTrans = new TransformGroup();
  objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
  objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
  objScale.addChild(objTrans);

  // Add the primitives to the scene
  objTrans.addChild(createLineTypes());

  BoundingSphere bounds = new BoundingSphere(new Point3d(), 100.0);    
  Background bg = new Background(new Color3f(1.0f, 1.0f, 1.0f));
  bg.setApplicationBounds(bounds);
  objTrans.addChild(bg);

  // set up the mouse rotation behavior
  MouseRotate mr = new MouseRotate();
  mr.setTransformGroup(objTrans);
  mr.setSchedulingBounds(bounds);
  mr.setFactor(0.007);
  objTrans.addChild(mr);

  // Set up the ambient light
  Color3f ambientColor = new Color3f(0.1f, 0.1f, 0.1f);
  AmbientLight ambientLightNode = new AmbientLight(ambientColor);
  ambientLightNode.setInfluencingBounds(bounds);
  objRoot.addChild(ambientLightNode);

  // Set up the directional lights
  Color3f light1Color = new Color3f(1.0f, 1.0f, 1.0f);
  Vector3f light1Direction = new Vector3f(0.0f, -0.2f, -1.0f);

  DirectionalLight light1 = new DirectionalLight(light1Color,
      light1Direction);
  light1.setInfluencingBounds(bounds);
  objRoot.addChild(light1);

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

示例5: addMouseRotate

import com.sun.j3d.utils.behaviors.mouse.MouseRotate; //导入方法依赖的package包/类
private void addMouseRotate(TransformGroup transformGroup) {
    MouseRotate mouseRotate = new MouseRotate();
    mouseRotate.setTransformGroup(transformGroup);
    transformGroup.addChild(mouseRotate);
    mouseRotate.setSchedulingBounds(BOUNDS);
}
 
开发者ID:tekrei,项目名称:JavaExamples,代码行数:7,代码来源:Java3DPanel.java

示例6: createSceneGraph

import com.sun.j3d.utils.behaviors.mouse.MouseRotate; //导入方法依赖的package包/类
private BranchGroup createSceneGraph() {
	BranchGroup objRoot = new BranchGroup();
	
	//Set up node for rotating the surface based on mouse drags
	TransformGroup objTransform = new TransformGroup();
	objTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
	objTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
	
	//Set up node for translating and scaling the surface
	TransformGroup surfaceTranslate = new TransformGroup();
	TransformGroup surfaceScale = new TransformGroup();
	surfaceTranslate.setBoundsAutoCompute(true);
	surfaceScale.setBoundsAutoCompute(true);
	
	surfaceTranslate.addChild(new Surface(_organism, 32, 32));
	BoundingSphere bSphere = new BoundingSphere(surfaceTranslate.getBounds());
	Point3d center = new Point3d();
	bSphere.getCenter(center);
	double radius = bSphere.getRadius();
	
	Matrix3d rotate = new Matrix3d();
	rotate.setIdentity();
	Vector3d translate = new Vector3d(center);
	translate.negate();
	double scale = 1/radius;
	
	surfaceTranslate.setTransform(new Transform3D(rotate,translate,1.0));
	surfaceScale.setTransform(new Transform3D(rotate,new Vector3d(),scale));
	surfaceScale.addChild(surfaceTranslate);
	
	//random rotation
	Transform3D rotX = new Transform3D();
	Transform3D rotY = new Transform3D();
	Transform3D rotZ = new Transform3D();
	rotX.rotX(2*Math.PI*Math.random());
	rotY.rotY(2*Math.PI*Math.random());
	rotZ.rotZ(2*Math.PI*Math.random());
	
	rotX.mul(rotY);
	rotX.mul(rotZ);
	
	TransformGroup randRot = new TransformGroup(rotX);
	randRot.addChild(surfaceScale);
	
	//Add nodes to root tree
	objTransform.addChild(randRot);
	objRoot.addChild(objTransform);
	
	//Set up lights
	DirectionalLight dirLight = 
		new DirectionalLight(new Color3f(.9f,.9f,.9f),new Vector3f(0,0,-1));
	dirLight.setInfluencingBounds(surfaceScale.getBounds());
	objRoot.addChild(dirLight);
	
	AmbientLight ambLight = new AmbientLight(new Color3f(.3f,.3f,.3f));
	ambLight.setInfluencingBounds(surfaceScale.getBounds());
	objRoot.addChild(ambLight);
	
	//Set up mouse interactions
	MouseRotate myMouseRotate = new MouseRotate();
	myMouseRotate.setTransformGroup(objTransform);
	myMouseRotate.setSchedulingBounds(surfaceScale.getBounds());
	objRoot.addChild(myMouseRotate);
    
	MouseZoom myMouseZoom = new MouseZoom();
	myMouseZoom.setTransformGroup(objTransform);
	myMouseZoom.setSchedulingBounds(surfaceScale.getBounds());
	objRoot.addChild(myMouseZoom);
	
	MouseTranslate myMouseTranslate = new MouseTranslate();
	myMouseTranslate.setTransformGroup(objTransform);
	myMouseTranslate.setSchedulingBounds(surfaceScale.getBounds());
	objRoot.addChild(myMouseTranslate);
	
    objRoot.compile();
    
	return objRoot;
}
 
开发者ID:wolfmanstout,项目名称:jene,代码行数:79,代码来源:SurfacePanel.java

示例7: createSceneBranchGroup

import com.sun.j3d.utils.behaviors.mouse.MouseRotate; //导入方法依赖的package包/类
private void createSceneBranchGroup() {

        sceneBranchGroup = new BranchGroup();
        sceneBranchGroup.setCapability(BranchGroup.ALLOW_DETACH);

        objRotate = new TransformGroup();
        objRotate.setCapability(Group.ALLOW_CHILDREN_EXTEND);
        objRotate.setCapability(Group.ALLOW_CHILDREN_WRITE);
        objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
        objRotate.setCapability(TransformGroup.ENABLE_PICK_REPORTING);

        sceneBranchGroup.addChild(objRotate);

        addAxes();
        addDataPoints();

        /*************************** Lighting ****************************/

        Color3f lightColor = new Color3f(1.0f, 1.0f, 1.0f);
        BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0),
                100.0);
        Vector3f lightDirection = new Vector3f(4.0f, -7.0f, -12.0f);
        DirectionalLight light = new DirectionalLight(lightColor,
                lightDirection);
        light.setInfluencingBounds(bounds);
        sceneBranchGroup.addChild(light);

        /**************************** Mouse *****************************/

        MouseRotate myMouseRotate = new MouseRotate();
        myMouseRotate.setTransformGroup(objRotate);
        myMouseRotate.setSchedulingBounds(new BoundingSphere());
        sceneBranchGroup.addChild(myMouseRotate);

        MouseWheelZoom myMouseZoom = new MouseWheelZoom();
        myMouseZoom.setTransformGroup(objRotate);
        myMouseZoom.setSchedulingBounds(new BoundingSphere());
        sceneBranchGroup.addChild(myMouseZoom);

    }
 
开发者ID:airalcorn2,项目名称:ScatterPlot3D,代码行数:42,代码来源:ScatterPlot3D.java


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