Пример #1
0
 public void Draw(DisplayPipeline display)
 {
     if (null != m_brep)
     {
         display.DrawBox(m_box, Color.BlueViolet);
     }
 }
        internal IntPtr NonConstPointer()
        {
            if (m_ptr_attributes != IntPtr.Zero)
            {
                return(m_ptr_attributes);
            }

            // Check pipeline_parent first since this is typically time critical
            // code when this is used.
            DisplayPipeline pipeline_parent = m_parent as DisplayPipeline;

            if (pipeline_parent != null)
            {
                // We can cheat and use a const pointer for the non-const version. This is
                // because when a pipeline is associated with attributes, it typically
                // happens when conduits are involved. When conduits are being called, the
                // attributes are exposed as a non const pointer.
                return(pipeline_parent.DisplayAttributeConstPointer());
            }

            DisplayModeDescription parent = m_parent as DisplayModeDescription;

            if (parent != null)
            {
                return(parent.DisplayAttributeNonConstPointer());
            }
            return(IntPtr.Zero);
        }
Пример #3
0
 public void Draw(DisplayPipeline display)
 {
     if (null != m_brep)
     {
         display.DrawBrepWires(m_brep, Rhino.ApplicationSettings.AppearanceSettings.FeedbackColor);
     }
 }
Пример #4
0
        internal IntPtr NonConstPointer()
        {
            if (m_pAttrs != IntPtr.Zero)
            {
                return(m_pAttrs);
            }

            // Check pipeline_parent first since this is typically time critical
            // code when this is used.
            DisplayPipeline pipeline_parent = m_parent as DisplayPipeline;

            if (pipeline_parent != null)
            {
                // Can't change the attributes in a pipeline, so create a copy
                // under the hood
                IntPtr pConstAttributes = ConstPointer();
                if (pConstAttributes != IntPtr.Zero)
                {
                    m_pAttrs = UnsafeNativeMethods.CDisplayPipelineAttributes_New2(pConstAttributes);
                    m_parent = null;
                    return(m_pAttrs);
                }
            }

            DisplayModeDescription parent = m_parent as DisplayModeDescription;

            if (parent != null)
            {
                return(parent.DisplayAttributeNonConstPointer());
            }
            return(IntPtr.Zero);
        }
Пример #5
0
        internal override void Draw(DisplayPipeline pipeline, System.Drawing.Color color, int thickness)
        {
            IntPtr pDisplayPipeline = pipeline.NonConstPointer();
            int    argb             = color.ToArgb();
            IntPtr pCurveDisplay    = CurveDisplay();

            UnsafeNativeMethods.CurveDisplay_Draw(pCurveDisplay, pDisplayPipeline, argb, thickness);
        }
Пример #6
0
        /// <summary>
        /// If Style==Wireframe, then the default decomposes the curve object into
        /// nurbs curve segments and calls the virtual DrawNurbsCurve for each segment.
        /// </summary>
        /// <param name="curve">A document curve object.</param>
        /// <param name="pipeline">The drawing pipeline.</param>
        protected virtual void DrawCurveObject(Rhino.DocObjects.CurveObject curve, DisplayPipeline pipeline)
        {
            IntPtr pConstThis  = ConstPointer();
            IntPtr pConstCurve = curve.ConstPointer();
            IntPtr pPipeline   = pipeline.NonConstPointer();

            UnsafeNativeMethods.CRhinoVisualAnalysisMode_DrawCurveObject(pConstThis, pConstCurve, pPipeline);
        }
Пример #7
0
        public void DrawViewportWires(IGH_PreviewArgs args)
        {
            DisplayPipeline dp = args.Display;

            foreach (DMesh3_goo goo in this.m_data.NonNulls)
            {
                goo.GenerateDispMesh();
                dp.DrawMeshWires(goo.dispMsh, Color.DarkGray);
            }
        }
Пример #8
0
        public void DrawViewportWires(IGH_PreviewArgs args)
        {
            DisplayPipeline dp = args.Display;

            foreach (EdgeConstraint_goo goo in this.m_data.NonNulls)
            {
                goo.GenerateDisplayCurve();
                dp.DrawCurve(goo.DisplayCurve, Color.DarkRed, 2);
                dp.DrawPoints(((PolylineCurve)goo.DisplayCurve).ToPolyline(), PointStyle.ArrowTip, 3, Color.Black);
            }
        }
Пример #9
0
        public void DrawViewportWires(IGH_PreviewArgs args)
        {
            DisplayPipeline dp = args.Display;

            foreach (EdgeSpan_goo goo in this.m_data.NonNulls)
            {
                goo.GenerateDispMesh();
                goo.GenerateDispCurves();
                dp.DrawMeshWires(goo.dispMsh, Color.DarkGray);
                dp.DrawCurve(goo.span, Color.DarkRed, 2);
            }
        }
