private void bar_Draw(GuiWidget drawingWidget, DrawEventArgs drawEvent) { if (drawingWidget != null && drawEvent != null && drawEvent.graphics2D != null) { drawEvent.graphics2D.FillRectangle(0, 0, drawingWidget.Width * RatioComplete, drawingWidget.Height, FillColor); drawEvent.graphics2D.Rectangle(drawingWidget.LocalBounds, BorderColor); } }
private void MeshViewerToDrawWith_Draw(GuiWidget drawingWidget, DrawEventArgs drawEvent) { if (Visible) { if (drawEvent != null) { Vector2 startLineGroundPos = Vector2.Zero; Vector2 startLineSelectionPos = Vector2.Zero; Vector2 midLinePos = Vector2.Zero; if (MeshViewerToDrawWith.HaveSelection) { // draw the hight from the bottom to the bed AxisAlignedBoundingBox selectedBounds = MeshViewerToDrawWith.GetBoundsForSelection(); Vector2 screenPosition = new Vector2(-100, 0); Vector3[] bottomPoints = new Vector3[4]; bottomPoints[0] = new Vector3(selectedBounds.minXYZ.x, selectedBounds.minXYZ.y, selectedBounds.minXYZ.z); bottomPoints[1] = new Vector3(selectedBounds.minXYZ.x, selectedBounds.maxXYZ.y, selectedBounds.minXYZ.z); bottomPoints[2] = new Vector3(selectedBounds.maxXYZ.x, selectedBounds.minXYZ.y, selectedBounds.minXYZ.z); bottomPoints[3] = new Vector3(selectedBounds.maxXYZ.x, selectedBounds.maxXYZ.y, selectedBounds.minXYZ.z); for (int i = 0; i < 4; i++) { Vector2 testScreenPosition = MeshViewerToDrawWith.TrackballTumbleWidget.GetScreenPosition(bottomPoints[i]); if (testScreenPosition.x > screenPosition.x) { startLineSelectionPos = testScreenPosition; startLineGroundPos = MeshViewerToDrawWith.TrackballTumbleWidget.GetScreenPosition(bottomPoints[i] + new Vector3(0, 0, -bottomPoints[i].z)); midLinePos = MeshViewerToDrawWith.TrackballTumbleWidget.GetScreenPosition(bottomPoints[i] + new Vector3(0, 0, -bottomPoints[i].z/2)); screenPosition = testScreenPosition + new Vector2(HorizontalLineLength, 0); } } heightValueDisplayInfo.DisplaySizeInfo(drawEvent.graphics2D, midLinePos, selectedBounds.minXYZ.z); OriginRelativeParent = screenPosition; // draw the line that is on the ground double yGround = (int)(startLineGroundPos.y + .5) + .5; drawEvent.graphics2D.Line(startLineGroundPos.x, yGround, startLineGroundPos.x + HorizontalLineLength - 5, yGround, RGBA_Bytes.Black); // and the line that is at the base of the selection double ySelection = (int)(startLineSelectionPos.y + .5) + .5; drawEvent.graphics2D.Line(startLineSelectionPos.x, ySelection, startLineSelectionPos.x + HorizontalLineLength - 5, ySelection, RGBA_Bytes.Black); // draw the vertical line that shows the measurement Vector2 pointerBottom = new Vector2(startLineGroundPos.x + HorizontalLineLength / 2, yGround); Vector2 pointerTop = new Vector2(startLineSelectionPos.x + HorizontalLineLength / 2, ySelection); InteractionVolume.DrawMeasureLine(drawEvent.graphics2D, pointerBottom, pointerTop, RGBA_Bytes.Black, InteractionVolume.LineArrows.End); } } } }
private void ShowOnNextMatterControlDraw(GuiWidget drawingWidget, DrawEventArgs e) { if (widgetWithPopContent.Children.Count > 0) { UiThread.RunOnIdle(() => { bool wasLeftOpen = UserSettings.Instance.Fields.GetBool(WindowLeftOpenKey, false); if (wasLeftOpen) { ShowContentInWindow(); } }); } ApplicationController.Instance.MainView.DrawAfter -= ShowOnNextMatterControlDraw; }
private void RemoveBooleanTestGeometry(GuiWidget drawingWidget, DrawEventArgs e) { if (meshViewerWidget.MeshGroups.Contains(booleanGroup)) { meshViewerWidget.MeshGroups.Remove(booleanGroup); meshViewerWidget.MeshGroupTransforms.Remove(groupTransform); UiThread.RunOnIdle(() => Invalidate(), 1.0 / 30.0); } }
private void CreateBooleanTestGeometry(GuiWidget drawingWidget, DrawEventArgs e) { try { booleanGroup = new MeshGroup(); booleanGroup.Meshes.Add(ApplyBoolean(PolygonMesh.Csg.CsgOperations.Union, AxisAlignedBoundingBox.Union, new Vector3(100, 0, 20), "U")); booleanGroup.Meshes.Add(ApplyBoolean(PolygonMesh.Csg.CsgOperations.Subtract, null, new Vector3(100, 100, 20), "S")); booleanGroup.Meshes.Add(ApplyBoolean(PolygonMesh.Csg.CsgOperations.Intersect, AxisAlignedBoundingBox.Intersection , new Vector3(100, 200, 20), "I")); offset += direction; rotCurrent += rotChange; scaleCurrent += scaleChange; meshViewerWidget.MeshGroups.Add(booleanGroup); groupTransform = Matrix4X4.Identity; meshViewerWidget.MeshGroupTransforms.Add(groupTransform); } catch(Exception e2) { string text = e2.Message; int a = 0; } }
private void CreateBooleanTestGeometry(GuiWidget drawingWidget, DrawEventArgs e) { Mesh boxA = PlatonicSolids.CreateCube(40, 40, 40); //boxA.Triangulate(); boxA.Translate(centering); Mesh boxB = PlatonicSolids.CreateCube(40, 40, 40); //boxB.Triangulate(); for (int i = 0; i < 3; i++) { if (Math.Abs(direction[i] + offset[i]) > 10) { direction[i] = -direction[i]; } } offset += direction; boxB.Translate(offset + centering); booleanGroup = new MeshGroup(); booleanGroup.Meshes.Add(PolygonMesh.Csg.CsgOperations.Union(boxA, boxB)); meshViewerWidget.MeshGroups.Add(booleanGroup); groupTransform = ScaleRotateTranslate.Identity(); meshViewerWidget.MeshGroupTransforms.Add(groupTransform); }
private void ConnectToWidget(GuiWidget drawingWidget, DrawEventArgs e) { GuiWidget parent = drawingWidget; while (parent.BackgroundColor.Alpha0To255 == 0) { parent = parent.Parent; } startColor = parent.BackgroundColor; timeSinceStart = Stopwatch.StartNew(); widgetToHighlight.AfterDraw -= ConnectToWidget; UiThread.RunOnIdle(ChangeBackgroundColor, animationDelay); }
private void MeshViewerToDrawWith_Draw(GuiWidget drawingWidget, DrawEventArgs drawEvent) { if (MeshViewerToDrawWith.SelectedMeshGroup != null && view3DWidget.meshViewerWidget.SnapGridDistance > 0 && view3DWidget.CurrentSelectInfo.DownOnPart) { if (drawEvent != null) { // draw the line that is on the ground drawEvent.graphics2D.Line(lines[0], lines[1], RGBA_Bytes.Red); drawEvent.graphics2D.Line(lines[2], lines[3], RGBA_Bytes.Red); } } }
private void DrawMouse(GuiWidget drawingWidget, DrawEventArgs e) { AutomationRunner.RenderMouse(currentlyHookedWindow, e.graphics2D); }
private void MeshViewerToDrawWith_Draw(GuiWidget drawingWidget, DrawEventArgs drawEvent) { if (Visible) { if (drawEvent != null) { // draw the line that is on the ground double yGround = (int)(startLineGroundPos.y + .5) + .5; drawEvent.graphics2D.Line(startLineGroundPos.x, yGround, startLineGroundPos.x + HorizontalLineLength - 5, yGround, RGBA_Bytes.Black); // and the line that is at the base of the selection double ySelection = (int)(startLineSelectionPos.y + .5) + .5; drawEvent.graphics2D.Line(startLineSelectionPos.x, ySelection, startLineSelectionPos.x + HorizontalLineLength - 5, ySelection, RGBA_Bytes.Black); // draw the verticle line that shows the measurment Vector2 pointerBottom = new Vector2(startLineGroundPos.x + HorizontalLineLength / 2, yGround); Vector2 pointerTop = new Vector2(startLineSelectionPos.x + HorizontalLineLength / 2, ySelection); drawEvent.graphics2D.Line(pointerBottom, pointerTop, RGBA_Bytes.Black); Vector2 direction = pointerTop - pointerBottom; if (direction.LengthSquared > 0) { PathStorage arrow = new PathStorage(); arrow.MoveTo(-3, -5); arrow.LineTo(0, 0); arrow.LineTo(3, -5); double rotation = Math.Atan2(direction.y, direction.x); IVertexSource correctRotation = new VertexSourceApplyTransform(arrow, Affine.NewRotation(rotation - MathHelper.Tau / 4)); IVertexSource inPosition = new VertexSourceApplyTransform(correctRotation, Affine.NewTranslation(pointerTop)); drawEvent.graphics2D.Render(inPosition, RGBA_Bytes.Black); } } } }