public static void ExportMain() { if (!exportMain || !exportBitmap) { return; } if (!CParameterSetter.GetBoolSettings(ESettings.ExportBMTreePositions)) { return; } if (CProgramStarter.tilesCount < 2) { return; } //mainMap.SetPixel(0, 0, treeColor); //main bitmap has a lot of missing fields - apply filter //todo: make radius dependent on bitmap width? if (FILTER_MAIN_MAP) { //looks good enough on .3f, higher npt necessary, just slows down rapidly const float kernelRadius = .3f; int kernelSize = GetKernelSize(mainMapStepSize, kernelRadius); FilterBitmap(ref mainMap, kernelSize, EFilter.ColorOrMax); } ExportBitmap(mainMap, "tree_positions_main", -1); }
private void LoadObj(string pFileName) { Obj = new Obj(pFileName); string refTreePath = GetRefTreeFilePath(pFileName, pFileName + ".obj"); bool useReducedReftreeModels = CParameterSetter.GetBoolSettings(ESettings.useReducedReftreeModels); if (useReducedReftreeModels || !File.Exists(refTreePath)) { Obj.Name += "_reduced"; string reducedObjFileName = pFileName + "_reduced.obj"; if (!useReducedReftreeModels) { CDebug.WriteLine("Reftree " + refTreePath + " OBJ does not exist."); CDebug.WriteLine("Try reduced file: " + reducedObjFileName); } refTreePath = GetRefTreeFilePath(pFileName, reducedObjFileName); if (!File.Exists(refTreePath)) { CDebug.Error("No ref tree OBJ found!"); return; } } Obj.LoadObj(refTreePath); }
public static void Init() { useTreeMaterial = CParameterSetter.GetBoolSettings(ESettings.colorTrees); materialSet = new Dictionary <EMaterial, List <int> >(); materials = new Mtl("colors"); AddMaterial("invalid", .3f, EMaterial.Invalid); AddMaterial("alarm", 1, 0, 0, EMaterial.Alarm); AddMaterial("fake", 1, 0, 1, EMaterial.Fake); AddMaterial("checkTree", 0, 0, 1, EMaterial.CheckTree); //https://www.december.com/html/spec/colorper.html AddMaterial("unassignedGold", .6f, .8f, .1f, EMaterial.UnassignedPoint); AddMaterial("groundBrown", .62f, .44f, .23f, EMaterial.GroundPoint); AddMaterial("vegeGreen", .6f, 1, .6f, EMaterial.VegePoint); AddMaterial("buildingRed", .63f, .32f, .18f, EMaterial.BuildingPoint); AddTreeMaterial("red", 1, 0, 0); AddTreeMaterial("orange", 1, .5f, 0); AddTreeMaterial("lightOrange", 1, .2f, 0); AddTreeMaterial("pink", 1, 0, .5f); AddTreeMaterial("purple", .5f, 0, .5f); AddTreeMaterial("green", 0, 1, 0); AddTreeMaterial("yellow", 1, 1, 0); AddTreeMaterial("azure", 0, 1, 1); AddTreeMaterial("lightBlue", 0, .5f, 1); AddTreeMaterial("darkBlue", 0, 0, .3f); AddTreeMaterial("mediumBlue", 0, 0, .7f); }
public static void Init() { string eq = CParameterSetter.GetStringSettings(ESettings.treeRadius); treeRadiusExpression = CreateExpression(eq); NeedsReinit = false; }
public static string LasClip(string classifyFilePath) { string shapefilePath = CParameterSetter.GetStringSettings(ESettings.shapeFilePath); string shapefileName = CUtils.GetFileName(shapefilePath); if (!File.Exists(shapefilePath)) { throw new Exception($"shapefile does not exist. {shapefilePath}"); } string clipFileName = $"{forestFileName}_clip[{shapefileName}]"; string clipFilePath = currentTmpFolder + clipFileName + LAZ; if (File.Exists(clipFilePath)) { return(clipFilePath); //already created } string clip = "lasclip -i " + classifyFilePath + " -poly " + shapefilePath + " -o " + clipFilePath; CCmdController.RunLasToolsCmd(clip, clipFilePath); return(clipFilePath); }
/// <summary> /// Split preprocessed file into tiles and converto to txt /// </summary> internal static List <string> GetTxtFilesPaths(string pPreprocessedFilePath) { List <string> result = new List <string>(); int tileSize = CParameterSetter.GetIntSettings(ESettings.tileSize); string outputFolderPath = GetTiledFilesFolder( CUtils.GetFileName(pPreprocessedFilePath), tileSize); FileInfo[] tiles; //lastile splits file into tiles even if tileSize is bigger //todo: WHY? //=> dont split to tiles if (CProjectData.mainHeader.Width <= tileSize && CProjectData.mainHeader.Height <= tileSize) { tiles = new FileInfo[] { new FileInfo(pPreprocessedFilePath) }; } else { tiles = GetTiledFiles(pPreprocessedFilePath, outputFolderPath, tileSize, CProjectData.bufferSize); } for (int i = 0; i < tiles.Length; i++) { string txtFile = Las2Txt(tiles[i].FullName, outputFolderPath); result.Add(txtFile); } return(result); }
public void UpdateRangeBounds() { //X //range has to match file coordinates //in project are used coordinates moved by offset Vector3 min = (Vector3)CProjectData.sourceFileHeader.Min_orig; Vector3 max = (Vector3)CProjectData.sourceFileHeader.Max_orig; form.trackBarRangeXmin.SetRange((int)min.X * 10, (int)max.X * 10); form.trackBarRangeXmax.SetRange((int)min.X * 10, (int)max.X * 10); int minValue = CParameterSetter.GetIntSettings(ESettings.rangeXmin); int maxValue = CParameterSetter.GetIntSettings(ESettings.rangeXmax); //if last values were out of slider bounds, update them if (minValue >= form.trackBarRangeXmax.Maximum) { minValue = form.trackBarRangeXmax.Minimum; } if (maxValue <= form.trackBarRangeXmax.Minimum) { maxValue = form.trackBarRangeXmax.Maximum; } TrySetTrackBarValue(form.trackBarRangeXmin, minValue); TrySetTrackBarValue(form.trackBarRangeXmax, maxValue); //form.trackBarRangeXmin.Value = // minValue.LimitToRange(form.trackBarRangeXmin.Minimum, form.trackBarRangeXmin.Maximum); //form.trackBarRangeXmax.Value = CUtils.LimitToRange(maxValue, // form.trackBarRangeXmax.Minimum, form.trackBarRangeXmax.Maximum); SetRangeX(); //Y form.trackBarRangeYmin.SetRange((int)min.Y * 10, (int)max.Y * 10); form.trackBarRangeYmax.SetRange((int)min.Y * 10, (int)max.Y * 10); minValue = CParameterSetter.GetIntSettings(ESettings.rangeYmin); maxValue = CParameterSetter.GetIntSettings(ESettings.rangeYmax); //if last values were out of slider bounds, update them if (minValue >= form.trackBarRangeYmax.Maximum) { minValue = form.trackBarRangeYmax.Minimum; } if (maxValue <= form.trackBarRangeYmax.Minimum) { maxValue = form.trackBarRangeYmax.Maximum; } //WARNING: when float is used there is a possible value overflow //form.trackBarRangeYmin.Value = CUtils.LimitToRange(minValue, // form.trackBarRangeYmin.Minimum, form.trackBarRangeYmin.Maximum); //form.trackBarRangeYmax.Value = CUtils.LimitToRange(maxValue, // form.trackBarRangeYmax.Minimum, form.trackBarRangeYmax.Maximum); TrySetTrackBarValue(form.trackBarRangeYmin, minValue); TrySetTrackBarValue(form.trackBarRangeYmax, maxValue); SetRangeY(); }
/// <summary> /// Returns path to folder containing tiles of given size. /// If doesnt exist => create it /// </summary> private static string GetTiledFilesFolder(string pSourceFileName, int pTileSize) { string forestFileName = CUtils.GetFileName(CParameterSetter.GetStringSettings(ESettings.forestFileName)); string path = currentTmpFolder + $"_tiles[{pTileSize}]_{pSourceFileName}\\"; Directory.CreateDirectory(path); return(path); }
/// <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); }
public static string LasSplit(string classifyFilePath) { SSplitRange range = CParameterSetter.GetSplitRange(); if (!range.IsValid()) { throw new Exception($"range {range} is not valid"); } string splitFileName = $"{forestFileName}_s[{range.MinX},{range.MinY}]-[{range.MaxX},{range.MaxY}]"; string keepXY = $" -keep_xy {range.MinX} {range.MinY} {range.MaxX} {range.MaxY}"; string splitFilePath = currentTmpFolder + splitFileName + LAZ; if (File.Exists(splitFilePath)) { return(splitFilePath); //already created } string split = "lassplit -i " + classifyFilePath + keepXY + " -o " + splitFilePath; //todo: when split file not created there is no error...(ie when invalid range is given) try { //todo: split fails on jen2_merged_preprocessed.laz CCmdController.RunLasToolsCmd(split, splitFilePath); } catch (Exception e) { //split command creates file with other name... CDebug.WriteLine($"exception {e}"); } //for some reason output split file gets appendix: "_0000000" => rename it #region rename //rename split file //todo: move to Utils string sourceFile = splitFileName + "_0000000" + LAZ; FileInfo fi = new FileInfo(currentTmpFolder + sourceFile); if (fi.Exists) { fi.MoveTo(currentTmpFolder + splitFileName + LAZ); Console.WriteLine("Split file Renamed."); } else { //todo: implement my own exception throw new Exception($"Split file not created. Perhaps there are no points at range {range}?"); } #endregion return(splitFilePath); }
private static float GetPartitionSize(float size) { int partitionStep = CParameterSetter.GetIntSettings(ESettings.partitionStep); int xParts = (int)Math.Ceiling(arrayWidth / partitionStep); int zParts = (int)Math.Ceiling(arrayHeight / partitionStep); int parts = xParts * zParts; return(size / Math.Max(1, parts)); }
private static void ExportCsv(List <Tuple <string, object> > pParams, string pName, bool pExportGlobal = false) { string fileName = pName + ".csv"; string filePath = CProjectData.outputTileSubfolder + "/" + fileName; string[] pathSplit = CProjectData.outputTileSubfolder.Split('\\'); string folderName = pathSplit[pathSplit.Length - 2]; string line; using (var outStream = File.OpenWrite(filePath)) using (var writer = new StreamWriter(outStream)) { writer.WriteLine(GetHeaderString(pParams)); writer.Write(folderName); line = folderName; foreach (Tuple <string, object> param in pParams) { string val = "," + param.Item2; writer.Write(val); line += val; } } string mainSummaryFile = CParameterSetter.GetStringSettings(ESettings.analyticsFilePath); FileMode fileMode = FileMode.Append; if (!File.Exists(mainSummaryFile)) { CDebug.WriteLine("analytics file not defined"); if (!string.IsNullOrEmpty(mainSummaryFile)) { fileMode = FileMode.Create; CDebug.WriteLine(" - creating"); } else { return; } } //if Append => file exists //just check if already contains some text //we expect, that if it already has text, it also contains header bool hasHeader = fileMode == FileMode.Append && File.ReadAllLines(mainSummaryFile).Length != 0; using (FileStream fs = new FileStream(mainSummaryFile, fileMode, FileAccess.Write)) using (var writer = new StreamWriter(fs)) { if (!hasHeader) { writer.WriteLine(GetHeaderString(pParams)); } writer.WriteLine(line); } }
public static void OnLastSequenceEnd() { if (string.IsNullOrEmpty(lastSequenceFile)) { return; } CParameterSetter.SetParameter(ESettings.forestFileFullName, lastSequenceFile); }
private static void CheckAGB() { string problem = CBiomassController.IsValidEquation(CParameterSetter.GetStringSettings(ESettings.agb)); if (problem.Length > 0) { problems.Add($"DBH equation problem: {problem}"); } }
private static void CheckTreeRadius() { string problem = CTreeRadiusCalculator.IsValidEquation(CParameterSetter.GetStringSettings(ESettings.treeRadius)); if (problem.Length > 0) { problems.Add($"tree radius equation problem: {problem}"); } }
public static bool IsSequence() { string mainFile = CParameterSetter.GetStringSettings(ESettings.forestFileName); if (!File.Exists(mainFile)) { return(false); } return(Path.GetExtension(mainFile) == SEQ_EXTENSION); }
private void SetRangeY() { CParameterSetter.SetParameter(ESettings.rangeYmin, form.trackBarRangeYmin.Value); CParameterSetter.SetParameter(ESettings.rangeYmax, form.trackBarRangeYmax.Value); SSplitRange range = CParameterSetter.GetSplitRange(); form.textRangeYmin.Text = range.ToStringYmin(); form.textRangeYmax.Text = range.ToStringYmax(); form.labelRangeYval.Text = range.RangeY.ToString("0.0") + " m"; }
/// <summary> /// Generates point feature representing position of the tree. /// Attributes: /// id, X, Y, height, DBH, AGB, type /// </summary> private static Feature GetTreePosition(CTree pTree, ref StringBuilder pString) { CVector3D globalTreepos = CUtils.GetGlobalPosition(pTree.peak.Center); IPoint myPoint = factory.CreatePoint(new Coordinate(globalTreepos.X, globalTreepos.Y)); AttributesTable attributesTable = new AttributesTable(); attributesTable.Add(ATTR_ID, pTree.treeIndex); pString.Append(pTree.treeIndex + SEP); shpInfoMain.Append(pTree.treeIndex + SEP); attributesTable.Add(ATTR_X, globalTreepos.X.ToString(NUM_FORMAT)); attributesTable.Add(ATTR_Y, globalTreepos.Y.ToString(NUM_FORMAT)); pString.Append(globalTreepos.X.ToString(NUM_FORMAT) + SEP); shpInfoMain.Append(globalTreepos.X.ToString(NUM_FORMAT) + SEP); pString.Append(globalTreepos.Y.ToString(NUM_FORMAT) + SEP); shpInfoMain.Append(globalTreepos.Y.ToString(NUM_FORMAT) + SEP); float treeHeight = pTree.GetTreeHeight(); attributesTable.Add(ATTR_HEIGHT, treeHeight.ToString(NUM_FORMAT)); pString.Append(treeHeight.ToString(NUM_FORMAT) + SEP); shpInfoMain.Append(treeHeight.ToString(NUM_FORMAT) + SEP); if (CParameterSetter.GetBoolSettings(ESettings.calculateDBH)) { double stemDiameter = CBiomassController.GetTreeStemDiameter(treeHeight); attributesTable.Add(ATTR_DBG, stemDiameter.ToString(NUM_FORMAT)); pString.Append(stemDiameter.ToString(NUM_FORMAT) + SEP); shpInfoMain.Append(stemDiameter.ToString(NUM_FORMAT) + SEP); if (CParameterSetter.GetBoolSettings(ESettings.calculateAGB)) { double biomass = CBiomassController.GetTreeBiomass(stemDiameter, treeHeight); attributesTable.Add(ATTR_AGB, biomass.ToString(NUM_FORMAT)); pString.Append(biomass.ToString(NUM_FORMAT) + SEP); shpInfoMain.Append(biomass.ToString(NUM_FORMAT) + SEP); } } //251 - Finalizace produktu //attributesTable.Add(ATTR_TYPE, pTree.assignedRefTree.RefTreeTypeName); //pString.Append(pTree.assignedRefTree.RefTreeTypeName + SEP); Feature feature = new Feature(myPoint, attributesTable); pString.AppendLine(); shpInfoMain.AppendLine(); return(feature); }
/// <summary> /// Assigns all vege points in preprocess arrays. /// Then it calculates the expected average tree height. /// </summary> private void PreprocessVegePoints() { const int debugFrequency = 10000; DateTime PreprocessVegePointsStart = DateTime.Now; CDebug.WriteLine("PreprocessVegePoints", true); DateTime preprocessVegePointsStart = DateTime.Now; DateTime previousDebugStart = DateTime.Now; for (int i = 0; i < vege.Count; i++) { if (CProjectData.backgroundWorker.CancellationPending) { return; } Vector3 point = vege[i]; preprocessDetailArray.AddPointInField(point); preprocessNormalArray.AddPointInField(point); CDebug.Progress(i, vege.Count, debugFrequency, ref previousDebugStart, preprocessVegePointsStart, "preprocessed point"); } //fill missing heigh - will be used in detection process //rank 2 - rank 1 (max) extends local maximas -> unwanted effect preprocessDetailArray.FillMissingHeights(2); preprocessDetailArray.FillMissingHeights(2); CDebug.Duration("PreprocessVegePoints", PreprocessVegePointsStart); //determine average tree height if (CParameterSetter.GetBoolSettings(ESettings.autoAverageTreeHeight)) { //not valid anymore //why not valid??...seems to work fine CTreeManager.AVERAGE_TREE_HEIGHT = preprocessNormalArray.GetAverageZ(); if (float.IsNaN(CTreeManager.AVERAGE_TREE_HEIGHT)) { CDebug.Error("AVERAGE_TREE_HEIGHT = NaN. using input value"); CTreeManager.AVERAGE_TREE_HEIGHT = CParameterSetter.GetIntSettings(ESettings.avgTreeHeigh); } } else { CTreeManager.AVERAGE_TREE_HEIGHT = CParameterSetter.GetIntSettings(ESettings.avgTreeHeigh); } }
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(); }
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(); }
/// <summary> /// Calculates estimated file size /// </summary> private static float GetResultFileSize() { CHeaderInfo header = CProjectData.sourceFileHeader; if (header == null) { return(0); } arrayHeight = header.Height; arrayWidth = header.Width; if ((ESplitMode)CParameterSetter.GetIntSettings(ESettings.currentSplitMode) == ESplitMode.Manual) { SSplitRange range = CParameterSetter.GetSplitRange(); arrayWidth = range.RangeX; arrayHeight = range.RangeY; } float area = arrayWidth * arrayHeight; const float treeStructure = .05f; const float reftreeSize = 1; const float treeBoxSize = .01f; const float treeDensity = .1f; //1 tree per 10 squared meters float groundSize = 5; //its just small, no reason to count it in float totalSize = groundSize; if (CParameterSetter.GetBoolSettings(ESettings.exportTreeStructures)) { totalSize += area * treeDensity * treeStructure; } if (CParameterSetter.GetBoolSettings(ESettings.exportTreeBoxes)) { totalSize += area * treeDensity * treeBoxSize; } if (CParameterSetter.GetBoolSettings(ESettings.exportRefTrees)) { totalSize += area * treeDensity * reftreeSize; } return(totalSize); }
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"); } } }
private static void CheckRange() { switch ((ESplitMode)CParameterSetter.GetIntSettings(ESettings.currentSplitMode)) { case ESplitMode.Manual: SSplitRange range = CParameterSetter.GetSplitRange(); if (!range.IsValid()) { problems.Add($"range {range} is not valid"); } break; case ESplitMode.Shapefile: string shapefilePath = CParameterSetter.GetStringSettings(ESettings.shapeFilePath); if (!File.Exists(shapefilePath)) { problems.Add($"shapefile not defined. {shapefilePath}"); } break; } }
private void SetSplitMode(ESplitMode pMode) { CParameterSetter.SetParameter(ESettings.currentSplitMode, (int)pMode); bool isManual = pMode == ESplitMode.Manual; form.trackBarRangeXmin.Enabled = isManual; form.trackBarRangeXmax.Enabled = isManual; form.trackBarRangeYmin.Enabled = isManual; form.trackBarRangeYmax.Enabled = isManual; form.textRangeXmin.Enabled = isManual; form.textRangeXmax.Enabled = isManual; form.textRangeYmin.Enabled = isManual; form.textRangeYmax.Enabled = isManual; bool isShapefile = pMode == ESplitMode.Shapefile; form.textShapefile.Enabled = isShapefile; form.btnShapefile.Enabled = isShapefile; }
/// <summary> /// True = everything ok /// </summary> public static bool CheckProblems() { Reset(); CheckPath("Forest", CParameterSetter.GetStringSettings(ESettings.forestFileFullName), true); //if(!CRxpParser.IsRxp) //{ // CheckPath("Reftree", CParameterSetter.GetStringSettings(ESettings.reftreeFolderPath), false); //} CheckPath("Output", CParameterSetter.GetStringSettings(ESettings.outputFolderPath), false); if (CParameterSetter.GetBoolSettings(ESettings.useCheckTreeFile)) { CheckPath("Checktree", CParameterSetter.GetStringSettings(ESettings.checkTreeFilePath), true); } CheckRange(); CheckExport(); if (CShpController.exportShape) { if (CParameterSetter.GetBoolSettings(ESettings.calculateDBH)) { CheckDBH(); } if (CParameterSetter.GetBoolSettings(ESettings.calculateAGB)) { CheckAGB(); } CheckTreeRadius(); } bool hasProblems = problems.Count > 0; if (hasProblems) { CDebug.WriteProblems(problems); problems.Clear(); } return(!hasProblems); }
/// <summary> /// When user sets range in textBox manually, update the value after the focus of /// textbox is lost, otherwise it always changes the selection /// </summary> internal void textRange_LostFocus(TrackBar pTrackBar, ESettings pOppositeRange, string textRangeValue) { float value = 0; if (textRangeValue.Length == 0) { return; } bool parsed; bool hasSign = textRangeValue[0] == '+' || textRangeValue[0] == '-'; if (hasSign) { int sign = textRangeValue[0] == '-' ? -1 : +1; parsed = float.TryParse(textRangeValue.Substring(1, textRangeValue.Length - 1), out value); if (!parsed) { return; } float newValue = CParameterSetter.GetIntSettings(pOppositeRange) / 10 + sign * value; TrySetTrackBarValue(pTrackBar, (int)newValue * 10); } else { parsed = float.TryParse(textRangeValue, out value); if (!parsed) { return; } TrySetTrackBarValue(pTrackBar, (int)value * 10); } SetRangeX(); SetRangeY(); }
private static void CheckExport() { bool willExportAny3D = CParameterSetter.GetBoolSettings(ESettings.export3d); if (willExportAny3D) { bool exportTreeStructures = CParameterSetter.GetBoolSettings(ESettings.exportTreeStructures); bool exportReftrees = CParameterSetter.GetBoolSettings(ESettings.exportRefTrees); bool exportTreeBoxes = CParameterSetter.GetBoolSettings(ESettings.exportTreeBoxes); willExportAny3D = exportTreeStructures || exportReftrees || exportTreeBoxes; } bool willExportSomeportBitmap = CParameterSetter.GetBoolSettings(ESettings.exportBitmap); if (willExportSomeportBitmap) { bool exportBMHeightmap = CParameterSetter.GetBoolSettings(ESettings.ExportBMHeightmap); bool exportBMTreeBorders = CParameterSetter.GetBoolSettings(ESettings.ExportBMTreeBorders); bool exportBMTreePositions = CParameterSetter.GetBoolSettings(ESettings.ExportBMTreePositions); willExportSomeportBitmap = exportBMHeightmap || exportBMTreeBorders || exportBMTreePositions; } bool willExportAnyShp = CParameterSetter.GetBoolSettings(ESettings.exportShape); if (willExportAnyShp) { bool exportShapeTreeAreas = CParameterSetter.GetBoolSettings(ESettings.exportShapeTreeAreas); bool exportShapeTreePositions = CParameterSetter.GetBoolSettings(ESettings.exportShapeTreePositions); willExportAnyShp = exportShapeTreeAreas || exportShapeTreePositions; } bool willExportAnyLas = CParameterSetter.GetBoolSettings(ESettings.exportLas); if (!willExportAny3D && !willExportSomeportBitmap && !willExportAnyShp && !willExportAnyLas) { problems.Add($"No reason to process when no 3D-obj, bitmap, SHP-file or LAS-file will be exported."); return; } }
internal static string ProcessForestFolder() { //string forestFolder = CParameterSetter.GetStringSettings(ESettings.forestFolderPath); DirectoryInfo forestFolder = new DirectoryInfo(CParameterSetter.GetStringSettings(ESettings.forestFolderPath)); if (!forestFolder.Exists) { CDebug.Error("forestFolderPath not set"); return(""); } string outputFilePath = forestFolder.FullName + $"\\{forestFolder.Name}_merged.laz"; //merge all LAS and LAX files in the folder into 1 file string merge = "lasmerge -i " + forestFolder.FullName + "\\*.las " + forestFolder.FullName + "\\*.laz " + " -o " + outputFilePath; CCmdController.RunLasToolsCmd(merge, outputFilePath); return(outputFilePath); }
public static void SetValues() { if (configs.Count == 0) { return; } CDebug.WriteLine("SetValues from config"); SSequenceConfig currentConfig = configs[currentConfigIndex]; CParameterSetter.SetParameter(ESettings.forestFileFullName, currentConfig.path); int treeHeight = currentConfig.treeHeight; CParameterSetter.SetParameter(ESettings.autoAverageTreeHeight, treeHeight <= 0); if (treeHeight > 0) { CParameterSetter.SetParameter(ESettings.avgTreeHeigh, treeHeight); } CParameterSetter.SetParameter(ESettings.treeExtent, currentConfig.treeExtent); CParameterSetter.SetParameter(ESettings.treeExtentMultiply, currentConfig.treeExtentMultiply); }