Ejemplo n.º 1
0
        public void createUsersDetails(MKMapView map)
        {
            // Create Driver's Detail
            UIView userDetails = new UIView();

            userDetails.BackgroundColor        = null;
            userDetails.UserInteractionEnabled = true;
            userDetails.Frame = new CGRect(map.Frame.Width / 2 - 90, map.Frame.Height / 2 + 200, map.Frame.Width / 2 - 10, map.Frame.Height / 4 - 75);
            map.AddSubview(userDetails);
            UIImage     driverImage = new UIImage("Car.png");
            UIImageView imageView   = new UIImageView(driverImage);

            imageView.Frame = new CGRect(userDetails.Frame.Width / 4 + 15, 10, 75, 75);
            imageView.Layer.MasksToBounds = true;
            imageView.Layer.CornerRadius  = 20;
            userDetails.Add(imageView);
            UILabel driverLabel = new UILabel();

            driverLabel.Frame         = new CGRect(userDetails.Frame.Width / 4, 20, userDetails.Frame.Height, userDetails.Frame.Width);
            driverLabel.LineBreakMode = UILineBreakMode.WordWrap;
            driverLabel.Lines         = 0;
            driverLabel.Font          = UIFont.BoldSystemFontOfSize(16);
            driverLabel.Text          = "Name: UberX  Price: 50$";
            userDetails.Add(driverLabel);
        }
Ejemplo n.º 2
0
        public override void ViewDidLoad()
        {
            showUserMap();
            showSearchBar();
            annotationMode = true;
            //var realm = Realm.GetInstance();
            map.AddSubview(modeButton);
            map.AddSubview(validateLocationButton);
            map.AddSubview(sendEmailButton);
            sendEmailButton.Enabled = false;

            sendEmailButton.SetTitle("Inform", UIControlState.Normal);
            validateLocationButton.SetTitle("Check", UIControlState.Normal);

            modeButton.AddTarget(modeButtonEventHandler, UIControlEvent.TouchUpInside);
            validateLocationButton.AddTarget(validateLocationButtonEventHandler, UIControlEvent.TouchUpInside);
            sendEmailButton.AddTarget(sendEmailButtonEventHandler, UIControlEvent.TouchUpInside);
            usersTosend.Add("*****@*****.**");
            usersTosend.Add("*****@*****.**");
            usersTosend.Add("*****@*****.**");
        }
Ejemplo n.º 3
0
        private void AddCompassButton(MKMapView nativeMap, int topAnchor)
        {
            MKCompassButton compass = MKCompassButton.FromMapView(nativeMap);

            compass.CompassVisibility = MKFeatureVisibility.Visible;
            compass.Frame             = new CGRect(new CGPoint(45, 45), compass.Frame.Size);
            compass.TranslatesAutoresizingMaskIntoConstraints = false;

            nativeMap.AddSubview(compass);

            compass.TopAnchor.ConstraintEqualTo(nativeMap.TopAnchor, topAnchor).Active = true;
            compass.RightAnchor.ConstraintEqualTo(nativeMap.RightAnchor, -14).Active   = true;
        }
Ejemplo n.º 4
0
        private void AddTrackingButton(MKMapView nativeMap)
        {
            MKUserTrackingButton button = MKUserTrackingButton.FromMapView(nativeMap);

            button.Layer.BackgroundColor = UIColor.White.ColorWithAlpha(0.9F).CGColor;
            button.Layer.BorderColor     = UIColor.White.ColorWithAlpha(0.9F).CGColor;
            button.Layer.ShadowColor     = UIColor.Black.CGColor;
            button.Layer.ShadowOpacity   = 0.3F;
            button.Layer.ShadowRadius    = 4;
            button.Layer.BorderWidth     = 1;
            button.Layer.CornerRadius    = 4;
            button.Layer.MasksToBounds   = false;
            button.TranslatesAutoresizingMaskIntoConstraints = false;

            nativeMap.AddSubview(button);
            button.TopAnchor.ConstraintEqualTo(nativeMap.TopAnchor, 58).Active      = true;
            button.RightAnchor.ConstraintEqualTo(nativeMap.RightAnchor, -12).Active = true;
        }
Ejemplo n.º 5
0
        protected override void CreateHeatMapIfNeeded()
        {
            if (_heatMapLayer == null)
            {
                _heatMapLayer = new HeatMapLayer(FormsMap)
                {
                    ParentMap = _nativeMap,
                    Radius    = FormsMap.Radius,
                    Intensity = FormsMap.Intensity,
                    Locations = FormsMap.Locations?.Select(CoordinateConverter.ConvertToNative)
                };

                FormsMap.PropertyChanged -= FormsMapPropertyChanged;
                FormsMap.PropertyChanged += FormsMapPropertyChanged;

                _heatMapLayer.Frame = new CoreGraphics.CGRect(0, 0, _nativeMap.Frame.Width, _nativeMap.Frame.Height);
                _nativeMap.AddSubview(_heatMapLayer);
            }
        }
