Inheritance: Geometry, ILineGeometry
コード例 #1
0
ファイル: Library.cs プロジェクト: vvzwvv/UWPTutorials
 private Path getPiece()
 {
     if ((piece == cross))
     {
         Path lines = new Path();
         LineGeometry line1 = new LineGeometry();
         LineGeometry line2 = new LineGeometry();
         GeometryGroup linegroup = new GeometryGroup();
         line1.StartPoint = new Point(0, 0);
         line1.EndPoint = new Point(60, 60);
         line2.StartPoint = new Point(60, 0);
         line2.EndPoint = new Point(0, 60);
         linegroup.Children.Add(line1);
         linegroup.Children.Add(line2);
         lines.Data = linegroup;
         lines.Stroke = new SolidColorBrush(Colors.Red);
         lines.StrokeThickness = 5;
         lines.Margin = new Thickness(10);
         return lines;
     }
     else
     {
         EllipseGeometry ellipse = new EllipseGeometry();
         Path circle = new Path();
         ellipse.Center = new Point(30, 30);
         ellipse.RadiusX = 30;
         ellipse.RadiusY = 30;
         circle.Data = ellipse;
         circle.Stroke = new SolidColorBrush(Colors.Blue);
         circle.StrokeThickness = 5;
         circle.Margin = new Thickness(10);
         return circle;
     }
 }
コード例 #2
0
 public static void AddLineGeometry(
     this D2D.GeometrySink sink, Jupiter.Media.LineGeometry lineGeometry)
 {
     sink.BeginFigure(
         lineGeometry.StartPoint.ToSharpDX(),
         D2D.FigureBegin.Hollow);
     sink.AddLine(
         lineGeometry.EndPoint.ToSharpDX());
     sink.EndFigure(D2D.FigureEnd.Open);
 }
コード例 #3
0
        public TileUC()
        {
            this.InitializeComponent();
            brush = new SolidColorBrush(Colors.Green);
            var c = 32;
            for (int i = 0; i < c; i++) {

                var f = Dim / c;
                var p = f * i;

                {
                    var geo = new LineGeometry() { StartPoint = new Point(0, p), EndPoint = new Point(Dim - p, Dim) };

                    var item = new Path();
                    item.Data = geo;
                    item.Stroke = brush;
                    item.StrokeThickness = .5;
                    item.StrokeEndLineCap = PenLineCap.Square;

                    this.Content.Children.Add(item);
                }
                if (i == 0) continue;
                {
                    var geo = new LineGeometry() { StartPoint = new Point(p, 0), EndPoint = new Point(Dim, Dim - p) };

                    var item = new Path();
                    item.Data = geo;
                    item.Stroke = brush;
                    item.StrokeThickness = .5;

                    item.StrokeEndLineCap = PenLineCap.Square;

                    this.Content.Children.Add(item);
                }
            }
        }
