コード例 #1
0
        private void CircleDemo(HuaweiMap hMap)
        {
            hMap.Clear();

            Circle        circle1;
            LatLng        circle1LatLng  = new LatLng(41.01019, 28.974475);
            CircleOptions circle1Options = new CircleOptions();

            circle1Options.InvokeCenter(circle1LatLng);
            circle1Options.InvokeRadius(1600);
            circle1Options.InvokeStrokeWidth(5);
            circle1Options.InvokeStrokeColor(Color.Blue);
            circle1Options.InvokeFillColor(Color.Argb(60, 0, 0, 255));
            circle1Options.Clickable(true);
            circle1Options.InvokeZIndex(2);
            circle1 = hMap.AddCircle(circle1Options);

            Circle        circle2;
            LatLng        circle2LatLng  = new LatLng(41.01563, 29.052667);
            CircleOptions circle2Options = new CircleOptions();

            circle2Options.InvokeCenter(circle2LatLng);
            circle2Options.InvokeRadius(5000);
            circle2Options.InvokeStrokeWidth(10);
            circle2Options.InvokeStrokeColor(Color.OrangeRed);
            circle2Options.InvokeFillColor(Color.Argb(60, 255, 200, 0));
            circle2Options.Clickable(true);
            circle2Options.InvokeZIndex(1);
            circle2 = hMap.AddCircle(circle2Options);
        }
コード例 #2
0
        private void DrawBlueDot()
        {
            CircleOptions circleOptions = new CircleOptions();

            circleOptions.InvokeCenter(new LatLng(currentLocation.Latitude, currentLocation.Longitude));
            circleOptions.InvokeRadius(5);
            circleOptions.InvokeFillColor(Color.CadetBlue);
            circleOptions.InvokeStrokeColor(Color.White);
            circleOptions.InvokeStrokeWidth(2);
            circleOptions.InvokeZIndex(1);

            blueDot = _map.AddCircle(circleOptions);
        }
コード例 #3
0
        /// <summary>
        /// When the user stops.
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">User's position</param>
        private void Model_UserStopped(object sender, PositionArgs e)
        {
            var circleOptions = new CircleOptions();

            circleOptions.InvokeCenter(new LatLng(e.LocationData.Latitude, e.LocationData.Longitude));
            circleOptions.InvokeRadius(14);
            circleOptions.InvokeFillColor(Color.Rgb(213, 52, 58));
            circleOptions.InvokeStrokeColor(Color.Black);
            circleOptions.InvokeStrokeWidth(1);
            circleOptions.InvokeZIndex(10);

            RunOnUiThread(() =>
            {
                _map.AddCircle(circleOptions);
                _speedTextView.Text = "0";
            });
        }
コード例 #4
0
        protected override NativeCircle CreateNativeItem(Circle outerItem)
        {
            var opts = new CircleOptions();

            opts.InvokeCenter(new LatLng(outerItem.Center.Latitude, outerItem.Center.Longitude));
            opts.InvokeRadius(outerItem.Radius.Meters);
            opts.InvokeStrokeWidth(outerItem.StrokeWidth * this.ScaledDensity); // TODO: convert from px to pt. Is this collect? (looks like same iOS Maps)
            opts.InvokeStrokeColor(outerItem.StrokeColor.ToAndroid());
            opts.InvokeFillColor(outerItem.FillColor.ToAndroid());
            opts.Clickable(outerItem.IsClickable);
            opts.InvokeZIndex(outerItem.ZIndex);

            var nativeCircle = NativeMap.AddCircle(opts);

            // associate pin with marker for later lookup in event handlers
            outerItem.NativeObject = nativeCircle;
            return(nativeCircle);
        }
