Пример #1
0
        protected override void DrawForeground(Rhino.Display.DrawEventArgs e)
        {
            if (m_conduit_faces != null)
            {
                foreach (var face in m_conduit_faces)
                {
                    var pnt2d = e.Viewport.WorldToClient(face.Centroid);
                    pnt2d.X += scaleMove;
                    pnt2d.Y -= scaleMove;

                    //e.Display.DrawLine(m_conduit_edgeLines[l], m_conduit_edges[l].Color, 2);
                    if (!face.Picked)
                    {
                        e.Display.Draw2dText("F_" + face.Id.ToString(), clrNP, pnt2d, false, scaleSmall);
                        if (double.IsNaN(face.TargetArea))
                        {
                            e.Display.DrawPoint(face.Centroid, PointStyle.Simple, 3, clrNP);
                        }
                        else
                        {
                            e.Display.DrawPoint(face.Centroid, PointStyle.Simple, 4, clrSet);
                        }
                    }
                    else
                    {
                        var clr = System.Drawing.Color.DarkRed;
                        e.Display.DrawPoint(face.Centroid, PointStyle.Simple, 3, clrP);
                        e.Display.Draw2dText("area=" + Math.Round(face.Area, 3).ToString(), clrP, pnt2d, false, scaleBig);
                    }
                }
            }
        }
Пример #2
0
 public virtual void Draw(DrawEventArgs e)
 {
     foreach (var tuple in DisplayGeometry)
     {
         e.Display.DrawMeshShaded(tuple.Item1, tuple.Item2);
     }
 }
Пример #3
0
 protected override void DrawForeground(Rhino.Display.DrawEventArgs e)
 {
     foreach (Line edge in edge_lines)
     {
         e.Display.DrawDottedLine(edge, System.Drawing.Color.Black);
     }
 }
Пример #4
0
        protected override void DrawOverlay(Rhino.Display.DrawEventArgs e)
        {
            base.DrawOverlay(e);
            Rhino.Display.RhinoView     myViewport = Rhino.RhinoDoc.ActiveDoc.Views.ActiveView;
            Rhino.Display.RhinoViewport viewport   = myViewport.ActiveViewport;

            for (int i = 0; i < Ids.Count; i++)
            {
                RhinoObject foundObject                   = Rhino.RhinoDoc.ActiveDoc.Objects.Find(Ids[i]);
                Rhino.Geometry.BoundingBox bbox           = foundObject.Geometry.GetBoundingBox(true);
                Rhino.Geometry.Plane       myFrustumPlane = new Rhino.Geometry.Plane();
                //viewport.GetFrustumFarPlane(out myFrustumPlane);
                //myFrustumPlane.Origin = bbox.Center;
                //Rhino.Geometry.Circle myFrustumCircle = new Rhino.Geometry.Circle();
                //myFrustumCircle.Plane = myFrustumPlane;
                //myFrustumCircle.Radius = bbox.Diagonal.Length / 2;
                //Rhino.Geometry.Curve myFrustumCurve = myFrustumCircle.ToNurbsCurve();

                //myFrustumCurve.Domain = new Rhino.Geometry.Interval(0.0,1.0);



                //e.Display.DrawDot(myFrustumCurve.PointAtNormalizedLength(0.4), i.ToString(), System.Drawing.Color.Red, System.Drawing.Color.White);
            }
            Rhino.RhinoDoc.ActiveDoc.Views.Redraw();
        }
Пример #5
0
        protected override void PreDrawObjects(Rhino.Display.DrawEventArgs e)
        {
            base.PreDrawObjects(e);


            Rhino.RhinoDoc.ActiveDoc.Views.Redraw();
        }
Пример #6
0
        protected override void DrawForeground(Rhino.Display.DrawEventArgs e)
        {
            if (m_conduit_vertices != null)
            {
                foreach (var vrt in m_conduit_vertices)
                {
                    var pnt2d = e.Viewport.WorldToClient(vrt.Point);
                    pnt2d.X += scaleMove;
                    pnt2d.Y -= scaleMove;

                    if (vrt.Picked)
                    {
                        e.Display.DrawPoint(vrt.Point, PointStyle.Simple, 3, clrP);
                        e.Display.Draw2dText("V_" + vrt.Id.ToString(), clrP, pnt2d, false, scaleBig);
                    }
                    else
                    {
                        if (vrt.RestrictSupport != null)
                        {
                            e.Display.DrawPoint(vrt.Point, PointStyle.Simple, 4, clrSet);
                        }
                        else
                        {
                            e.Display.DrawPoint(vrt.Point, PointStyle.Simple, 3, clrNP);
                        }

                        e.Display.Draw2dText("V_" + vrt.Id.ToString(), clrNP, pnt2d, false, scaleSmall);
                    }
                }
            }
        }
Пример #7
0
 protected override void PreDrawObjects(DrawEventArgs e)
 {
   base.PreDrawObjects(e);
   var vp = e.Display.Viewport;
   if (vp.DisplayMode.EnglishName.ToLower() == "wireframe")
     e.Display.DrawMeshWires(m_mesh, m_color);
   else
     e.Display.DrawMeshShaded(m_mesh, m_material);
 }
