${mapping_ShapeBase_Title}
${mapping_ShapeBase_Description}
private void ArrangeShapeBase(ShapeElement sb, Rectangle2D clipBox) { if (sb.Visibility != Visibility.Collapsed) { Rectangle2D b = GetBounds(sb); if (!b.IsEmpty) { double x = (b.Left - this.Origin.X) / this.Resolution; double y = (this.Origin.Y - b.Top) / this.Resolution; if (((b.Width > 0.0) || (b.Height > 0.0)) && (sb.Point2Ds != null)) { double ratio = sb.Resolution / this.Resolution; this.SetClipShapeBase(sb, clipBox); if (sb.ClippedPoint2Ds != null) { b = sb.ClippedPoint2Ds.GetBounds(); if (b.IsEmpty) { return; } x = (b.Left - this.Origin.X) / this.Resolution; y = (this.Origin.Y - b.Top) / this.Resolution; } if (sb.EncapsulatedShape.RenderTransform is ScaleTransform) { (sb.EncapsulatedShape.RenderTransform as ScaleTransform).ScaleX = (sb.EncapsulatedShape.RenderTransform as ScaleTransform).ScaleY = ratio; } else { sb.EncapsulatedShape.RenderTransform = new ScaleTransform { ScaleX = ratio, ScaleY = ratio }; } double num4 = b.Width / sb.Resolution * ratio + 10.0; double num5 = b.Height / sb.Resolution * ratio + 10.0; num4 = Math.Min(32000.0, num4); num5 = Math.Min(32000.0, num5); sb.Arrange(new Rect(x, y, num4, num5)); } else { sb.Arrange(new Rect(new Point(x, y), sb.DesiredSize)); } } } }
//对于SL自带的Rectangle暂不做处理 private void SetClipShapeBase(ShapeElement sb, Rectangle2D clipBox) { Rectangle2D bounds = sb.Point2Ds.GetBounds(); if ((bounds.IsEmpty) || ((bounds.Width / this.Resolution) < 16383.5)) { if (sb.ClippedPoint2Ds != null) { sb.ClearClip(); } } else if (((sb.ClipBox.IsEmpty) || !clipBox.Within(sb.ClipBox)) || ((sb.ClipBox.Width / this.Resolution) >= 16383.5)) { if (sb is PolygonElement) { sb.SetClip(new PolygonElementClip(clipBox).Clip(sb.Point2Ds), clipBox); } else if (sb is PolylineElement) { sb.SetClip(new PolylineElementClip(clipBox).Clip(sb.Point2Ds), clipBox); } } }
internal void ResetShapeBaseTransform(ShapeElement sb) { if (((sb.OriginX != this.Origin.X) || (sb.OriginY != this.Origin.Y)) || (sb.Resolution != this.Resolution)) { sb.InvalidatePath(this.Resolution, this.OriginX, this.OriginY); } }