コード例 #4
0
        public static WMedia.Geometry ToWindows(this Geometry geometry)
        {
            WMedia.Geometry wGeometry = null;

            if (geometry is LineGeometry)
            {
                LineGeometry lineGeometry = geometry as LineGeometry;
                wGeometry = new WMedia.LineGeometry
                {
                    StartPoint = lineGeometry.StartPoint.ToWindows(),
                    EndPoint   = lineGeometry.EndPoint.ToWindows()
                };
            }
            else if (geometry is RectangleGeometry)
            {
                var rect = (geometry as RectangleGeometry).Rect;
                wGeometry = new WMedia.RectangleGeometry
                {
                    Rect = new WFoundation.Rect(rect.X, rect.Y, rect.Width, rect.Height)
                };
            }
            else if (geometry is EllipseGeometry)
            {
                EllipseGeometry ellipseGeometry = geometry as EllipseGeometry;
                wGeometry = new WMedia.EllipseGeometry
                {
                    Center  = ellipseGeometry.Center.ToWindows(),
                    RadiusX = ellipseGeometry.RadiusX,
                    RadiusY = ellipseGeometry.RadiusY
                };
            }
            else if (geometry is GeometryGroup)
            {
                GeometryGroup geometryGroup = geometry as GeometryGroup;
                wGeometry = new WMedia.GeometryGroup
                {
                    FillRule = ConvertFillRule(geometryGroup.FillRule)
                };

                foreach (Geometry children in geometryGroup.Children)
                {
                    WMedia.Geometry winChild = children.ToWindows();
                    (wGeometry as WMedia.GeometryGroup).Children.Add(winChild);
                }
            }
            else if (geometry is PathGeometry)
            {
                PathGeometry pathGeometry = geometry as PathGeometry;

                WMedia.PathGeometry wPathGeometry = new WMedia.PathGeometry
                {
                    FillRule = ConvertFillRule(pathGeometry.FillRule)
                };

                foreach (PathFigure xamPathFigure in pathGeometry.Figures)
                {
                    WMedia.PathFigure wPathFigure = new WMedia.PathFigure
                    {
                        StartPoint = xamPathFigure.StartPoint.ToWindows(),
                        IsFilled   = xamPathFigure.IsFilled,
                        IsClosed   = xamPathFigure.IsClosed
                    };
                    wPathGeometry.Figures.Add(wPathFigure);

                    foreach (PathSegment pathSegment in xamPathFigure.Segments)
                    {
                        // LineSegment
                        if (pathSegment is LineSegment)
                        {
                            LineSegment lineSegment = pathSegment as LineSegment;

                            WMedia.LineSegment winSegment = new WMedia.LineSegment
                            {
                                Point = lineSegment.Point.ToWindows()
                            };

                            wPathFigure.Segments.Add(winSegment);
                        }

                        // PolylineSegment
                        if (pathSegment is PolyLineSegment)
                        {
                            PolyLineSegment        polyLineSegment = pathSegment as PolyLineSegment;
                            WMedia.PolyLineSegment wSegment        = new WMedia.PolyLineSegment();

                            foreach (var point in polyLineSegment.Points)
                            {
                                wSegment.Points.Add(point.ToWindows());
                            }

                            wPathFigure.Segments.Add(wSegment);
                        }

                        // BezierSegment
                        if (pathSegment is BezierSegment)
                        {
                            BezierSegment bezierSegment = pathSegment as BezierSegment;

                            WMedia.BezierSegment wSegment = new WMedia.BezierSegment
                            {
                                Point1 = bezierSegment.Point1.ToWindows(),
                                Point2 = bezierSegment.Point2.ToWindows(),
                                Point3 = bezierSegment.Point3.ToWindows()
                            };

                            wPathFigure.Segments.Add(wSegment);
                        }
                        // PolyBezierSegment
                        else if (pathSegment is PolyBezierSegment)
                        {
                            PolyBezierSegment        polyBezierSegment = pathSegment as PolyBezierSegment;
                            WMedia.PolyBezierSegment wSegment          = new WMedia.PolyBezierSegment();

                            foreach (var point in polyBezierSegment.Points)
                            {
                                wSegment.Points.Add(point.ToWindows());
                            }

                            wPathFigure.Segments.Add(wSegment);
                        }

                        // QuadraticBezierSegment
                        if (pathSegment is QuadraticBezierSegment)
                        {
                            QuadraticBezierSegment quadraticBezierSegment = pathSegment as QuadraticBezierSegment;

                            WMedia.QuadraticBezierSegment wSegment = new WMedia.QuadraticBezierSegment
                            {
                                Point1 = quadraticBezierSegment.Point1.ToWindows(),
                                Point2 = quadraticBezierSegment.Point2.ToWindows()
                            };

                            wPathFigure.Segments.Add(wSegment);
                        }
                        // PolyQuadraticBezierSegment
                        else if (pathSegment is PolyQuadraticBezierSegment)
                        {
                            PolyQuadraticBezierSegment        polyQuadraticBezierSegment = pathSegment as PolyQuadraticBezierSegment;
                            WMedia.PolyQuadraticBezierSegment wSegment = new WMedia.PolyQuadraticBezierSegment();

                            foreach (var point in polyQuadraticBezierSegment.Points)
                            {
                                wSegment.Points.Add(point.ToWindows());
                            }

                            wPathFigure.Segments.Add(wSegment);
                        }
                        // ArcSegment
                        else if (pathSegment is ArcSegment)
                        {
                            ArcSegment arcSegment = pathSegment as ArcSegment;

                            WMedia.ArcSegment wSegment = new WMedia.ArcSegment
                            {
                                Size           = new WFoundation.Size(arcSegment.Size.Width, arcSegment.Size.Height),
                                RotationAngle  = arcSegment.RotationAngle,
                                IsLargeArc     = arcSegment.IsLargeArc,
                                SweepDirection = arcSegment.SweepDirection == SweepDirection.Clockwise ? WMedia.SweepDirection.Clockwise : WMedia.SweepDirection.Counterclockwise,
                                Point          = arcSegment.Point.ToWindows()
                            };

                            wPathFigure.Segments.Add(wSegment);
                        }
                    }
                }

                wGeometry = wPathGeometry;
            }

            return(wGeometry);
        }
