Inheritance: System.Windows.Controls.Control
示例#1
0
 internal void SetElementReference(FeatureElement element)
 {
     if (element == null)
     {
         this.ElementReference = null;
     }
     else
     {
         this.ElementReference = new WeakReference(element);
         Canvas.SetZIndex(element, this.zIndex);
         if (this.geometry != null)
         {
             SuperMap.WindowsPhone.Mapping.LayerContainer.SetBounds(element, this.geometry.Bounds);
         }
     }
 }
 //int最大值32765的一半16382.5,最大支持16383
 private void SetClip(FeatureElement fe, Rectangle2D clipBox)
 {
     Rectangle2D bounds = fe.Geometry.Bounds;
     if ((Rectangle2D.IsNullOrEmpty(bounds)) || ((bounds.Width / this.Resolution) < 16383.5))
     {
         if (fe.ClippedGeometry != null)
         {
             fe.ClearClip();
         }
     }
     else if (((Rectangle2D.IsNullOrEmpty(fe.ClipBox)) || !clipBox.Within(fe.ClipBox)) || ((fe.ClipBox.Width / this.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);
         }
     }
 }
 internal void ResetGeometryTransform(FeatureElement elm)
 {
     if (((elm.OriginX != this.Origin.X) || (elm.OriginY != this.Origin.Y)) || (elm.Resolution != this.Resolution))
     {
         elm.InvalidatePath(this.Resolution, this.OriginX, this.OriginY);
     }
 }
        private void ArrangeFeature(FeatureElement elm, Rectangle2D clipBox)
        {
            if (elm.Visibility != Visibility.Collapsed)
            {
                Rectangle2D b = GetBounds(elm);
                if (!Rectangle2D.IsNullOrEmpty(b))
                {
                    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)) && (elm.PathGeometry != null))
                    {
                        double ratio = elm.Resolution / this.Resolution;
                        this.SetClip(elm, clipBox);
                        if (elm.ClippedGeometry != null)
                        {
                            b = elm.ClippedGeometry.Bounds;
                            if (Rectangle2D.IsNullOrEmpty(b))
                            {
                                return;
                            }
                            x = (b.Left - this.Origin.X) / this.Resolution;
                            y = (this.Origin.Y - b.Top) / this.Resolution;
                        }
                        if (elm.PathGeometry.Transform is ScaleTransform)
                        {
                            (elm.PathGeometry.Transform as ScaleTransform).ScaleX = (elm.PathGeometry.Transform as ScaleTransform).ScaleY = ratio;
                        }
                        else
                        {
                            elm.PathGeometry.Transform = new ScaleTransform { ScaleX = ratio, ScaleY = ratio };
                        }

                        double num4 = ((b.Width / elm.Resolution) * ratio) + 10.0;
                        double num5 = ((b.Height / elm.Resolution) * ratio) + 10.0;//这也已经加了10.0
                        num4 = Math.Min(32000.0, num4);
                        num5 = Math.Min(32000.0, num5);
                        elm.Arrange(new Rect(x, y, num4, num5));
                    }
                    else
                    {
                        elm.Arrange(new Rect(new Point(x, y), elm.DesiredSize));
                    }
                }
            }
        }