コード例 #5
0
        /// <summary>
        /// Delete the previous user circle and draw the new one
        /// </summary>
        /// <param name="position">User's new position</param>
        private void DrawUser(LatLng position)
        {
            var circleOptions = new CircleOptions();

            circleOptions.InvokeCenter(position);
            circleOptions.InvokeRadius(9);
            circleOptions.InvokeFillColor(Color.Rgb(69, 140, 228));
            circleOptions.InvokeStrokeColor(Color.White);
            circleOptions.InvokeStrokeWidth(2);
            circleOptions.InvokeZIndex(11);

            RunOnUiThread(() =>
            {
                var newUserPosition = _map.AddCircle(circleOptions);
                _userPosition?.Remove();
                _userPosition = newUserPosition;
            });
        }
コード例 #6
0
        private void drawCircle()
        {
            Circle        circle;
            LatLng        circleLatLng  = new LatLng(40.985996056, 29.035333192);
            CircleOptions circleOptions = new CircleOptions();

            circle = hMap.AddCircle(circleOptions);
            circleOptions.InvokeCenter(circleLatLng);
            circleOptions.InvokeRadius(1800);
            circleOptions.InvokeStrokeWidth(5);
            circleOptions.InvokeStrokeColor(Color.Blue);
            circleOptions.InvokeStrokeWidth(30);
            circleOptions.Clickable(true);
            circleOptions.InvokeZIndex(2);
            circle = hMap.AddCircle(circleOptions);
            circleOptions.Clickable(true);
            hMap.CircleClick += OnCircleClick;
        }
コード例 #7
0
        public MapOverlay(Cell cell)
        {
            CellID = cell.ID;

            // Set cell overlay options
            cellPolygonOptions = new PolygonOptions();
            cellPolygonOptions.Add(new LatLng((double)cell.Latitude, (double)cell.Longitude)); //first rectangle point
            cellPolygonOptions.Add(new LatLng((double)cell.Latitude, (double)cell.Longitude + (double)GameModel.FrontierInterval));
            cellPolygonOptions.Add(new LatLng((double)cell.Latitude + (double)GameModel.FrontierInterval, (double)cell.Longitude + (double)GameModel.FrontierInterval));
            cellPolygonOptions.Add(new LatLng((double)cell.Latitude + (double)GameModel.FrontierInterval, (double)cell.Longitude)); //automatically connects last two points
            cellPolygonOptions.InvokeZIndex(100);

            // Set mine overlay options
            LatLng circleCenter = new LatLng((double)cell.Latitude + ((double)GameModel.FrontierInterval / 2), (double)cell.Longitude + ((double)GameModel.FrontierInterval / 2));

            mineCircleOptions = new CircleOptions();
            mineCircleOptions.InvokeCenter(circleCenter);
            mineCircleOptions.InvokeRadius(3);
            mineCircleOptions.InvokeStrokeWidth(6);
            mineCircleOptions.InvokeStrokeColor(Color.White);
            mineCircleOptions.InvokeZIndex(200);

            // Set antimine overlay options
            antiMineTriangleOptions = new PolygonOptions();
            antiMineTriangleOptions.Add(new LatLng(((double)cell.Latitude + ((double)GameModel.FrontierInterval) * .75), ((double)cell.Longitude + (double)GameModel.FrontierInterval / 2)));
            antiMineTriangleOptions.Add(new LatLng(((double)cell.Latitude + ((double)GameModel.FrontierInterval) * .25), ((double)cell.Longitude + (double)GameModel.FrontierInterval * .25)));
            antiMineTriangleOptions.Add(new LatLng(((double)cell.Latitude + ((double)GameModel.FrontierInterval) * .25), ((double)cell.Longitude + (double)GameModel.FrontierInterval * .75)));
            antiMineTriangleOptions.InvokeStrokeWidth(6);
            antiMineTriangleOptions.InvokeStrokeColor(Color.White);
            antiMineTriangleOptions.InvokeZIndex(200);

            UpdateColor(cell.HoldStrength, cell.TeamID);
            cellPolygonOptions.InvokeStrokeWidth(0);

            if (cell.TeamID == GameModel.Player.Team.ID)
            {
                MapOverlayClickHandler = new FriendlyOverlayClickHandler();
            }
            else
            {
                MapOverlayClickHandler = new EnemyOverlayClickHandler();
            }
        }