Beispiel #1
0
        /// <summary>
        /// Performs the donkey work of the boundary calculation
        /// </summary>
        private List <Fence> Calc(DesignBoundaryArgument arg, out DesignProfilerRequestResult calcResult)
        {
            calcResult = DesignProfilerRequestResult.UnknownError;

            var siteModel = DIContext.Obtain <ISiteModels>().GetSiteModel(arg.ProjectID, false);

            if (siteModel == null)
            {
                calcResult = DesignProfilerRequestResult.NoSelectedSiteModel;
                Log.LogError($"Site model {arg.ProjectID} not found");
                return(null);
            }

            var design = Designs.Lock(arg.ReferenceDesign.DesignID, siteModel, siteModel.CellSize, out var lockResult);

            if (design == null)
            {
                Log.LogWarning($"Failed to read file for design {arg.ReferenceDesign.DesignID}");
                calcResult = DesignProfilerRequestResult.FailedToLoadDesignFile;
                return(null);
            }

            try
            {
                var result = design.GetBoundary();

                calcResult = result != null ? DesignProfilerRequestResult.OK : DesignProfilerRequestResult.FailedToCalculateBoundary;

                return(result);
            }
            finally
            {
                Designs.UnLock(arg.ReferenceDesign.DesignID, design);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Performs execution business logic for this executor.
        /// </summary>
        public List <Fence> Execute(DesignBoundaryArgument arg, out DesignProfilerRequestResult calcResult)
        {
            // Perform the design boundary calculation
            var result = Calc(arg, out calcResult);

            if (result == null)
            {
                Log.LogInformation($"Unable to calculate a design boundary result for {arg}");
                result = new List <Fence>();
            }

            return(result);
        }