Пример #10
0
        public void DrawViewportWires(IGH_PreviewArgs args)
        {
            DisplayPipeline dp = args.Display;

            foreach (Grid3f_goo goo in this.m_data.NonNulls)
            {
                goo.GenerateDispPts();
                int len = goo.dispPts.Length;

                for (int i = 0; i < len; i++)
                {
                    dp.DrawPoint(goo.dispPts[i]);
                    //dp.DrawDot(goo.dispPts[i], goo.values[i].ToString());
                }
            }
        }
Пример #11
0
        public static void DrawInstanceObject(this DisplayPipeline display, InstanceObject instanceObject, Transform xForm, bool highlight)
        {
            instanceObject.Explode(false, out var pieces, out _,
                                   out var pieceTransforms);
            var geo = instanceObject.Geometry;

            for (int i = 0; i < pieces.Length; i++)
            {
                if (highlight)
                {
                    display.DrawObjectHighlighted(pieces[i], xForm * pieceTransforms[i]);
                }
                else
                {
                    display.DrawObject(pieces[i], xForm * pieceTransforms[i]);
                }
            }
        }
Пример #12
0
        static void OnDrawRhinoObjectProc(Guid am_id, IntPtr pConstRhinoObject, IntPtr pRhinoDisplayPipeline)
        {
            VisualAnalysisMode mode = FindLocal(am_id);

            if (mode != null)
            {
                var             rhobj = Rhino.DocObjects.RhinoObject.CreateRhinoObjectHelper(pConstRhinoObject);
                DisplayPipeline dp    = new DisplayPipeline(pRhinoDisplayPipeline);
                try
                {
                    Rhino.DocObjects.BrepObject brep = rhobj as Rhino.DocObjects.BrepObject;
                    if (brep != null)
                    {
                        mode.DrawBrepObject(brep, dp);
                        return;
                    }
                    Rhino.DocObjects.CurveObject curve = rhobj as Rhino.DocObjects.CurveObject;
                    if (curve != null)
                    {
                        mode.DrawCurveObject(curve, dp);
                        return;
                    }
                    Rhino.DocObjects.MeshObject mesh = rhobj as Rhino.DocObjects.MeshObject;
                    if (mesh != null)
                    {
                        mode.DrawMeshObject(mesh, dp);
                        return;
                    }
                    Rhino.DocObjects.PointCloudObject pointcloud = rhobj as Rhino.DocObjects.PointCloudObject;
                    if (pointcloud != null)
                    {
                        mode.DrawPointCloudObject(pointcloud, dp);
                        return;
                    }
                    Rhino.DocObjects.PointObject pointobj = rhobj as Rhino.DocObjects.PointObject;
                    if (pointobj != null)
                    {
                        mode.DrawPointObject(pointobj, dp);
                        return;
                    }
                }
                catch (Exception) { }
            }
        }
Пример #13
0
        public static void DrawObjectHighlighted(this DisplayPipeline display, RhinoObject rhinoObject, Transform xForm)
        {
            // get old color and color source
            var objColor       = rhinoObject.Attributes.ObjectColor;
            var objColorSource = rhinoObject.Attributes.ColorSource;

            // modify
            rhinoObject.Attributes.ObjectColor = Rhino.ApplicationSettings.AppearanceSettings.SelectedObjectColor;
            rhinoObject.Attributes.ColorSource = ObjectColorSource.ColorFromObject;
            rhinoObject.CommitChanges();

            // draw
            display.DrawObject(rhinoObject, xForm);

            // restore old settings
            rhinoObject.Attributes.ObjectColor = objColor;
            rhinoObject.Attributes.ColorSource = objColorSource;
            rhinoObject.CommitChanges();
        }
Пример #14
0
        public void DrawViewportMeshes(IGH_PreviewArgs args)
        {
            DisplayPipeline dp = args.Display;

            foreach (DMesh3_goo goo in this.m_data.NonNulls)
            {
                goo.GenerateDispMesh();

                if (goo.dispMsh.VertexColors.Count != 0)
                {
                    dp.DrawMeshFalseColors(goo.dispMsh);
                }
                else
                {
                    dp.DrawMeshShaded(goo.dispMsh, new DisplayMaterial(Color.DarkSlateGray, 0.2));
                }

                dp.DrawMeshWires(goo.dispMsh, Color.DarkGray);
            }
        }
