Exemplo n.º 1
0
        public async Task <PointsListResult> GetAlignmentPointsList(
            [FromQuery] Guid projectUid,
            [FromServices] IBoundingBoxService boundingBoxService)
        {
            Log.LogInformation($"{nameof(GetAlignmentPointsList)}: " + Request.QueryString);

            var projectId            = GetLegacyProjectId(projectUid);
            var alignmentDescriptors = GetAlignmentDescriptors(projectUid);

            await Task.WhenAll(projectId, alignmentDescriptors);

            var result = new PointsListResult();
            var list   = new List <List <WGSPoint> >();

            foreach (var alignmentDescriptor in alignmentDescriptors.Result)
            {
                var alignmentPoints = await boundingBoxService.GetAlignmentPoints(
                    new ProjectData { ProjectUID = projectUid.ToString() },
                    alignmentDescriptor,
                    0, 0, 0, 0,
                    CustomHeaders);

                if (alignmentPoints != null && alignmentPoints.Any())
                {
                    list.Add(alignmentPoints.ToList());
                }
            }

            result.PointsList = ConvertPoints(list);

            return(result);
        }
Exemplo n.º 2
0
        public async Task <PointsListResult> GetFilterPointsList(
            [FromServices] ISummaryDataHelper summaryDataHelper,
            [FromQuery] Guid projectUid,
            [FromQuery] Guid?filterUid,
            [FromQuery] Guid?baseUid,
            [FromQuery] Guid?topUid,
            [FromQuery] FilterBoundaryType boundaryType,
            [FromServices] IBoundingBoxService boundingBoxService)
        {
            Log.LogInformation($"{nameof(GetFilterPointsList)}: " + Request.QueryString);

            var projectTask = ((RaptorPrincipal)User).GetProject(projectUid);
            var filterTask  = GetCompactionFilter(projectUid, filterUid);
            //Base or top may be a design UID
            var baseFilterTask = summaryDataHelper.WithSwallowExceptionExecute(() => GetCompactionFilter(projectUid, baseUid));
            var topFilterTask  = summaryDataHelper.WithSwallowExceptionExecute(() => GetCompactionFilter(projectUid, topUid));

            var result = new PointsListResult();

            await Task.WhenAll(projectTask, filterTask, baseFilterTask, topFilterTask);

            var polygons = await boundingBoxService.GetFilterBoundaries(projectTask.Result, filterTask.Result, baseFilterTask.Result, topFilterTask.Result, boundaryType, CustomHeaders);

            result.PointsList = ConvertPoints(polygons);

            return(result);
        }
Exemplo n.º 3
0
        public async Task <AlignmentPointsResult> GetAlignmentPoints(
            [FromQuery] Guid projectUid,
            [FromQuery] Guid alignmentUid,
            [FromServices] IBoundingBoxService boundingBoxService)
        {
            Log.LogInformation($"{nameof(GetAlignmentPoints)}: " + Request.QueryString);

            var projectId           = GetLegacyProjectId(projectUid);
            var alignmentDescriptor = GetAndValidateDesignDescriptor(projectUid, alignmentUid);

            await Task.WhenAll(projectId, alignmentDescriptor);

            var result          = new AlignmentPointsResult();
            var alignmentPoints = await boundingBoxService.GetAlignmentPoints(
                new ProjectData { ProjectUID = projectUid.ToString() },
                alignmentDescriptor.Result);

            if (alignmentPoints != null && alignmentPoints.Any())
            {
                //TODO: Fix this when WGSPoint & WGSPoint3D aligned
                result.AlignmentPoints = alignmentPoints.Select(x => new WGSPoint(x.Lat, x.Lon)).ToList();
            }

            return(result);
        }
