public static void AddAnnotationReference(SceneElement element, AnnotationSceneNode annotation) { ExceptionChecks.CheckNullArgument <SceneElement>(element, "element"); ExceptionChecks.CheckNullArgument <AnnotationSceneNode>(annotation, "annotation"); string str = annotation.Id; if (string.IsNullOrEmpty(str)) { str = AnnotationUtils.SetAnnotationId(annotation); } IEnumerable <string> referencedAnnotationIds = AnnotationUtils.GetReferencedAnnotationIds(element); AnnotationUtils.SetAnnotationReferences(element, EnumerableExtensions.AppendItem <string>(referencedAnnotationIds, str)); }
public static bool RemoveAnnotationReference(SceneElement element, AnnotationSceneNode annotation) { ExceptionChecks.CheckNullArgument <SceneElement>(element, "element"); ExceptionChecks.CheckNullArgument <AnnotationSceneNode>(annotation, "annotation"); string annotationId = annotation.Id; if (string.IsNullOrEmpty(annotationId)) { return(false); } List <string> list = Enumerable.ToList <string>(AnnotationUtils.GetReferencedAnnotationIds(element)); IEnumerable <string> enumerable = Enumerable.Where <string>((IEnumerable <string>)list, (Func <string, bool>)(id => id.Equals(annotationId, StringComparison.OrdinalIgnoreCase))); if (!Enumerable.Any <string>(enumerable)) { return(false); } AnnotationUtils.SetAnnotationReferences(element, Enumerable.Except <string>((IEnumerable <string>)list, enumerable)); return(true); }