Пример #1
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();
        }
Пример #2
0
        public static string GetMethodSuffix(EDetectionMethod pMethod)
        {
            switch (pMethod)
            {
            case EDetectionMethod.AddFactor:
                return("_af");

            case EDetectionMethod.Detection2D:
                return("_2d");

            case EDetectionMethod.AddFactor2D:
                return("_af2d");
            }
            return("_noMethod");
        }
Пример #3
0
        public static void Init()
        {
            saveFileName = CUtils.GetFileName(
                CParameterSetter.GetStringSettings(ESettings.forestFileFullName));
            string outputFolderSettings = CParameterSetter.GetStringSettings(ESettings.outputFolderPath);

            //include the method alias into the main folder name
            EDetectionMethod method = CTreeManager.GetDetectMethod();
            string           suffix = CUtils.GetMethodSuffix(method);

            saveFileName += suffix;

            outputFolder = CObjExporter.CreateFolderIn(saveFileName, outputFolderSettings);

            Points = new CPointsHolder();
        }
Пример #4
0
        public static void ProcessParsedLines(List <Tuple <EClass, Vector3> > parsedLines)
        {
            CAnalytics.loadedPoints = parsedLines.Count;
            CProjectData.Points.AddPointsFromLines(parsedLines);

            CObjPartition.AddGroundArrayObj();

            if (CParameterSetter.GetBoolSettings(ESettings.exportPoints))
            {
                CObjPartition.AddPoints(EClass.Unassigned);
                CObjPartition.AddPoints(EClass.Ground);
                CObjPartition.AddPoints(EClass.Vege);
                CObjPartition.AddPoints(EClass.Building);
            }

            CDebug.Count("Trees", CTreeManager.Trees.Count);

            CTreeManager.CheckAllTrees();

            CDebug.Step(EProgramStep.ValidateTrees1);
            //dont move invalid trees to invalid list yet, some invalid trees will be merged
            CTreeManager.ValidateTrees(false, false);

            //export before merge
            if (CProjectData.exportBeforeMerge)
            {
                CTreeManager.AssignMaterials();                 //call before export

                CObjPartition.AddTrees(true);
                CObjPartition.AddTrees(false);
                CObjPartition.ExportPartition("_noMerge");
                CObjPartition.Init();
                //CObjPartition.AddArray();
            }

            CAnalytics.firstDetectedTrees = CTreeManager.Trees.Count;

            CDebug.Step(EProgramStep.MergeNotTrees1);
            CTreeManager.TryMergeNotTrees();


            CDebug.Step(EProgramStep.MergeTrees1);
            //try merge all (even valid)
            EDetectionMethod detectionMethod = CTreeManager.GetDetectMethod();

            if ((detectionMethod == EDetectionMethod.AddFactor ||
                 detectionMethod == EDetectionMethod.Detection2D
                 ) &&
                CProjectData.tryMergeTrees)
            {
                CTreeManager.TryMergeAllTrees(false);
            }
            CAnalytics.afterFirstMergedTrees = CTreeManager.Trees.Count;

            //validate restrictive
            bool cathegorize = false;

            if (detectionMethod == EDetectionMethod.Detection2D)
            {
                cathegorize = true;
            }

            CDebug.Step(EProgramStep.ValidateTrees2);
            CTreeManager.ValidateTrees(cathegorize, true);

            CDebug.Step(EProgramStep.MergeTrees2);
            if (detectionMethod == EDetectionMethod.AddFactor)
            {
                //merge only invalid
                if (CProjectData.tryMergeTrees2)
                {
                    CTreeManager.TryMergeAllTrees(true);
                }
            }

            //try merging not-trees again after trees were merged
            CDebug.Step(EProgramStep.MergeNotTrees2);
            CTreeManager.TryMergeNotTrees();

            CDebug.Step(EProgramStep.ValidateTrees3);
            if (detectionMethod == EDetectionMethod.AddFactor)
            {
                //validate restrictive
                //cathegorize invalid trees
                CTreeManager.ValidateTrees(true, true, true);
            }

            //todo: just debug
            //CTreeManager.CheckAllTrees();

            CAnalytics.detectedTrees        = CTreeManager.Trees.Count;
            CAnalytics.invalidTrees         = CTreeManager.InvalidTrees.Count;
            CAnalytics.invalidTreesAtBorder = CTreeManager.GetInvalidTreesAtBorderCount();

            CAnalytics.inputAverageTreeHeight = CTreeManager.AVERAGE_TREE_HEIGHT;
            CAnalytics.averageTreeHeight      = CTreeManager.GetAverageTreeHeight();
            CAnalytics.maxTreeHeight          = CTreeManager.MaxTreeHeight;
            CAnalytics.minTreeHeight          = CTreeManager.GetMinTreeHeight();

            CDebug.Count("Trees", CTreeManager.Trees.Count);
            CDebug.Count("InvalidTrees", CTreeManager.InvalidTrees.Count);
            //CProjectData.array.DebugDetectedTrees();

            CTreeManager.AssignMaterials();

            CDebug.Step(EProgramStep.AssignReftrees);
            CReftreeManager.AssignRefTrees();
            if (CParameterSetter.GetBoolSettings(ESettings.exportRefTrees))            //no reason to export when no refTrees were assigned
            {
                //CRefTreeManager.ExportTrees();
                CObjPartition.AddRefTrees();
            }

            CObjPartition.AddTrees(true);
            if (CParameterSetter.GetBoolSettings(ESettings.exportInvalidTrees))
            {
                CObjPartition.AddTrees(false);
            }
        }