Пример #8
0
 protected override void DrawForeground(Rhino.Display.DrawEventArgs e)
 {
     if (m_conduit_points != null)
     {
         foreach (var cp in m_conduit_points)
         {
             e.Display.DrawPoint(cp.Point, PointStyle.Tag, 3, cp.Color);
         }
     }
 }
Пример #9
0
 protected override void DrawForeground(Rhino.Display.DrawEventArgs e)
 {
     e.Display.DepthMode = DepthMode.AlwaysInBack;
     if (tempLines != null)
     {
         for (int i = 0; i < tempLines.Count; i++)
         {
             e.Display.DrawLine(tempLines[i].line, tempLines[i].Color, tempLines[i].RoadWidth + 1);
         }
     }
 }
Пример #10
0
 protected override void PostDrawObjects(Rhino.Display.DrawEventArgs e)
 {
     if (corbel != null)
     {
         e.Display.DrawBrepShaded(corbel, new DisplayMaterial(Color.Black, 0.5));
         e.Display.DrawBrepWires(corbel, Color.Black);
     }
     foreach (Brep brep in reinforcements)
     {
         e.Display.DrawBrepShaded(brep, new DisplayMaterial(Color.Black, 0.1));
     }
 }
 protected override void PostDrawObjects(DrawEventArgs e)
 {
     try
     {
         lock (Rhino.RhinoDoc.ActiveDoc.Views.ActiveView)
         {
             for (int i = 0; i < DisplayMesh.Count; i++)
             {
                 for (int j = 0; j < DirMesh[i].Length; j++) e.Display.DrawMeshWires(DirMesh[i][j], System.Drawing.Color.Blue);
                 e.Display.DrawMeshWires(DisplayMesh[i], System.Drawing.Color.Red);
             }
         }
     }
     catch { return; }
 }
Пример #12
0
        protected override void DrawForeground(Rhino.Display.DrawEventArgs e)
        {
            if (m_conduit_edges != null)
            {
                for (int i = 0; i < m_conduit_edges.Count(); i++)
                {
                    var pnt2d = e.Viewport.WorldToClient(m_conduit_midPoints[i]);
                    pnt2d.X += scaleMove;
                    pnt2d.Y -= scaleMove;

                    //e.Display.DrawLine(m_conduit_edgeLines[l], m_conduit_edges[l].Color, 2);
                    if (!m_conduit_edges[i].Picked)
                    {
                        e.Display.Draw2dText("E_" + m_conduit_edges[i].Id.ToString(), clrNP, pnt2d, false, scaleSmall);

                        if (double.IsNaN(m_conduit_edges[i].TargetLength))
                        {
                            e.Display.DrawPoint(m_conduit_midPoints[i], PointStyle.Simple, 3, clrNP);
                        }
                        else
                        {
                            e.Display.DrawPoint(m_conduit_midPoints[i], PointStyle.Simple, 4, clrSet);
                        }
                    }
                    else
                    {
                        string targetL = "";
                        if (double.IsNaN(m_conduit_edges[i].TargetLength))
                        {
                            targetL = "not set";
                        }
                        else
                        {
                            targetL = Math.Round(m_conduit_edges[i].TargetLength, 3).ToString();
                        }

                        e.Display.DrawPoint(m_conduit_midPoints[i], PointStyle.Simple, 3, clrP);
                        e.Display.Draw2dText($"length = {Math.Round(m_conduit_edgeLines[i].Length , 3).ToString()}", clrP, pnt2d, false, scaleBig);
                        e.Display.DrawLine(m_conduit_edgeLines[i], clrP, 2);
                    }
                }
            }
        }
Пример #13
0
    protected override void PreDrawObjects(DrawEventArgs e)
    {
      base.PreDrawObjects(e);

      var c_plane = e.Display.Viewport.ConstructionPlane();
      var x_color = Rhino.ApplicationSettings.AppearanceSettings.GridXAxisLineColor;
      var y_color = Rhino.ApplicationSettings.AppearanceSettings.GridYAxisLineColor;
      var z_color = Rhino.ApplicationSettings.AppearanceSettings.GridZAxisLineColor;

      e.Display.PushDepthWriting(false);
      e.Display.PushDepthTesting(false);

      e.Display.DrawPoint(c_plane.Origin, System.Drawing.Color.White);
      e.Display.DrawArrow(new Line(c_plane.Origin, new Vector3d(c_plane.XAxis) * 10.0), x_color);
      e.Display.DrawArrow(new Line(c_plane.Origin, new Vector3d(c_plane.YAxis) * 10.0), y_color);
      e.Display.DrawArrow(new Line(c_plane.Origin, new Vector3d(c_plane.ZAxis) * 10.0), z_color);

      e.Display.PopDepthWriting();
      e.Display.PopDepthTesting();
    }
 /// <summary>
 /// Called after all non-highlighted objects have been drawn and PostDrawObjects has been called.
 /// Depth writing and testing are turned OFF. If you want to draw with depth writing/testing,
 /// see PostDrawObjects.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="e">The event argument contains the current viewport and display state.</param>
 protected virtual void DrawForeground(DrawEventArgs e) {}
