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<GeometryBase> 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);
                    }
                }
            }
        }
    }



}

is it possible to create a general class for preview every thing is in the Rhino.Display.DisplayPipeline ?
the class should have a generic input and based on the type of input shows different overloads relevent to that spicific type.
for example if the generic input is line the Line oveloads should be activated to select from them based on what are the other inputs are.


/// <summary>Draws a single line object.</summary>
/// <param name="line">Line to draw.</param>
/// <param name="color">Color to draw line in.</param>
/// <since>5.0</since>
public void DrawLine(Line line, Color color) => this.DrawLine(line.From, line.To, color, 1);

/// <summary>Draws a single line object.</summary>
/// <param name="line">Line to draw.</param>
/// <param name="color">Color to draw line in.</param>
/// <param name="thickness">Thickness (in pixels) of line.</param>
/// <since>5.0</since>
public void DrawLine(Line line, Color color, int thickness)
{
  this.DrawLine(line.From, line.To, color, thickness);
}

/// <summary>Draws a single line object.</summary>
/// <param name="from">Line from point.</param>
/// <param name="to">Line to point.</param>
/// <param name="color">Color to draw line in.</param>
/// <since>5.0</since>
public void DrawLine(Point3d from, Point3d to, Color color)
{
  this.DrawLine(from, to, color, 1);
}

/// <summary>Draws a single line object.</summary>
/// <param name="from">Line from point.</param>
/// <param name="to">Line to point.</param>
/// <param name="color">Color to draw line in.</param>
/// <param name="thickness">Thickness (in pixels) of line.</param>
/// <since>5.0</since>
public void DrawLine(Point3d from, Point3d to, Color color, int thickness)
{
  UnsafeNativeMethods.CRhinoDisplayPipeline_DrawLine(this.m_ptr, from, to, color.ToArgb(), thickness);
}

/// <summary>
/// Draws a single line object .This version of line drawing will draw the
/// segments of the line that extend beyond the near and far planes of the
/// view frustum with depths on those planes
/// </summary>
/// <param name="from">Line from point.</param>
/// <param name="to">Line to point.</param>
/// <param name="color">Color to draw line in.</param>
/// <param name="thickness">Thickness (in pixels) of line.</param>
/// <since>7.1</since>
public void DrawLineNoClip(Point3d from, Point3d to, Color color, int thickness)
{
  UnsafeNativeMethods.CRhinoDisplayPipeline_DrawLineNoClip(this.m_ptr, from, to, color.ToArgb(), thickness);
}

/// <summary>Draws a single dotted line.</summary>
/// <param name="line">Line to draw.</param>
/// <param name="color">Color of line.</param>
/// <since>5.0</since>
public void DrawDottedLine(Line line, Color color)
{
  this.DrawDottedLine(line.From, line.To, color);
}

/// <summary>Draws a single line with specified pattern.</summary>
/// <param name="line">Line to draw.</param>
/// <param name="color">Color of line.</param>
/// <param name="pattern">Pattern of the line (like 0x00001111 for dotted line).</param>
/// <param name="thickness">Thickness (in pixels) of lines.</param>
/// <since>6.0</since>
public void DrawPatternedLine(Line line, Color color, int pattern, int thickness)
{
  this.DrawPatternedLine(line.From, line.To, color, pattern, thickness);
}

/// <summary>Draws a single dotted line.</summary>
/// <param name="from">Line start point.</param>
/// <param name="to">Line end point.</param>
/// <param name="color">Color of line.</param>
/// <since>5.0</since>
public void DrawDottedLine(Point3d from, Point3d to, Color color)
{
  this.DrawPatternedLine(from, to, color, 4369, 1);
}

/// <summary>Draws a single line with specified pattern.</summary>
/// <param name="from">Line start point.</param>
/// <param name="to">Line end point.</param>
/// <param name="color">Color of line.</param>
/// <param name="pattern">Pattern of the line (like 0x00001111 for dotted line).</param>
/// <param name="thickness">Thickness (in pixels) of lines.</param>
/// <since>6.0</since>
public void DrawPatternedLine(
  Point3d from,
  Point3d to,
  Color color,
  int pattern,
  int thickness)
{
  UnsafeNativeMethods.CRhinoDisplayPipeline_DrawPatternedLine(this.m_ptr, from, to, color.ToArgb(), pattern, thickness);
}