Examples of PickCanvas


Examples of com.sun.j3d.utils.picking.PickCanvas

     */
    public ArrayList toggleSinglePick(int posX, int posY) {
      lastMouseX = posX;
      lastMouseY = posY;

    PickCanvas pickCanvas = new PickCanvas(canvas, scene.getBranchgroup());
      pickCanvas.setMode(PickTool.GEOMETRY_INTERSECT_INFO);
      pickCanvas.setTolerance(2.0f);
      pickCanvas.setShapeLocation(posX, posY);
      PickResult result = pickCanvas.pickClosest();

      if (result!=null) {
      Node node = result.getObject();
            Object o = node.getUserData();
            if (o instanceof ActiveNode) {
View Full Code Here

Examples of com.sun.j3d.utils.picking.PickCanvas

      // do not update last mouse XY position, so user can refine selection from the same point

      int dx = Math.abs(posX - lastMouseX) / 2;
      int dy = Math.abs(posY - lastMouseY) / 2;

      PickCanvas pickCanvas = new PickCanvas(canvas, scene.getBranchgroup());
      pickCanvas.setMode(PickTool.GEOMETRY_INTERSECT_INFO);
      pickCanvas.setTolerance(Math.max(dx,dy));
      pickCanvas.setShapeLocation(posX, posY);

      // TODO : don't do pick closest, loop on all results
      PickResult result = pickCanvas.pickClosest();
      if (result!=null) {
      Node node = result.getObject();
            Object o = node.getUserData();
            if (o instanceof ActiveNode) {
              ((ActiveNode)o).highlight(true,result);
View Full Code Here

Examples of com.sun.j3d.utils.picking.PickCanvas

    }
   
    void pick(int x, int y, boolean add){
        _pickX=x;
        _pickY=y;
        PickCanvas pickCanvas = new PickCanvas(_canvas, this._universe.getLocale());
        pickCanvas.setMode(PickTool.GEOMETRY_INTERSECT_INFO);
        pickCanvas.setTolerance(2.0f);
        pickCanvas.setShapeLocation(_pickX, _pickY);
        PickResult result = pickCanvas.pickClosest();
        if(result==null){
            select(add, new Node[0]);
        }
        else{
            select(add, result.getObject());
View Full Code Here

Examples of com.sun.j3d.utils.picking.PickCanvas

            select(add, result.getObject());
        }
    }
   
    void pickArea(int x, int y, boolean add){
        PickCanvas pickCanvas = new PickCanvas(_canvas, this._universe.getLocale());
        pickCanvas.setMode(PickTool.GEOMETRY_INTERSECT_INFO);
        int cx=(_pickX+x)/2;
        int cy=(_pickY+y)/2;
        float t=Math.max(Math.abs(_pickX-x),Math.abs(_pickY-y))/2.f;
        pickCanvas.setTolerance(t);
        pickCanvas.setShapeLocation(cx, cy);
        if(t>2.){
            PickResult[] result = pickCanvas.pickAll();
            if(result==null){
                select(add,new Node[0]);
            }
            else{
                Node[] n=new Node[result.length];
                int i=0;
                for(PickResult r : result){
                    n[i++]=r.getObject();
                }
                select(add, n);
            }
        }
        else{
            PickResult result = pickCanvas.pickClosest();
            if(result==null){
                select(add, new Node[0]);
            }
            else{
                select(add, result.getObject());
View Full Code Here

Examples of com.sun.j3d.utils.picking.PickCanvas

       
        // create the base branch group in which our world
        // will be put
        scene = new BranchGroup();
     
        pickCanvas = new PickCanvas(this, scene);
        addMouseListener(this);
       
        // set focusable for mous control later
        setFocusable(true);
        requestFocus();
View Full Code Here

Examples of com.sun.j3d.utils.picking.PickCanvas

    super();
    currGrp = new TransformGroup();
    currGrp.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    currGrp.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
    root.addChild(currGrp);
    pickCanvas = new PickCanvas(canvas, root);
  }
View Full Code Here

Examples of com.sun.j3d.utils.picking.PickCanvas

/*     */   {
/*  75 */     this.currGrp = new TransformGroup();
/*  76 */     this.currGrp.setCapability(18);
/*  77 */     this.currGrp.setCapability(17);
/*  78 */     root.addChild(this.currGrp);
/*  79 */     this.pickCanvas = new PickCanvas(canvas, root);
/*     */   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.