コード例 #5
0
ファイル: NativeGeometry.cs プロジェクト: arun6202/XFSession
        public object ConvertToNative(Geometry geometry)
        {
            winMedia.Geometry winGeometry = null;

            // Determine what type of geometry we're dealing with.
            if (geometry is LineGeometry)
            {
                LineGeometry xamGeometry = geometry as LineGeometry;
                winGeometry = new winMedia.LineGeometry
                {
                    StartPoint = ConvertPoint(xamGeometry.StartPoint),
                    EndPoint   = ConvertPoint(xamGeometry.EndPoint)
                };
            }

            else if (geometry is RectangleGeometry)
            {
                Rect rect = (geometry as RectangleGeometry).Rect;
                winGeometry = new winMedia.RectangleGeometry
                {
                    Rect = new winFound.Rect(rect.X, rect.Y, rect.Width, rect.Height)
                };
            }

            else if (geometry is EllipseGeometry)
            {
                EllipseGeometry xamGeometry = geometry as EllipseGeometry;
                winGeometry = new winMedia.EllipseGeometry
                {
                    Center  = ConvertPoint(xamGeometry.Center),
                    RadiusX = xamGeometry.RadiusX,
                    RadiusY = xamGeometry.RadiusY
                };
            }

            else if (geometry is GeometryGroup)
            {
                GeometryGroup xamGeometry = geometry as GeometryGroup;
                winGeometry = new winMedia.GeometryGroup
                {
                    FillRule = ConvertFillRule(xamGeometry.FillRule)
                };

                foreach (Geometry xamChild in xamGeometry.Children)
                {
                    winMedia.Geometry winChild = ConvertToNative(xamChild) as winMedia.Geometry;
                    (winGeometry as winMedia.GeometryGroup).Children.Add(winChild);
                }
            }

            else if (geometry is PathGeometry)
            {
                PathGeometry xamPathGeometry = geometry as PathGeometry;

                winMedia.PathGeometry winPathGeometry = new winMedia.PathGeometry
                {
                    FillRule = ConvertFillRule(xamPathGeometry.FillRule)
                };

                foreach (PathFigure xamPathFigure in xamPathGeometry.Figures)
                {
                    winMedia.PathFigure winPathFigure = new winMedia.PathFigure
                    {
                        StartPoint = ConvertPoint(xamPathFigure.StartPoint),
                        IsFilled   = xamPathFigure.IsFilled,
                        IsClosed   = xamPathFigure.IsClosed
                    };
                    winPathGeometry.Figures.Add(winPathFigure);

                    foreach (PathSegment xamPathSegment in xamPathFigure.Segments)
                    {
                        // LineSegment
                        if (xamPathSegment is LineSegment)
                        {
                            LineSegment xamSegment = xamPathSegment as LineSegment;

                            winMedia.LineSegment winSegment = new winMedia.LineSegment
                            {
                                Point = ConvertPoint(xamSegment.Point)
                            };

                            winPathFigure.Segments.Add(winSegment);
                        }

                        // PolylineSegment
                        if (xamPathSegment is PolyLineSegment)
                        {
                            PolyLineSegment          xamSegment = xamPathSegment as PolyLineSegment;
                            winMedia.PolyLineSegment winSegment = new winMedia.PolyLineSegment();

                            foreach (Point point in xamSegment.Points)
                            {
                                winSegment.Points.Add(ConvertPoint(point));
                            }

                            winPathFigure.Segments.Add(winSegment);
                        }

                        // BezierSegment
                        if (xamPathSegment is BezierSegment)
                        {
                            BezierSegment xamSegment = xamPathSegment as BezierSegment;

                            winMedia.BezierSegment winSegment = new winMedia.BezierSegment
                            {
                                Point1 = ConvertPoint(xamSegment.Point1),
                                Point2 = ConvertPoint(xamSegment.Point2),
                                Point3 = ConvertPoint(xamSegment.Point3)
                            };

                            winPathFigure.Segments.Add(winSegment);
                        }

                        // PolyBezierSegment
                        else if (xamPathSegment is PolyBezierSegment)
                        {
                            PolyBezierSegment          xamSegment = xamPathSegment as PolyBezierSegment;
                            winMedia.PolyBezierSegment winSegment = new winMedia.PolyBezierSegment();

                            foreach (Point point in xamSegment.Points)
                            {
                                winSegment.Points.Add(ConvertPoint(point));
                            }

                            winPathFigure.Segments.Add(winSegment);
                        }

                        // QuadraticBezierSegment
                        if (xamPathSegment is QuadraticBezierSegment)
                        {
                            QuadraticBezierSegment xamSegment = xamPathSegment as QuadraticBezierSegment;

                            winMedia.QuadraticBezierSegment winSegment = new winMedia.QuadraticBezierSegment
                            {
                                Point1 = ConvertPoint(xamSegment.Point1),
                                Point2 = ConvertPoint(xamSegment.Point2),
                            };

                            winPathFigure.Segments.Add(winSegment);
                        }

                        // PolyQuadraticBezierSegment
                        else if (xamPathSegment is PolyQuadraticBezierSegment)
                        {
                            PolyQuadraticBezierSegment          xamSegment = xamPathSegment as PolyQuadraticBezierSegment;
                            winMedia.PolyQuadraticBezierSegment winSegment = new winMedia.PolyQuadraticBezierSegment();

                            foreach (Point point in xamSegment.Points)
                            {
                                winSegment.Points.Add(ConvertPoint(point));
                            }

                            winPathFigure.Segments.Add(winSegment);
                        }


                        // ArcSegment
                        else if (xamPathSegment is ArcSegment)
                        {
                            ArcSegment          xamSegment = xamPathSegment as ArcSegment;
                            winMedia.ArcSegment winSegment = new winMedia.ArcSegment();

                            winSegment.Size           = new winFound.Size(xamSegment.Size.Width, xamSegment.Size.Height);
                            winSegment.RotationAngle  = xamSegment.RotationAngle;
                            winSegment.IsLargeArc     = xamSegment.IsLargeArc;
                            winSegment.SweepDirection = xamSegment.SweepDirection == SweepDirection.Clockwise ? winMedia.SweepDirection.Clockwise : winMedia.SweepDirection.Counterclockwise;
                            winSegment.Point          = ConvertPoint(xamSegment.Point);

                            winPathFigure.Segments.Add(winSegment);
                        }
                    }
                }

                winGeometry = winPathGeometry;
            }

            // Set transform.
            if (geometry.Transform != null)
            {
                winGeometry.Transform = (winMedia.Transform)geometry.Transform.GetNativeObject();
            }

            return(winGeometry);
        }
