private void MeshViewerToDrawWith_Draw(object 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 = Math.Round(startLineGroundPos.y) + .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 = Math.Round(startLineSelectionPos.y) + .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 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); InteractionVolume.DrawMeasureLine(drawEvent.graphics2D, pointerBottom, pointerTop, RGBA_Bytes.Black, InteractionVolume.LineArrows.End); } } }