Example #1
0
        /// <summary>
        /// Calculate partition step size in proportion to used ground array step
        /// </summary>
        private static void SetPartitionStepSize()
        {
            float scaledPartitionStep =
                CParameterSetter.GetIntSettings(ESettings.partitionStep) /
                CParameterSetter.GetFloatSettings(ESettings.groundArrayStep);

            partitionStepSize = Math.Max(1, (int)scaledPartitionStep);
        }
Example #2
0
        public static void Init()
        {
            treeIndex  = 0;
            debugcalls = 0;
            maxPossibleTreesAssignment = 0;

            detectMethod    = GetDetectMethod();
            AllowedDescend  = CParameterSetter.GetFloatSettings(ESettings.allowedDescend);
            MinAscendSteps  = CParameterSetter.GetIntSettings(ESettings.minAscendSteps);
            MinDescendSteps = CParameterSetter.GetIntSettings(ESettings.minDescendSteps);

            LocalMaxHeight = CParameterSetter.GetFloatSettings(ESettings.localMaxHeight);

            Reinit();
        }
Example #3
0
        public static void Write(bool pToFile)
        {
            string output = " - ANALYTICS - " + newLine2;

            output += $"treeExtent = {CParameterSetter.GetFloatSettings(ESettings.treeExtent)} " + newLine;
            output += $"treeExtentMultiply = {CParameterSetter.GetFloatSettings(ESettings.treeExtentMultiply)} " + newLine2;

            output += $"loadedPoints = {loadedPoints} " + newLine;
            output += $"vegePoints = {vegePoints} " + newLine;
            output += $"groundPoints = {groundPoints} " + newLine;
            output += $"unassignedPoints = {unassignedPoints} " + newLine;
            output += $"buildingPoints = {buildingPoints} " + newLine;
            output += $"filteredPoints = {filteredPoints}" + newLine2;

            output += $"arrayWidth = {arrayWidth} m" + newLine;
            output += $"arrayHeight = {arrayHeight} m" + newLine2;

            output += $"firstDetectedTrees = {firstDetectedTrees} " + newLine;
            output += $"firstMergedCount = {GetFirstMergedCount()} " + newLine;
            output += $"secondMergedCount = {GetSecondMergedCount()} " + newLine;
            output += $"detectedTrees = {detectedTrees} " + newLine;


            output += $"trees density = 1 per {GetTreesDensity():0.00} m\xB2 " + newLine;
            output += $"invalidTrees = {invalidTrees} ({invalidTreesAtBorder} of them at border)\n" + newLine;

            output += $"inputAverageTreeHeight = {inputAverageTreeHeight} " + newLine;
            output += $"averageTreeHeight = {averageTreeHeight} " + newLine;
            output += $"maxTreeHeight = {maxTreeHeight} " + newLine;
            output += $"minTreeHeight = {minTreeHeight}" + newLine2;

            output += $"loadedReftrees = {loadedReftrees} " + newLine;
            output += $"averageReftreeSimilarity = {averageReftreeSimilarity} " + newLine2;


            output += "Duration" + newLine;
            output += $"load reftrees = {loadReftreesDuration} " + newLine;
            output += $"fill missing ground = {fillAllHeightsDuration} " + newLine;
            output += $"add vege points = {processVegePointsDuration} " + newLine;
            output += $"first merge = {firstMergeDuration} " + newLine;
            output += $"second merge = {secondMergeDuration} " + newLine;
            output += $"reftree assignment = {reftreeAssignDuration} " + newLine;
            output += $"bitmap export = {bitmapExportDuration} " + newLine;
            output += $"las export = {lasExportDuration} " + newLine;
            output += $"-------------------" + newLine;
            output += $"total = {totalDuration} " + newLine;

            if (CParameterSetter.GetBoolSettings(ESettings.useCheckTreeFile))
            {
                output += "Checktree" + newLine;
                output += $"loadedCheckTrees = {loadedCheckTrees} " + newLine;
                output += $"assignedCheckTrees = {assignedCheckTrees} " + newLine;
                output += $"invalidCheckTrees = {invalidCheckTrees} " + newLine;
            }

            output += $"\nERRORS" + newLine;
            int       counter         = 0;
            const int MAX_ERROR_DEBUG = 100;

            foreach (string error in errors)
            {
                output += $"- {error} " + newLine;
                counter++;
                if (counter > MAX_ERROR_DEBUG)
                {
                    break;
                }
            }

            //before WriteToFile (it can fail there too)
            errors.Clear();             //reset, so errors dont stack with previous error

            CDebug.WriteLine(output);
            if (pToFile)
            {
                WriteToFile(output);
                //ExportCsv(ECsvAnalytics.InputParams);
                //ExportCsv(ECsvAnalytics.ComputationTime);
                ExportCsv(ECsvAnalytics.Summary);                 //probably enough
            }
        }