コード例 #6
0
ファイル: Crossline.cs プロジェクト: DuckDeck/TouchTestWp8.1
       public Crossline(Color color, PointerPoint point) 
       {
             this.horizontalPath = new Path();
             this.verticalPath = new Path();
            this.point = point;
            horizontalPath.Stroke = new SolidColorBrush(color);
            verticalPath.Stroke = new SolidColorBrush(color);
            LineGeometry horizontalLg = new LineGeometry();
            horizontalLg.StartPoint = new Point(0, 0);
            horizontalLg.EndPoint = new Point(Window.Current.Bounds.Width, 0);
            TranslateTransform horizontalLineTrans = new TranslateTransform();
            horizontalLineTrans.Y = point.Position.Y;
            horizontalLineTrans.X = 0;
            horizontalLg.Transform = horizontalLineTrans;
            horizontalPath.Data = horizontalLg;
            horizontalPath.StrokeThickness = strokeThickness;
            LineGeometry verticalLg = new LineGeometry();
            verticalLg.StartPoint = new Point(0, 0);
            verticalLg.EndPoint = new Point(0, Window.Current.Bounds.Height);
            TranslateTransform verticalLineTrans = new TranslateTransform();
            verticalLineTrans.X = point.Position.X;
            verticalLineTrans.Y = 0;
            verticalLg.Transform = verticalLineTrans;
            verticalPath.Data = verticalLg;
            verticalPath.StrokeThickness = strokeThickness;


       }
