Exemple #1
0
        private bool load_Labels()
        {
            string fn = pviewer.ProjectManager.CurrentProject.FolderPath + "/Data/Labels.xml";

            if (!System.IO.File.Exists(fn))
            {
                return(false);
            }

            XPathDocument  doc = new XPathDocument(fn);
            XPathNavigator nav = doc.CreateNavigator();
            var            xml = nav.Select("Labels/Label");

            while (xml.MoveNext())
            {
                string     xpos  = xml.Current.GetAttribute("x", "");
                string     ypos  = xml.Current.GetAttribute("y", "");
                string     zpos  = xml.Current.GetAttribute("z", "");
                string     name  = xml.Current.GetAttribute("name", "");
                double     x     = double.Parse(xpos, System.Globalization.CultureInfo.InvariantCulture);
                double     y     = double.Parse(ypos, System.Globalization.CultureInfo.InvariantCulture);
                double     z     = double.Parse(zpos, System.Globalization.CultureInfo.InvariantCulture);
                VRVector3D pos   = new VRVector3D(x, y, z);
                IVRLabel   label = m_LabelGroup.Add(name, pos);
            }

            return(true);
        }
Exemple #2
0
        void m_ItemCreate_Click(object sender, EventArgs e)
        {
            // Get the click information from the Tag property as a VRRaycastResult type.
            VRRayCastResult res = SDKViewer.UI.ContextMenu3D.Tag as VRRayCastResult;

            // Create the label at the location the user clicked, and set the text of the label to "New Label" and a next line with the position.
            IVRLabel label = m_LabelGroup.Add("New Label\n" + res.Position.ToString("f2"), res.Position);

            // Add it to the dictionary, for later reference (see m_ItemDestroy_Click)
            m_Labels.Add(label.ID, label);
            // Dump in the window text area the ID of the label created.
            m_RichTextBox.Text += "Created a new Label of ID : " + label.ID.ToString() + "\r\n";
        }