-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Бабин Георгий #218
base: master
Are you sure you want to change the base?
Бабин Георгий #218
Conversation
…s on this feature
…ted drawing into separate class
public void DrawShape() | ||
{ | ||
var center = new Point(image.Width / 2, image.Height / 2); | ||
var radius = (int)layouter.Rectangles.Select(x => Math.Sqrt(Math.Pow(x.X - center.X, 2) + Math.Pow(x.Y - center.Y, 2))).Max(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Слишком длинная строка, логично было бы вынести в отдельный метод, возможно даже в метод расширения
{ | ||
var center = new Point(image.Width / 2, image.Height / 2); | ||
var radius = (int)layouter.Rectangles.Select(x => Math.Sqrt(Math.Pow(x.X - center.X, 2) + Math.Pow(x.Y - center.Y, 2))).Max(); | ||
graphics.DrawEllipse(Pens.Brown, new Rectangle(new Point(center.X - radius, center.Y - radius), new Size(radius * 2, radius * 2))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А здесь тяжело читается из-за того, что создаешь прямоугольник прямо внутри метода, возможно лучше в отдельную переменную вынести
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вообще как будто самым логичным вариантом будет создать здесь отдельного "поставщика" точек, в которых нужно нарисовать фигуру
graphics.Save(); | ||
} | ||
|
||
public void SaveImage(string filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это не ответственность визуализатора
|
||
protected BaseCloudLayouter(Point center) | ||
{ | ||
this.center = center; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А если центр будет иметь отрицательные координаты?
@69raccoon96