/// <summary> /// Retrieves the persistable properties of <see cref="T:Dataweb.NShape.Advanced.CaptionedShapeBase" />. /// </summary> new public static IEnumerable<EntityPropertyDefinition> GetPropertyDefinitions(int version) { foreach (EntityPropertyDefinition pi in PathBasedPlanarShape.GetPropertyDefinitions(version)) yield return pi; yield return new EntityFieldDefinition("CharacterStyle", typeof(object)); yield return new EntityFieldDefinition("ParagraphStyle", typeof(object)); yield return new EntityFieldDefinition("Text", typeof(string)); }
/// <override></override> public override void CopyFrom(Shape source) { base.CopyFrom(source); // Copy size if the source is a DiameterShape if (source is DiameterShapeBase) { internalDiameter = ((DiameterShapeBase)source).DiameterInternal; } else { // If not, try to calculate the size a good as possible Rectangle srcBounds = Geometry.InvalidRectangle; if (source is PathBasedPlanarShape) { PathBasedPlanarShape src = (PathBasedPlanarShape)source; // Calculate the bounds of the (unrotated) resize handles because with // GetBoundingRectangle(), we receive the bounds including the children's bounds List <Point> pointBuffer = new List <Point>(); int centerX = src.X; int centerY = src.Y; float angleDeg = Geometry.TenthsOfDegreeToDegrees(-src.Angle); foreach (ControlPointId id in source.GetControlPointIds(ControlPointCapabilities.Resize)) { pointBuffer.Add(Geometry.RotatePoint(centerX, centerY, angleDeg, source.GetControlPointPosition(id))); } Geometry.CalcBoundingRectangle(pointBuffer, out srcBounds); } else { // Generic approach: try to fit into the bounding rectangle srcBounds = source.GetBoundingRectangle(true); } // // Calculate new size if (Geometry.IsValid(srcBounds)) { float scale = Geometry.CalcScaleFactor(DiameterInternal, DiameterInternal, srcBounds.Width, srcBounds.Height); DiameterInternal = (int)Math.Round(DiameterInternal * scale); } } }