Example #1
0
        public GeometryDrawing GetDrawing(IFeature f, int i)
        {
            Geometry.Vector   p        = new Geometry.PointString(f.GeoData).GetExtents().Center();
            Point             pos      = new Point(p.X, p.Y);
            Size              size     = GetSize(f);
            double            x        = pos.X - Chart.Width / 2 + i * size.Width;
            double            y        = pos.Y;
            RectangleGeometry geometry = new RectangleGeometry(new Rect(new Point(x, y), size));
            GeometryDrawing   drawing  = new GeometryDrawing(new SolidColorBrush(Color), null, geometry);

            return(drawing);
        }
Example #2
0
        public override void ApplyFluidTheme(IDataFluidTheme theme)
        {
            if (LayerData.GeoType == VectorLayer.GEOTYPE_LINEAR)
            {
                foreach (var featurePair in Features)
                {
                    var    feature  = featurePair.Key;
                    var    geometry = featurePair.Value.Geometry as PathGeometry;
                    var    poly     = new Geometry.PointString(feature.GeoData);
                    double length   = poly.Length();
                    if (length < 10)
                    {
                        continue;
                    }

                    double velocity  = theme.GetVelocity(feature);
                    double time      = length / velocity;
                    double space     = 1 / theme.GetDensity(feature);
                    int    spotCount = (int)(length / space) + 1;
                    var    color     = theme.GetColor(feature);

                    for (int i = 0; i < spotCount; i++)
                    {
                        var pointAnimation = new PointAnimationUsingPath
                        {
                            PathGeometry   = geometry,
                            Duration       = new Duration(new TimeSpan(0, 0, 0, 0, (int)(time * 1000))),
                            RepeatBehavior = RepeatBehavior.Forever,
                            BeginTime      = new TimeSpan(0, 0, 0, 0, (int)(time / spotCount * i * 1000))
                        };

                        var colorAnimation = new ColorAnimation(
                            fromValue: color.Item1,
                            toValue: color.Item2,
                            duration: new Duration(new TimeSpan(0, 0, 0, 0, (int)(time * 1000))))
                        {
                            RepeatBehavior = RepeatBehavior.Forever,
                            BeginTime      = new TimeSpan(0, 0, 0, 0, (int)(time / spotCount * i * 1000))
                        };

                        double radius      = theme.GetDiameter(feature) / 2;
                        var    fill        = new SolidColorBrush(color.Item1);
                        var    spot        = new EllipseGeometry(new Point(), radius, radius);
                        var    spotDrawing = new GeometryDrawing(fill, null, spot);
                        this.AddOverlayChildren(spotDrawing);
                        spot.BeginAnimation(EllipseGeometry.CenterProperty, pointAnimation);
                        fill.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation);
                    }
                }
            }
        }
Example #3
0
        public Rectangle GetShape(IFeature f, int i)
        {
            Geometry.Vector p    = new Geometry.PointString(f.GeoData).Centroid();
            Point           pos  = new Point(p.X, p.Y);
            Size            size = GetSize(f);
            double          x    = pos.X - Chart.Width / 2 + i * size.Width;
            double          y    = pos.Y;
            Rectangle       rect = new Rectangle {
                Width = size.Width, Height = size.Height, Fill = new SolidColorBrush(Color), Stroke = null
            };

            Canvas.SetLeft(rect, x);
            Canvas.SetTop(rect, y);
            ToolTipService.SetToolTip(rect, UIHelper.TitledToolTip(Property, ValueSelector(f).ToString()));
            return(rect);
        }