Beispiel #1
0
 void _watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
 {
     MRGCSearch.GPSToOffset(new double[] { e.Position.Location.Longitude }, new double[] { e.Position.Location.Latitude }, (o) =>
     {
         if (o.Erro == null)
         {
             if (centerMarker == null)
             {
                 map.Children.Add(centerMarker = new MMarker()
                 {
                     LngLat  = o.RGCItemList[0],
                     IconURL = "/location_on.png",
                     Anchor  = new Point(0.5, 0.5)
                 });
                 map.Children.Add(centerCircle = new MCircle()
                 {
                 });
                 centerCircle.SetCenterAndRadius(o.RGCItemList[0], 500);
             }
             else
             {
                 centerMarker.LngLat = o.RGCItemList[0];
                 centerCircle.SetCenterAndRadius(o.RGCItemList[0], 500);
             }
             map.Center = o.RGCItemList[0];
         }
     });
 }
Beispiel #2
0
 public Pinhole(TransitionType type, float speed, float acceleration) : base(type, speed, acceleration)
 {
     pinhole = new MCircle(0, 0, 1)
     {
         Color = Color.Black
     };
 }
Beispiel #3
0
        public Boolean Update()
        {
            if (_ranges.Count < 3)
            {
                return(false);
            }

            MPoint p = MCircle.IntersectThree(_ranges[0], _ranges[1], _ranges[2]);

            Console.WriteLine($@"{_beacon.UUID} : {p}");
            Location = (Point)p;
            return(true);
        }
Beispiel #4
0
        private void CircleButton_Click(object sender, RoutedEventArgs e)
        {
            MCircle           mp;
            MLngLatCollection xys = new MLngLatCollection();

            xys.Add(map.Center);

            xys.Add(new MLngLat(map.Center.LngX + 0.0151, map.Center.LatY - 0.0131));
            map.Children.Add(mp = new MCircle()
            {
                LngLats       = xys,
                LineColor     = Colors.Green,
                LineThickness = 4
            });
        }
Beispiel #5
0
 // 针对预制件的初始化
 public MObject(GameObject template, MPrefabType type)
 {
     this.template = template;
     gameObject = GameObject.Instantiate(template);
     switch (type)
     {
         case MPrefabType.CUBE:
             mesh = MCube.GetMMesh();
             break;
         case MPrefabType.SPHERE:
             mesh = MSphere.GetMMesh();
             break;
         case MPrefabType.CYLINDER:
             mesh = MCylinder.GetMMesh();
             break;
         case MPrefabType.CONE:
             mesh = MCone.GetMMesh();
             break;
         case MPrefabType.PRISM:
             mesh = MPrism.GetMMesh();
             break;
         case MPrefabType.PYRAMID:
             mesh = MPyramid.GetMMesh();
             break;
         case MPrefabType.REGULAR_TRIANGLE:
             mesh = MRegularTriangle.GetMMesh();
             break;
         case MPrefabType.CIRCLE:
             mesh = MCircle.GetMMesh();
             break;
         default:
             Debug.Log("Unknown prefab type: " + type);
             return;
     }
     InitObject();
 }
Beispiel #6
0
        private async void UpdateCircle(MCircle circle)
        {
            ShapeOptionsCircle.Visibility      = Visibility.Visible;
            ShapeOptionsCircleLabel.Visibility = Visibility.Visible;

            double x, y;
            float  r;

            try
            {
                x = double.Parse(CircleCenterXEdit.Text);
                y = double.Parse(CircleCenterYEdit.Text);
                r = float.Parse(CircleRadiusEdit.Text);
            }
            catch (Exception)
            {
                await InvalidValuesFormatDialog();

                return;
            }

            circle.Center = new Point(x, y);
            circle.Radius = r;
        }
Beispiel #7
0
 public void AddScanData(MCircle c)
 {
     _ranges.Add(c);
 }
Beispiel #8
0
        private void PointerPressedDraw(bool rightButtonPressed, Point startPosition)
        {
            if (CurrentShapeType == ShapeType.Polygon || CurrentShapeType == ShapeType.Bezier)
            {
                DrawClickTool.IsChecked = true;
                SelectedTool            = Tools.DrawClick;
            }

            if (SelectedTool == Tools.DrawClick)
            {
                if (CurrentShapeType == ShapeType.Polygon || CurrentShapeType == ShapeType.Bezier)
                {
                    if (ClickedTimes++ >= 1)
                    {
                        if (rightButtonPressed)
                        {
                            if (ClickedTimes >= 4)
                            {
                                ClickedTimes = 0;

                                var poly = PendingShape as MPolygon;
                                if (CurrentShapeType == ShapeType.Polygon)
                                {
                                    poly.AddSegment(poly.StartLocation);
                                }
                                poly.StartLocation = new Point(0, 0);
                                poly.EndLocation   = new Point(0, 0);
                                poly.Closed        = true;

                                AddShape();

                                return;
                            }
                            else
                            {
                                --ClickedTimes;
                            }
                        }
                        else
                        {
                            if (CurrentShapeType == ShapeType.Polygon || CurrentShapeType == ShapeType.Bezier)
                            {
                                (PendingShape as MPolygon).AddSegment(startPosition);
                            }
                        }
                        this.canvasControl.Invalidate();

                        return;
                    }
                }
                else
                {
                    if (ClickedTimes == 0)
                    {
                        ClickedTimes = 1;
                    }
                    else
                    {
                        ClickedTimes = 0;

                        AddShape();

                        return;
                    }
                }
            }

            if (CurrentShapeType == ShapeType.Rectangle)
            {
                PendingShape = new MRectangle(startPosition, startPosition);
            }
            else if (CurrentShapeType == ShapeType.Circle)
            {
                PendingShape = new MCircle(startPosition, startPosition);
            }
            else if (CurrentShapeType == ShapeType.Line)
            {
                PendingShape = new MLine(startPosition, startPosition);
            }
            else if (CurrentShapeType == ShapeType.Polygon)
            {
                PendingShape = new MPolygon(startPosition, startPosition);
            }
            else if (CurrentShapeType == ShapeType.Bezier)
            {
                PendingShape = new MBezier(startPosition, startPosition);
            }

            PendingShape.Mode = ShapeModes.Drawing;

            this.canvasControl.Invalidate();
        }