Пример #15
0
        static void OnDrawGeometryProc(Guid am_id, IntPtr pConstRhinoObject, IntPtr pConstGeometry, IntPtr pRhinoDisplayPipeline)
        {
            VisualAnalysisMode mode = FindLocal(am_id);

            if (mode != null)
            {
                var rhobj = Rhino.DocObjects.RhinoObject.CreateRhinoObjectHelper(pConstRhinoObject);
                var geom  = Rhino.Geometry.GeometryBase.CreateGeometryHelper(pConstGeometry, null);
                if (geom != null)
                {
                    geom.DoNotDestructOnDispose();
                }
                DisplayPipeline     dp   = new DisplayPipeline(pRhinoDisplayPipeline);
                Rhino.Geometry.Mesh mesh = geom as Rhino.Geometry.Mesh;
                try
                {
                    if (mesh != null)
                    {
                        mode.DrawMesh(rhobj, mesh, dp);
                        return;
                    }
                    Rhino.Geometry.NurbsCurve nurbscurve = geom as Rhino.Geometry.NurbsCurve;
                    if (nurbscurve != null)
                    {
                        mode.DrawNurbsCurve(rhobj, nurbscurve, dp);
                        return;
                    }
                    Rhino.Geometry.NurbsSurface nurbssurf = geom as Rhino.Geometry.NurbsSurface;
                    if (nurbssurf != null)
                    {
                        mode.DrawNurbsSurface(rhobj, nurbssurf, dp);
                        return;
                    }
                }
                catch (Exception) { }
            }
        }
        internal IntPtr ConstPointer()
        {
            if (m_ptr_attributes != IntPtr.Zero)
            {
                return(m_ptr_attributes);
            }

            // Check pipeline_parent first since this is typically time critical
            // code when this is used.
            DisplayPipeline pipeline_parent = m_parent as DisplayPipeline;

            if (pipeline_parent != null)
            {
                return(pipeline_parent.DisplayAttributeConstPointer());
            }

            DisplayModeDescription parent = m_parent as DisplayModeDescription;

            if (parent != null)
            {
                return(parent.DisplayAttributeConstPointer());
            }
            return(IntPtr.Zero);
        }
Пример #17
0
 /// <summary>
 /// Draws a mesh.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="obj">A Rhino object corresponding to the surface.</param>
 /// <param name="mesh">The mesh geometry.</param>
 /// <param name="pipeline">The current display pipeline.</param>
 protected virtual void DrawMesh(Rhino.DocObjects.RhinoObject obj, Rhino.Geometry.Mesh mesh, DisplayPipeline pipeline)
 {
 }
Пример #18
0
 /// <summary>
 /// Draws a NURBS curve. This is a good function to override for
 /// analysis modes like curvature hair display.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="obj">A Rhino object corresponding to the curve.</param>
 /// <param name="curve">The curve geometry.</param>
 /// <param name="pipeline">The current display pipeline.</param>
 protected virtual void DrawNurbsCurve(Rhino.DocObjects.RhinoObject obj, Rhino.Geometry.NurbsCurve curve, DisplayPipeline pipeline)
 {
 }
Пример #19
0
 /// <summary>
 /// Draws a NURBS surface. This is a good function to override
 /// to display object-related meshes.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="obj">A Rhino object corresponding to the surface.</param>
 /// <param name="surface">The surface geometry.</param>
 /// <param name="pipeline">The current display pipeline.</param>
 protected virtual void DrawNurbsSurface(Rhino.DocObjects.RhinoObject obj, Rhino.Geometry.NurbsSurface surface, DisplayPipeline pipeline)
 {
 }
Пример #20
0
 /// <summary>
 /// Draws one brep. Override this method to add your custom behavior.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="brep">A brep object.</param>
 /// <param name="pipeline">The current display pipeline.</param>
 protected virtual void DrawBrepObject(Rhino.DocObjects.BrepObject brep, DisplayPipeline pipeline)
 {
 }
Пример #21
0
 /// <summary>
 /// Draws one point cloud. Override this method to add your custom behavior.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="pointCloud">A point cloud object.</param>
 /// <param name="pipeline">The current display pipeline.</param>
 protected virtual void DrawPointCloudObject(Rhino.DocObjects.PointCloudObject pointCloud, DisplayPipeline pipeline)
 {
 }
Пример #22
0
 /// <summary>
 /// Draws one mesh. Override this method to add your custom behavior.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="mesh">A mesh object.</param>
 /// <param name="pipeline">The current display pipeline.</param>
 protected virtual void DrawMeshObject(Rhino.DocObjects.MeshObject mesh, DisplayPipeline pipeline)
 {
 }
Пример #23
0
 public static void DrawLine2d(this DisplayPipeline pipeline, Line2d line, Color lineColor, int lineThickness)
 {
     pipeline.Draw2dLine(line.From, line.To, lineColor, lineThickness);
 }
 /// <summary>
 /// Pipeline constructor
 /// </summary>
 /// <param name="display"></param>
 public RhinoRenderingParameters(DisplayPipeline display, DisplayMaterial overrideMaterial = null)
 {
     Display          = display;
     OverrideMaterial = overrideMaterial;
 }
 internal DisplayPipelineAttributes(DisplayPipeline parent)
 {
     m_parent = parent;
 }
Пример #26
0
 /// <summary>
 /// Draws one point. Override this method to add your custom behavior.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="point">A point object.</param>
 /// <param name="pipeline">The current display pipeline.</param>
 protected virtual void DrawPointObject(Pixel.Rhino.DocObjects.PointObject point, DisplayPipeline pipeline)
 {
 }