public static void CloneAnnotation(AnnotationSceneNode annotationNode, SceneNode newParent) { DocumentNode node = annotationNode.DocumentNode.Clone(newParent.DocumentContext); AnnotationSceneNode annotationSceneNode = (AnnotationSceneNode)newParent.ViewModel.GetSceneNode(node); AnnotationManagerSceneNode.GetAnnotations(newParent).Add(annotationSceneNode); }
public static void SetAnnotationParent(AnnotationSceneNode annotationNode, SceneNode newParent) { if (annotationNode.Parent != null) { AnnotationManagerSceneNode.DeleteAnnotation(annotationNode); } AnnotationManagerSceneNode.GetAnnotations(newParent).Add(annotationNode); }
public static AnnotationSceneNode CreateAnnotation(SceneNode ownerNode) { if (ownerNode == null) { throw new ArgumentNullException("ownerNode"); } AnnotationSceneNode annotationNode = AnnotationSceneNode.Factory.Instantiate(ownerNode.ViewModel); annotationNode.Timestamp = DateTime.UtcNow; AnnotationManagerSceneNode.SetAnnotationParent(annotationNode, ownerNode); return(annotationNode); }
public static void DeleteAnnotation(AnnotationSceneNode nodeToRemove) { SceneNode parent = nodeToRemove.Parent; IList <AnnotationSceneNode> annotations = AnnotationManagerSceneNode.GetAnnotations(parent); annotations.Remove(nodeToRemove); if (annotations.Count != 0) { return; } parent.ClearLocalValue(AnnotationManagerSceneNode.AnnotationsProperty); }