コード例 #7
0
        public void DisplayTime()
        {
            //txtTo.Text = DateTime.Now.ToString("mm/dd/yyyy HH:mm:ss");
            string HH_str = DateTime.Now.ToString("HH");

            int hour = Convert.ToInt32(HH_str); ;

            shadow1.Stroke = new SolidColorBrush(Colors.Black);
            shadow2.Stroke = new SolidColorBrush(Colors.Black);
            shadow1.StrokeThickness = 3;
            shadow2.StrokeThickness = 3;

            LineGeometry s1Geometry = new LineGeometry();
            LineGeometry s2Geometry = new LineGeometry();

            s1Geometry.StartPoint = new Point(235, 208);
            s1Geometry.EndPoint = new Point(231, 300);
            shadow1.Data = s1Geometry;
            shadow1.HorizontalAlignment = HorizontalAlignment.Left;
            shadow1.VerticalAlignment = VerticalAlignment.Center;
            if (hour > 3 && hour < 21)
            {
                shadow1.Visibility = Visibility.Visible;
                shadow2.Visibility = Visibility.Visible;
            }

            switch (hour)
            {

                case 4:
                    //shadow 1
                    shadow1.Margin = new Thickness { Left = 228.655, Top = 220, Right = 193.5, Bottom = 336 };

                    //shadow 2
                    s2Geometry.StartPoint = new Point(238, 324.00107);

                    s2Geometry.EndPoint = new Point(235, 387.00137);

                    shadow2.Data = s2Geometry;

                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;

                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;

                    shadow2.Height = 92.5;

                    shadow2.Width = 45.345;

                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 193.5, Bottom = 311.5 };

                    break;

                case 5:

                    //shadow 1

                    shadow1.Margin = new Thickness { Left = 228.655, Top = 238.25, Right = 162, Bottom = 336 };

                    //shadow 2

                    s2Geometry.StartPoint = new Point(238, 324.00107);

                    s2Geometry.EndPoint = new Point(235, 387.00137);

                    shadow2.Data = s2Geometry;

                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;

                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;

                    shadow2.Height = 82.25;

                    shadow2.Width = 80.832;

                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 162, Bottom = 303.5 };

                    break;

                case 6:

                    //shadow 1

                    shadow1.Margin = new Thickness { Left = 228.655, Top = 260, Right = 143, Bottom = 336 };

                    //shadow 2

                    s2Geometry.StartPoint = new Point(238, 324.00107);

                    s2Geometry.EndPoint = new Point(235, 387.00137);

                    shadow2.Data = s2Geometry;

                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;

                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;

                    shadow2.Height = 60.5;

                    shadow2.Width = 99.082;

                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 143.75, Bottom = 303.5 };

                    break;

                case 7:

                    //shadow 1

                    shadow1.Margin = new Thickness { Left = 228.655, Top = 286.5, Right = 138, Bottom = 336 };

                    //shadow 2

                    s2Geometry.StartPoint = new Point(238, 324.00107);

                    s2Geometry.EndPoint = new Point(235, 387.00137);

                    shadow2.Data = s2Geometry;

                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;

                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;

                    shadow2.Height = 34;

                    shadow2.Width = 104.832;

                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 138, Bottom = 303.5 };

                    break;

                case 8:

                    //shadow 1

                    shadow1.Margin = new Thickness { Left = 228.655, Top = 286.5, Right = 145.25, Bottom = 311.5 };

                    s1Geometry.StartPoint = new Point(235, 208);

                    s1Geometry.EndPoint = new Point(261, 300);

                    shadow1.Data = s1Geometry;

                    //shadow 2

                    s2Geometry.StartPoint = new Point(238, 324.00107);

                    s2Geometry.EndPoint = new Point(235, 387.00137);

                    shadow2.Data = s2Geometry;

                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;

                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;

                    shadow2.Height = 7.4;

                    shadow2.Width = 97.932;

                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 146.4, Bottom = 305 };

                    break;

                case 9:

                    //shadow 1

                    shadow1.Margin = new Thickness { Left = 228.655, Top = 286.5, Right = 161, Bottom = 297 };

                    s1Geometry.StartPoint = new Point(235, 208);

                    s1Geometry.EndPoint = new Point(261, 300);

                    shadow1.Data = s1Geometry;

                    //228.655,286.5,161,297"

                    //shadow 2

                    s2Geometry.StartPoint = new Point(238, 324.00107);

                    s2Geometry.EndPoint = new Point(240, 387.00137);

                    shadow2.Data = s2Geometry;

                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;

                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;

                    shadow2.Height = 16.65;

                    shadow2.Width = 83.332;

                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 161, Bottom = 293.75 };

                    break;

                case 10:

                    //shadow 1

                    shadow1.Margin = new Thickness { Left = 228.655, Top = 286.5, Right = 179, Bottom = 280 };

                    s1Geometry.StartPoint = new Point(235, 208);

                    s1Geometry.EndPoint = new Point(261, 300);

                    shadow1.Data = s1Geometry;

                    //shadow 2  shadow2" Data="M238,324.00107 L240,387.00137"  Margin="0,0,179,280"  Width="65.332"  Height="30.4" >10

                    s2Geometry.StartPoint = new Point(238, 324.00107);

                    s2Geometry.EndPoint = new Point(240, 387.00137);

                    shadow2.Data = s2Geometry;

                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;

                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;

                    shadow2.Height = 30.4;

                    shadow2.Width = 65.332;

                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 179, Bottom = 280 };

                    break;

                case 11:

                    //shadow 1 shadow1" Data="M235,208 L251,300"  Margin="228.655,286.5,203.333,268.999"   />11

                    shadow1.Margin = new Thickness { Left = 228.655, Top = 286.5, Right = 203.333, Bottom = 268.999 };

                    s1Geometry.StartPoint = new Point(235, 208);

                    s1Geometry.EndPoint = new Point(261, 300);

                    shadow1.Data = s1Geometry;

                    //shadow 2  shadow2" Data="M238,324.00107 L240,387.00137"  Margin="0,0,203.333,268.999"  Width="40.999"  Height="41.401"  />  11

                    s2Geometry.StartPoint = new Point(238, 324.00107);

                    s2Geometry.EndPoint = new Point(240, 387.00137);

                    shadow2.Data = s2Geometry;

                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;

                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;

                    shadow2.Height = 41.401;

                    shadow2.Width = 40.999;

                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 203.333, Bottom = 268.999 };

                    break;

                case 12:
                    //shadow 1 shadow1" Data="M235,208 L251,300"  Margin="228.655,286.5,226.833,264"   /> 12
                    shadow1.Margin = new Thickness { Left = 228.655, Top = 286.5, Right = 226.833, Bottom = 264 };
                    s1Geometry.StartPoint = new Point(235, 208);
                    s1Geometry.EndPoint = new Point(261, 300);
                    shadow1.Data = s1Geometry;

                    //shadow 2  shadow2" Data="M238,324.00107 L240,387.00137"  Margin="0,0,226.833,264"  Width="17.499"  Height="46.4"  /> 12
                    s2Geometry.StartPoint = new Point(238, 324.00107);
                    s2Geometry.EndPoint = new Point(240, 387.00137);
                    shadow2.Data = s2Geometry;
                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow2.Height = 46.4;
                    shadow2.Width = 17.499;
                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 226.833, Bottom = 264 };
                    break;

                case 13:
                    //shadow 1 M235,208 L261,300" Data="M235,208 L251,300"  Margin="228.655,286.5,250.345,264"   />1
                    shadow1.Margin = new Thickness { Left = 228.655, Top = 286.5, Right = 250.345, Bottom = 260 };
                    s1Geometry.StartPoint = new Point(235, 208);
                    s1Geometry.EndPoint = new Point(251, 300);
                    shadow1.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow1.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow1.Data = s1Geometry;

                    s2Geometry.StartPoint = new Point(238, 324.00107);
                    s2Geometry.EndPoint = new Point(230, 387.00137);
                    shadow2.Data = s2Geometry;
                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow2.Height = 49.6;
                    shadow2.Width = 9.2;
                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 241, Bottom = 260 };
                    break;

                case 14:
                    //shadow 1shadow1" Data="M235,208 L231,300"  Margin="207.667,284.25,253.333,260"
                    shadow1.Margin = new Thickness { Left = 207.667, Top = 284.25, Right = 253.333, Bottom = 260 };
                    s1Geometry.StartPoint = new Point(235, 208);
                    s1Geometry.EndPoint = new Point(231, 300);
                    shadow1.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow1.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow1.Data = s1Geometry;
                    // shadow2" Data="M238,324.00107 L230,387.00137"  Margin="0,0,241.333,260"  Width="31"  Height="47.333"  /> 2
                    s2Geometry.StartPoint = new Point(238, 324.00107);
                    s2Geometry.EndPoint = new Point(230, 387.00137);
                    shadow2.Data = s2Geometry;
                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow2.Height = 47.333;
                    shadow2.Width = 31;
                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 241.333, Bottom = 260 };
                    break;

                case 15:
                    //shadow1" Data="M235,208 L231,300"  Margin="180,284.25,253.333,264"   /> 3
                    shadow1.Margin = new Thickness { Left = 180, Top = 284.25, Right = 253.333, Bottom = 264 };
                    s1Geometry.StartPoint = new Point(235, 208);
                    s1Geometry.EndPoint = new Point(231, 300);
                    shadow1.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow1.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow1.Data = s1Geometry;
                    // shadow2" Data="M238,324.00107 L230,387.00137"  Margin="0,0,241.333,264"  Width="58.667"  Height="43.333"  /> 3
                    s2Geometry.StartPoint = new Point(238, 324.00107);
                    s2Geometry.EndPoint = new Point(230, 387.00137);
                    shadow2.Data = s2Geometry;
                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow2.Height = 47.333;
                    shadow2.Width = 58.667;
                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 241.333, Bottom = 264 };
                    break;

                case 16:
                    //shadow1" Data="M235,208 L231,300"  Margin="154.333,284.25,253.333,275"   />4
                    shadow1.Margin = new Thickness { Left = 154.333, Top = 284.25, Right = 253.333, Bottom = 275 };
                    s1Geometry.StartPoint = new Point(235, 208);
                    s1Geometry.EndPoint = new Point(231, 300);
                    shadow1.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow1.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow1.Data = s1Geometry;
                    // shadow2" Data="M238,324.00107 L230,387.00137"  Margin="0,0,241.333,275"  Width="84.334"  Height="32.333"  />
                    s2Geometry.StartPoint = new Point(238, 324.00107);
                    s2Geometry.EndPoint = new Point(230, 387.00137);
                    shadow2.Data = s2Geometry;
                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow2.Height = 32.333;
                    shadow2.Width = 84.334;
                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 241.333, Bottom = 275 };
                    break;
                case 17:
                    //shadow1" Data="M235,208 L231,300"  Margin="129,284.25,253.333,293.75"   />5
                    shadow1.Margin = new Thickness { Left = 129, Top = 284.25, Right = 253.333, Bottom = 293.75 };
                    s1Geometry.StartPoint = new Point(235, 208);
                    s1Geometry.EndPoint = new Point(231, 300);
                    shadow1.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow1.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow1.Data = s1Geometry;
                    // shadow2" Data="M238,324.00107 L230,387.00137"  Margin="0,0,241.333,293.75"  Width="109.667"  Height="13.583"  />5
                    s2Geometry.StartPoint = new Point(238, 324.00107);
                    s2Geometry.EndPoint = new Point(230, 387.00137);
                    shadow2.Data = s2Geometry;
                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow2.Height = 13.583;
                    shadow2.Width = 109.667;
                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 241.333, Bottom = 293.75 };
                    break;
                case 18:
                    //shadow1" Data="M235,208 L231,300"  Margin="107,284.25,253.333,321"   /> 6
                    shadow1.Margin = new Thickness { Left = 107, Top = 284.25, Right = 253.333, Bottom = 321 };
                    s1Geometry.StartPoint = new Point(235, 208);
                    s1Geometry.EndPoint = new Point(231, 300);
                    shadow1.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow1.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow1.Data = s1Geometry;
                    //        shadow2" Data="M238,324.00107 L260,387.00137"  Margin="0,0,241.333,305.333"  Width="131.667"  Height="16"  />6
                    s2Geometry.StartPoint = new Point(238, 324.00107);
                    s2Geometry.EndPoint = new Point(260, 387.00137);
                    shadow2.Data = s2Geometry;
                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow2.Height = 16;
                    shadow2.Width = 131.667;
                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 241.333, Bottom = 305.333 };
                    break;

                case 19:
                    //shadow1" Data="M235,208 L261,300"  Margin="107,271.667,253.333,338.333"   /> 7
                    shadow1.Margin = new Thickness { Left = 107, Top = 271.667, Right = 253.333, Bottom = 338.333 };
                    s1Geometry.StartPoint = new Point(235, 208);
                    s1Geometry.EndPoint = new Point(261, 300);
                    shadow1.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow1.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow1.Data = s1Geometry;
                    //  Data="M238,324.00107 L260,387.00137"  Margin="0,0,241.333,305.333"  Width="131.667"  Height="47"  /> 7
                    s2Geometry.StartPoint = new Point(238, 324.00107);
                    s2Geometry.EndPoint = new Point(260, 387.00137);
                    shadow2.Data = s2Geometry;
                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow2.Height = 47;
                    shadow2.Width = 131.667;
                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 241.333, Bottom = 305.333 };
                    break;

                case 20:
                    //s shadow1" Data="M235,208 L261,300"  Margin="121.667,244.333,253.333,338.333"   /> 8
                    shadow1.Margin = new Thickness { Left = 121.667, Top = 244, Right = 253.333, Bottom = 338.333 };
                    s1Geometry.StartPoint = new Point(235, 208);
                    s1Geometry.EndPoint = new Point(261, 300);
                    shadow1.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow1.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow1.Data = s1Geometry;
                    // w2" Data="M238,324.00107 L260,387.00137"  Margin="0,0,241.333,305.333"  Width="116.667"  Height="74"  /> 8
                    s2Geometry.StartPoint = new Point(238, 324.00107);
                    s2Geometry.EndPoint = new Point(260, 387.00137);
                    shadow2.Data = s2Geometry;
                    shadow2.HorizontalAlignment = HorizontalAlignment.Right;
                    shadow2.VerticalAlignment = VerticalAlignment.Bottom;
                    shadow2.Height = 74;
                    shadow2.Width = 116.667;
                    shadow2.Margin = new Thickness { Left = 0, Top = 0, Right = 241.333, Bottom = 305.333 };
                    break;

            }
        }
