Exemple #1
0
        /// <summary>
        /// Creates a new referenced decoder.
        /// </summary>
        public ReferencedDecoderBase(BasicRouterDataSource <LiveEdge> graph, Vehicle vehicle, Decoder locationDecoder)
            : base(locationDecoder)
        {
            _graph   = graph;
            _vehicle = vehicle;

            _referencedCircleDecoder         = this.GetReferencedCircleDecoder();
            _referencedGeoCoordinateDecoder  = this.GetReferencedGeoCoordinateDecoder();
            _referencedGridDecoder           = this.GetReferencedGridDecoder();
            _referencedLineDecoder           = this.GetReferencedLineDecoder();
            _referencedPointAlongLineDecoder = this.GetReferencedPointAlongLineDecoder();
            _referencedPolygonDecoder        = this.GetReferencedPolygonDecoder();
            _referencedRectangleDecoder      = this.GetReferencedRectangleDecoder();
        }
Exemple #2
0
        /// <summary>
        /// Creates a new referenced decoder.
        /// </summary>
        public ReferencedDecoderBase(BasicRouterDataSource <LiveEdge> graph, Vehicle vehicle, Decoder locationDecoder, Meter maxVertexDistance,
                                     float candidateSearchBoxSize)
            : base(locationDecoder)
        {
            _graph                  = graph;
            _maxVertexDistance      = maxVertexDistance;
            _vehicle                = vehicle;
            _candidateSearchBoxSize = candidateSearchBoxSize;

            _referencedCircleDecoder         = this.GetReferencedCircleDecoder();
            _referencedGeoCoordinateDecoder  = this.GetReferencedGeoCoordinateDecoder();
            _referencedGridDecoder           = this.GetReferencedGridDecoder();
            _referencedLineDecoder           = this.GetReferencedLineDecoder();
            _referencedPointAlongLineDecoder = this.GetReferencedPointAlongLineDecoder();
            _referencedPolygonDecoder        = this.GetReferencedPolygonDecoder();
            _referencedRectangleDecoder      = this.GetReferencedRectangleDecoder();
        }
        public void DecodeReferencedRectangleLocation()
        {
            // build the location to decode.
            var location = new RectangleLocation();

            location.LowerLeft            = new Model.Coordinate();
            location.LowerLeft.Latitude   = 49.60586;
            location.LowerLeft.Longitude  = 6.12555;
            location.UpperRight           = new Model.Coordinate();
            location.UpperRight.Longitude = 6.12875;
            location.UpperRight.Latitude  = 49.60711;

            // decode the location
            //var decoder = new GeoCoordinateLocationDecoder();
            var referencedDecoder  = new ReferencedRectangleDecoder(null, null);
            var referencedLocation = referencedDecoder.Decode(location);

            // confirm result.
            Assert.IsNotNull(referencedLocation);
            Assert.AreEqual(referencedLocation.LowerLeftLatitude, location.LowerLeft.Latitude);
            Assert.AreEqual(referencedLocation.LowerLeftLongitude, location.LowerLeft.Longitude);
            Assert.AreEqual(referencedLocation.UpperRightLatitude, location.UpperRight.Latitude);
            Assert.AreEqual(referencedLocation.UpperRightLongitude, location.UpperRight.Longitude);
        }