Пример #15
0
        protected override void DrawOverlay(Rhino.Display.DrawEventArgs e)
        {
            base.DrawOverlay(e);

            List <Guid> noDupGUIDs = new List <Guid>();


            for (int i = 0; i < Ids.Count; i++)
            {
                if (noDupGUIDs.Contains(Ids[i]))
                {
                }
                else
                {
                    noDupGUIDs.Add(Ids[i]);
                    RhinoObject foundObject = Rhino.RhinoDoc.ActiveDoc.Objects.Find(Ids[i]);
                    int         isSelected  = foundObject.IsSelected(false);

                    switch (foundObject.ObjectType)
                    {
                    case Rhino.DocObjects.ObjectType.Point:
                        if (isSelected > 0)
                        {
                            e.Display.DrawDot(((Rhino.Geometry.Point)foundObject.Geometry).Location, i.ToString(), System.Drawing.Color.Red, System.Drawing.Color.White);
                        }
                        else
                        {
                            e.Display.DrawDot(((Rhino.Geometry.Point)foundObject.Geometry).Location, i.ToString(), System.Drawing.Color.Black, System.Drawing.Color.White);
                        }
                        break;

                    case Rhino.DocObjects.ObjectType.Curve:
                        Rhino.Geometry.Curve myCurve = (Rhino.Geometry.Curve)foundObject.Geometry;
                        myCurve.Domain = new Rhino.Geometry.Interval(0, 1);
                        if (isSelected > 0)
                        {
                            e.Display.DrawDot(myCurve.PointAtNormalizedLength(0.5), i.ToString(), System.Drawing.Color.Red, System.Drawing.Color.White);
                        }
                        else
                        {
                            e.Display.DrawDot(myCurve.PointAtNormalizedLength(0.5), i.ToString(), System.Drawing.Color.Black, System.Drawing.Color.White);
                        }
                        break;

                    case Rhino.DocObjects.ObjectType.Extrusion:
                        Rhino.Geometry.Extrusion myExtru         = (Rhino.Geometry.Extrusion)foundObject.Geometry;
                        Rhino.Geometry.Point3d   myExtruLocation = myExtru.GetBoundingBox(true).Center;
                        //Rhino.Geometry.Point3d myExtruCentroid = Rhino.Geometry.AreaMassProperties.Compute(myExtru.ToBrep()).Centroid;
                        if (isSelected > 0)
                        {
                            e.Display.DrawDot(myExtruLocation, i.ToString(), System.Drawing.Color.Red, System.Drawing.Color.White);
                        }
                        else
                        {
                            e.Display.DrawDot(myExtruLocation, i.ToString(), System.Drawing.Color.Black, System.Drawing.Color.White);
                        }
                        break;

                    case Rhino.DocObjects.ObjectType.Brep:
                        Rhino.Geometry.Brep    myBrep         = (Rhino.Geometry.Brep)foundObject.Geometry;
                        Rhino.Geometry.Point3d myBrepLocation = myBrep.GetBoundingBox(true).Center;
                        if (isSelected > 0)
                        {
                            e.Display.DrawDot(myBrepLocation, i.ToString(), System.Drawing.Color.Red, System.Drawing.Color.White);
                        }
                        else
                        {
                            e.Display.DrawDot(myBrepLocation, i.ToString(), System.Drawing.Color.Black, System.Drawing.Color.White);
                        }
                        break;

                    case Rhino.DocObjects.ObjectType.Mesh:
                        var mesh = foundObject.Geometry as Rhino.Geometry.Mesh;
                        Rhino.Geometry.Point3d myMeshLocation = mesh.GetBoundingBox(true).Center;
                        if (isSelected > 0)
                        {
                            e.Display.DrawDot(myMeshLocation, i.ToString(), System.Drawing.Color.Red, System.Drawing.Color.White);
                        }
                        else
                        {
                            e.Display.DrawDot(myMeshLocation, i.ToString(), System.Drawing.Color.Black, System.Drawing.Color.White);
                        }
                        break;

                    case Rhino.DocObjects.ObjectType.TextDot:
                        var textDot = (TextDot)foundObject.Geometry;
                        break;

                    case Rhino.DocObjects.ObjectType.Annotation:
                        var textObj = (Rhino.Geometry.TextEntity)foundObject.Geometry;
                        break;
                    }
                }
            }

            Rhino.RhinoDoc.ActiveDoc.Views.Redraw();
        }
