本文整理汇总了Java中javax.media.j3d.Node.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getName方法的具体用法?Java Node.getName怎么用?Java Node.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.j3d.Node
的用法示例。
在下文中一共展示了Node.getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findNodeByName
import javax.media.j3d.Node; //导入方法依赖的package包/类
/**
* Finds the first node in a depth-first traversal of the scene graph whose name (all or part) matches a regular expression.
*
* @param start
* the starting node for the scene graph traversal.
* @param nameRegexp
* a regular expression
* @return a matching {@link Node}, or <code>null</code> if none is found.
*/
public static Node findNodeByName( Node start , String nameRegexp )
{
final Pattern p = Pattern.compile( nameRegexp );
for( final Node node : SceneGraphIterator.unboundedIterable( start ) )
{
if( node.getName( ) == null )
{
continue;
}
final Matcher m = p.matcher( node.getName( ) );
if( m.find( ) )
{
return node;
}
}
return null;
}
示例2: handleObjectSelection
import javax.media.j3d.Node; //导入方法依赖的package包/类
public void handleObjectSelection(MouseEvent mousee) {
pickCanvas.setShapeLocation(mousee);
pickInfoArr = pickCanvas.pickAllSorted();
//pickInfoArr = pickCanvas.pickAll();
if (pickInfoArr != null) {
// Get closest intersection results
Transform3D l2vw = pickInfoArr[0].getLocalToVWorld();
PickInfo.IntersectionInfo[] iInfoArr = pickInfoArr[0].getIntersectionInfos();
PickIntersection pi = new PickIntersection(l2vw, iInfoArr[0]);
// Position sphere at intersection point
Vector3d v = new Vector3d();
Point3d intPt = pi.getPointCoordinatesVW();
v.set(intPt);
t3d.setTranslation(v);
sphTrans.setTransform(t3d);
Point3f scalePnt = new Point3f(intPt);
scalePnt.scale(1.0f / scale);
for (int i = 0; i < pickInfoArr.length; i++) {
Node node = pickInfoArr[i].getNode();
if (node != null) {
if (node.getName() != null) {
ngView.outPrintln(node.getName());
} else {
ngView.outPrintln("no info for this object");
}
ngView.outPrintln("Coordinates: " + scalePnt);
break;
} else {
ngView.outPrintln("Coordinates: " + scalePnt);
}
}
}
}