protected void DrawOverlay_Snapping(DrawSceneParams data) { if (CurrentPoint is SnapPoint point) { DisplaySnappedVertex(point); } }
protected override void DrawOverlay(DrawSceneParams data) { // display warning message if (duplicatedBlockDetected && !Entities.IsOpenCurrentBlockReference) { DrawText(Size.Width - 5, 5, WarningMessage, new Font(System.Drawing.FontFamily.GenericSerif, 1, System.Drawing.FontStyle.Regular, GraphicsUnit.Pixel), Color.Red, Color.FromArgb(127, Color.White), ContentAlignment.BottomRight); } }
protected override void DrawOverlay(DrawSceneParams myParams) { if (!_measuring) { base.DrawOverlay(myParams); return; } ScreenToPlane(_mouseLocation, _plane, out _currentPoint); // size line renderContext.SetLineSize(1); // draw inverted renderContext.EnableXOR(true); renderContext.SetState(depthStencilStateType.DepthTestOff); if (ActionMode == actionType.None && !GetToolBar().Contains(_mouseLocation)) { if (_points.Count > 0) { List <Point3D> pts2 = new List <Point3D>(); // Draw elastic line pts2.Add(WorldToScreen(_points[0])); pts2.Add(WorldToScreen(_currentPoint)); renderContext.DrawLines(pts2.ToArray()); } // disables draw inverted renderContext.EnableXOR(false); if (_measureEndPoint != null) { // text drawing DrawText(_mouseLocation.X, Size.Height - _mouseLocation.Y + 10, "Current point: " + _measureEndPoint.X.ToString("f2") + ", " + _measureEndPoint.Y.ToString("f2") + ", " + _measureEndPoint.Z.ToString("f2"), new Font("Tahoma", 8.25f), Color.Black, ContentAlignment.BottomLeft); } } else { // disables draw inverted renderContext.EnableXOR(false); } base.DrawOverlay(myParams); }
protected void DrawOverlay_Picking(DrawSceneParams data) { if (buttonPressed) { if (CurrentPickState == Common.ViewportPickState.Crossing) { DrawSelectionBox(initialLocation, currentLocation, CrossingBoxColor, true, true); } else if (CurrentPickState == Common.ViewportPickState.Enclosed) { DrawSelectionBox(initialLocation, currentLocation, EnclosedBoxColor, true, false); } } }
/*private void NotifyEntityChanged(object sender, Common.EntityChangedEventArgs e) * { * var entity = sender as devDept.Eyeshot.Entities.Entity; * entity.Regen(0.0); * entity.RegenMode = devDept.Eyeshot.Entities.regenType.RegenAndCompile; * entity.Compile(new CompileParams(this)); * Refresh(); * Invalidate(); * }*/ protected override void DrawOverlay(DrawSceneParams data) { if (IsSnapEnable) { DrawOverlay_Snapping(data); } if (IsPickingEnable) { DrawOverlay_Picking(data); } if (IsDrawingEnable) { DrawOverlay_Drawing(data); } base.DrawOverlay(data); }
protected override void DrawViewport(DrawSceneParams myParams) { base.DrawViewport(myParams); switch (RulerPlaneMode) { case rulerPlaneType.XY: rulerPlane = Plane.XY; break; case rulerPlaneType.ZX: rulerPlane = Plane.ZX; break; case rulerPlaneType.YZ: rulerPlane = Plane.YZ; break; } // Get the world coordinates of the corners and the screen position of the origin for reference Point3D ptUpperRight, ptLowerLeft; ScreenToPlane(new System.Drawing.Point((int)Size.Width, rulerSize), rulerPlane, out ptUpperRight); ScreenToPlane(new System.Drawing.Point(rulerSize, (int)Size.Height), rulerPlane, out ptLowerLeft); originScreen = WorldToScreen(0, 0, 0); switch (RulerPlaneMode) { case rulerPlaneType.XY: upperRightWorldCoord = new Point2D(ptUpperRight.X, ptUpperRight.Y); lowerLeftWorldCoord = new Point2D(ptLowerLeft.X, ptLowerLeft.Y); break; case rulerPlaneType.ZX: upperRightWorldCoord = new Point2D(ptUpperRight.X, ptUpperRight.Z); lowerLeftWorldCoord = new Point2D(ptLowerLeft.X, ptLowerLeft.Z); break; case rulerPlaneType.YZ: upperRightWorldCoord = new Point2D(ptUpperRight.Y, ptUpperRight.Z); lowerLeftWorldCoord = new Point2D(ptLowerLeft.Y, ptLowerLeft.Z); break; } }
protected override void DrawOverlay(DrawSceneParams data) { if (DrawingLinearDim && ActionMode == actionType.None) // checks if ZP is disabled (rotation not enabled in Drawings) { ScreenToPlane(_mouseLocation, _plane, out _current); if (_snappedPoint != null) { DisplaySnappedVertex(); } // set render context for interactive drawing renderContext.SetLineSize(1); renderContext.EnableXOR(true); renderContext.SetState(depthStencilStateType.DepthTestOff); // if cursor is outside from Drawings it does not need to draw anything on overlay if (!_cursorOutside) { DrawPositionMark(_current); if (_numPoints < 2) { DrawSelectionMark(_mouseLocation); renderContext.EnableXOR(false); string text = "Select the first point"; if (_numPoints == 1) { text = "Select the second point"; } DrawText(_mouseLocation.X, (int)Size.Height - _mouseLocation.Y + 10, text, new Font("Tahoma", 8.25f), DrawingColor, ContentAlignment.BottomLeft); } else { DrawInteractiveLinearDim(); } } } base.DrawOverlay(data); }
protected override void DrawOverlay(DrawSceneParams myParams) { double Height = Size.Height; double Width = Size.Width; renderContext.SetState(depthStencilStateType.DepthTestOff); renderContext.SetState(blendStateType.Blend); // Draw the transparent ruler renderContext.SetColorWireframe(Color.FromArgb((int)(0.4 * 255), 255, 255, 255)); renderContext.SetState(rasterizerStateType.CCW_PolygonFill_NoCullFace_NoPolygonOffset); // Vertical Ruler renderContext.DrawQuad(new RectangleF(0, 0, rulerSize, (float)(Height - rulerSize))); // Horizontal Ruler renderContext.DrawQuad(new RectangleF(rulerSize, (float)(Height - rulerSize), (float)(Width - rulerSize), rulerSize)); renderContext.SetState(blendStateType.NoBlend); // choose a string format with 2 decimal numbers string formatString = "{0:0.##}"; double worldToScreen = (Height - rulerSize) / (upperRightWorldCoord.Y - lowerLeftWorldCoord.Y); double stepWorldX = 5, stepWorldY = 5; double worldHeight = upperRightWorldCoord.Y - lowerLeftWorldCoord.Y; double nlinesH = (worldHeight / stepWorldY); double worldWidth = upperRightWorldCoord.X - lowerLeftWorldCoord.X; double nlinesW = (worldWidth / stepWorldX); RefineStep(nlinesH, worldHeight, ref stepWorldY); RefineStep(nlinesW, worldWidth, ref stepWorldX); double stepWorld = Math.Min(stepWorldX, stepWorldY); double stepScreen = stepWorld * worldToScreen; /////////////////////////// // Vertical ruler /////////////////////////// // First line Y world coordinate double startYWorld = stepWorld * Math.Floor(lowerLeftWorldCoord.Y / stepWorld); Point2D firstLineScreenPositionY = new Point2D(0, originScreen.Y + startYWorld * worldToScreen); double currentScreenY = firstLineScreenPositionY.Y; double shorterLineXPos = (firstLineScreenPositionY.X + rulerSize) / 2; // draw a longer line each 5 lines. The origin must be a longer line. int countShortLinesY = (int)(Math.Round((currentScreenY - originScreen.Y) / stepScreen)) % 5; // Draw the ruler lines renderContext.SetLineSize(1); double left; Font myFont = UtilityEx.GetFont(FontFamily, FontStyle, FontWeight, FontSize); for (double y = startYWorld; y < upperRightWorldCoord.Y; y += stepWorld, currentScreenY += stepScreen) { if (countShortLinesY % 5 == 0) { left = firstLineScreenPositionY.X; } else { left = shorterLineXPos; }; renderContext.SetColorWireframe(Color.Black); renderContext.DrawLine(new Point2D(left, currentScreenY), new Point2D(rulerSize, currentScreenY)); DrawText((int)firstLineScreenPositionY.X, (int)currentScreenY, string.Format(formatString, y), myFont, Color.Black, ContentAlignment.BottomLeft); countShortLinesY++; } /////////////////////////// // Horizontal ruler /////////////////////////// // First line X world coordinate double startXWorld = stepWorld * Math.Ceiling(lowerLeftWorldCoord.X / stepWorld); Point2D firstLineScreenPositionX = new Point2D(originScreen.X + startXWorld * worldToScreen, 0); double currentScreenX = firstLineScreenPositionX.X; double shorterLineYPos = (firstLineScreenPositionX.Y + rulerSize) / 2; int countShortLinesX = (int)(Math.Round((currentScreenX - originScreen.X) / stepScreen)) % 5; double top; for (double x = startXWorld; x < upperRightWorldCoord.X; x += stepWorld, currentScreenX += stepScreen) { if (countShortLinesX % 5 == 0) { top = firstLineScreenPositionX.Y; } else { top = shorterLineYPos; } renderContext.SetColorWireframe(Color.Black); renderContext.DrawLine(new Point2D(currentScreenX, Height - top), new Point2D(currentScreenX, Height - rulerSize)); DrawText((int)currentScreenX, (int)(Height - rulerSize - firstLineScreenPositionX.Y), string.Format(formatString, x), myFont, Color.Black, ContentAlignment.BottomLeft); countShortLinesX++; } // Draw a red line in correspondence with the mouse position renderContext.SetColorWireframe(Color.Red); if (mousePos.Y > rulerSize) { renderContext.DrawLine(new Point3D(0, Height - mousePos.Y, 0), new Point3D(rulerSize, Height - mousePos.Y, 0)); } if (mousePos.X > rulerSize) { renderContext.DrawLine(new Point3D(mousePos.X, Height, 0), new Point3D(mousePos.X, Height - rulerSize, 0)); } // Draw the logo image at the bottom right corner Bitmap logo = new Bitmap("../../../../../../dataset/Assets/Pictures/Logo.png"); DrawImage(Size.Width - logo.Width - 20, 20, logo); // call the base function base.DrawOverlay(myParams); }
protected override void DrawOverlay(DrawSceneParams myParams) { DrawLines(); base.DrawOverlay(myParams); }
protected override void DrawOverlay(DrawSceneParams myParams) { ScreenToPlane(mouseLocation, plane, out current); // draw the elastic line renderContext.SetLineSize(1); // draw inverted renderContext.EnableXOR(true); renderContext.SetState(depthStencilStateType.DepthTestOff); // entity drawing in 2D lp = new LinearPath(points); List <Point3D> pts = new List <Point3D>(); // draw the elastic line for (int i = 0; i < lp.Vertices.Length; i++) { pts.Add(WorldToScreen(lp.Vertices[i])); } foreach (var pt in pts) { pt.Z = 0; // Avoid clipping by camera planes } if (pts.Count > 0) { renderContext.DrawLineStrip(pts.ToArray()); } if (ActionMode == actionType.None && !GetToolBar().Contains(mouseLocation) && lp.Vertices.Length > 0) { List <Point3D> pts2 = new List <Point3D>(); // Draw elastic line pts2.Add(WorldToScreen(lp.Vertices[lp.Vertices.Length - 1])); pts2.Add(WorldToScreen(current)); // cross drawing in 3D Point3D left = WorldToScreen(current.X - (p2.X - p1.X) / 10, current.Y, current.Z); Point3D right = WorldToScreen(current.X + (p2.X - p1.X) / 10, current.Y, current.Z); pts2.Add(left); pts2.Add(right); Point3D bottom = WorldToScreen(current.X, current.Y - (p3.Y - p1.Y) / 10, current.Z - (p3.Z - p1.Z) / 10); Point3D top = WorldToScreen(current.X, current.Y + (p3.Y - p1.Y) / 10, current.Z + (p3.Z - p1.Z) / 10); pts2.Add(bottom); pts2.Add(top); foreach (var pt in pts2) { pt.Z = 0; // Avoid clipping by camera planes } renderContext.DrawLines(pts2.ToArray()); // disables draw inverted renderContext.EnableXOR(false); // text drawing DrawText(mouseLocation.X, (int)Size.Height - mouseLocation.Y + 10, "Current point: " + current.X.ToString("f2") + ", " + current.Y.ToString("f2") + ", " + current.Z.ToString("f2"), new Font("Tahoma", 8.25f), Color.Black, ContentAlignment.BottomLeft); } else { // disables draw inverted renderContext.EnableXOR(false); } base.DrawOverlay(myParams); }
protected override void DrawOverlay(DrawSceneParams myParams) { if (ActionMode != actionType.None || GetToolBar().Contains(mouseLocation)) { base.DrawOverlay(myParams); return; } ScreenToPlane(mouseLocation, plane, out current); SnapToGrid(ref current); // draw inverted renderContext.EnableXOR(true); renderContext.SetState(depthStencilStateType.DepthTestOff); if (firstClick) { renderContext.SetLineSize(1); Point3D screenStart = WorldToScreen(start); Point3D screenCurrent = WorldToScreen(current); screenStart.Z = 0; screenCurrent.Z = 0; List <Point3D> pts = new List <Point3D>(); // elastic line pts.Add(screenStart); pts.Add(screenCurrent); renderContext.DrawLines(pts.ToArray()); } // cross drawing in 3D renderContext.SetLineSize(3); List <Point3D> pts2 = new List <Point3D>(); Point3D left = WorldToScreen(current.X - (p2.X - p1.X) / 20, current.Y, current.Z); Point3D right = WorldToScreen(current.X + (p2.X - p1.X) / 20, current.Y, current.Z); pts2.Add(left); pts2.Add(right); Point3D bottom = WorldToScreen(current.X, current.Y - (p3.Y - p1.Y) / 20, current.Z - (p3.Z - p1.Z) / 20); Point3D top = WorldToScreen(current.X, current.Y + (p3.Y - p1.Y) / 20, current.Z + (p3.Z - p1.Z) / 20); pts2.Add(bottom); pts2.Add(top); // Sets the Z to 0 to avoid clipping planes issues for (int i = 0; i < pts2.Count; i++) { pts2[i].Z = 0; } renderContext.DrawLines(pts2.ToArray()); // disables draw inverted renderContext.EnableXOR(false); renderContext.EnableXORForTexture(true, myParams.ShaderParams); // text drawing DrawText(mouseLocation.X, (int)Size.Height - mouseLocation.Y + 10, "Current point: " + current.X.ToString("f2") + ", " + current.Y.ToString("f2") + ", " + current.Z.ToString("f2"), new Font("Tahoma", 8.25f), Color.Black, ContentAlignment.BottomLeft); renderContext.EnableXORForTexture(false, myParams.ShaderParams); base.DrawOverlay(myParams); }
protected void DrawOverlay_Drawing(DrawSceneParams data) { DrawOverlay_Jigging?.Invoke(this, new JiggingEventArgs(data)); }
protected override void DrawOverlay(DrawSceneParams myParams) { base.DrawOverlay(myParams); RenderText(); }