Exemplo n.º 4
0
        public async Task <ProjectExtentsResult> GetProjectExtentsV1(
            [FromQuery] long projectId,
            [FromServices] IBoundingBoxService boundingBoxService)
        {
            Log.LogInformation($"{nameof(GetProjectExtentsV1)}: {Request.QueryString}");

            var projectUid  = await((RaptorPrincipal)User).GetProjectUid(projectId);
            var excludedIds = await ProjectStatisticsHelper.GetExcludedSurveyedSurfaceIds(projectUid, GetUserId(), CustomHeaders);

            try
            {
                var result = await boundingBoxService.GetProductionDataExtents(projectUid, projectId, excludedIds?.Select(e => e.Item1), excludedIds?.Select(e => e.Item2), GetUserId(), CustomHeaders);

                return(await FormatProjectExtentsResult(projectUid, result));
            }
            catch (ServiceException se)
            {
                Log.LogError(se, $"{nameof(GetProjectExtentsV1)}: exception");
                throw;
            }
            finally
            {
                Log.LogInformation($"{nameof(GetProjectExtentsV1)} returned: {Response.StatusCode}");
            }
        }
Exemplo n.º 5
0
        public async Task <AlignmentStationRangeResult> GetAlignmentStationRange(
            [FromQuery] Guid projectUid,
            [FromQuery] Guid alignmentFileUid,
            [FromServices] IBoundingBoxService boundingBoxService)
        {
            Log.LogInformation("GetAlignmentStationRange: " + Request.QueryString);

            var projectId           = GetLegacyProjectId(projectUid);
            var alignmentDescriptor = GetAndValidateDesignDescriptor(projectUid, alignmentFileUid);

            await Task.WhenAll(projectId, alignmentDescriptor);

            var request = requestFactory.Create <AlignmentStationRangeRequestHelper>(r => r
                                                                                     .ProjectId(projectId.Result)
                                                                                     .Headers(CustomHeaders))
                          .CreateAlignmentStationRangeRequest(alignmentDescriptor.Result);

            request.Validate();

            var result = await WithServiceExceptionTryExecuteAsync(() =>
                                                                   boundingBoxService.GetAlignmentStationRange(
                                                                       new ProjectData {
                ProjectUID = projectUid.ToString()
            },
                                                                       alignmentDescriptor.Result,
                                                                       CustomHeaders));

            return(result);
        }
Exemplo n.º 6
0
        public async Task <ProjectExtentsResult> GetProjectExtentsV2(
            [FromQuery] Guid projectUid,
            [FromServices] IBoundingBoxService boundingBoxService)
        {
            Log.LogInformation("GetProjectExtents V2: " + Request.QueryString);
            var projectId = await GetLegacyProjectId(projectUid);

            return(await GetProjectExtentsV1(projectId, boundingBoxService));
        }
Exemplo n.º 7
0
 public VoronoiFactory(
     IEventHandlerStrategy <SiteEvent> siteEventHandler,
     IEventHandlerStrategy <CircleEvent> circleEventHandler,
     ISiteGenerator siteGenerator,
     IBoundingBoxService boundingBoxService)
 {
     _siteGenerator      = siteGenerator;
     _siteEventHandler   = siteEventHandler;
     _circleEventHandler = circleEventHandler;
     _boundingBoxService = boundingBoxService;
     _logger             = Logger.Instance;
 }