コード例 #8
0
ファイル: Grid.cs プロジェクト: dolkensp/OTWB
        public override Path CreateGrid()
        {
            Path _outline = base.CreateGrid();
            _outline.Name = "RADIAL_GRID";
            if (Dim1 == null || Dim2 == null) return _outline;
            GeometryGroup gg = new GeometryGroup();
            Point origin = new Point(0, 0);
            double inc = (_dim1.Inc <= 0) ? 5 : _dim1.Inc;
            for (double r = _dim1.Start; r <= _dim1.End; r += inc)
            {
                EllipseGeometry eg = new EllipseGeometry();
                eg.Center = origin;
                eg.RadiusX = eg.RadiusY = r;
                gg.Children.Add(eg);
            }

            inc = (_dim2.Inc <= 0) ? 5 : _dim2.Inc;

            for (double a = _dim2.Start; a <= _dim2.End; a += _dim2.Inc)
            {
                double aa = a * Math.PI / 180;
                double xs = _dim1.Start * Math.Cos(aa);
                double ys = _dim1.Start * Math.Sin(aa);
                Point start = new Point(xs, ys);
                double xe = _dim1.End * Math.Cos(aa);
                double ye = _dim1.End * Math.Sin(aa);
                Point end = new Point(xe, ye);
                LineGeometry lg = new LineGeometry();
                lg.StartPoint = start;
                lg.EndPoint = end;
                gg.Children.Add(lg);
            }
            _outline.Data = gg;
            return _outline;
        }
