//对于SL自带的Rectangle暂不做处理 private void SetClipShapeBase(ShapeElement sb, Rectangle2D clipBox, double resolution) { Rectangle2D bounds = sb.Point2Ds.GetBounds(); if ((Rectangle2D.IsNullOrEmpty(bounds)) || ((bounds.Width / resolution) < 16383.5)) { if (sb.ClippedPoint2Ds != null) { sb.ClearClip(); } } else if (((Rectangle2D.IsNullOrEmpty(sb.ClipBox)) || !clipBox.Within(sb.ClipBox)) || ((sb.ClipBox.Width / 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); } } }
private void SetClip(FeatureElement fe, Rectangle2D clipBox, double resolution) { Rectangle2D bounds = fe.Geometry.Bounds; if ((Rectangle2D.IsNullOrEmpty(bounds)) || ((bounds.Width / resolution) < 16383.5)) { if (fe.ClippedGeometry != null) { fe.ClearClip(); } } else if (((Rectangle2D.IsNullOrEmpty(fe.ClipBox)) || !clipBox.Within(fe.ClipBox)) || ((fe.ClipBox.Width / resolution) >= 16383.5)) { if (fe.Geometry is GeoRegion) { fe.SetClip(new GeoRegionClip(clipBox).Clip(fe.Geometry as GeoRegion), clipBox); } else if (fe.Geometry is GeoLine) { fe.SetClip(new GeoLineClip(clipBox).Clip(fe.Geometry as GeoLine), clipBox); } } }