/// <summary> /// Constructor. /// </summary> /// <param name="elements">Model element to create proto elements for.</param> /// <param name="operation">Operation.</param> public ModelProtoGroup(ICollection<ModelElement> elements, ModelProtoGroupOperation operation) { if (elements.Count == 0) throw new ArgumentNullException("elements"); this.protoElements = new List<ModelProtoElement>(6000); this.protoRootElements = new List<ModelProtoElement>(6000); this.protoEmbeddingLinks = new List<ModelProtoLink>(6000); this.protoReferenceLinks = new List<ModelProtoLink>(6000); this.protoOperation = operation; foreach (ModelElement modelElement in elements) { if (modelElement is IModelMergeElements) { ModelProtoElement root; if (operation == ModelProtoGroupOperation.Copy) { root = (modelElement as IModelMergeElements).ModelCreateMergeCopy(this); } else root = (modelElement as IModelMergeElements).ModelCreateMoveCopy(this); if (root == null) throw new ArgumentNullException("root"); this.protoRootElements.Insert(0, root); } } InitDictionaries(elements.ElementAt(0).Partition); }
/// <summary> /// Decides whether the element can be pasted or not based on the operation. /// </summary> /// <param name="protoGroupOperation">Proto group operation.</param> /// <returns>True if the element can be pasted. False otherwise.</returns> public virtual bool ModelIsPasteAllowed(ModelProtoGroupOperation protoGroupOperation) { if (protoGroupOperation == ModelProtoGroupOperation.Move) { return(ModelIsMoveAllowed()); } return(true); }
/// <summary> /// Deserialize. /// </summary> public void OnDeserialization(object sender) { protoElements = (List <ModelProtoElement>)serializationInfo.GetValue("protoElements", typeof(List <ModelProtoElement>)); protoRootElements = (List <ModelProtoElement>)serializationInfo.GetValue("protoRootElements", typeof(List <ModelProtoElement>)); protoReferenceLinks = (List <ModelProtoLink>)serializationInfo.GetValue("protoReferenceLinks", typeof(List <ModelProtoLink>)); protoEmbeddingLinks = (List <ModelProtoLink>)serializationInfo.GetValue("protoEmbeddingLinks", typeof(List <ModelProtoLink>)); //protoElements = new List<ModelProtoElement>((ModelProtoElement[])serializationInfo.GetValue("protoElements", typeof(ModelProtoElement[]))); //protoRootElements = new List<ModelProtoElement>((ModelProtoElement[])serializationInfo.GetValue("protoRootElements", typeof(ModelProtoElement[]))); //protoReferenceLinks = new List<ModelProtoLink>((ModelProtoLink[])serializationInfo.GetValue("protoReferenceLinks", typeof(ModelProtoLink[]))); //protoEmbeddingLinks = new List<ModelProtoLink>((ModelProtoLink[])serializationInfo.GetValue("protoEmbeddingLinks", typeof(ModelProtoLink[]))); protoOperation = (ModelProtoGroupOperation)serializationInfo.GetValue("protoOperation", typeof(ModelProtoGroupOperation)); bNeedsInitialization = true; }
/// <summary> /// Constructor. /// </summary> /// <param name="elements">Model element to create proto elements for.</param> /// <param name="operation">Operation.</param> public ModelProtoGroup(ICollection <ModelElement> elements, ModelProtoGroupOperation operation) { if (elements.Count == 0) { throw new ArgumentNullException("elements"); } this.protoElements = new List <ModelProtoElement>(6000); this.protoRootElements = new List <ModelProtoElement>(6000); this.protoEmbeddingLinks = new List <ModelProtoLink>(6000); this.protoReferenceLinks = new List <ModelProtoLink>(6000); this.protoOperation = operation; foreach (ModelElement modelElement in elements) { if (modelElement is IModelMergeElements) { ModelProtoElement root; if (operation == ModelProtoGroupOperation.Copy) { root = (modelElement as IModelMergeElements).ModelCreateMergeCopy(this); } else { root = (modelElement as IModelMergeElements).ModelCreateMoveCopy(this); } if (root == null) { throw new ArgumentNullException("root"); } this.protoRootElements.Insert(0, root); } } InitDictionaries(elements.ElementAt(0).Partition); }
/// <summary> /// Deserialize. /// </summary> public void OnDeserialization(object sender) { protoElements = (List<ModelProtoElement>)serializationInfo.GetValue("protoElements", typeof(List<ModelProtoElement>)); protoRootElements = (List<ModelProtoElement>)serializationInfo.GetValue("protoRootElements", typeof(List<ModelProtoElement>)); protoReferenceLinks = (List<ModelProtoLink>)serializationInfo.GetValue("protoReferenceLinks", typeof(List<ModelProtoLink>)); protoEmbeddingLinks = (List<ModelProtoLink>)serializationInfo.GetValue("protoEmbeddingLinks", typeof(List<ModelProtoLink>)); //protoElements = new List<ModelProtoElement>((ModelProtoElement[])serializationInfo.GetValue("protoElements", typeof(ModelProtoElement[]))); //protoRootElements = new List<ModelProtoElement>((ModelProtoElement[])serializationInfo.GetValue("protoRootElements", typeof(ModelProtoElement[]))); //protoReferenceLinks = new List<ModelProtoLink>((ModelProtoLink[])serializationInfo.GetValue("protoReferenceLinks", typeof(ModelProtoLink[]))); //protoEmbeddingLinks = new List<ModelProtoLink>((ModelProtoLink[])serializationInfo.GetValue("protoEmbeddingLinks", typeof(ModelProtoLink[]))); protoOperation = (ModelProtoGroupOperation)serializationInfo.GetValue("protoOperation", typeof(ModelProtoGroupOperation)); bNeedsInitialization = true; }
/// <summary> /// Decides whether the element can be pasted or not based on the operation. /// </summary> /// <param name="protoGroupOperation">Proto group operation.</param> /// <returns>True if the element can be pasted. False otherwise.</returns> public virtual bool ModelIsPasteAllowed(ModelProtoGroupOperation protoGroupOperation) { if (protoGroupOperation == ModelProtoGroupOperation.Move) return ModelIsMoveAllowed(); return true; }
/// <summary> /// Decides whether the element can be pasted or not based on the operation. /// </summary> /// <param name="protoGroupOperation">Proto group operation.</param> /// <returns>True if the element can be pasted. False otherwise.</returns> public virtual bool ModelIsPasteAllowed(ModelProtoGroupOperation protoGroupOperation) { return (this.Element as IModelMergeElements).ModelIsMoveAllowed(); }
/// <summary> /// Decides whether the element can be pasted or not based on the operation. /// </summary> /// <param name="protoGroupOperation">Proto group operation.</param> /// <returns>True if the element can be pasted. False otherwise.</returns> public virtual bool ModelIsPasteAllowed(ModelProtoGroupOperation protoGroupOperation) { return(true); }
/// <summary> /// Decides whether the element can be pasted or not based on the operation. /// </summary> /// <param name="protoGroupOperation">Proto group operation.</param> /// <returns>True if the element can be pasted. False otherwise.</returns> public virtual bool ModelIsPasteAllowed(ModelProtoGroupOperation protoGroupOperation) { return true; }
/// <summary> /// Decides whether the element can be pasted or not based on the operation. /// </summary> /// <param name="protoGroupOperation">Proto group operation.</param> /// <returns>True if the element can be pasted. False otherwise.</returns> public virtual bool ModelIsPasteAllowed(ModelProtoGroupOperation protoGroupOperation) { return((this.Element as IModelMergeElements).ModelIsMoveAllowed()); }