Java Doc for PickTool.java in  » 6.0-JDK-Modules » java-3d » com » sun » j3d » utils » picking » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » java 3d » com.sun.j3d.utils.picking 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.j3d.utils.picking.PickTool

All known Subclasses:   com.sun.j3d.utils.picking.PickCanvas,
PickTool
public class PickTool (Code)
The base class for picking operations. The picking methods will return a PickResult object for each object picked, which can then be queried to obtain more detailed information about the specific objects that were picked.

The pick mode specifies the detail level of picking before the PickResult is returned:

  • PickTool.BOUNDS - Pick using the bounds of the pickable nodes. The PickResult returned will contain the SceneGraphPath to the picked Node.
  • PickTool.GEOMETRY will pick using the geometry of the pickable nodes. The PickResult returned will contain the SceneGraphPath to the picked Node. Geometry nodes in the scene must have the ALLOW_INTERSECT capability set for this mode.
  • PickTool.GEOMETRY_INTERSECT_INFO -is the same as GEOMETRY, but the the PickResult will also include information on each intersection of the pick shape with the geometry. The intersection information includes the sub-primitive picked (that is, the point, line, triangle or quad), the closest vertex to the center of the pick shape, and the intersection's coordinate, normal, color and texture coordinates. To allow this information to be generated, Shape3D and Morph nodes must have the ALLOW_GEOMETRY_READ capability set and GeometryArrays must have the ALLOW_FORMAT_READ, ALLOW_COUNT_READ, and ALLOW_COORDINATE_READ capabilities set, plus the ALLOW_COORDINATE_INDEX_READ capability for indexed geometry. To inquire the intersection color, normal or texture coordinates the corresponding READ capability bits must be set on the GeometryArray.

The utility method PickTool.setCapabilities(Node, int) can be used before the scene graph is made live to set the capabilities of Shape3D, Morph or Geometry nodes to allow picking.

A PickResult from a lower level of detail pick can be used to inquire more detailed information if the capibility bits are set. This can be used to filter the PickResults before the more computationally intensive intersection processing. For example, the application can do a BOUNDS pick and then selectively inquire intersections on some of the PickResults. This will save the effort of doing intersection computation on the other PickResults. However, inquiring the intersections from a GEOMETRY pick will make the intersection computation happen twice, use GEOMETRY_INTERSECT_INFO if you want to inquire the intersection information on all the PickResults.

When using pickAllSorted or pickClosest methods, the picks will be sorted by the distance from the start point of the pick shape to the intersection point.

Morph nodes cannot be picked using the displayed geometry in GEOMETRY_INTERSECT_INFO mode due to limitations in the current Java3D core API (the current geometry of the the Morph cannot be inquired). Instead they are picked using the geometry at index 0 in the Morph, this limitation may be eliminated in a future release of Java3D.

If the pick shape is a PickBounds, the pick result will contain only the scene graph path, even if the mode is GEOMETRY_INTERSECT_INFO.



Field Summary
final public static  intBOUNDS
     Use this mode to pick by bounds and get basic information on the pick.
final public static  intGEOMETRY
     Use this mode to pick by geometry and get basic information on the pick.
final public static  intGEOMETRY_INTERSECT_INFO
     Use this mode to pick by geometry and save information about the intersections (intersected primitive, intersection point and closest vertex).
final public static  intINTERSECT_COORD
     Flag to pass to setCapabilities(Node, int) to set the Node's capabilities to allow inquiry of the intersection coordinate information.
final public static  intINTERSECT_FULL
     Flag to pass to setCapabilities(Node, int) to set the Node's capabilities to allow inquiry of all intersection information.
final public static  intINTERSECT_TEST
     Flag to pass to setCapabilities(Node, int) to set the Node's capabilities to allow intersection tests, but not inquire information about the intersections (use for GEOMETRY mode).
 intmode
    
 BranchGrouppickRootBG
    
 LocalepickRootL
    
 PickShapepickShape
    
 Point3dstart
     Used to store a reference point used in determining how "close" points are.
protected  booleanuserDefineShape
    

Constructor Summary
public  PickTool(BranchGroup b)
     Constructor with BranchGroup to be picked.
public  PickTool(Locale l)
     Constructor with the Locale to be picked.

Method Summary
public  BranchGroupgetBranchGroup()
     Returns the BranchGroup to be picked if the tool was initialized with a BranchGroup, null otherwise.