コード例 #9
0
 private Path getPiece(int player)
 {
     if ((player == 1)) // Draw X
     {
         Path lines = new Path();
         LineGeometry line1 = new LineGeometry();
         LineGeometry line2 = new LineGeometry();
         GeometryGroup linegroup = new GeometryGroup();
         line1.StartPoint = new Point(0, 0);
         line1.EndPoint = new Point(30, 30);
         line2.StartPoint = new Point(30, 0);
         line2.EndPoint = new Point(0, 30);
         linegroup.Children.Add(line1);
         linegroup.Children.Add(line2);
         lines.Data = linegroup;
         lines.Stroke = new SolidColorBrush(Colors.Red);
         lines.StrokeThickness = 2;
         lines.Margin = new Thickness(4);
         return lines;
     }
     else // Draw O
     {
         EllipseGeometry ellipse = new EllipseGeometry();
         Path circle = new Path();
         ellipse.Center = new Point(15, 15);
         ellipse.RadiusX = 15;
         ellipse.RadiusY = 15;
         circle.Data = ellipse;
         circle.Stroke = new SolidColorBrush(Colors.Blue);
         circle.StrokeThickness = 2;
         circle.Margin = new Thickness(4);
         return circle;
     }
 }
コード例 #10
0
ファイル: Utterance.cs プロジェクト: david-wb/Transcriber
        public async Task<bool> DrawWaveform(Canvas canvas)
        {
            if (this.WaveFile == null)
            {
                this.WaveFile = await WaveFile.Create(AudioFile);
            }

            double W = canvas.ActualWidth;
            double H = canvas.ActualHeight;

            double y_c = H / 2.0;

            canvas.Children.Clear();
            double dseconds = (1.0 / 16000.0);
            double dpixels = PixelsPerSecond * dseconds;
            canvas.Width = this.WaveFile.SmoothedSamples.Count * dpixels;


            Path path = new Path();
            path.Stroke = new SolidColorBrush(Windows.UI.Colors.DeepSkyBlue);
            path.StrokeThickness = 2.0;
            GeometryGroup geomGroup = new GeometryGroup();

            for (int i = 0; i < Samples.Count; ++i)
            {
                double f = Samples[i];

                Point a = new Point((i * dpixels) + 0.5, y_c - f * y_c);
                Point b = new Point((i * dpixels) + 0.5, y_c + f * y_c);

                LineGeometry line = new LineGeometry();
                line.StartPoint = a;
                line.EndPoint = b;
                geomGroup.Children.Add(line);
            }

            path.Data = geomGroup;
            canvas.Children.Add(path);

            return true;
        }
コード例 #11
0
ファイル: LineGraph.cs プロジェクト: jayharry28/Audiotica
        private void DrawYLines()
        {
            RemoveGuidlines(GuideLines.Y);

            var height = ActualHeight;
            var loops = (int) height/YGuideLineResolution; // amount of Y info

            for (var i = 1; i < loops; i++)
            {
                // text
                var length = _seriesMaxY - _seriesMinY;
                var interval = length/(loops - 1);
                //

                var tb = new TextBlock
                {
                    Text = Math.Round(_seriesMinY + (i*interval), 1).ToString(),
                    Foreground = GuideTextColor,
                    FontSize = GuideTextSize,
                    Margin = new Thickness(5, _drawAreaBottom - (i*(ActualHeight/6)) - 5, 0, 0)
                };

                var p = new Path();
                var geo = new LineGeometry
                {
                    StartPoint = new Point(25, _drawAreaBottom - (i*(ActualHeight/6))),
                    EndPoint = new Point(ActualWidth - 25, _drawAreaBottom - (i*(ActualHeight/6)))
                };
                p.Stroke = GuideLineColor;
                p.StrokeDashArray = new DoubleCollection {5, 20};
                p.StrokeThickness = GuideLineThickness;
                p.Data = geo;

                if (ShowText)
                    _yDataMarkers.Add(tb);
                _yGuideLines = p;

                if (ShowText)
                    SetZIndex(tb, 15);
                SetZIndex(p, 14);

                if (ShowText)
                    Children.Add(tb);
                Children.Add(p);
            }
        }
