aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2022-03-20 09:35:37 +0200
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2022-03-20 09:35:37 +0200
commitb013a21554870bf80dfa4260ec14b2e1abfd97dc (patch)
treead086403d2bb27f0c4a8558334bad0c497dc2964 /Software/Visual_Studio
parentf4250aad05835e7864dede0cbb376bf463fbb62f (diff)
downloadTango-b013a21554870bf80dfa4260ec14b2e1abfd97dc.tar.gz
Tango-b013a21554870bf80dfa4260ec14b2e1abfd97dc.zip
Jobs - update index by grouped segments.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/Tango.BL/Entities/Job.cs39
1 files changed, 28 insertions, 11 deletions
diff --git a/Software/Visual_Studio/Tango.BL/Entities/Job.cs b/Software/Visual_Studio/Tango.BL/Entities/Job.cs
index 1f0b73cfa..04451da31 100644
--- a/Software/Visual_Studio/Tango.BL/Entities/Job.cs
+++ b/Software/Visual_Studio/Tango.BL/Entities/Job.cs
@@ -529,23 +529,40 @@ namespace Tango.BL.Entities
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
int fromAngle = -90;
- double totalLength = Segments.Sum(x => x.Length); //Excluding inter segment.
+ double totalLength = 0;//Segments.Sum(x => x.Length); //Excluding inter segment.
+ foreach(var isegm in OrderedSegmentsWithGroups)
+ {
+ if (isegm is SegmentsGroup group)
+ {
+ foreach (var innerSegment in group.Segments)
+ {
+ totalLength += innerSegment.Length*group.Repeats;
+ }
+ }
+ else if(isegm is Segment segment)
+ {
+ totalLength += segment.Length;
+ }
+ }
foreach (var segm in OrderedSegmentsWithGroups)
{
if (segm is SegmentsGroup group)
{
- foreach(var innerSegment in group.Segments)
+ for (int i = 0; i < group.Repeats; i++)
{
- int toAngle = (int)((innerSegment.Length / totalLength) * 360d);
- Rectangle rect = new Rectangle(0, 0, bmp.Width - 2, bmp.Height - 2);
- g.FillPie(innerSegment.CreateGdiBrush(bmp.Width - 2, bmp.Height - 2), rect, fromAngle, toAngle);
+ foreach (var innerSegment in group.Segments)
+ {
+ int toAngle = (int)((innerSegment.Length / totalLength) * 360d);
+ Rectangle rect = new Rectangle(0, 0, bmp.Width - 2, bmp.Height - 2);
+ g.FillPie(innerSegment.CreateGdiBrush(bmp.Width - 2, bmp.Height - 2), rect, fromAngle, toAngle);
- Pen pen = new Pen(Color.Gainsboro);
- g.DrawEllipse(pen, rect);
- pen.Dispose();
- fromAngle += toAngle;
+ Pen pen = new Pen(Color.Gainsboro);
+ g.DrawEllipse(pen, rect);
+ pen.Dispose();
+ fromAngle += toAngle;
+ }
}
}
else if(segm is Segment segment)
@@ -605,9 +622,9 @@ namespace Tango.BL.Entities
Segment segment = new Segment();
segment.Name = "Standard Segment";
- if (Segments.Count > 0)
+ if (OrderedSegmentsWithGroups.Count > 0)
{
- segment.SegmentIndex = Segments.Max(x => x.SegmentIndex) + 1;
+ segment.SegmentIndex = OrderedSegmentsWithGroups.Max(x => x.SegmentIndex) + 1;
}
else
{