Beispiel #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();
        }
Beispiel #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 DecodeReferencedCircleLocation()
        {
            // build the location to decode.
            var location = new CircleLocation();

            location.Coordinate           = new Model.Coordinate();
            location.Coordinate.Latitude  = 49.60728;
            location.Coordinate.Longitude = 6.12699;
            location.Radius = 170;

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

            // confirm result.
            Assert.IsNotNull(referencedLocation);
            Assert.AreEqual(referencedLocation.Longitude, location.Coordinate.Longitude);
            Assert.AreEqual(referencedLocation.Latitude, location.Coordinate.Latitude);
            Assert.AreEqual(referencedLocation.Radius, location.Radius);
        }