Beispiel #1
0
        private void PruneConsecutiveDuplicateGeometryPoints(SurfaceLine surfaceLine)
        {
            Point3D[] readPoints = surfaceLine.Points.ToArray();
            var       consecutiveDuplicatePointIndices = new List <int>();
            Point3D   previousPoint = null;

            for (var j = 0; j < readPoints.Length; j++)
            {
                if (j != 0 && readPoints[j].Equals(previousPoint))
                {
                    consecutiveDuplicatePointIndices.Add(j);
                    previousPoint = readPoints[j];
                }
                else
                {
                    previousPoint = readPoints[j];
                }
            }

            if (consecutiveDuplicatePointIndices.Any())
            {
                Log.WarnFormat(RiskeerCommonIOResources.SurfaceLinesCsvImporter_SurfaceLine_0_has_multiple_duplicate_geometry_points_and_is_ignored,
                               surfaceLine.Name);
                surfaceLine.SetGeometry(readPoints.Where((p, index) => !consecutiveDuplicatePointIndices.Contains(index)));
            }
        }
Beispiel #2
0
        private SurfaceLine CreateSurfaceLine(string readText)
        {
            string[] tokenizedString = TokenizeString(readText);

            string surfaceLineName       = GetSurfaceLineName(tokenizedString);
            IEnumerable <Point3D> points = GetSurfaceLinePoints(tokenizedString, surfaceLineName);

            var surfaceLine = new SurfaceLine
            {
                Name = surfaceLineName
            };

            try
            {
                surfaceLine.SetGeometry(points);
            }
            catch (ArgumentException e)
            {
                throw CreateLineParseException(lineNumber, surfaceLine.Name, e.Message);
            }

            return(surfaceLine);
        }