private bool TryFetchWay(TransportWayIdInterop wayIdInterop, out TransportWay way)
        {
            var wayInterop = new TransportWayInterop()
            {
                Id = wayIdInterop
            };


            bool success = NativeTransportApi_TryGetWayBufferSizes(NativePluginRunner.API, ref wayInterop);

            if (!success)
            {
                way = TransportWay.MakeEmpty();
                return(false);
            }

            var centerLinePointsBuffer         = new DoubleVector3[wayInterop.CenterLinePointsBufferSize];
            var centerLinePointsBufferGCHandle = GCHandle.Alloc(centerLinePointsBuffer, GCHandleType.Pinned);

            wayInterop.CenterLinePoints = centerLinePointsBufferGCHandle.AddrOfPinnedObject();

            var centerLineSplineParamsBuffer         = new double[wayInterop.CenterLineSplineParamsBufferSize];
            var centerLineSplineParamsBufferGCHandle = GCHandle.Alloc(centerLineSplineParamsBuffer, GCHandleType.Pinned);

            wayInterop.CenterLineSplineParams = centerLineSplineParamsBufferGCHandle.AddrOfPinnedObject();

            var classificationBuffer         = new byte[wayInterop.ClassificationBufferSize];
            var classificationBufferGCHandle = GCHandle.Alloc(classificationBuffer, GCHandleType.Pinned);

            wayInterop.Classification = classificationBufferGCHandle.AddrOfPinnedObject();

            success = NativeTransportApi_TryGetWay(NativePluginRunner.API, ref wayInterop);
            if (!success)
            {
                way = TransportWay.MakeEmpty();
                return(false);
            }

            var classification = Marshal.PtrToStringAnsi(wayInterop.Classification, wayInterop.ClassificationBufferSize - 1);

            way = new TransportWay(
                wayInterop.Id.FromInterop(),
                centerLinePointsBuffer,
                centerLineSplineParamsBuffer,
                wayInterop.LengthMeters,
                wayInterop.HalfWidthMeters,
                wayInterop.WayDirection,
                classification,
                wayInterop.AverageSpeedKph,
                wayInterop.ApproximateSpeedLimitKph
                );

            centerLinePointsBufferGCHandle.Free();
            centerLineSplineParamsBufferGCHandle.Free();
            classificationBufferGCHandle.Free();
            return(true);
        }
 /// <summary>
 /// The TransportWay value associated with the given TransportWayId key.
 /// </summary>
 /// <param name="wayId">The id of the TransportWay to get.</param>
 /// <param name="way">On return, contains the value associated with transportWayId if found; else an empty
 /// value as returned by TransportWay.MakeEmpty().</param>
 /// <returns>True if a TransportWay object with Id equal to wayId was found, else false.</returns>
 public bool TryGetWay(TransportWayId wayId, out TransportWay way)
 {
     return(m_apiInternal.TryGetWay(wayId, out way));
 }
 public bool TryGetWay(TransportWayId wayId, out TransportWay way)
 {
     return(TryFetchWay(wayId.ToInterop(), out way));
 }