Example #4
0
        public bool IsAtBorder(Vector3 pPoint)
        {
            float distanceToBorder = GetDistanceToBorderFrom(pPoint);

            return(distanceToBorder < CParameterSetter.GetFloatSettings(ESettings.treeExtent));
        }
Example #5
0
        private static void ExportCsv(ECsvAnalytics pType)
        {
            switch (pType)
            {
            /*case ECsvAnalytics.InputParams:
             *      ExportCsv(new List<object>
             *              {
             *                      CProjectData.header.Width,
             *                      CProjectData.header.Height,
             *                      CParameterSetter.GetFloatSettings(ESettings.treeExtent),
             *                      CParameterSetter.GetFloatSettings(ESettings.treeExtentMultiply),
             *                      firstDetectedTrees,
             *                      GetFirstMergedCount(),
             *                      GetSecondMergedCount(),
             *                      detectedTrees
             *              },
             *              pType.ToString());
             *      break;
             * case ECsvAnalytics.ComputationTime:
             *      ExportCsv(new List<object>
             *              {
             *                      CProjectData.header.Width,
             *                      CProjectData.header.Height,
             *                      loadedPoints,
             *                      detectedTrees,
             *                      processVegePointsDuration,
             *                      firstMergeDuration,
             *                      secondMergeDuration,
             *                      reftreeAssignDuration,
             *                      totalDuration
             *              },
             *              pType.ToString());
             *      break;*/

            case ECsvAnalytics.Summary:
                ExportCsv(new List <Tuple <string, object> >
                {
                    new Tuple <string, object>("width", CProjectData.currentTileHeader.Width),
                    new Tuple <string, object>("Height", CProjectData.currentTileHeader.Height),
                    new Tuple <string, object>("treeExtent",
                                               CParameterSetter.GetFloatSettings(ESettings.treeExtent)),
                    new Tuple <string, object>("treeExtentMultiply",
                                               CParameterSetter.GetFloatSettings(ESettings.treeExtentMultiply)),
                    new Tuple <string, object>("loadedPoints", loadedPoints),

                    new Tuple <string, object>("firstDetectedTrees", firstDetectedTrees),
                    new Tuple <string, object>("FirstMergedCount", GetFirstMergedCount()),
                    new Tuple <string, object>("SecondMerged", GetSecondMergedCount()),
                    new Tuple <string, object>("detectedTrees", detectedTrees),

                    new Tuple <string, object>("loadedReftrees", loadedReftrees),
                    new Tuple <string, object>("averageReftreeSimilarity", averageReftreeSimilarity),

                    new Tuple <string, object>("processVege", processVegePointsDuration),
                    new Tuple <string, object>("firstMerge", firstMergeDuration),
                    new Tuple <string, object>("secondMerge", secondMergeDuration),
                    new Tuple <string, object>("reftreeAssign", reftreeAssignDuration),
                    new Tuple <string, object>("totalDuration", totalDuration)
                },
                          pType.ToString(), true);
                break;
            }
        }