/// <summary> /// Sets up a point cloud from an XML root element. /// </summary> /// <param name="rootElement">The root element.</param> protected void SetupFrom(XElement rootElement) { // Read scale, if it exists. foreach (XElement scaleElement in rootElement.Elements("Scale")) { double scale = XmlUtils.GetDouble(scaleElement); if (scale < 0.0) { TaskDialog.Show("Scale error", "The value of scale is not a valid number greater than zero."); } else { m_scale = scale; } } // Read cells. m_storedCells = new List <PointCloudCellStorage>(); foreach (XElement cellElement in rootElement.Elements("Cell")) { PointCloudCellStorage cell = new PointCloudCellStorage(cellElement); m_storedCells.Add(cell); AddCellToOutline(cell); cell.GeneratePoints(); } }
/// <summary> /// Adds a new cell to the point cloud. /// </summary> /// <param name="lowerLeft">The lower left point.</param> /// <param name="upperRight">The upper right point.</param> /// <param name="color">The color.</param> /// <param name="randomize">True to randomize point number and location, false for a regular arrangement of points.</param> protected void AddCell(XYZ lowerLeft, XYZ upperRight, int color, bool randomize) { PointCloudCellStorage storage = new PointCloudCellStorage(lowerLeft, upperRight, color, randomize); storage.GeneratePoints(); m_storedCells.Add(storage); AddCellToOutline(storage); }
/// <summary> /// Sets up a point cloud from an XML root element. /// </summary> /// <param name="rootElement">The root element.</param> protected void SetupFrom(XElement rootElement) { // Read scale, if it exists. foreach (XElement scaleElement in rootElement.Elements("Scale")) { double scale = XmlUtils.GetDouble(scaleElement); if (scale < 0.0) { TaskDialog.Show("Scale error", "The value of scale is not a valid number greater than zero."); } else { m_scale = scale; } } // Read cells. m_storedCells = new List<PointCloudCellStorage>(); foreach (XElement cellElement in rootElement.Elements("Cell")) { PointCloudCellStorage cell = new PointCloudCellStorage(cellElement); m_storedCells.Add(cell); AddCellToOutline(cell); cell.GeneratePoints(); } }