Esempio n. 1
0
        private void CreateRoute(object sender, EventArgs e)
        {
            StopRoute();

            NCDeviceInfo  res               = navigineCore.DeviceInfo;
            NCSublocation sublocation       = navigineCore.Location.Sublocations.GetItem <NCSublocation>(currentSublocationIndex);
            CGSize        imageSizeInMeters = new CGSize(sublocation.Width, sublocation.Height);
            double        xPoint            = pressedRoutePin.CenterX() / (mapView.Width() / scrollView.ZoomScale) * imageSizeInMeters.Width;
            double        yPoint            = (1.0f - pressedRoutePin.CenterY() / (mapView.Height() / scrollView.ZoomScale)) * imageSizeInMeters.Height;

            NCLocationPoint point = NCLocationPoint.PointWithLocation(res.Location, res.Sublocation, xPoint, yPoint);

            activeRoutePin = new RouteMapPin();
            activeRoutePin.SetImage(UIImage.FromBundle("MapUser"), UIControlState.Normal);
            activeRoutePin.SetImage(UIImage.FromBundle("MapUser"), UIControlState.Highlighted);
            activeRoutePin.SizeToFit();
            mapView.AddSubview(activeRoutePin);
            scrollView.BringSubviewToFront(activeRoutePin);
            activeRoutePin.Center = pressedRoutePin.Center;

            if (pressedRoutePin != null)
            {
                pressedRoutePin.PopUp.RemoveFromSuperview();
                pressedRoutePin.RemoveFromSuperview();
            }

            navigineCore.AddTatget(point);

            isRouting = true;
            cancelRouteButton.Hidden = false;
        }
Esempio n. 2
0
        private void LongPress(UILongPressGestureRecognizer gesture)
        {
            if (deviceInfo == null ||
                !deviceInfo.IsValid() ||
                deviceInfo.Location != location.Id ||
                deviceInfo.Sublocation != currentSublocation.Id)
            {
                return;
            }

            if (pressedRoutePin != null)
            {
                pressedRoutePin.PopUp.RemoveFromSuperview();
                pressedRoutePin.RemoveFromSuperview();
            }

            nfloat xPoint = gesture.LocationInView(mapView).X;
            nfloat yPoint = gesture.LocationInView(mapView).Y;

            CGPoint point = new CGPoint(xPoint, yPoint);

            pressedRoutePin = new RouteMapPin();
            pressedRoutePin.SetImage(UIImage.FromBundle("MapUser"), UIControlState.Normal);
            pressedRoutePin.SetImage(UIImage.FromBundle("MapUser"), UIControlState.Highlighted);
            pressedRoutePin.SizeToFit();
            mapView.AddSubview(pressedRoutePin);
            scrollView.BringSubviewToFront(pressedRoutePin);
            pressedRoutePin.Center = point;

            mapView.AddSubview(pressedRoutePin.PopUp);
            pressedRoutePin.PopUp.SetBottom(pressedRoutePin.Top() - 9.0f);
            pressedRoutePin.PopUp.SetCenterX(pressedRoutePin.CenterX());
            pressedRoutePin.PopUp.AddTarget(CreateRoute, UIControlEvent.TouchUpInside);
        }
Esempio n. 3
0
        private void StopRoute()
        {
            isRouting = false;

            routeLayer?.RemoveFromSuperLayer();
            routeLayer = null;

            uipath?.RemoveAllPoints();
            uipath = null;

            navigineCore.CancelTargets();

            cancelRouteButton.Hidden = true;

            activeRoutePin?.RemoveFromSuperview();
            activeRoutePin = null;
        }