using System; using System.Collections.Generic; using System.Linq; using System.Text;…
- User
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Rhino.Display; using Rhino.Geometry; using System.Drawing; using Rhino.DocObjects;
namespace EmreIstikam001.component.TehranOffice.ToosForAll { class GeometryDisplay : DisplayConduit { private List geometryList; private Color color; private bool drawMeshes; private bool drawCurves; private bool drawSurfaces; private bool drawPoints; private bool drawTexts; private bool drawBrepEdges; private bool drawMeshEdges; private bool drawMeshVertices; private bool drawMeshWires; private bool drawMeshFaces; private bool drawMeshNormals; private bool drawMeshCurvature; private bool drawMeshTextureCoordinates; private bool drawMeshParameters; private bool drawMeshVertexColors; private bool drawMeshVertexNormals; private bool drawMeshVertexCurvatures; private bool drawMeshVertexTextureCoordinates; private bool drawMeshVertexParameters; private bool drawMeshFaceNormals; private bool drawMeshFaceCurvatures; private bool drawMeshFaceTextureCoordinates; private bool drawMeshFaceParameters; private bool drawMeshFaceColors; private bool drawMeshFaceCenters; private bool drawMeshFaceAreas; private bool drawMeshFaceNormalsAtCenters; private bool drawMeshFaceCurvaturesAtCenters; private bool drawMeshFaceTextureCoordinatesAtCenters; private bool drawMeshFaceParametersAtCenters; private bool drawMeshFaceColorsAtCenters; private bool drawMeshFaceBoundingBoxes; private bool drawMeshFaceBoundingBoxesAtCenters; private bool drawMeshFaceBoundingBoxesAtCorners; private bool drawMeshFaceBoundingBoxesAtEdges; private bool drawMeshFaceBoundingBoxesAtVertices; private bool drawMeshFaceBoundingBoxesAtFaceCenters; private bool drawMeshFaceBoundingBoxesAtFaceCorners; private bool drawMeshFaceBoundingBoxesAtFaceEdges; private bool drawMeshFaceBoundingBoxesAtFaceVertices; private bool drawMeshFaceBoundingBoxesAtFaceFaceCenters; private bool drawMeshFaceBoundingBoxesAtFaceFaceCorners; private bool drawMeshFaceBoundingBoxesAtFaceFaceEdges; private bool drawMeshFaceBoundingBoxesAtFaceFaceVertices; private bool drawMeshFaceBoundingBoxesAtFaceFaceFaceCenters; private bool drawMeshFaceBoundingBoxesAtFaceFaceFaceCorners; private bool drawMeshFaceBoundingBoxesAtFaceFaceFaceEdges; private bool drawMeshFaceBoundingBoxesAtFaceFaceFaceVertices;
private bool drawMesh { get { return drawMeshes || drawMeshEdges || drawMeshVertices || drawMeshWires || drawMeshFaces || drawMeshNormals || drawMeshCurvature || drawMeshTextureCoordinates || drawMeshParameters || drawMeshVertexColors || drawMeshVertexNormals || drawMeshVertexCurvatures || drawMeshVertexTextureCoordinates || drawMeshVertexParameters || drawMeshFaceNormals || drawMeshFaceCurvatures || drawMeshFaceTextureCoordinates || drawMeshFaceParameters || drawMeshFaceColors || drawMeshFaceCenters || drawMeshFaceAreas || drawMeshFaceNormalsAtCenters || drawMeshFaceCurvaturesAtCenters || drawMeshFaceTextureCoordinatesAtCenters || drawMeshFaceParametersAtCenters || drawMeshFaceColorsAtCenters || drawMeshFaceBoundingBoxes || drawMeshFaceBoundingBoxesAtCenters || drawMeshFaceBoundingBoxesAtCorners || drawMeshFaceBoundingBoxesAtEdges || drawMeshFaceBoundingBoxesAtVertices || drawMeshFaceBoundingBoxesAtFaceCenters || drawMeshFaceBoundingBoxesAtFaceCorners || drawMeshFaceBoundingBoxesAtFaceEdges || drawMeshFaceBoundingBoxesAtFaceVertices || drawMeshFaceBoundingBoxesAtFaceFaceCenters || drawMeshFaceBoundingBoxesAtFaceFaceCorners || drawMeshFaceBoundingBoxesAtFaceFaceEdges || drawMeshFaceBoundingBoxesAtFaceFaceVertices || drawMeshFaceBoundingBoxesAtFaceFaceFaceCenters || drawMeshFaceBoundingBoxesAtFaceFaceFaceCorners || drawMeshFaceBoundingBoxesAtFaceFaceFaceEdges || drawMeshFaceBoundingBoxesAtFaceFaceFaceVertices; } } private bool drawGeometry { get { return drawMesh || drawCurves || drawSurfaces || drawPoints || drawTexts || drawBrepEdges; } } public GeometryDisplay(List<GeometryBase> geometryList, Color color, bool drawMeshes, bool drawCurves, bool drawSurfaces, bool drawPoints, bool drawTexts, bool drawBrepEdges, bool drawMeshEdges, bool drawMeshVertices, bool drawMeshWires, bool drawMeshFaces, bool drawMeshNormals, bool drawMeshCurvature, bool drawMeshTextureCoordinates, bool drawMeshParameters, bool drawMeshVertexColors, bool drawMeshVertexNormals, bool drawMeshVertexCurvatures, bool drawMeshVertexTextureCoordinates, bool drawMeshVertexParameters, bool drawMeshFaceNormals, bool drawMeshFaceCurvatures, bool drawMeshFaceTextureCoordinates, bool drawMeshFaceParameters, bool drawMeshFaceColors, bool drawMeshFaceCenters, bool drawMeshFaceAreas, bool drawMeshFaceNormalsAtCenters, bool drawMeshFaceCurvaturesAtCenters, bool drawMeshFaceTextureCoordinatesAtCenters, bool drawMeshFaceParametersAtCenters, bool drawMeshFaceColorsAtCenters, bool drawMeshFaceBoundingBoxes, bool drawMeshFaceBoundingBoxesAtCenters, bool drawMeshFaceBoundingBoxesAtCorners, bool drawMeshFaceBoundingBoxesAtEdges, bool drawMeshFaceBoundingBoxesAtVertices, bool drawMeshFaceBoundingBoxesAtFaceCenters, bool drawMeshFaceBoundingBoxesAtFaceCorners, bool drawMeshFaceBoundingBoxesAtFaceEdges, bool drawMeshFaceBoundingBoxesAtFaceVertices, bool drawMeshFaceBoundingBoxesAtFaceFaceCenters, bool drawMeshFaceBoundingBoxesAtFaceFaceCorners, bool drawMeshFaceBoundingBoxesAtFaceFaceEdges, bool drawMeshFaceBoundingBoxesAtFaceFaceVertices, bool drawMeshFaceBoundingBoxesAtFaceFaceFaceCenters, bool drawMeshFaceBoundingBoxesAtFaceFaceFaceCorners, bool drawMeshFaceBoundingBoxesAtFaceFaceFaceEdges, bool drawMeshFaceBoundingBoxesAtFaceFaceFaceVertices) { this.geometryList = geometryList; this.color = color; this.drawMeshes = drawMeshes; this.drawCurves = drawCurves; this.drawSurfaces = drawSurfaces; this.drawPoints = drawPoints; this.drawTexts = drawTexts; this.drawBrepEdges = drawBrepEdges; this.drawMeshEdges = drawMeshEdges; this.drawMeshVertices = drawMeshVertices; this.drawMeshWires = drawMeshWires; this.drawMeshFaces = drawMeshFaces; this.drawMeshEdges = drawMeshEdges; this.drawMeshVertices = drawMeshVertices; this.drawMeshWires = drawMeshWires; this.drawMeshFaces = drawMeshFaces; this.drawMeshEdges = drawMeshEdges; this.drawMeshVertices = drawMeshVertices; this.drawMeshWires = drawMeshWires; this.drawMeshFaces = drawMeshFaces; this.drawMeshEdges = drawMeshEdges; this.drawMeshVertices = drawMeshVertices; this.drawMeshWires = drawMeshWires; } protected override void CalculateBoundingBox(CalculateBoundingBoxEventArgs e) { base.CalculateBoundingBox(e); foreach (var geometry in geometryList) { e.IncludeBoundingBox(geometry.GetBoundingBox(false)); } } protected override void PreDrawObjects(DrawEventArgs e) { base.PreDrawObjects(e); if (drawGeometry) { foreach (var geometry in geometryList) { if (drawMeshes && geometry is Mesh) { e.Display.DrawMeshShaded((Mesh)geometry, new DisplayMaterial(color)); } if (drawCurves && geometry is Curve) { e.Display.DrawCurve((Curve)geometry, color); } if (drawSurfaces && geometry is Surface) { e.Display.DrawSurface((Surface)geometry, color); } if (drawPoints && geometry is Point) { e.Display.DrawPoint((Point)geometry, color); } if (drawTexts && geometry is TextEntity) { e.Display.Draw3dText((TextEntity)geometry, color); } if (drawBrepEdges && geometry is Brep) { e.Display.DrawBrepWires((Brep)geometry, color); } } } } } - Assistant