Ejemplo n.º 6
0
        private void Initialize()
        {
            _MapView                   = new MKMapView();
            _MapView.Frame             = new RectangleF(0, 0, Frame.Width, Frame.Height);
            _MapView.ShowsUserLocation = true;
            _MapView.Delegate          = new MapViewDelegate(this);

            _RouteView       = new UIImageView();
            _RouteView.Frame = new RectangleF(0, 0, _MapView.Frame.Width, _MapView.Frame.Height);
            _RouteView.UserInteractionEnabled = false;

            this.LineColor = UIColor.FromWhiteAlpha(0.2f, 0.5f);

            _Routes = new CLLocation[] { };

            CalculateRoutesAction = CalculateRoutes;

            _Client = new RestClient(@"http://maps.googleapis.com/maps/api/directions/");
            _Client.AddDefaultUrlSegment("sensor", "false");

            _MapView.AddSubview(_RouteView);
            this.AddSubview(_MapView);
        }
Ejemplo n.º 7
0
        private void Initialize()
        {
            _MapView = new MKMapView();
            _MapView.Frame = new RectangleF(0, 0, Frame.Width, Frame.Height);
            _MapView.ShowsUserLocation = true;
            _MapView.Delegate = new MapViewDelegate(this);

            _RouteView = new UIImageView();
            _RouteView.Frame = new RectangleF(0, 0, _MapView.Frame.Width, _MapView.Frame.Height);
            _RouteView.UserInteractionEnabled = false;

            this.LineColor = UIColor.FromWhiteAlpha(0.2f, 0.5f);

            _Routes = new CLLocation[] { };

            CalculateRoutesAction = CalculateRoutes;

            _Client = new RestClient(@"http://maps.googleapis.com/maps/api/directions/");
            _Client.AddDefaultUrlSegment("sensor", "false");

            _MapView.AddSubview(_RouteView);
            this.AddSubview(_MapView);
        }
Ejemplo n.º 8
0
        private void AddToolbar(MKMapView nativeMap)
        {
            // Map Tracking button
            MKUserTrackingBarButtonItem trackingButton = new MKUserTrackingBarButtonItem(nativeMap);

            trackingButton.CustomView.Frame     = new CGRect(x: trackingButton.CustomView.Frame.X, y: trackingButton.CustomView.Frame.Y, width: 44, height: 44);
            trackingButton.CustomView.Transform = CGAffineTransform.MakeRotation((nfloat)(-270.0 / 180 * Math.PI));

            // Add Feature Button
            UIButton addFeatureButton = new UIButton(UIButtonType.ContactAdd)
            {
                Frame     = new CGRect(x: trackingButton.CustomView.Frame.X, y: trackingButton.CustomView.Frame.Y, width: 44, height: 44),
                Transform = CGAffineTransform.MakeRotation((nfloat)(-270.0 / 180 * Math.PI))
            };

            addFeatureButton.TouchUpInside += (sender, e) =>
            {
                NavigationService navigationService = (NavigationService)DependencyService.Get <INavigationService <Feature> >();
                _ = navigationService.PushAddFeaturePage();
            };
            UIBarButtonItem addFeatureButtonItem = new UIBarButtonItem(addFeatureButton);

            // Flexible Seperator
            UIBarButtonItem flex = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, target: this, action: null);

            // Toolbar Items Aray
            UIBarButtonItem[] ButtonsArray = new UIBarButtonItem[] { flex, trackingButton, flex, addFeatureButtonItem, flex };

            // Toolbar and frame
            CGRect    toolBarFrame = new CGRect(location: new CGPoint(x: 0, y: 0), size: new CGSize(width: 88, height: 44));
            UIToolbar toolbar      = new UIToolbar(frame: toolBarFrame)
            {
                BarTintColor = UIColor.SystemBackgroundColor,
                Translucent  = true
            };

            toolbar.SetItems(ButtonsArray, true);

            // Set toolbar position
            CGPoint origin = new CGPoint(x: UIScreen.MainScreen.Bounds.Width - 75, y: 75);

            // Create base view for button
            UIView baseView = new UIView(frame: new CGRect(location: origin, size: new CGSize(width: 88, height: 44)))
            {
                BackgroundColor = UIColor.Clear
            };

            // Shadow effects
            baseView.Layer.ShadowColor   = UIColor.Black.CGColor;
            baseView.Layer.ShadowOpacity = 0.3f;
            baseView.Layer.ShadowOffset  = new CGSize(width: 0, height: 0);
            baseView.Layer.ShadowRadius  = 4.0f;

            // Rounded border view for button
            UIView borderview = new UIView
            {
                Frame = baseView.Bounds
            };

            borderview.Layer.CornerRadius  = 10;
            borderview.Layer.MasksToBounds = true;
            baseView.Transform             = CGAffineTransform.MakeRotation((nfloat)(270.0 / 180 * Math.PI));

            // Stack subviews
            borderview.AddSubview(toolbar);
            baseView.AddSubview(borderview);
            nativeMap.AddSubview(baseView);
        }