public void CreateProject() { var repo = ProjectRepository.Instance; var baseline = new BaseLine(); BaseLineRepository.Instance.Insert(baseline); var branch = new Branch() { BaseLineId = baseline.Id, IsMainBranch = true, Name = "Master" }; BranchRepository.Instance.Insert(branch); var project = new Project() { Name = "Some Project Name", MainBranchId = branch.Id }; repo.Insert(project); baseline.BranchId = branch.Id; BaseLineRepository.Instance.Update(baseline); branch.ProjectId = project.Id; BranchRepository.Instance.Update(branch); }
// 绘制基准线(用于调试) public void draw_base_line(BaseLine base_line) { for (int i = 0; i < base_line.points.Length - 1; i++) { Debug.DrawLine(base_line.points[i], base_line.points[i + 1], Color.red, 0.0f, false); } }
public static void CopyScreenShotsFromMainBranchBaselineToNewBaseline(BaseLine newBaseLine, IEnumerable <ScreenShot> mainBranchBaselineScreenShots) { foreach (var mainBaselineScreenShot in mainBranchBaselineScreenShots) { var newBaselineScreenShot = new ScreenShot() { BaseLineId = newBaseLine.Id, Name = mainBaselineScreenShot.Name, Status = mainBaselineScreenShot.Status, IsLastPassed = true, ImagePath = mainBaselineScreenShot.ImagePath, ImagePathUrl = mainBaselineScreenShot.ImagePathUrl, PreviewImagePath = mainBaselineScreenShot.PreviewImagePath, PreviewImagePathUrl = mainBaselineScreenShot.PreviewImagePathUrl, BaseLineImagePath = mainBaselineScreenShot.BaseLineImagePath, BaseLineImagePathUrl = mainBaselineScreenShot.BaseLineImagePathUrl, BaseLinePreviewPath = mainBaselineScreenShot.BaseLinePreviewPath, BaseLinePreviewPathUrl = mainBaselineScreenShot.BaseLinePreviewPathUrl, DiffImagePath = mainBaselineScreenShot.DiffImagePath, DiffImagePathUrl = mainBaselineScreenShot.DiffImagePathUrl, DiffPreviewPath = mainBaselineScreenShot.DiffPreviewPath, DiffPreviewPathUrl = mainBaselineScreenShot.DiffPreviewPathUrl, Url = mainBaselineScreenShot.Url }; ScreenShotRepository.Instance.Insert(newBaselineScreenShot); } }
public override void DrawItem(Graphics graphics) { base.DrawItem(graphics); ILineDecorator lineDecorator = base.StyleDecorator as LineDecorator; if (lineDecorator != null) { throw new ArgumentException("Line is not a valid Container"); } else { IGraphicStyleDecorator style = base.StyleDecorator as GraphicStyleDecorator; if (style != null) { base.FillShape(graphics,style.Shape); BaseLine baseLine = null; if (style.BackColor == GlobalValues.DefaultBackColor){ baseLine = new BaseLine (style.ForeColor,style.DashStyle,style.Thickness); } else { baseLine = new BaseLine (style.BackColor,style.DashStyle,style.Thickness); } style.Shape.DrawShape(graphics, baseLine, style.DisplayRectangle); } Items.ForEach(item =>item.DrawItem(graphics)); } }
public override void DrawItem(Graphics graphics) { if (graphics == null) { throw new ArgumentNullException("graphics"); } base.DrawItem(graphics); ILineDecorator lineDecorator = base.StyleDecorator as LineDecorator; if (lineDecorator != null) { GraphicsLineDrawer (graphics); } else { IGraphicStyleDecorator style = base.StyleDecorator as GraphicStyleDecorator; if (style != null) { base.FillShape(graphics,style.Shape); BaseLine baseLine = null; if (style.BackColor == GlobalValues.DefaultBackColor){ baseLine = new BaseLine (style.ForeColor,style.DashStyle,style.Thickness); } else { baseLine = new BaseLine (style.BackColor,style.DashStyle,style.Thickness); } style.Shape.DrawShape(graphics, baseLine, style.DisplayRectangle); } } }
public override void Draw(Graphics graphics) { if (graphics == null) { throw new ArgumentNullException("graphics"); } Rectangle rect = new Rectangle(this.ClientRectangle.Left, this.ClientRectangle.Top, this.ClientRectangle.Right - 1, this.ClientRectangle.Bottom - 1); // backgroundShape.FillShape(graphics, // new SolidFillPattern(this.BackColor), // rect); Border b = new Border(new BaseLine(this.ForeColor, System.Drawing.Drawing2D.DashStyle.Solid, 1)); // DrawFrame(graphics,b); BaseLine line = new BaseLine(base.ForeColor, DashStyle, Thickness, LineCap.Round, LineCap.Round, DashCap.Round); using (Pen pen = line.CreatePen(line.Thickness)){ shape.CornerRadius = this.CornerRadius; GraphicsPath path1 = shape.CreatePath(rect); graphics.DrawPath(pen, path1); } // shape.DrawShape (graphics, // this.Baseline(), // rect); }
public void CreatePenThicknessZeroReturns1() { BaseLine bl = new BaseLine(Color.Red, DashStyle.DashDot, 0, LineCap.DiamondAnchor, LineCap.ArrowAnchor, DashCap.Round); Pen pen = bl.CreatePen(); Assert.AreEqual(1, pen.Width); }
public override void DrawItem(Graphics graphics) { if (graphics == null) { throw new ArgumentNullException("graphics"); } base.DrawItem(graphics); ILineDecorator lineDecorator = base.StyleDecorator as LineDecorator; if (lineDecorator != null) { GraphicsLineDrawer(graphics); } else { IGraphicStyleDecorator style = base.StyleDecorator as GraphicStyleDecorator; if (style != null) { base.FillShape(graphics, style.Shape); BaseLine baseLine = null; if (style.BackColor == GlobalValues.DefaultBackColor) { baseLine = new BaseLine(style.ForeColor, style.DashStyle, style.Thickness); } else { baseLine = new BaseLine(style.BackColor, style.DashStyle, style.Thickness); } style.Shape.DrawShape(graphics, baseLine, style.DisplayRectangle); } } }
public override void DrawItem(Graphics graphics) { base.DrawItem(graphics); ILineDecorator lineDecorator = base.StyleDecorator as LineDecorator; if (lineDecorator != null) { throw new ArgumentException("Line is not a valid Container"); } else { IGraphicStyleDecorator style = base.StyleDecorator as GraphicStyleDecorator; if (style != null) { base.FillShape(graphics, style.Shape); BaseLine baseLine = null; if (style.BackColor == GlobalValues.DefaultBackColor) { baseLine = new BaseLine(style.ForeColor, style.DashStyle, style.Thickness); } else { baseLine = new BaseLine(style.BackColor, style.DashStyle, style.Thickness); } style.Shape.DrawShape(graphics, baseLine, style.DisplayRectangle); } Items.ForEach(item => item.DrawItem(graphics)); } }
protected BaseLine(BaseLine other) { this.p1 = other.P1; AddP1Listeners(this.p1); this.p2 = other.P2; AddP2Listeners(this.p2); }
/// <summary> /// Расчет параметров взаимного расположения /// Этот расчет предполагает, что полилинии направлены в одну сторону /// </summary> /// <param name="baseLine"></param> public void ComputeParameters() { if (BaseLine == null) { throw new System.Exception("Нет ссылки на BaseLine"); } //Начало Point3d startPt = Poly2d.GetPoint3dAt(0);//Начальная точка этой полилинии Point3d closestPtBase = BaseLine.GetClosestPointTo(startPt, false); StartParameterBase = BaseLine.GetParameterAtPoint(closestPtBase); //Параметр BaseLine в точке ближайшей к начальной точке этой полилинии Point3d baseLinePt = BaseLine.GetPointAtParameter(StartParameterBase); //точка на BaseLine Point3d closestPt = Poly2d.GetClosestPointTo(baseLinePt, false); StartParameter = Poly2d.GetParameterAtPoint(closestPt);//Обратный расчет параметра текущей линии //Конец Point3d endPt = Poly2d.GetPoint3dAt(Poly2d.NumberOfVertices - 1);//Конечная точка этой полилинии closestPtBase = BaseLine.GetClosestPointTo(endPt, false); EndParameterBase = BaseLine.GetParameterAtPoint(closestPtBase); //Параметр BaseLine в точке ближайшей к конечной точке этой полилинии baseLinePt = BaseLine.GetPointAtParameter(EndParameterBase); //точка на BaseLine closestPt = Poly2d.GetClosestPointTo(baseLinePt, false); EndParameter = Poly2d.GetParameterAtPoint(closestPt);//Обратный расчет параметра текущей линии }
public void create_base_line(BaseLine base_line, int start, int end, float base_offset, float fluc_amp, float fluc_cycle) { int index = 0; float offset; base_line.total_distance = 0.0f; for(int i = start;i <= end;i++) { Vector3 point = this.road_creator.sections[i].center; Vector3 offset_vector = this.road_creator.sections[i].right; offset = base_offset; offset += (fluc_amp/2.0f)*Mathf.Sin(Mathf.Repeat(base_line.total_distance, fluc_cycle)); point += offset*offset_vector; base_line.points[index] = point; if(index > 0) { base_line.total_distance += Vector3.Distance(base_line.points[index], base_line.points[index - 1]); } // index++; } }
public void CreateCustomPenThicknessEqualsZero() { BaseLine bl = new BaseLine(Color.Red,DashStyle.DashDot,3,LineCap.DiamondAnchor,LineCap.ArrowAnchor,DashCap.Round); Pen pen = bl.CreatePen(0); Assert.AreEqual(1,pen.Width); Assert.AreEqual(DashStyle.DashDot,pen.DashStyle); Assert.AreEqual(Color.Red,pen.Color); }
public void CreateDefaultPen() { BaseLine bl = new BaseLine(Color.Red,DashStyle.DashDot,2,LineCap.DiamondAnchor,LineCap.ArrowAnchor,DashCap.Round); Pen pen = bl.CreatePen(); Assert.AreEqual(2,pen.Width); Assert.AreEqual(DashStyle.DashDot,pen.DashStyle); Assert.AreEqual(Color.Red,pen.Color); }
private List <Branch> BindBranchesWithProjects(ImportConfigModel importedConfig, List <Project> mappedProjects) { var branches = new List <Branch>(); foreach (var mappedProject in mappedProjects) { if (!mappedProject.MainBranchId.HasValue) { throw new Exception(new ErrorMessage() { Code = ErrorMessage.ErorCode.ProjectDontHaveMainBranch, ExceptionMessage = $"Project '{mappedProject.Name}' don't have main branch. Please, manually specify for project which branch should be considered as main." }.ToString()); } var storedBranches = BranchRepository.Instance.Find(new { ProjectId = mappedProject.Id }); var importedBranches = mapper.GetBranches(importedConfig.Projects .First(project => project.Name == mappedProject.Name).Branches).ToList(); var mainBranch = BranchRepository.Instance.Get(mappedProject.MainBranchId.Value); var mainBranchBaselineScreenShots = ScreenShotRepository.Instance.GetBaselineScreenShots(mainBranch.BaseLineId.Value); for (int index = 0; index < importedBranches.Count; index++) { var importedBranch = importedBranches[index]; var storedBranchEqualWithImporedBranch = storedBranches.FirstOrDefault(branch => branch.Name == importedBranch.Name); if (storedBranchEqualWithImporedBranch != null) { importedBranch = storedBranchEqualWithImporedBranch; } else // if branch don't exist in DB, copy a baseline from main branch and screenshots from baseline { importedBranch.ProjectId = mappedProject.Id; importedBranch.Id = BranchRepository.Instance.Insert(importedBranch).Value; var baseline = new BaseLine() { BranchId = importedBranch.Id }; baseline.Id = BaseLineRepository.Instance.Insert(baseline).Value; importedBranch.BaseLineId = baseline.Id; BranchRepository.Instance.Update(importedBranch); CopyScreenShotsFromMainBranchBaselineToNewBaseline(baseline, mainBranchBaselineScreenShots); } branches.Add(importedBranch); } } return(branches); }
public void CreateDefaultPen() { BaseLine bl = new BaseLine(Color.Red, DashStyle.DashDot, 2, LineCap.DiamondAnchor, LineCap.ArrowAnchor, DashCap.Round); Pen pen = bl.CreatePen(); Assert.AreEqual(2, pen.Width); Assert.AreEqual(DashStyle.DashDot, pen.DashStyle); Assert.AreEqual(Color.Red, pen.Color); }
public void CreateCustomPenThicknessEqualsZero() { BaseLine bl = new BaseLine(Color.Red, DashStyle.DashDot, 3, LineCap.DiamondAnchor, LineCap.ArrowAnchor, DashCap.Round); Pen pen = bl.CreatePen(0); Assert.AreEqual(1, pen.Width); Assert.AreEqual(DashStyle.DashDot, pen.DashStyle); Assert.AreEqual(Color.Red, pen.Color); }
public void CheckDefault_2() { BaseLine bl = new BaseLine(Color.Black,DashStyle.DashDot,2,LineCap.DiamondAnchor,LineCap.ArrowAnchor,DashCap.Round); Assert.AreEqual(Color.Black,bl.Color); Assert.AreEqual(DashStyle.DashDot,bl.DashStyle); Assert.AreEqual(2,bl.Thickness); Assert.AreEqual(LineCap.DiamondAnchor,bl.StartLineCap); Assert.AreEqual(LineCap.ArrowAnchor,bl.EndLineCap); Assert.AreEqual(DashCap.Round,bl.DashLineCap); }
public void ScaleH2() { VerticalRhythm vr = new VerticalRhythm(new VerticalRhythmOptions { BaseFontSize = "16px", BaseLineHeight = "1.5" }); BaseLine baseLine = vr.Scale(2); Assert.AreEqual("4rem", baseLine.FontSize); Assert.AreEqual("4.5rem", baseLine.LineHeight); }
public void CheckDefault_1() { BaseLine bl = new BaseLine(Color.Black,DashStyle.DashDot,2); Assert.AreEqual(Color.Black,bl.Color); Assert.AreEqual(DashStyle.DashDot,bl.DashStyle); Assert.AreEqual(2,bl.Thickness); Assert.AreEqual(LineCap.Flat,bl.StartLineCap); Assert.AreEqual(LineCap.Flat,bl.EndLineCap); Assert.AreEqual(DashCap.Flat,bl.DashLineCap); }
private void ValidateRepeatedColor(BaseLine line, Color color) { foreach (Spot spot in line.code) { if (spot.HasPeg() && spot.pegColor == color) { throw new System.ArgumentException("Can't repeat color"); } } }
// ベースラインを生成する. public void create_base_line(BaseLine base_line, int start, int end, float base_offset, float fluc_amp, float fluc_cycle) { int n = 0; float offset; // 道路の中心線上の道のり. float center_distance = 0.0f; // 道路の断面. RoadCreator.Section[] sections = this.road_creator.sections; // ベースライン上の道のり. base_line.total_distance = 0.0f; for (int i = start; i <= end; i++) { // 道路の中心線上の道のり. // if (i > start) { center_distance += (sections[i].center - sections[i - 1].center).magnitude; } // -------------------------------------------- // // 道路と直交する方向のオフセットを求める. offset = base_offset; // サイン波になるように. float angle = Mathf.Repeat(center_distance, fluc_cycle) / fluc_cycle * Mathf.PI * 2.0f; offset += fluc_amp * Mathf.Sin(angle); // -------------------------------------------- // Vector3 point = sections[i].center; Vector3 offset_vector = sections[i].right; point += offset * offset_vector; base_line.points[n] = point; // ベースライン上の道のり. // if (n > 0) { base_line.total_distance += Vector3.Distance(base_line.points[n], base_line.points[n - 1]); } // n++; } }
// 生成基准线 public void create_base_line(BaseLine base_line, int start, int end, float base_offset, float fluc_amp, float fluc_cycle) { int n = 0; float offset; // 道路中心线上的距离 float center_distance = 0.0f; // 道路截面 RoadCreator.Section[] sections = this.road_creator.sections; // 基准线上的道路距离 base_line.total_distance = 0.0f; for (int i = start; i <= end; i++) { // 道路中心线上的距离 // if (i > start) { center_distance += (sections[i].center - sections[i - 1].center).magnitude; } // -------------------------------------------- // // 求出和道路垂直交叉方向的偏移 offset = base_offset; // 按照正弦曲线波动 float angle = Mathf.Repeat(center_distance, fluc_cycle) / fluc_cycle * Mathf.PI * 2.0f; offset += fluc_amp * Mathf.Sin(angle); // -------------------------------------------- // Vector3 point = sections[i].center; Vector3 offset_vector = sections[i].right; point += offset * offset_vector; base_line.points[n] = point; // 基准线上的道路距离 // if (n > 0) { base_line.total_distance += Vector3.Distance(base_line.points[n], base_line.points[n - 1]); } // n++; } }
public void CheckDefault_2() { BaseLine bl = new BaseLine(Color.Black, DashStyle.DashDot, 2, LineCap.DiamondAnchor, LineCap.ArrowAnchor, DashCap.Round); Assert.AreEqual(Color.Black, bl.Color); Assert.AreEqual(DashStyle.DashDot, bl.DashStyle); Assert.AreEqual(2, bl.Thickness); Assert.AreEqual(LineCap.DiamondAnchor, bl.StartLineCap); Assert.AreEqual(LineCap.ArrowAnchor, bl.EndLineCap); Assert.AreEqual(DashCap.Round, bl.DashLineCap); }
public void CheckDefault_1() { BaseLine bl = new BaseLine(Color.Black, DashStyle.DashDot, 2); Assert.AreEqual(Color.Black, bl.Color); Assert.AreEqual(DashStyle.DashDot, bl.DashStyle); Assert.AreEqual(2, bl.Thickness); Assert.AreEqual(LineCap.Flat, bl.StartLineCap); Assert.AreEqual(LineCap.Flat, bl.EndLineCap); Assert.AreEqual(DashCap.Flat, bl.DashLineCap); }
public Activity Select( TrainingProgram trainingProgram, SourceTemplate sourceTemplate, BaseLine baseLine) { return (trainingProgram?.Activity ?? sourceTemplate?.Activity ?? baseLine?.Activity ?? throw new InvalidOperationException()); }
public void createBuildings() { if(this.start > this.end) { float temp = this.start; this.start = this.end; this.end = temp; } // BaseLine base_line = new BaseLine(); base_line.points = new Vector3[(int)this.end - (int)this.start + 1]; // this.mesh_bounds = new Bounds[this.BuildingPrefabs.Length]; for(int i = 0;i < this.BuildingPrefabs.Length;i++) { GameObject go = GameObject.Instantiate(this.BuildingPrefabs[i]) as GameObject; if(go.GetComponent<MeshFilter>() != null) { this.mesh_bounds[i] = go.GetComponent<MeshFilter>().mesh.bounds; } MeshFilter[] filters = go.GetComponentsInChildren<MeshFilter>(); foreach(var filter in filters) { this.mesh_bounds[i].Encapsulate(filter.mesh.bounds); } GameObject.Destroy(go); } // this.create_base_line(base_line, (int)this.start, (int)this.end, this.base_offset, 0.0f, 400.0f); this.create_buildings_on_line(base_line, SIDE.RIGHT); // this.create_base_line(base_line, (int)this.start, (int)this.end, -this.base_offset, 0.0f, 400.0f); this.create_buildings_on_line(base_line, SIDE.LEFT); // this.is_created = true; }
public void CreateCodePeg(BaseLine line, Color color) { Spot codeSpot = line.GetNextCodeSpot(); if (codeSpot.HasGameObject()) { codeSpot.SetPegColor(color); } else { GameObject newPeg = Instantiate(codePegRef, codeSpot.position, codeSpot.baseCodePegRotation); codeSpot.SetPeg(newPeg, color); } }
public bool IsSameCode(BaseLine line) { bool sameColor = false; for (int i = 0; i < maxCols; i++) { sameColor = this.code[i].pegColor.Equals(line.code[i].pegColor); if (!sameColor) { break; } } return(sameColor); }
/// <summary> /// 构造车次-线路关系并写入数据库 /// </summary> private static TrainNoLine WriteTrainNoLineRelation(TrainNo trainNo, BaseLine line) { var trainNoLineRelation = new TrainNoLine { LineId = line.Id, Sort = 0, TrainNoId = trainNo.Id, UpdateTime = DateTime.Now }; new TrainNoLineBll().Insert(trainNoLineRelation); DataUpdateLog.SingleUpdate(nameof(TrainNoLine), trainNoLineRelation.Id, DataUpdateType.Insert); return(trainNoLineRelation); }
private void GraphicsLineDrawer (Graphics graphics) { LineDecorator lineStyle = base.StyleDecorator as LineDecorator; BaseLine baseLine = null; baseLine = new BaseLine (lineStyle.ForeColor,lineStyle.DashStyle,lineStyle.Thickness); Point from = new Point(lineStyle.DisplayRectangle.Left + lineStyle.From.X, lineStyle.DisplayRectangle.Top + lineStyle.From.Y); Point to = new Point(lineStyle.DisplayRectangle.Left + lineStyle.To.X, lineStyle.DisplayRectangle.Top + lineStyle.To.Y); lineStyle.Shape.DrawShape(graphics, baseLine, from, to); }
private void GraphicsLineDrawer(Graphics graphics) { LineDecorator lineStyle = base.StyleDecorator as LineDecorator; BaseLine baseLine = null; baseLine = new BaseLine(lineStyle.ForeColor, lineStyle.DashStyle, lineStyle.Thickness); Point from = new Point(lineStyle.DisplayRectangle.Left + lineStyle.From.X, lineStyle.DisplayRectangle.Top + lineStyle.From.Y); Point to = new Point(lineStyle.DisplayRectangle.Left + lineStyle.To.X, lineStyle.DisplayRectangle.Top + lineStyle.To.Y); lineStyle.Shape.DrawShape(graphics, baseLine, from, to); }
/// <summary> /// Add a station to the end of the transline. /// </summary> public void AddStationToNewLine(StationController station, BaseLine line) { if (station == null) { return; } //Debug.Log(GetStationName(station)); if (!editingLineStations.Contains(station)) { editingLineStations.Add(station); if (editingLineStations.Count > 1) { int[] times = line.GetTravelingTimes(); travelTimes.Add(times[editingLineStations.Count - 2]); } } }
//Set Frames public void SetFrames() { var baseCrv = BaseLine.ToCurve(); var frame1 = new Plane(); var frame2 = new Plane(); var outFrames = new List <Plane>(); if (baseCrv.IsClosed) { baseCrv.PerpendicularFrameAt(0, out frame1); baseCrv.PerpendicularFrameAt(baseCrv.Domain.Max, out frame2); } else if (baseCrv.IsVertical()) { var vecX = Vector3d.YAxis; var vecY = Vector3d.CrossProduct(baseCrv.TangentAtStart, vecX); frame1 = new Plane(baseCrv.PointAtStart, vecX, vecY); frame2 = new Plane(baseCrv.PointAtEnd, vecX, vecY); } else if (baseCrv.IsHorizontal()) { var vecY = Vector3d.ZAxis; var vecX = Vector3d.CrossProduct(vecY, baseCrv.TangentAtStart); frame1 = new Plane(baseCrv.PointAtStart, vecX, vecY); frame2 = new Plane(baseCrv.PointAtEnd, vecX, vecY); } else // curve is slopped { var vecX = Vector3d.CrossProduct(Vector3d.ZAxis, baseCrv.TangentAtStart); var vecY = Vector3d.CrossProduct(baseCrv.TangentAtStart, vecX); frame1 = new Plane(baseCrv.PointAtStart, vecX, vecY); frame2 = new Plane(baseCrv.PointAtEnd, vecX, vecY); } // Rotate axis? if (RotationAngle != 0) { frame1.Rotate(RotationAngle * Math.PI / 180, frame1.Normal); frame2.Rotate(RotationAngle * Math.PI / 180, frame2.Normal); } // Output outFrames.Add(frame1); outFrames.Add(frame2); Frames = outFrames; }
public void CreateBranch(string name, long projectId) { ValidateBranchBeforeCreation(name, projectId); var project = ProjectRepository.Instance.Get(projectId); try { var baseline = new BaseLine(); baseline.Id = BaseLineRepository.Instance.Insert(baseline).Value; var branch = new Branch { Name = name, BaseLineId = baseline.Id, ProjectId = projectId }; branch.Id = BranchRepository.Instance.Insert(branch).Value; baseline.BranchId = branch.Id; BaseLineRepository.Instance.Update(baseline); long mainBaseLineId; if (!project.MainBranchId.HasValue) { mainBaseLineId = baseline.Id; } else { mainBaseLineId = BranchRepository.Instance.Get(project.MainBranchId.Value).BaseLineId.Value; } var mainBranchBaselineScreenShots = ScreenShotRepository.Instance.GetBaselineScreenShots(mainBaseLineId); ConfigImporter.CopyScreenShotsFromMainBranchBaselineToNewBaseline(baseline, mainBranchBaselineScreenShots); } catch (Exception ex) { LogErrorMessage(ErrorMessage.ErorCode.UndefinedError, ex); } }
public void Add(Entry e) { long diff = 0; if (Entries.Count == 0) { diff = e.Value;; } else { diff = e.Value - Entries[Entries.Count - 1].Value; } Entries.Add(e); Diffs.Add(diff); BaseLine.Add(e.Value - Entries[0].Value); Sum += diff; Min = Math.Min(Min, e.Value); Max = Math.Max(Max, e.Value); }
/// <summary> /// Определение расположения справа или слева относительно BaseLine /// Этот расчет предполагает, что полилинии направлены в одну сторону /// </summary> public void ComputeOrientation() { if (BaseLine == null) { throw new System.Exception("Нет ссылки на BaseLine"); } if (StartParameterBase < 0 || StartParameter < 0 || EndParameterBase < 0 || EndParameter < 0) { throw new System.Exception("Не расcчитано расположение"); } //Получить две точки на BaseLine между которыми находится параметр начала этой линии int pt1Index = -1; int pt2Index = -1; if (StartParameterBase == BaseLine.StartParam) { pt1Index = 0; pt2Index = 1; } else if (StartParameterBase == BaseLine.EndParam) { pt1Index = BaseLine.NumberOfVertices - 2; pt2Index = BaseLine.NumberOfVertices - 1; } else if (Math.Truncate(StartParameterBase) == StartParameterBase) { pt1Index = (int)StartParameterBase; pt2Index = (int)StartParameterBase + 1; } else { pt1Index = (int)Math.Floor(StartParameterBase); pt2Index = (int)Math.Ceiling(StartParameterBase); } Point2d baseLinePt1 = BaseLine.GetPoint2dAt(pt1Index); Point2d baseLinePt2 = BaseLine.GetPoint2dAt(pt2Index); Point3d thisLineStartPt = Poly2d.GetPointAtParameter(StartParameter); Point2d thisLineStartPt_2d = new Point2d(thisLineStartPt.X, thisLineStartPt.Y); ToTheRightOfBaseLine = Utils.IsLeft(baseLinePt1, baseLinePt2, thisLineStartPt_2d) < 0; }
public void CreateBaseline_2() { BaseLine bl = new BaseLine(Color.Black,DashStyle.DashDot,1,LineCap.DiamondAnchor,LineCap.DiamondAnchor,DashCap.Flat); Assert.NotNull(bl); }
public void CreateBaseline_1() { BaseLine bl = new BaseLine(Color.Black,DashStyle.DashDot,2); Assert.NotNull(bl); }
public void CreatePenThicknessZeroReturns1() { BaseLine bl = new BaseLine(Color.Red,DashStyle.DashDot,0,LineCap.DiamondAnchor,LineCap.ArrowAnchor,DashCap.Round); Pen pen = bl.CreatePen(); Assert.AreEqual(1,pen.Width); }