public void Add(IVisualObject newVisualObject) { if (visualObjects.All(x => x != newVisualObject)) { visualObjects.Add(newVisualObject); } }
/// <summary> /// Opens a folder in the log. /// </summary> /// <param name="caption">The caption.</param> /// <param name="additionalInfo">The additional information.</param> /// <param name="visual">if visual != null, a screenshot is stored in the log.</param> public void OpenFolder(string caption, string additionalInfo = "", IVisualObject visual = null) { mDriver.Log.OpenFolder(caption, additionalInfo); if (visual != null) { mDriver.Log.Screenshot(visual, "Initial screenshot"); } }
/// <summary>Logs the specified information.</summary> /// <param name="info">The information.</param> /// <param name="additionalInfo">The additional information.</param> /// <param name="visual">if visual != null, a screenshot is stored in the log.</param> public void Info(string info, string additionalInfo = "", IVisualObject visual = null) { if (visual != null) { mDriver.Log.Screenshot(visual, info, additionalInfo); } else { mDriver.Log.Message(info, additionalInfo); } }
internal static bool ResolveConstraint(DrCanvas canvas, double newX, double newY, int issuerHash) { DcPoint issuerPoint = canvas.PointCollection[issuerHash]; DcPoint subPoint = canvas.PointCollection[issuerPoint.DependedHash]; IVisualObject visualObject = canvas.GetDrawingVisualById(PointHash.GetIdFromHash(subPoint.GetHashCode()))?.VisualObject; if (visualObject is IPrimitive primitive) { return(primitive.SetPoint(newX, newY, subPoint.GetHashCode())); } return(false); }
/// <summary> /// /// </summary> /// <param name="visualObject"></param> public void RemoveVisualObject(IVisualObject visualObject) { DrawingVisual visual = GetDrawingVisualById(visualObject.ID); if (visual != null) { RemoveVisualChild(visual); if (visualObject is DcLineSegment line) { PointManager.RemovePrimitivePoints(PointCollection, line); DcLineSegments.Remove(line); } _visualsCollection.Remove(visual); } }
public static void DrawOnScene(this IVisualObject visualObject) { GL.Enable(EnableCap.PolygonOffsetFill); GL.PolygonOffset(1, 1); GL.Begin(PrimitiveType.Triangles); GL.Color3(Color.LightGray); foreach (var triangleVector in visualObject.TrianglesVectors) { GL.Vertex3(triangleVector); } GL.End(); GL.PolygonOffset(0, 0); GL.Disable(EnableCap.PolygonOffsetFill); GL.Color3(Color.Black); GL.LineWidth(3); GL.Begin(PrimitiveType.Lines); foreach (var edgeVector in visualObject.EdgesVectors) { GL.Vertex3(edgeVector); } GL.End(); GL.LineWidth(1); GL.PointSize(5); GL.Begin(PrimitiveType.Points); foreach (var vertexVector in visualObject.VerticesVectors) { GL.Vertex3(vertexVector); } GL.End(); GL.PointSize(1); GL.PopMatrix(); }
/// <summary> /// Logs a screenshot of the specified object. /// </summary> /// <param name="objectForPicture">The object from which a screenshot is logged.</param> /// <param name="caption">The caption.</param> /// <param name="additionalInfo">The additional information.</param> public void Screenshot(IVisualObject objectForPicture, string caption = "", string additionalInfo = "") { mDriver.Log.Screenshot(objectForPicture, caption, additionalInfo); }
/// <summary> /// Execute a UI Test. /// Function encapsulates the UI test with logging. /// A screenshot is taken to document the test start conditions. /// </summary> /// <param name="action">The action.</param> /// <param name="caption">The caption.</param> /// <param name="visual">The visual used for the screenshot. If null, HomeZone is used.</param> protected void ExecuteUITest(Action action, [CallerMemberName] string caption = "", IVisualObject visual = null) { try { Log.OpenFolder(caption, visual: visual ?? HomeZone.VisualObject); Act(action, caption); Log.Info(caption + " finished", visual: visual ?? HomeZone.VisualObject); Log.CloseFolder(); } catch (Exception ex) { PostException(ex); Log.CloseFolder(); throw; } void PostException(Exception ex, bool innerException = false) { Log.Error($"{( innerException ? "Inner exception: " : "" )}{ex.Message}", ex.StackTrace); //automatically creates a screenshot if (ex.InnerException != null) { PostException(ex.InnerException, true); } } }
/// <summary> /// /// </summary> /// <param name="primitive"></param> public DrawingVisualEx(IVisualObject primitive) : base() { _visualObj = primitive; }