Пример #16
0
        private void DisplayPipeline_PostDrawObjects(object sender, DrawEventArgs e)
        {
            //Walls
            e.Display.DrawMeshShaded(_limitBottom, _material);
            e.Display.DrawMeshShaded(_limitTop, _material);

            //Left Blade
            e.Display.PushModelTransform(_bladeTransformLetft);
            e.Display.DrawMeshShaded(_bladeLeft, _material);
            e.Display.PopModelTransform();

            //Right Blade
            e.Display.PushModelTransform(_bladeTransformRight);
            e.Display.DrawMeshShaded(_bladeRight, _material);
            e.Display.PopModelTransform();

            //Ball
            e.Display.PushModelTransform(_ballTransform);
            e.Display.DrawMeshShaded(_ball, _material);
            e.Display.PopModelTransform();

            //FPS
            if (ShowFps)
            {
                var fpsStr = String.Format("FPS:{0}", Math.Round(_currentFps, 1));
                e.Display.Draw2dText(fpsStr, Color.Firebrick, new Point2d(30, 50), false, 30);
            }

            var scoreHeigth = Convert.ToInt32(e.Viewport.Bounds.Height * 0.1);

            //Player Score
            e.Display.Draw2dText(_playerPoints.ToString(), Color.ForestGreen, new Point2d(e.Viewport.Bounds.Width / 2.0 - scoreHeigth, scoreHeigth / 2.0), true, scoreHeigth, "Impact");

            //Player Score
            e.Display.Draw2dText(_iaPoints.ToString(), Color.ForestGreen, new Point2d(e.Viewport.Bounds.Width / 2.0 + scoreHeigth, scoreHeigth / 2.0), true, scoreHeigth, "Impact");

            if (_bigText != null)
            {
                var mid = new Point2d(e.Viewport.Bounds.Width / 2.0, e.Viewport.Bounds.Height / 2.0);
                e.Display.Draw2dText(_bigText, _bigTextColor, mid, true, _bigTextHeight, "Impact");
            }


        }
    void DisplayPipeline_PostDrawObjects(object sender, DrawEventArgs e)
    {
      if (!m_enabled) { return; }
      if (m_disposed) { return; }

      if (e.Viewport.ViewportType == ViewportType.PageViewMainViewport) { return; }

      for (int i = 0; i < m_arcs.Count; i++)
      {
        if (m_arcs[i] == null) { continue; }
        e.Display.DrawArc(m_arcs[i].m_arc, m_arcs[i].m_color, m_arcs[i].m_thickness);
      }
      for (int i = 0; i < m_text.Count; i++)
      {
        if (m_text[i] == null) { continue; }
        e.Display.Draw3dText(m_text[i].m_text, m_text[i].m_color);
      }
      for (int i = 0; i < m_lines.Count; i++)
      {
        if (m_lines[i] == null) { continue; }
        e.Display.DrawLine(m_lines[i].m_line, m_lines[i].m_color, m_lines[i].m_thickness);
      }
      for (int i = 0; i < m_points.Count; i++)
      {
        if (m_points[i] == null) { continue; }
        e.Display.DrawPoint(m_points[i].m_point, m_points[i].m_style, m_points[i].m_radius, m_points[i].m_color);
      }
      for (int i = 0; i < m_curves.Count; i++)
      {
        if (m_curves[i] == null) { continue; }
        e.Display.DrawCurve(m_curves[i].m_curve, m_curves[i].m_color, m_curves[i].m_thickness);
      }
      for (int i = 0; i < m_vectors.Count; i++)
      {
        if (m_vectors[i] == null) { continue; }
        e.Display.DrawArrow(m_vectors[i].m_span, m_vectors[i].m_color);
        if (m_vectors[i].m_anchor)
        {
          e.Display.DrawPoint(m_vectors[i].m_span.From, PointStyle.Simple, 5, m_vectors[i].m_color);
        }
      }
      for (int i = 0; i < m_polygons.Count; i++)
      {
        if (m_polygons[i] == null) { continue; }

        if (m_polygons[i].m_draw_fill)
        {
          e.Display.DrawPolygon(m_polygons[i].m_polygon, m_polygons[i].m_color_fill, true);
        }
        if (m_polygons[i].m_draw_edge)
        {
          e.Display.DrawPolygon(m_polygons[i].m_polygon, m_polygons[i].m_color_edge, false);
        }
      }
    }
            protected override void DrawForeground(DrawEventArgs e)
            {
                int index = 0;
                foreach (Guid G in m_id_list)
                {
                    Rhino.DocObjects.RhinoObject rhobj = Rhino.RhinoDoc.ActiveDoc.Objects.Find(G);
                    if (rhobj == null)
                    {
                        m_id_list.Remove(G);
                        m_Balloons.RemoveAt(index);
                        continue;
                    }

                    if (rhobj.Attributes.ObjectId == G)
                    {
                        if (rhobj.ObjectType == Rhino.DocObjects.ObjectType.Point)
                        {
                            string mode = rhobj.Geometry.GetUserString("SourceType");
                            // Draw our own representation of the object 
                            //m_pChannelAttrs.m_bDrawObject = false;
                            Rhino.Geometry.Point3d pt = rhobj.Geometry.GetBoundingBox(true).Min;
                            // this is a point object so the bounding box will be wee sized 
                            Rhino.Geometry.Point2d screen_pt = e.Display.Viewport.WorldToClient(pt);
                            if (mode == "2" && m_Balloons[index] != null)
                            {
                                if ((rhobj.IsSelected(false) != 0))
                                {
                                    //Display the balloon for 1khz.
                                    e.Display.DrawSprite(LS, pt, 0.25f, true);// screen_pt, 32.0f);
                                    e.Display.DrawMeshWires(this.m_Balloons[index].m_DisplayMesh, Color.Blue);
                                    e.Display.Draw2dText(index.ToString(), Color.Yellow, new Rhino.Geometry.Point2d((int)screen_pt.X, (int)screen_pt.Y + 40), false, 12, "Arial");
                                    double Theta = (m_Balloons[index].CurrentAlt + 270) * System.Math.PI / 180;
                                    double Phi = (m_Balloons[index].CurrentAzi - 90) * System.Math.PI / 180;
                                    Hare.Geometry.Vector Direction = new Hare.Geometry.Vector(Math.Sin(Theta) * Math.Cos(Phi), Math.Sin(Theta) * Math.Sin(Phi), Math.Cos(Theta));
                                    e.Display.DrawLine(pt, new Rhino.Geometry.Point3d(Direction.x * 1000, Direction.y * 1000, Direction.z * 1000) + pt, Color.Red, 1);
                                }
                                else
                                {
                                    //Display the Icon for a loudspeaker.
                                    e.Display.DrawSprite(LU, pt, 0.5f, true);// screen_pt, 32.0f);
                                    //e.Display.DrawMeshVertices(this.m_Balloons[i].m_DisplayMesh, R);
                                    e.Display.Draw2dText(index.ToString(), Color.Black, new Rhino.Geometry.Point2d((int)screen_pt.X, (int)screen_pt.Y + 40), false, 12, "Arial");
                                }
                            }
                            else
                            {
                                if ((rhobj.IsSelected(false) != 0))
                                {
                                    e.Display.DrawSprite(SS, pt, 0.5f, true);// screen_pt, 32.0f);
                                    e.Display.Draw2dText(index.ToString(), Color.Yellow, new Rhino.Geometry.Point2d((int)screen_pt.X, (int)screen_pt.Y + 40), false, 12, "Arial");
                                }
                                else
                                {
                                    e.Display.DrawSprite(SU, pt, 0.5f, true);// screen_pt, 32.0f, Color.Black);
                                    e.Display.Draw2dText(index.ToString(), Color.Black, new Rhino.Geometry.Point2d((int)screen_pt.X, (int)screen_pt.Y + 40), false, 12, "Arial");
                                }
                            }
                        }
                        else if (rhobj.ObjectType == Rhino.DocObjects.ObjectType.Brep)
                        {
                            Rhino.Geometry.Point3d pt = (rhobj.Geometry as Rhino.Geometry.Brep).GetBoundingBox(false).Center;
                            Rhino.Geometry.Point2d screen_pt = e.Display.Viewport.WorldToClient(pt);
                            if ((rhobj.IsSelected(false) != 0))
                            {
                                e.Display.DrawSprite(SS, pt, 0.5f, true);// screen_pt, 32.0f);
                                e.Display.Draw2dText(index.ToString(), Color.Yellow, new Rhino.Geometry.Point2d((int)screen_pt.X, (int)screen_pt.Y + 40), false, 12, "Arial");
                            }
                            else
                            {
                                e.Display.DrawSprite(SU, pt, 0.5f, true);// screen_pt, 32.0f, Color.Black);
                                e.Display.Draw2dText(index.ToString(), Color.Black, new Rhino.Geometry.Point2d((int)screen_pt.X, (int)screen_pt.Y + 40), false, 12, "Arial");
                            }
                        }
                        else if (rhobj.ObjectType == Rhino.DocObjects.ObjectType.Curve)
                        {
                            Rhino.Geometry.Curve crv = (rhobj.Geometry as Rhino.Geometry.Curve);
                            Rhino.Geometry.Point3d[] pts;
                            double[] par = crv.DivideByLength(10, true, out pts);

                            for(int i = 0; i < par.Length; i++)
                            {
                                Rhino.Geometry.Vector3d V = crv.TangentAt(par[i]);
                                e.Display.DrawCircle(new Rhino.Geometry.Circle(new Rhino.Geometry.Plane(pts[i], V), .5), System.Drawing.Color.Red);
                                e.Display.DrawCircle(new Rhino.Geometry.Circle(new Rhino.Geometry.Plane(pts[i], V), .7), System.Drawing.Color.Red);
                                e.Display.DrawCircle(new Rhino.Geometry.Circle(new Rhino.Geometry.Plane(pts[i], V), 1.2), System.Drawing.Color.Red);
                                e.Display.DrawCircle(new Rhino.Geometry.Circle(new Rhino.Geometry.Plane(pts[i], V), 1.4), System.Drawing.Color.Red);
                                e.Display.DrawCircle(new Rhino.Geometry.Circle(new Rhino.Geometry.Plane(pts[i], V), 1.9), System.Drawing.Color.Red);
                                e.Display.DrawCircle(new Rhino.Geometry.Circle(new Rhino.Geometry.Plane(pts[i], V), 2.1), System.Drawing.Color.Red); 
                            }
                            
                            Rhino.Geometry.Point2d screen_pt0 = e.Display.Viewport.WorldToClient(pts[0]);
                            Rhino.Geometry.Point2d screen_pt1 = e.Display.Viewport.WorldToClient(pts[pts.Length-1]);
                            if ((rhobj.IsSelected(false) != 0))
                            {
                                e.Display.Draw2dText(index.ToString(), Color.Yellow, new Rhino.Geometry.Point2d((int)screen_pt0.X, (int)screen_pt0.Y + 40), false, 12, "Arial");
                                e.Display.Draw2dText(index.ToString(), Color.Yellow, new Rhino.Geometry.Point2d((int)screen_pt1.X, (int)screen_pt1.Y + 40), false, 12, "Arial");
                            }
                            else
                            {
                                e.Display.Draw2dText(index.ToString(), Color.Black, new Rhino.Geometry.Point2d((int)screen_pt0.X, (int)screen_pt0.Y + 40), false, 12, "Arial");
                                e.Display.Draw2dText(index.ToString(), Color.Black, new Rhino.Geometry.Point2d((int)screen_pt1.X, (int)screen_pt1.Y + 40), false, 12, "Arial");
                            }

                        }
                    }
                    index++;
                }
            }
 private void _DrawForeground(object sender, DrawEventArgs e) { DrawForeground(e); }
