// ------------------------------------------------------------------ /// <summary> /// Unwraps an entity /// <list type="bullet"> /// <term>Uid</term><description>Generates a new <see cref="IDiagramEntity.Uid"/> for the entity. </description> /// <tem>Model</tem><description>Assigns the Model property to the entity.</description> /// /// </list> /// </summary> // ------------------------------------------------------------------ public void Unwrap(IDiagramEntity entity) { //set a new unique identifier for this copied object entity.NewUid(true); //this assignment will be recursive if needed SetModel(entity); CurrentPage.DefaultLayer.Entities.Add(entity); entity.Attached(CurrentPage.DefaultLayer); }
// ------------------------------------------------------------------ /// <summary> /// Adds an entity to the diagram. The magnification level for the /// entity is set to the current magnification level of the current /// page. /// </summary> /// <param name="entity">IDiagramEntity: The entity to add.</param> /// <returns>IDiagramEntity: The added entity.</returns> // ------------------------------------------------------------------ public IDiagramEntity AddEntity(IDiagramEntity entity) { SetModel(entity); //By default the new entity is added to the default layer in the // current page. CurrentPage.DefaultLayer.Entities.Add(entity); entity.Attached(CurrentPage.DefaultLayer); entity.Magnification = CurrentPage.Magnification; return(entity); }
// ------------------------------------------------------------------ /// <summary> /// Adds an entity to the diagram. The magnification level for the /// entity is set to the current magnification level of the current /// page. /// </summary> /// <param name="entity">IDiagramEntity: The entity to add.</param> /// <returns>IDiagramEntity: The added entity.</returns> // ------------------------------------------------------------------ public IDiagramEntity AddEntity(IDiagramEntity entity) { SetModel(entity); //By default the new entity is added to the default layer in the // current page. CurrentPage.DefaultLayer.Entities.Add(entity); entity.Attached(CurrentPage.DefaultLayer); entity.Magnification = CurrentPage.Magnification; return entity; }