Package org.jdesktop.wonderland.modules.placemarks.api.common

Examples of org.jdesktop.wonderland.modules.placemarks.api.common.Placemark


            public void actionPerformed(ActionEvent e) {
                JFrame frame = JmeClientMain.getFrame().getFrame();

                // Form a placemark with the current position about the avatar's
                // location.
                Placemark placemark = getCurrentPlacemark(sessionManager);

                // Fetch the list of known USER Placemark names
                PlacemarkRegistry registry =
                        PlacemarkRegistryFactory.getInstance();
                Set<Placemark> placemarkSet =
                        registry.getAllPlacemarks(PlacemarkType.USER);

                // Display a dialog with the values in the Placemark. And if we
                // wish to update the values, then re-add the placemark.
                // (Re-adding the placemark should have the effect of updating
                // its values.
                AddEditPlacemarkJDialog dialog = new AddEditPlacemarkJDialog(
                        frame, true, placemark, placemarkSet);
                dialog.setTitle(BUNDLE.getString("Add_Placemark"));
                dialog.setLocationRelativeTo(frame);
                dialog.pack();
                dialog.setVisible(true);

                if (dialog.getReturnStatus() ==
                        AddEditPlacemarkJDialog.RET_OK) {
                    // Create a new placemark with the new information.
                    String name = dialog.getPlacemarkName();
                    String url = dialog.getServerURL();
                    float x = dialog.getLocationX();
                    float y = dialog.getLocationY();
                    float z = dialog.getLocationZ();
                    float angle = dialog.getLookAtAngle();
                    ColorRGBA backColor = dialog.getBackgroundColor();
                    ColorRGBA textColor = dialog.getTextColor();
                    String imageURL = dialog.getImageURL();
                    String message = dialog.getMessage();
                    Placemark newPlacemark = new Placemark(name, url, x, y, z, angle,
                            backColor, textColor, imageURL, message);

                    try {
                        PlacemarkUtils.addUserPlacemark(newPlacemark);
                    } catch (Exception excp) {
                        LOGGER.log(Level.WARNING, "Unable to add " + name +
                                " to user's placemarks", excp);
                        return;
                    }

                    // Tell the client-side registry of placemarks that a new
                    // one has been added
                    registry.registerPlacemark(newPlacemark, PlacemarkType.USER);
                }
            }
        });

        // Menu item to take avatar to starting location
        startingLocationMI = new JMenuItem(BUNDLE.getString("Starting_Location"));
        startingLocationMI.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
               
                Vector3f position = new Vector3f();
                Quaternion look = new Quaternion();

                String prop = System.getProperty("Placemark.CoverScreen");
                if(prop == null) {
                    prop="";
                }
                if(!prop.equalsIgnoreCase("off")) {
                    if(!(ClientContextJME.getViewManager()
                            .getPrimaryViewCell().getWorldTransform().getTranslation(null).x==position.x &&
                            ClientContextJME.getViewManager()
                            .getPrimaryViewCell().getWorldTransform().getTranslation(null).z==position.z)) {

                        Placemark pl = new Placemark("", sessionManager.getServerURL()
                                , position.x, position.y, position.z, 0);
                        if(systemPlacemarkMenuItems!=null && systemPlacemarkMenuItems.keySet()!=null) {
                            Iterator<Placemark> sysItr = systemPlacemarkMenuItems.keySet().iterator();
                            while(sysItr.hasNext()) {
                                Placemark p = sysItr.next();
                               
                                if(p.getX()==0 && p.getZ()==0) {
                                    pl = p;
                                }
                            }
                        }
                       
View Full Code Here


        float dotProduct = v1.dot(v2);
        Vector3f crossProduct = v1.cross(v2);
        float lookAngle = (float) Math.atan2(normal.dot(crossProduct), dotProduct);
        lookAngle = (float) Math.toDegrees(lookAngle);

        return new Placemark("", url, x, y, z, lookAngle);
    }
View Full Code Here

        String name = request.getParameter("name");

        // Fetch the PlacemarkList from the /system/placemarks/placemarks.xml
        // file.
        PlacemarkList placemarkList = getPlacemarkList();
        Placemark placemark = placemarkList.getPlacemark(name);

        // Remove the placemark given the name. It should exist. If not, then
        // the HTML list will get reloaded anyway. Write back to the placemarks.xml
        // file
        placemarkList.removePlacemark(name);
View Full Code Here

            return;
        }

        // Add the new placemark to the list of placemarks. Write the data
        // back out to the file.
        Placemark placemark = new Placemark(name, url, x, y, z, angle);
        placemarkList.addPlacemark(placemark);
        setPlacemarkList(placemarkList);

        // Tell the config connection that we have added a new Placemark, if
        // the config connection exists (it should)
View Full Code Here

        Collection<PlacemarkEntry> entries = new ArrayList();
        PlacemarkList placemarkList = getPlacemarkList();
        Set<String> nameSet = placemarkList.getPlacemarkNames();
        for (String name : nameSet) {
            // Create a new entry for the HTML page to list
            Placemark placemark = placemarkList.getPlacemark(name);
            PlacemarkEntry entry = new PlacemarkEntry();
            entry.name = placemark.getName();
            entry.url = placemark.getUrl();
            entry.x = placemark.getX();
            entry.y = placemark.getY();
            entry.z = placemark.getZ();
            entry.angle = placemark.getAngle();

            // Add an action to "Delete" the entry
            String url = "delete&name=" + name;
            entry.addAction(new PlacemarkAction("delete", url));
            entries.add(entry);
View Full Code Here

            register();
        }
    }

    protected void register() {
        Placemark pm = toPlacemark(placemarkName);
        if (pm != null) {
            PlacemarkRegistrySrvFactory.getInstance().registerPlacemark(pm);
        }
    }
View Full Code Here

        }
    }

    protected void unregister() {
        // construct a fake placemark with the given name
        Placemark pm = new Placemark(placemarkName, null, 0, 0, 0, 0
                , ColorRGBA.black, ColorRGBA.white, "", "Teleporting. Please Wait...");
        PlacemarkRegistrySrvFactory.getInstance().unregisterPlacemark(pm);
    }
View Full Code Here

        // convert angle to degrees
        angle = (float) Math.toDegrees(angle);

        // create placemark
        return new Placemark(placemarkName, null, trans.x, trans.y, trans.z, angle,
                backgroundColor, textColor, imageURL, message);   
    }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.modules.placemarks.api.common.Placemark

Copyright © 2018 www.massapicom. 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.