public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            locationManager = new CLLocationManager();
            locationManager.AuthorizationChanged += OnAuthorizationChanged;
            locationManager.LocationsUpdated     += OnLocationsUpdated;
            locationManager.DesiredAccuracy       = CLLocation.AccuracyBest;
            locationManager.ActivityType          = CLActivityType.Other;

            // We setup a pair of anchors that will define how the floorplan image, maps to geographic co-ordinates
            var anchor1 = new GeoAnchor {
                LatitudeLongitude = new CLLocationCoordinate2D(37.770511, -122.465810),
                Pixel             = new CGPoint(12, 18)
            };

            var anchor2 = new GeoAnchor {
                LatitudeLongitude = new CLLocationCoordinate2D(37.769125, -122.466356),
                Pixel             = new CGPoint(481, 815)
            };

            anchorPair = new Tuple <GeoAnchor, GeoAnchor> (anchor1, anchor2);

            // Initialize the coordinate system converter with two anchor points.
            coordinateConverter = new CoordinateConverter(anchorPair);
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			locationManager = new CLLocationManager ();
			locationManager.AuthorizationChanged += OnAuthorizationChanged;
			locationManager.LocationsUpdated += OnLocationsUpdated;
			locationManager.DesiredAccuracy = CLLocation.AccuracyBest;
			locationManager.ActivityType = CLActivityType.Other;

			// We setup a pair of anchors that will define how the floorplan image, maps to geographic co-ordinates
			var anchor1 = new GeoAnchor {
				LatitudeLongitude = new CLLocationCoordinate2D (37.770511, -122.465810),
				Pixel = new CGPoint (12, 18)
			};

			var anchor2 = new GeoAnchor {
				LatitudeLongitude = new CLLocationCoordinate2D (37.769125, -122.466356),
				Pixel = new CGPoint (481, 815)
			};

			anchorPair = new Tuple<GeoAnchor, GeoAnchor> (anchor1, anchor2);

			// Initialize the coordinate system converter with two anchor points.
			coordinateConverter = new CoordinateConverter (anchorPair);
		}
		// This will anchor image to geographic coordinates
		public CoordinateConverter (CLLocationCoordinate2D topLeft, CLLocationCoordinate2D bottomRight, CGSize imageSize)
		{
			var topLeftAnchor = new GeoAnchor {
				LatitudeLongitude = topLeft,
				Pixel = new CGPoint (0, 0)
			};

			var bottomRightAnchor = new GeoAnchor {
				LatitudeLongitude = bottomRight,
				Pixel = new CGPoint (imageSize.Width, imageSize.Height)
			};

			var anchorPair = new Tuple<GeoAnchor, GeoAnchor> (topLeftAnchor, bottomRightAnchor);
			Init (anchorPair);
		}
Exemplo n.º 4
0
        // This will anchor image to geographic coordinates
        public CoordinateConverter(CLLocationCoordinate2D topLeft, CLLocationCoordinate2D bottomRight, CGSize imageSize)
        {
            var topLeftAnchor = new GeoAnchor {
                LatitudeLongitude = topLeft,
                Pixel             = new CGPoint(0, 0)
            };

            var bottomRightAnchor = new GeoAnchor {
                LatitudeLongitude = bottomRight,
                Pixel             = new CGPoint(imageSize.Width, imageSize.Height)
            };

            var anchorPair = new Tuple <GeoAnchor, GeoAnchor> (topLeftAnchor, bottomRightAnchor);

            Init(anchorPair);
        }