Exemple #1
0
        /// <summary>
        /// Add points of given class to the partitions
        /// </summary>
        public static void AddPoints(EClass pClass)
        {
            for (int x = 0; x < CProjectData.Points.groundArray.arrayXRange; x += partitionStepSize)
            {
                for (int y = 0; y < CProjectData.Points.groundArray.arrayYRange; y += partitionStepSize)
                {
                    List <Vector3> points = new List <Vector3>();
                    for (int _x = x; _x < x + partitionStepSize; _x++)
                    {
                        for (int _y = y; _y < y + partitionStepSize; _y++)
                        {
                            CField element = CProjectData.Points.GetField(pClass, _x, _y);
                            //CField element = CProjectData.Points.groundArray.GetField(_x, _y);
                            if (element != null)
                            {
                                points.AddRange(element.points);
                            }
                        }
                    }
                    Obj pointsObj = new Obj(GetPointsObjName(pClass));
                    CObjExporter.AddPointsToObj(ref pointsObj, points);
                    pointsObj.UseMtl = CMaterialManager.GetPointsMaterial(pClass).Name;

                    AddObj(x, y, pointsObj);
                }
            }
        }
Exemple #2
0
        public static bool IsDebugPoint3D(Vector3 pPoint)
        {
            Vector3 movedPoint = CObjExporter.GetMovedPoint(pPoint);
            bool    result     = Vector3.Distance(movedPoint, DEBUG_POINT_3D_swapYZ) < 0.01f;

            if (result)
            {
                return(result);
            }
            return(result);
        }
Exemple #3
0
        private static void DebugPoint(Vector3 pPoint, int pPointIndex)
        {
            if (DEBUG)
            {
                CDebug.WriteLine("\n" + pointCounter + " AddPoint " + pPoint);
            }

            Vector3 debugPoint = CObjExporter.GetMovedPoint(pPoint);

            debugPoint.Z *= -1;
        }
Exemple #4
0
        public static void ReInit(int pTileIndex)
        {
            //dont create subfolder if we export only one tile
            bool   isOnlyTile      = CProgramStarter.tilesCount == 1;
            string tileIndexString = GetTileIndexString(pTileIndex);

            string tileExtent = currentTileHeader.GetExtentString();

            outputTileSubfolder = isOnlyTile ? outputFolder :
                                  CObjExporter.CreateFolderIn($"tile_{tileIndexString}_{tileExtent}", outputFolder);

            Points.ReInit();
        }
Exemple #5
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();
        }
Exemple #6
0
        public static void ExportPartition(string pFileSuffix = "", string pIndexPrefix = "")
        {
            //folderPath = CObjExporter.CreateFolderIn(
            //	CProjectData.saveFileName, CProjectData.outputTileSubfolder);

            //just creates a folder (for analytics etc)
            if (!CParameterSetter.GetBoolSettings(ESettings.export3d) || CRxpParser.IsRxp)
            {
                CDebug.WriteLine("Skipping export");
                return;
            }

            int      counter = 0;
            DateTime exportPartitionStart = DateTime.Now;
            DateTime previousDebugStart   = DateTime.Now;
            int      partsCount           = partitionXRange * partitionYRange;

            int debugFrequency = 1;

            for (int x = 0; x < partitionXRange; x++)
            {
                for (int y = 0; y < partitionYRange; y++)
                {
                    if (CProjectData.backgroundWorker.CancellationPending)
                    {
                        return;
                    }

                    counter++;
                    List <Obj> objsInPartition = objPartition[x, y];
                    //export only if partition contains some objects (doesn't have to)
                    if (objsInPartition.Count > 0)
                    {
                        CObjExporter.ExportObjs(objsInPartition,
                                                $"{CProjectData.saveFileName}_{pIndexPrefix}[{x},{y}]{pFileSuffix}", CProjectData.outputTileSubfolder);
                    }

                    CDebug.Progress(counter, partsCount, debugFrequency, ref previousDebugStart, exportPartitionStart, "Export of part");
                }
            }
        }