Пример #20
0
        private void DisplayPipelineOnDrawOverlay(object sender, DrawEventArgs drawEventArgs)
        {
            if (_mesh == null)
                return;

            var di = drawEventArgs.Display;

            var result = Waffle.Create(_mesh, _plane, _thickness.CurrentValue, _deeper.CurrentValue, _countX.CurrentValue, _countY.CurrentValue, _unit, _project.CurrentValue, _projectSpace.CurrentValue);

            foreach (var curve in result.CurvesX.SelectMany(o => o))
                di.DrawCurve(curve, Color.White);

            foreach (var curve in result.CurvesY.SelectMany(o => o))
                di.DrawCurve(curve, Color.White);
        }
            //public void Populate(List<List<Point3d>> P, List<List<double>> pressure)
            //{
            //    Mesh_Vis = false;
            //    Section_Vis = false;
            //    if (pressure.Count > 0)
            //    {
            //        PC = new PointCloud();
            //        for (int j = 0; j < P.Count; j++)
            //        {
            //            for (int i = 0; i < P[j].Count; i++)
            //            {
            //                PC.Add(P[j][i], P_Color(Utilities.AcousticalMath.SPL_Intensity(pressure[j][i] * pressure[j][i])));
            //            }
            //        }
            //    }
            //    else
            //    {
            //        for (int j = 0; j < P.Count; j++)
            //        {
            //            PC = new PointCloud(P[j]);
            //        }
            //    }
            //}

            protected override void  PostDrawObjects(DrawEventArgs e)        
            {
                try
                {
                    lock (Rhino.RhinoDoc.ActiveDoc.Views.ActiveView)
                    {
                        if (Mesh_Vis)
                        {
                            for (int i = 0; i < DisplayMesh.Count; i++)
                            {
                                if (e.Viewport.DisplayMode.SupportsShading)
                                {
                                    e.Display.DrawMeshFalseColors(DisplayMesh[i]);
                                    if (e.Viewport.DisplayMode.WireframePipelineRequired)
                                    {
                                        e.Display.DrawMeshWires(DisplayMesh[i], System.Drawing.Color.Black);
                                    }
                                }
                                else
                                {
                                    if (Section_Vis)
                                    {
                                        e.Display.DrawMeshFalseColors(DisplayMesh[i]);
                                    }
                                    else
                                    {
                                        e.Display.DrawMeshWires(DisplayMesh[i], System.Drawing.Color.Green);
                                    }
                                }
                            }
                        }
                        else
                        {
                            e.Display.DrawPointCloud(PC, 2);
                        }
                    }
                }
                catch { return; }
            }
 /// <summary>
 /// If Rhino is in a feedback mode, the draw overlay call allows for temporary geometry to be drawn on top of
 /// everything in the scene. This is similar to the dynamic draw routine that occurs with custom get point.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="e">The event argument contains the current viewport and display state.</param>
 protected virtual void DrawOverlay(DrawEventArgs e) {}
 /// <summary>
 /// Called after all non-highlighted objects have been drawn. Depth writing and testing are
 /// still turned on. If you want to draw without depth writing/testing, see DrawForeground.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="e">The event argument contains the current viewport and display state.</param>
 protected virtual void PostDrawObjects(DrawEventArgs e) {}
