Example #1
0
        private CVector3D ParseLineVector3(string pLine)
        {
            if (string.IsNullOrEmpty(pLine))
            {
                return(CVector3D.Zero);
            }

            string[] split  = pLine.Split(null);
            int      length = split.Length;

            //											X					Y					Z
            return(CLazTxtParser.ParseHeaderVector3(split[length - 3], split[length - 2], split[length - 1]));
        }
Example #2
0
        /// <summary>
        /// Reads parsed lines and loads class and point list.
        /// Result is sorted in descending order.
        /// </summary>
        public static List <Tuple <EClass, Vector3> > ParseLines(string[] lines, bool pUseHeader)
        {
            CDebug.Step(EProgramStep.ParseLines);

            //store coordinates to corresponding data strucures based on their class
            const int DEFAULT_START_LINE = 19;
            int       startLine          = pUseHeader && CProjectData.mainHeader != null ? DEFAULT_START_LINE : 0;

            CDebug.Warning("loading " + lines.Length + " lines!");

            int linesToRead = lines.Length;

            //todo: check that "classic" processed files work correctly without using default class
            //bool classesCorect = true;
            List <Tuple <EClass, Vector3> > parsedLines = new List <Tuple <EClass, Vector3> >();

            if (useDebugData)
            {
                parsedLines = CDebugData.GetStandartTree();
                //CDebugData.DefineArray(true, 0);
            }
            else
            {
                for (int i = startLine; i < linesToRead; i++)
                {
                    // <class, coordinate>
                    Tuple <EClass, Vector3> c = CLazTxtParser.ParseLine(lines[i], pUseHeader);
                    if (c == null)
                    {
                        continue;
                    }

                    //some files have different class counting. we are interested only in classes in EClass
                    //if(c.Item1 == EClass.Other)
                    //{
                    //	c = new Tuple<EClass, Vector3>(EClass.Vege, c.Item2);
                    //	classesCorect = false;
                    //}
                    parsedLines.Add(c);
                }
            }

            //if(!classesCorect)
            //{
            //	CDebug.WriteLine("classes not correct. using default class");
            //}
            CDebug.Count("parsedLines", parsedLines.Count);

            return(parsedLines);
        }