Esempio n. 1
0
        public PointOnPath GetPointOnPath(Wrld.Space.LatLong inputPoint, List <Wrld.Space.LatLong> polylinePathPoints)
        {
            var pathPointsBuffer = new LatLongInterop[polylinePathPoints.Count];

            for (int i = 0; i < polylinePathPoints.Count; ++i)
            {
                pathPointsBuffer[i] = LatLongInterop.FromLatLong(polylinePathPoints[i]);
            }

            var pathPointsBufferGCHandle = GCHandle.Alloc(pathPointsBuffer, GCHandleType.Pinned);
            var bufferPtr = pathPointsBufferGCHandle.AddrOfPinnedObject();

            var inputPointInterop = LatLongInterop.FromLatLong(inputPoint);

            var resultInterop = NativePathApi_GetPointOnPath(NativePluginRunner.API, inputPointInterop, bufferPtr, pathPointsBuffer.Length);

            var result = resultInterop.FromInterop();

            pathPointsBufferGCHandle.Free();

            return(result);
        }
        private BuildingInformation TryFetchBuildingInformationForHighlight(int buildingHighlightId)
        {
            BuildingInformation        buildingInformation = null;
            BuildingInformationInterop buildingInfoInterop = new BuildingInformationInterop();
            // call C++ api point to populate buffer size fields
            var success = NativeBuildingsApi_TryGetBuildingInformation(NativePluginRunner.API, buildingHighlightId, ref buildingInfoInterop);

            if (success)
            {
                // alloc + pin buffers
                var buildingIdBuffer         = new byte[buildingInfoInterop.BuildingIdSize];
                var buildingIdBufferGCHandle = GCHandle.Alloc(buildingIdBuffer, GCHandleType.Pinned);
                buildingInfoInterop.BuildingId = buildingIdBufferGCHandle.AddrOfPinnedObject();

                var contourPointsBuffer         = new LatLongInterop[buildingInfoInterop.ContourPointsSize];
                var contourPointsBufferGCHandle = GCHandle.Alloc(contourPointsBuffer, GCHandleType.Pinned);
                buildingInfoInterop.ContourPoints = contourPointsBufferGCHandle.AddrOfPinnedObject();

                var buildingContoursBuffer         = new BuildingContourInterop[buildingInfoInterop.BuildingContoursSize];
                var buildingContoursBufferGCHandle = GCHandle.Alloc(buildingContoursBuffer, GCHandleType.Pinned);
                buildingInfoInterop.BuildingContours = buildingContoursBufferGCHandle.AddrOfPinnedObject();

                // call C++ api point again to populate buffers
                success = NativeBuildingsApi_TryGetBuildingInformation(NativePluginRunner.API, buildingHighlightId, ref buildingInfoInterop);

                if (success)
                {
                    buildingInformation = CreateBuildingInformation(buildingInfoInterop, contourPointsBuffer, buildingContoursBuffer);
                }

                buildingIdBufferGCHandle.Free();
                contourPointsBufferGCHandle.Free();
                buildingContoursBufferGCHandle.Free();
            }

            return(buildingInformation);
        }
 private static extern int NativePrecacheApi_BeginPrecacheOperation(IntPtr ptr, ref LatLongInterop center, double radius);
        internal int BeginPrecacheOperation(LatLong center, double radius)
        {
            var latLongInterop = LatLongInterop.FromLatLong(center);

            return(NativePrecacheApi_BeginPrecacheOperation(NativePluginRunner.API, ref latLongInterop, radius));
        }
Esempio n. 5
0
 private static extern PointOnPathInterop NativePathApi_GetPointOnPath(IntPtr ptr, LatLongInterop inputPoint, IntPtr polylinePathPointsPtr, int polylinePathPointsSize);
Esempio n. 6
0
 private static extern DoubleRay NativeSpacesApi_LatLongToVerticallyDownRay(IntPtr ptr, ref LatLongInterop latLongInterop);