public  LocalegetLocale()
     Returns the Locale to be picked if the tool was initialized with a Locale, null otherwise.
public  intgetMode()
     Gets the picking detail mode.
public  PickShapegetPickShape()
     Returns the PickShape for this object.
public  Point3dgetStartPosition()
     Returns the start postion used for distance measurement.
public  PickResult[]pickAll()
     Selects all the nodes that intersect the PickShape. An array of PickResult objects which will contain information about the picked instances.
public  PickResult[]pickAllSorted()
     Select all the nodes that intersect the PickShape, returned sorted.
public  PickResultpickAny()
     Select one of the nodes that intersect the PickShape A PickResult object which will contain information about the picked instance.
public  PickResultpickClosest()
     Select the closest node that intersects the PickShape.
public  LocalesetBranchGroup(Locale l)
    
public static  voidsetCapabilities(Node node, int level)
     Sets the capabilities on the Node and it's components to allow picking at the specified detail level.
public  voidsetMode(int mode)
     Sets the picking detail mode.
public  voidsetShape(PickShape ps, Point3d startPt)
    
public  voidsetShapeBounds(Bounds bounds, Point3d startPt)
    
public  voidsetShapeConeRay(Point3d start, Vector3d dir, double angle)
     Sets the pick shape to an infinite PickCone.
public  voidsetShapeConeSegment(Point3d start, Point3d end, double angle)
    
public  voidsetShapeCylinderRay(Point3d start, Vector3d dir, double radius)
     Sets the pick shape to an infinite PickCylinder.
public  voidsetShapeCylinderSegment(Point3d start, Point3d end, double radius)
    
public  voidsetShapeRay(Point3d start, Vector3d dir)
     Sets the pick shape to a PickRay.
public  voidsetShapeSegment(Point3d start, Point3d end)
     Sets the pick shape to a PickSegment.

Field Detail
BOUNDS
final public static int BOUNDS(Code)
Use this mode to pick by bounds and get basic information on the pick.



GEOMETRY
final public static int GEOMETRY(Code)
Use this mode to pick by geometry and get basic information on the pick.



GEOMETRY_INTERSECT_INFO
final public static int GEOMETRY_INTERSECT_INFO(Code)
Use this mode to pick by geometry and save information about the intersections (intersected primitive, intersection point and closest vertex).



INTERSECT_COORD
final public static int INTERSECT_COORD(Code)
Flag to pass to setCapabilities(Node, int) to set the Node's capabilities to allow inquiry of the intersection coordinate information.
See Also:   PickTool.setCapabilities
See Also:   



INTERSECT_FULL
final public static int INTERSECT_FULL(Code)
Flag to pass to setCapabilities(Node, int) to set the Node's capabilities to allow inquiry of all intersection information.
See Also:   PickTool.setCapabilities
See Also:   



INTERSECT_TEST
final public static int INTERSECT_TEST(Code)
Flag to pass to setCapabilities(Node, int) to set the Node's capabilities to allow intersection tests, but not inquire information about the intersections (use for GEOMETRY mode).
See Also:   PickTool.setCapabilities
See Also:   



mode
int mode(Code)



pickRootBG
BranchGroup pickRootBG(Code)
Used to store the BranchGroup used for picking



pickRootL
Locale pickRootL(Code)
Used to store the Locale used for picking



pickShape
PickShape pickShape(Code)



start
Point3d start(Code)
Used to store a reference point used in determining how "close" points are.



userDefineShape
protected boolean userDefineShape(Code)




Constructor Detail
PickTool
public PickTool(BranchGroup b)(Code)
Constructor with BranchGroup to be picked.



PickTool
public PickTool(Locale l)(Code)
Constructor with the Locale to be picked.




Method Detail
getBranchGroup
public BranchGroup getBranchGroup()(Code)
Returns the BranchGroup to be picked if the tool was initialized with a BranchGroup, null otherwise.



getLocale
public Locale getLocale()(Code)
Returns the Locale to be picked if the tool was initialized with a Locale, null otherwise.



getMode
public int getMode()(Code)
Gets the picking detail mode.



getPickShape
public PickShape getPickShape()(Code)
Returns the PickShape for this object.



getStartPosition
public Point3d getStartPosition()(Code)
Returns the start postion used for distance measurement.