コード例 #12
0
ファイル: LineGraph.cs プロジェクト: jayharry28/Audiotica
        private void DrawXLines()
        {
            RemoveGuidlines(GuideLines.X);

            var width = ActualWidth; // just in case it changes?
            var height = ActualHeight;

            var loops = (int) width/XGuideLineResolution; // amount of x info

            /*
            if ((width / this.data.Count) > this.xResolution) // if there are less data points than the resolution, show the absolute data points
            {
                loops = this.data.Count;
            }
            */

            for (var i = 1; i < loops; i++)
            {
                var x = width/(loops - 1)*i;

                // text
                var length = _seriesMaxX - _seriesMinX;
                var interval = length/(loops - 1);
                //

                var tb = new TextBlock
                {
                    Text = Math.Round(_seriesMinX + (i*interval), 1).ToString(),
                    Foreground = GuideTextColor,
                    FontSize = GuideTextSize
                };

                tb.Margin = new Thickness(x - (tb.Text.Length/2*6), height - 20, 0, 20);

                var p = new Path();
                var geo = new LineGeometry {StartPoint = new Point(x, 20), EndPoint = new Point(x, ActualHeight - 20)};
                p.Stroke = GuideLineColor;
                p.StrokeDashArray = new DoubleCollection {5, 20};
                p.StrokeThickness = GuideLineThickness;
                p.Data = geo;

                if (ShowText)
                    _xDataMarkers.Add(tb);
                _xGuideLines = p;

                if (ShowText)
                    SetZIndex(tb, 15);
                SetZIndex(p, 14);

                if (ShowText)
                    Children.Add(tb);
                Children.Add(p);
            }
        }
コード例 #13
0
        public static Windows.UI.Xaml.Shapes.Path GetGeometry(double width, double widthPoint1, double widthPoint2, double widthPoint3, double heightPoint1, double heightPoint2, SolidColorBrush color)
        {
            Windows.UI.Xaml.Shapes.Path myPath = new Windows.UI.Xaml.Shapes.Path();
            myPath.Stroke = color;
            myPath.StrokeThickness = 15;
           

            LineGeometry myLineGeometry = new LineGeometry();
            myLineGeometry.StartPoint = new Point(widthPoint1, heightPoint2);
            myLineGeometry.EndPoint = new Point(widthPoint1, heightPoint1);


            ArcSegment arc2 = new ArcSegment();
            arc2.Point = new Point(widthPoint2, heightPoint1);
            arc2.RotationAngle = 180;
            arc2.SweepDirection = SweepDirection.Clockwise;
            arc2.Size = new Size((double)(width / 6), heightPoint1);



            LineGeometry line3 = new LineGeometry();
            line3.StartPoint = new Point(widthPoint2, heightPoint1);
            line3.EndPoint = new Point(widthPoint2, heightPoint2);



            ArcSegment arc4 = new ArcSegment();
            arc4.Point = new Point(widthPoint3, heightPoint2);
            arc4.RotationAngle = 180;
            

            arc4.SweepDirection = SweepDirection.Clockwise;
            arc4.Size = new Size(width / 12, heightPoint1 / 2);

            LineGeometry line5 = new LineGeometry();
            line5.StartPoint = new Point(widthPoint3, heightPoint2);
            line5.EndPoint = new Point(widthPoint3, heightPoint1);

            

            PathFigure pathfigureforarc2 = new PathFigure();

            pathfigureforarc2.StartPoint = new Point(widthPoint1, heightPoint1);
            pathfigureforarc2.Segments.Add(arc2);
            pathfigureforarc2.IsFilled = false;

            PathFigure pathfigureforarc4 = new PathFigure();
            pathfigureforarc4.StartPoint = new Point(widthPoint2, heightPoint2);
            pathfigureforarc4.Segments.Add(arc4);
            pathfigureforarc4.IsFilled = false;

            PathGeometry pathgeoforarc2 = new PathGeometry();

            pathgeoforarc2.Figures.Add(pathfigureforarc2);


            PathGeometry pathgeoforarc4 = new PathGeometry();
            pathgeoforarc4.Figures.Add(pathfigureforarc4);


            GeometryGroup myGeometryGroup = new GeometryGroup();
            myGeometryGroup.Children.Add(myLineGeometry);
            myGeometryGroup.Children.Add(pathgeoforarc2);
            myGeometryGroup.Children.Add(line3);
            myGeometryGroup.Children.Add(pathgeoforarc4);
            myGeometryGroup.Children.Add(line5);            

            myPath.Data = myGeometryGroup;
            return myPath;
        }
コード例 #14
0
ファイル: chartPlotter.cs プロジェクト: m3talelite/WiFiVision
        private void drawLine(Point point1, Point point2, int lineThickness, Color strokeColor)
        {
            LineGeometry line = new LineGeometry();
            Path linePath = new Path();
            line.StartPoint = point1;
            line.EndPoint = point2;
            linePath.Data = line;
            linePath.Stroke = new SolidColorBrush(strokeColor);
            linePath.StrokeThickness = lineThickness;

            activeCanvas.Children.Add(linePath);
        }
コード例 #15
0
ファイル: GeometryHelper.cs プロジェクト: unoplatform/uno
 public static void Write(this StreamGeometryContext ctx, LineGeometry lineGeometry)
 {
     ctx.BeginFigure(lineGeometry.StartPoint, false);
     ctx.LineTo(lineGeometry.EndPoint, true, false);
     ctx.SetClosedState(true);
 }