Пример #24
0
        protected override void PreDrawObjects(Rhino.Display.DrawEventArgs e)
        {
            base.PreDrawObjects(e);

            RhinoObject foundObject = Rhino.RhinoDoc.ActiveDoc.Objects.Find(Id);

            Rhino.Geometry.BoundingBox bbox = foundObject.Geometry.GetBoundingBox(true);
            bbox.Inflate(2);
            e.Display.EnableDepthWriting(false);
            List <Rhino.Geometry.Point3d> bboxCorners = bbox.GetCorners().ToList();
            List <Rhino.Geometry.Line>    bboxEdges   = bbox.GetEdges().ToList();

            //e.Display.DrawBoxCorners(bbox, System.Drawing.Color.Red, 3, 4);


            Rhino.Display.RhinoView     myViewport = Rhino.RhinoDoc.ActiveDoc.Views.ActiveView;
            Rhino.Display.RhinoViewport viewport   = myViewport.ActiveViewport;

            e.Display.EnableDepthWriting(true);
            e.Display.EnableDepthWriting(false);
            switch (foundObject.ObjectType)
            {
            case Rhino.DocObjects.ObjectType.Point:
                e.Display.DrawPoint(((Rhino.Geometry.Point)foundObject.Geometry).Location, PointStyle.X, 2, myCol);
                break;

            case Rhino.DocObjects.ObjectType.Curve:
                e.Display.DrawCurve((Rhino.Geometry.Curve)foundObject.Geometry, myCol, 4);
                break;

            case Rhino.DocObjects.ObjectType.Extrusion:
                DisplayMaterial eMaterial = new DisplayMaterial(myCol, 0.5);
                e.Display.DrawBrepShaded(((Rhino.Geometry.Extrusion)foundObject.Geometry).ToBrep(), eMaterial);
                break;

            case Rhino.DocObjects.ObjectType.Brep:
                DisplayMaterial bMaterial = new DisplayMaterial(myCol, 0.5);
                e.Display.DrawBrepShaded((Brep)foundObject.Geometry, bMaterial);

                Mesh[] meshes     = Rhino.Geometry.Mesh.CreateFromBrep((Brep)foundObject.Geometry);
                Mesh   globalMesh = new Rhino.Geometry.Mesh();
                foreach (Mesh m in meshes)
                {
                    globalMesh.Append(m);
                }
                Polyline[] myPolys2 = globalMesh.GetOutlines(viewport);
                foreach (Polyline poly in myPolys2)
                {
                    e.Display.DrawCurve(poly.ToNurbsCurve(), Color.Black, 6);
                }
                break;

            case Rhino.DocObjects.ObjectType.Mesh:
                var mesh = foundObject.Geometry as Rhino.Geometry.Mesh;
                if (mesh.VertexColors.Count > 0)
                {
                    for (int i = 0; i < mesh.VertexColors.Count; i++)
                    {
                        mesh.VertexColors[i] = Color.FromArgb(100, mesh.VertexColors[i]);
                    }

                    e.Display.DrawMeshFalseColors(mesh);
                }
                else
                {
                    DisplayMaterial mMaterial = new DisplayMaterial(myCol, 0.5);
                    e.Display.DrawMeshShaded(mesh, mMaterial);
                }
                //e.Display.DrawMeshWires((Mesh)obj, Color.DarkGray);
                break;

            case Rhino.DocObjects.ObjectType.TextDot:
                //e.Display.Draw3dText( ((TextDot)obj).Text, Colors[count], new Plane(((TextDot)obj).Point));
                var textDot = (TextDot)foundObject.Geometry;
                e.Display.DrawDot(textDot.Point, textDot.Text, myCol, Color.White);

                break;

            case Rhino.DocObjects.ObjectType.Annotation:

                var textObj = (Rhino.Geometry.TextEntity)foundObject.Geometry;
                e.Display.Draw3dText(textObj.Text, Color.Black, textObj.Plane, textObj.TextHeight, Rhino.RhinoDoc.ActiveDoc.Fonts[textObj.FontIndex].FaceName);
                break;
            }
            e.Display.EnableDepthWriting(true);



            List <Rhino.Geometry.Line> myEdges = new List <Rhino.Geometry.Line>();

            if (Edges.Count > 0)
            {
                System.Drawing.Color colorKid = System.Drawing.Color.LightCoral;
                foreach (List <Guid> li in Edges)
                {
                    RhinoObject foundObject0 = Rhino.RhinoDoc.ActiveDoc.Objects.Find(li[0]);
                    RhinoObject foundObject1 = Rhino.RhinoDoc.ActiveDoc.Objects.Find(li[1]);
                }
            }
            Rhino.RhinoDoc.ActiveDoc.Views.Redraw();
        }