Exemplo n.º 8
0
        public async Task <string> GetBoundingBox(
            [FromQuery] Guid projectUid,
            [FromQuery] TileOverlayType[] overlays,
            [FromQuery] Guid?filterUid,
            [FromQuery] Guid?cutFillDesignUid,
            [FromQuery] Guid?baseUid,
            [FromQuery] Guid?topUid,
            [FromQuery] VolumeCalcType?volumeCalcType,
            [FromServices] IBoundingBoxService boundingBoxService)
        {
            Log.LogInformation("GetBoundingBox: " + Request.QueryString);
            //Check we have at least one overlay
            if (overlays == null || overlays.Length == 0)
            {
                throw new ServiceException(HttpStatusCode.BadRequest,
                                           new ContractExecutionResult(ContractExecutionStatesEnum.ValidationError,
                                                                       "At least one overlay type must be specified to calculate bounding box"));
            }
            var project              = ((RaptorPrincipal)User).GetProject(projectUid);
            var filter               = GetCompactionFilter(projectUid, filterUid);
            var cutFillDesign        = GetAndValidateDesignDescriptor(projectUid, cutFillDesignUid);
            var sumVolParametersTask = GetSummaryVolumesParameters(projectUid, volumeCalcType, baseUid, topUid);

            var sumVolParameters = sumVolParametersTask.Result;

            await Task.WhenAll(project, filter, cutFillDesign, sumVolParametersTask);

            var designDescriptor = (!volumeCalcType.HasValue || volumeCalcType.Value == VolumeCalcType.None)
        ? cutFillDesign.Result
        : sumVolParameters.Item3;

            var overlayTypes = overlays.ToList();

            if (overlays.Contains(TileOverlayType.AllOverlays))
            {
                overlayTypes = new List <TileOverlayType>((TileOverlayType[])Enum.GetValues(typeof(TileOverlayType)));
                overlayTypes.Remove(TileOverlayType.AllOverlays);
            }

            var result = await boundingBoxService.GetBoundingBox(project.Result, filter.Result, overlayTypes.ToArray(), sumVolParameters.Item1,
                                                                 sumVolParameters.Item2, designDescriptor, GetUserId(), CustomHeaders);

            var bbox = $"{result.minLatDegrees},{result.minLngDegrees},{result.maxLatDegrees},{result.maxLngDegrees}";

            Log.LogInformation($"GetBoundingBox: returning {bbox}");
            return(bbox);
        }
Exemplo n.º 9
0
 public MapTileGenerator(ILoggerFactory logger, IBoundingBoxService bboxService, IProductivity3dV2ProxyCompactionTile productivity3DProxyCompactionTile,
                         IMapTileService mapTileService, IProjectTileService projectTileService, IGeofenceTileService geofenceTileService,
                         IAlignmentTileService alignmentTileService, IDxfTileService dxfTileService, IBoundingBoxHelper boundingBoxHelper,
                         ILoadDumpTileService loadDumpTileService, ILoadDumpProxy loadDumpProxy)
 {
     log = logger.CreateLogger <MapTileGenerator>();
     this.mapTileService       = mapTileService;
     this.projectTileService   = projectTileService;
     this.geofenceTileService  = geofenceTileService;
     this.alignmentTileService = alignmentTileService;
     this.dxfTileService       = dxfTileService;
     this.boundingBoxHelper    = boundingBoxHelper;
     boundingBoxService        = bboxService;
     this.productivity3DProxyCompactionTile = productivity3DProxyCompactionTile;
     this.loadDumpTileService = loadDumpTileService;
     this.loadDumpProxy       = loadDumpProxy;
 }
Exemplo n.º 10
0
        public async Task <PointsListResult> GetDesignBoundaryPoints(
            [FromQuery] Guid projectUid,
            [FromQuery] Guid designUid,
            [FromServices] IBoundingBoxService boundingBoxService)
        {
            Log.LogInformation("GetDesignBoundaryPoints: " + Request.QueryString);

            var projectId        = GetLegacyProjectId(projectUid);
            var designDescriptor = GetAndValidateDesignDescriptor(projectUid, designUid);

            await Task.WhenAll(projectId, designDescriptor);

            var project = new ProjectData {
                ProjectUID = projectUid.ToString()
            };
            var result   = new PointsListResult();
            var polygons = await boundingBoxService.GetDesignBoundaryPolygons(project, designDescriptor.Result, CustomHeaders);

            result.PointsList = ConvertPoints(polygons);

            return(result);
        }
Exemplo n.º 11
0
        public async Task <PointsListResult> GetFilterPoints(
            [FromQuery] Guid projectUid,
            [FromQuery] Guid filterUid,
            [FromServices] IBoundingBoxService boundingBoxService)
        {
            Log.LogInformation("GetFilterPoints: " + Request.QueryString);

            var project = ((RaptorPrincipal)User).GetProject(projectUid);
            var filter  = GetCompactionFilter(projectUid, filterUid);

            await Task.WhenAll(project, filter);

            var result = new PointsListResult();

            if (filter.Result != null)
            {
                var polygons = await boundingBoxService.GetFilterBoundaries(
                    project.Result, filter.Result, FilterBoundaryType.All, CustomHeaders);

                result.PointsList = ConvertPoints(polygons);
            }

            return(result);
        }