pickAll
public PickResult[] pickAll()(Code)
Selects all the nodes that intersect the PickShape. An array of PickResult objects which will contain information about the picked instances. null if nothing was picked.



pickAllSorted
public PickResult[] pickAllSorted()(Code)
Select all the nodes that intersect the PickShape, returned sorted. The "closest" object will be returned first. See note above to see how "closest" is determined.

An array of PickResult objects which will contain information about the picked instances. null if nothing was picked.




pickAny
public PickResult pickAny()(Code)
Select one of the nodes that intersect the PickShape A PickResult object which will contain information about the picked instance. null if nothing was picked.



pickClosest
public PickResult pickClosest()(Code)
Select the closest node that intersects the PickShape. See note above to see how "closest" is determined.

A PickResult object which will contain information about the picked instance. null if nothing was picked.




setBranchGroup
public Locale setBranchGroup(Locale l)(Code)



setCapabilities
public static void setCapabilities(Node node, int level)(Code)
Sets the capabilities on the Node and it's components to allow picking at the specified detail level.

Note that by default all com.sun.j3d.utils.geometry.Primitive objects with the same parameters share their geometry (e.g., you can have 50 spheres in your scene, but the geometry is stored only once). Therefore the capabilities of the geometry are also shared, and once a shared node is live, the capabilities cannot be changed. To assign capabilities to Primitives with the same parameters, either set the capabilities before the primitive is set live, or specify the Primitive.GEOMETRY_NOT_SHARED constructor parameter when creating the primitive.
Parameters:
  node - The node to modify
Parameters:
  level - The capability level, must be one of INTERSECT_TEST,INTERSECT_COORD or INTERSECT_FULL
throws:
  IllegalArgumentException - if Node is not a Shape3D or Morph orif the flag value is not valid.
throws:
  javax.media.j3d.RestrictedAccessException - if the node is part of a live or compiled scene graph.




setMode
public void setMode(int mode)(Code)
Sets the picking detail mode. The default is BOUNDS.
Parameters:
  mode - One of BOUNDS, GEOMETRY, GEOMETRY_INTERSECT_INFO, or
exception:
  IllegalArgumentException - if mode is not a legal value



setShape
public void setShape(PickShape ps, Point3d startPt)(Code)
Sets the pick shape to a user-provided PickShape object
Parameters:
  ps - The pick shape to pick against.
Parameters:
  startPt - The start point to use for distance calculations



setShapeBounds
public void setShapeBounds(Bounds bounds, Point3d startPt)(Code)
Sets the pick shape to use a user-provided Bounds object
Parameters:
  bounds - The bounds to pick against.
Parameters:
  startPt - The start point to use for distance calculations



setShapeConeRay
public void setShapeConeRay(Point3d start, Vector3d dir, double angle)(Code)
Sets the pick shape to an infinite PickCone.
Parameters:
  start - The start of axis of the cone
Parameters:
  dir - The direction of the axis of the cone
Parameters:
  angle - The angle of the cone



setShapeConeSegment
public void setShapeConeSegment(Point3d start, Point3d end, double angle)(Code)
Sets the pick shape to a capped PickCone
Parameters:
  start - The start of axis of the cone
Parameters:
  end - The end of the axis of the cone
Parameters:
  angle - The angle of the cone



setShapeCylinderRay
public void setShapeCylinderRay(Point3d start, Vector3d dir, double radius)(Code)
Sets the pick shape to an infinite PickCylinder.
Parameters:
  start - The start of axis of the cylinder
Parameters:
  dir - The direction of the axis of the cylinder
Parameters:
  radius - The radius of the cylinder



setShapeCylinderSegment
public void setShapeCylinderSegment(Point3d start, Point3d end, double radius)(Code)
Sets the pick shape to a capped PickCylinder
Parameters:
  start - The start of axis of the cylinder
Parameters:
  end - The end of the axis of the cylinder
Parameters:
  radius - The radius of the cylinder



setShapeRay
public void setShapeRay(Point3d start, Vector3d dir)(Code)
Sets the pick shape to a PickRay.
Parameters:
  start - The start of the ray
Parameters:
  dir - The direction of the ray



setShapeSegment
public void setShapeSegment(Point3d start, Point3d end)(Code)
Sets the pick shape to a PickSegment.
Parameters:
  start - The start of the segmentp @param end The end of the segment



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.