Пример #25
0
 private void DisplayPipeline_PostDrawObjects(object sender, DrawEventArgs e)
 {
     _maze.Draw(e);
     _pacman.Draw(e);
     _gohsts.Draw(e);
 }
Пример #26
0
    private static void GetPointPostDrawObjectsCallback(IntPtr pPipeline, IntPtr pConduit)
    {
      if (null == m_active_gp)
        return;

      try
      {
        Rhino.Display.DrawEventArgs e = new DrawEventArgs(pPipeline, pConduit);
        m_active_gp.OnPostDrawObjects(e);
      }
      catch (Exception ex)
      {
        Runtime.HostUtils.ExceptionReport(ex);
      }
    }
Пример #27
0
 public override void Draw(DrawEventArgs e)
 {
     e.Display.PushModelTransform(Transform);
     base.Draw(e);
     e.Display.PopModelTransform();
 }
Пример #28
0
 private static void DisplayPipeline_PostDrawObjects(object sender, DrawEventArgs e)
 {
     _menuObjects.Draw(e);
 }
            protected override void DrawForeground(DrawEventArgs e)
            {
                int index = 0;

                if (Dir != null)
                    e.Display.DrawLineArrow(Dir, System.Drawing.Color.Red, 3, .1);

                foreach (Guid G in m_id_list)
                {
                    //Rhino.DocObjects.RhinoObject rhobj = m_pChannelAttrs.m_pObject;
                    Rhino.DocObjects.RhinoObject rhobj = Rhino.RhinoDoc.ActiveDoc.Objects.Find(G);
                    if (rhobj == null)
                    {
                        m_id_list.Remove(G);
                        continue;
                    }
                    // Draw our own representation of the object 
                    Rhino.Geometry.Point2d screen_pt = e.Display.Viewport.WorldToClient(rhobj.Geometry.GetBoundingBox(true).Min);
                    if ((rhobj.IsSelected(false) != 0))
                    {
                        e.Display.DrawSprite(RS, rhobj.Geometry.GetBoundingBox(true).Min, 0.5f, true);// screen_pt, 32.0f);
                        e.Display.Draw2dText(index.ToString(), Color.Yellow, new Rhino.Geometry.Point2d((int)screen_pt.X, (int)screen_pt.Y + 40), false, 12, "Arial");
                    }
                    else
                    {
                        e.Display.DrawSprite(RU, rhobj.Geometry.GetBoundingBox(true).Min, 0.5f, true);// screen_pt, 32.0f);
                        e.Display.Draw2dText(index.ToString(), Color.Black, new Rhino.Geometry.Point2d((int)screen_pt.X, (int)screen_pt.Y + 40), false, 12, "Arial");
                    }
                    index++;
                }
            }
