Exemple #1
0
        private void CreateAnnotation(AnnotationElement annotation, Feature feature)
        {
            if (annotation.name.IsNullOrEmpty())
            {
                return;
            }

            AnnotationCreator creator = FindObjectOfType <AnnotationCreator> ();

            if (creator == null)
            {
                return;
            }

            AnnotationsRoot root = feature.gameObject.GetComponentInChildren <AnnotationsRoot> ();

            if (root == null)
            {
                GameObject rootGO = new GameObject("Annotations");
                rootGO.transform.SetParent(feature.transform, false);
                rootGO.transform.localPosition = Vector3.zero;
                root = rootGO.AddComponent <AnnotationsRoot> ();
            }

            AnnotationVisualization.AnnotationData data = new AnnotationVisualization.AnnotationData();
            data.name        = annotation.name;
            data.description = annotation.description;
            data.position    = new Vector3(annotation.ParsePos()[0], annotation.ParsePos()[1], annotation.ParsePos()[2]);

            creator.CreateAnnotation(data, root.gameObject);
        }