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


Java PickResult.getNode方法代码示例

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


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

示例1: mouseClicked

import com.sun.j3d.utils.picking.PickResult; //导入方法依赖的package包/类
private void mouseClicked(MouseEvent e) {

            lastMouseDragLocation = null;

            pickCanvas.setShapeLocation(e);
            PickResult[] thePickResult = pickCanvas.pickAllSorted();
            if (thePickResult != null) {
                for (PickResult theResult : thePickResult) {
                    if (theResult != null) {
                        Primitive p = (Primitive) theResult.getNode(PickResult.PRIMITIVE);
                        if (p != null) {
                            if (p.getUserData() instanceof UserObjectInfo) {
                                UserObjectInfo theItem = (UserObjectInfo) p.getUserData();
                                if (!SwingUtilities.isRightMouseButton(e)) {
                                    if (e.getClickCount() == 2) {
                                        editModelItem(theItem.item);
                                    } else {
                                        OutlineComponent.getDefault().setSelectedItem(theItem.item);
                                    }
                                    // We only handle the first found object
                                    return;
                                } else {
                                    DefaultPopupMenu theMenu = new DefaultPopupMenu(ResourceHelper
                                            .getResourceHelper(ERDesignerBundle.BUNDLE_NAME));

                                    List<ModelItem> theItems = new ArrayList<>();
                                    theItems.add(theItem.item);
                                    ContextMenuFactory.addActionsToMenu(Java3DEditor.this, theMenu, theItems);

                                    UIInitializer.getInstance().initialize(theMenu);

                                    theMenu.show(mainPanel, e.getX(), e.getY());
                                    // We only handle the first found object
                                    return;
                                }
                            }
                        }
                    }
                }
            }
        }
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:42,代码来源:Java3DEditor.java

示例2: mouseMoved

import com.sun.j3d.utils.picking.PickResult; //导入方法依赖的package包/类
private void mouseMoved(MouseEvent e) {

            currentElement.setText("");

            UserObjectInfo pickedObject = null;
            pickCanvas.setShapeLocation(e);
            // We have to use pickAll because of transparency
            PickResult[] thePickResult = pickCanvas.pickAllSorted();
            if (thePickResult != null) {
                for (PickResult theResult : thePickResult) {
                    if (theResult != null) {
                        Primitive p = (Primitive) theResult.getNode(PickResult.PRIMITIVE);
                        if (p != null) {
                            if (p.getUserData() instanceof UserObjectInfo && pickedObject == null) {
                                UserObjectInfo theItem = (UserObjectInfo) p.getUserData();
                                pickedObject = theItem;
                            }
                        }
                    }
                }
            }

            if (pickedObject != null) {
                currentElement.setText(pickedObject.item.getName());
                if (pickedObject != fadingComponent) {
                    fadingHelper.setComponentToHighlightFadeOut(fadingHelper.getComponentToHighlight() != null);
                    fadingHelper.setComponentToHighlightNext(getHighlightComponentFor(pickedObject));
                }
            } else {
                fadingHelper.setComponentToHighlightFadeOut(true);
                fadingHelper.setComponentToHighlightNext(null);
            }
            fadingComponent = pickedObject;

            fadingHelper.startWaitTimer();

            // Repaint triggern
            Transform3D theTransform = new Transform3D();
            modelGroup.getTransform(theTransform);
            modelGroup.setTransform(theTransform);
        }
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:42,代码来源:Java3DEditor.java

示例3: mouseClicked

import com.sun.j3d.utils.picking.PickResult; //导入方法依赖的package包/类
public void mouseClicked(MouseEvent e) {

        if (e.getButton() == MouseEvent.BUTTON1) {

            pickCanvas.setShapeLocation(e);

            PickResult result = pickCanvas.pickClosest();

            // If nothing is selected, restore all data points
            if (result == null) {

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

                    spheres[i].getAppearance().getMaterial()
                            .setDiffuseColor(colors[i]);
                    TransparencyAttributes t_attr = new TransparencyAttributes(
                            TransparencyAttributes.NONE, 0.0f);

                    spheres[i].getAppearance()
                            .setTransparencyAttributes(t_attr);

                }

                ScatterPlot3DGUI.detailTextArea.append("Nothing selected.\n\n");

            } else {

                Primitive p = (Primitive) result.getNode(PickResult.PRIMITIVE);

                Shape3D s = (Shape3D) result.getNode(PickResult.SHAPE3D);

                if (p != null) {

                    int index = Integer.parseInt(p.getUserData().toString());

                    if (index == -1) {

                        ScatterPlot3DGUI.detailTextArea
                                .append("Axis selected.\n");

                    } else {

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

                            ScatterPlot3DGUI.detailTextArea
                                    .append(ScatterPlot3DGUI.headers[i] + ": "
                                            + data.data[index][i] + "\n");
                        }
                    }

                    // Adjust label
                    ScatterPlot3DGUI.detailTextArea.append("\n");
                    ScatterPlot3DGUI.detailTextArea
                            .setCaretPosition(ScatterPlot3DGUI.detailTextArea
                                    .getDocument().getLength());

                } else if (s != null) {

                    System.out.print("s: ");
                    System.out.println(s.getClass().getName());

                } else {

                    System.out.println("null");

                }
            }

        } else if (e.getButton() == MouseEvent.BUTTON3) {

            saveMenu.show(e.getComponent(), e.getX(), e.getY());

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


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