Ejemplo n.º 1
0
        protected override void OnDynamicDraw(GetPointDrawEventArgs e)
        {
            IAction action = Core.Instance.Actions.CurrentAction;

            if (action != null)
            {
                PreviewParameters pParam;
                if (SelectionPoints == null)
                {
                    Point3d basePt;
                    TryGetBasePoint(out basePt);
                    pParam = new PreviewParameters(true, null, FromRC.Convert(e.CurrentPoint), FromRC.Convert(basePt));
                }
                else
                {
                    IList <Vector> sPts = new List <Vector>();
                    foreach (Vector pt in SelectionPoints)
                    {
                        sPts.Add(pt);
                        // Draw points:
                        e.Display.DrawPoint(ToRC.Convert(pt), PointStyle.X, 3, System.Drawing.Color.Orange);
                    }
                    sPts.Add(FromRC.Convert(e.CurrentPoint));
                    pParam = new PreviewParameters(true, null, sPts);
                }
                DisplayLayer previewLayer = action.PreviewLayer(pParam);
                if (previewLayer != null)
                {
                    var rParam = new RhinoRenderingParameters(e);
                    previewLayer.Draw(rParam);
                }
            }

            base.OnDynamicDraw(e);
        }
Ejemplo n.º 2
0
 public override bool Draw(RenderingParameters parameters)
 {
     if (parameters is RhinoRenderingParameters && RenderCurve != null)
     {
         RhinoRenderingParameters rParams = (RhinoRenderingParameters)parameters;
         if (RenderCurve is RC.LineCurve && Dotted) //?
         {
             RC.Line line = ((RC.LineCurve)RenderCurve).Line;
             if (Dotted)
             {
                 rParams.Display.DrawDottedLine(line, Material.Diffuse);
             }
             else
             {
                 rParams.Display.DrawLine(line, Material.Diffuse);
             }
         }
         else
         {
             rParams.Display.DrawCurve(RenderCurve, Material.Diffuse, 3);
         }
         double arrS = ToRC.Convert(0.3);
         if (ArrowStart)
         {
             rParams.Display.DrawArrowHead(RenderCurve.PointAtStart - arrS * RenderCurve.TangentAtStart, -RenderCurve.TangentAtStart, Material.Diffuse, 0, arrS);
         }
         if (ArrowEnd)
         {
             rParams.Display.DrawArrowHead(RenderCurve.PointAtEnd + arrS * RenderCurve.TangentAtEnd, RenderCurve.TangentAtEnd, Material.Diffuse, 0, arrS);
         }
         return(true);
     }
     return(false);
 }
Ejemplo n.º 3
0
 public override bool Draw(RenderingParameters parameters)
 {
     if (parameters is RhinoRenderingParameters && _Label != null)
     {
         RhinoRenderingParameters rParams = (RhinoRenderingParameters)parameters;
         var scrPt = rParams.Display.Viewport.WorldToClient(ToRC.Convert(_Label.Position));
         scrPt.X += 2;
         scrPt.Y -= 2;
         rParams.Display.Draw2dText(_Label.Text, System.Drawing.Color.GhostWhite, scrPt, !_Label.HorizontalSetOut.IsEdge());
         return(true);
     }
     return(false);
 }
 public override bool Draw(RenderingParameters parameters)
 {
     if (parameters is RhinoRenderingParameters && _CoordinateSystem != null)
     {
         RhinoRenderingParameters rParams = (RhinoRenderingParameters)parameters;
         if (_CoordinateSystem is CartesianCoordinateSystem)
         {
             CartesianCoordinateSystem cSystem = (CartesianCoordinateSystem)_CoordinateSystem;
             rParams.Display.DrawDirectionArrow(ToRC.Convert(cSystem.Origin), ToRC.ConvertVector(cSystem.X), System.Drawing.Color.LightGray);
             rParams.Display.DrawDirectionArrow(ToRC.Convert(cSystem.Origin), ToRC.ConvertVector(cSystem.Y), System.Drawing.Color.Gray);
             rParams.Display.DrawDirectionArrow(ToRC.Convert(cSystem.Origin), ToRC.ConvertVector(cSystem.Z), System.Drawing.Color.Orange);
         }
         return(true);
     }
     return(false);
 }
        protected override void PostDrawObjects(DrawEventArgs e)
        {
            // Initialise rendering parameters:
            RhinoRenderingParameters parameters = new RhinoRenderingParameters(e);

            // Draw everything:
            // SalamanderHost.Instance.OrnamentTable.DrawAll(parameters);
            Core.Instance.Layers.Draw(parameters);

            // Draw current action preview:
            if (Core.Instance.Actions.CurrentAction != null)
            {
                DisplayLayer previewLayer = Core.Instance.Actions.CurrentAction.PreviewLayer(new Actions.PreviewParameters());
                if (previewLayer != null)
                {
                    previewLayer.Draw(parameters);
                }
            }
        }
Ejemplo n.º 6
0
 public override bool Draw(RenderingParameters parameters)
 {
     if (parameters is RhinoRenderingParameters && RenderMesh != null)
     {
         RhinoRenderingParameters rParams = (RhinoRenderingParameters)parameters;
         if (rParams.Display.DisplayPipelineAttributes.ShadingEnabled)
         {
             rParams.Draw(RenderMesh, Material);
         }
         else
         {
             rParams.DrawWireframe(RenderMesh, Material.Diffuse);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }