Skip to content
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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

tripples25
Copy link

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();

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)));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А здесь тяжело читается из-за того, что создаешь прямоугольник прямо внутри метода, возможно лучше в отдельную переменную вынести

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)

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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А если центр будет иметь отрицательные координаты?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants