public object Clone() { DescriptionRenderer n = new DescriptionRenderer(symbolDB); n.margin = this.margin; n.cellSize = this.cellSize; n.numColumns = this.numColumns; n.description = this.description; n.descriptionKind = this.descriptionKind; n.replaceMultiplySign = this.replaceMultiplySign; return n; }
DescriptionRenderer renderer; // The description renderer that holds the description. #endregion Fields #region Constructors // Create a new description course object. public DescriptionCourseObj(Id<Special> specialId, PointF topLeft, float cellSize, SymbolDB symbolDB, DescriptionLine[] description, DescriptionKind kind, int numColumns) : base(Id<ControlPoint>.None, Id<CourseControl>.None, specialId, 1, new CourseAppearance(), GetRect(topLeft, cellSize, symbolDB, description, kind, numColumns)) { // Create the renderer. renderer = new DescriptionRenderer(symbolDB); renderer.Description = description; renderer.DescriptionKind = kind; renderer.Margin = cellSize / 20; // about the thickness of the thick lines. renderer.CellSize = cellSize; renderer.NumberOfColumns = numColumns; aspectAnglesByColumns = ComputeAspectAngles(); }
// Get the rectangle used by the description. static RectangleF GetRect(PointF topLeft, float cellSize, SymbolDB symbolDB, DescriptionLine[] description, DescriptionKind kind, int numColumns) { // Create the renderer. DescriptionRenderer renderer = new DescriptionRenderer(symbolDB); renderer.Description = description; renderer.DescriptionKind = kind; renderer.Margin = cellSize / 20; // about the thickness of the thick lines. renderer.CellSize = cellSize; renderer.NumberOfColumns = numColumns; SizeF size = renderer.Measure(); return new RectangleF(topLeft.X, topLeft.Y - size.Height, size.Width, size.Height); }
// Get a description renderer for rendering the description from a course view. private DescriptionRenderer GetRenderer(CourseView courseView) { DescriptionFormatter descFormatter = new DescriptionFormatter(courseView, symbolDB); DescriptionKind descKind = GetDescriptionKind(courseView); DescriptionLine[] description = descFormatter.CreateDescription(descKind == DescriptionKind.Symbols); DescriptionRenderer renderer = new DescriptionRenderer(symbolDB); renderer.CellSize = descPrintSettings.BoxSize / 0.254F; renderer.Description = description; renderer.DescriptionKind = descKind; renderer.Margin = 0; return renderer; }