Пример #30
0
 protected override void DrawForeground(Rhino.Display.DrawEventArgs e)
 {
     e.Display.DrawBitmap(m_display_bitmap, 50, 50, Color.White);
 }
 private void _DrawOverlay(object sender, DrawEventArgs e)  { DrawOverlay(e); }
 private void _PreDrawObjects(object sender, DrawEventArgs e) { PreDrawObjects(e); }
Пример #33
0
        protected override void PreDrawObjects(Rhino.Display.DrawEventArgs e)
        {
            base.PreDrawObjects(e);


            for (int i = 0; i < Ids.Count; i++)
            {
                RhinoObject foundObject         = Rhino.RhinoDoc.ActiveDoc.Objects.Find(Ids[i]);
                Rhino.Geometry.BoundingBox bbox = foundObject.Geometry.GetBoundingBox(true);
                bbox.Inflate(2);

                e.Display.EnableDepthWriting(false);
                //e.Display.DrawBoxCorners(bbox, System.Drawing.Color.DarkGray, 3, 2);
                e.Display.EnableDepthWriting(true);
                switch (foundObject.ObjectType)
                {
                case Rhino.DocObjects.ObjectType.Point:
                    e.Display.DrawPoint(((Rhino.Geometry.Point)foundObject.Geometry).Location, PointStyle.X, 2, myCol);
                    break;

                case Rhino.DocObjects.ObjectType.Curve:
                    e.Display.DrawCurve((Rhino.Geometry.Curve)foundObject.Geometry, myCol, 3);
                    break;

                case Rhino.DocObjects.ObjectType.Extrusion:
                    DisplayMaterial eMaterial = new DisplayMaterial(myCol, 0.5);
                    e.Display.DrawBrepShaded(((Rhino.Geometry.Extrusion)foundObject.Geometry).ToBrep(), eMaterial);
                    break;

                case Rhino.DocObjects.ObjectType.Brep:
                    DisplayMaterial bMaterial = new DisplayMaterial(myCol, 0.5);
                    e.Display.DrawBrepShaded((Brep)foundObject.Geometry, bMaterial);
                    break;

                case Rhino.DocObjects.ObjectType.Mesh:
                    var mesh = foundObject.Geometry as Rhino.Geometry.Mesh;
                    if (mesh.VertexColors.Count > 0)
                    {
                        for (int j = 0; j < mesh.VertexColors.Count; j++)
                        {
                            mesh.VertexColors[j] = Color.FromArgb(100, mesh.VertexColors[j]);
                        }
                        e.Display.DrawMeshFalseColors(mesh);
                    }
                    else
                    {
                        DisplayMaterial mMaterial = new DisplayMaterial(myCol, 0.5);
                        e.Display.DrawMeshShaded(mesh, mMaterial);
                    }
                    //e.Display.DrawMeshWires((Mesh)obj, Color.DarkGray);
                    break;

                case Rhino.DocObjects.ObjectType.TextDot:
                    //e.Display.Draw3dText( ((TextDot)obj).Text, Colors[count], new Plane(((TextDot)obj).Point));
                    var textDot = (TextDot)foundObject.Geometry;
                    e.Display.DrawDot(textDot.Point, textDot.Text, myCol, Color.White);

                    break;

                case Rhino.DocObjects.ObjectType.Annotation:

                    var textObj = (Rhino.Geometry.TextEntity)foundObject.Geometry;
                    e.Display.Draw3dText(textObj.Text, Color.Black, textObj.Plane, textObj.TextHeight, Rhino.RhinoDoc.ActiveDoc.Fonts[textObj.FontIndex].FaceName);
                    break;
                }
            }

            Rhino.RhinoDoc.ActiveDoc.Views.Redraw();
        }