コード例 #1
0
        /// <summary>
        /// Gets a value indicating if this visual analysis mode can be used on a given Rhino object.
        /// </summary>
        /// <param name="obj">The object to be tested.</param>
        /// <returns>true if this mode can indeed be used on the object; otherwise false.</returns>
        /// <since>5.0</since>
        public virtual bool ObjectSupportsAnalysisMode(Pixel.Rhino.DocObjects.RhinoObject obj)
        {
            IntPtr pConstPointer     = ConstPointer();
            IntPtr pConstRhinoObject = obj.ConstPointer();

            return(UnsafeNativeMethods.CRhinoVisualAnalysisMode_ObjectSupportsAnalysisMode(pConstPointer, pConstRhinoObject));
        }
コード例 #2
0
 internal void OnAttachedToRhinoObject(Pixel.Rhino.DocObjects.RhinoObject rhObj)
 {
     m_bDeleteOnDispose = false;
     // make sure all of the callback functions are hooked up
     UnsafeNativeMethods.CRhinoObjectGrips_SetCallbacks(m_OnResetCallback,
                                                        m_OnResetMeshesCallback, m_OnUpdateMeshCallback, m_OnNewGeometryCallback,
                                                        m_OnDrawCallback, m_OnNeighborGripCallback, m_OnNurbsSurfaceGripCallback,
                                                        m_NurbsSurfaceCallback);
 }
コード例 #3
0
        /// <summary>
        /// For derived classes implementers.
        /// <para>Defines the necessary implementation to free the instance from being constant.</para>
        /// </summary>
        protected virtual void NonConstOperation()
        {
            if (IntPtr.Zero == m_ptr)
            {
                // 1 Sept 2017 S. Baer
                // Ensure switching to non-const is thread safe
                lock (m_nonconst_lock)
                {
                    if (IntPtr.Zero == m_ptr)
                    {
                        bool   applymempressure;
                        IntPtr pNewPointer = _InternalDuplicate(out applymempressure);
                        m_ptr = pNewPointer;
                        if (applymempressure)
                        {
                            ApplyMemoryPressure();
                        }

#if RHINO_SDK
                        Pixel.Rhino.DocObjects.RhinoObject parent_object = m__parent as Pixel.Rhino.DocObjects.RhinoObject;
                        if (null != parent_object)
                        {
                            if ((object)parent_object.m_original_geometry == this)
                            {
                                parent_object.m_original_geometry = null;
                                parent_object.m_edited_geometry   = this as Geometry.GeometryBase;
                            }
                            if (parent_object.m_original_attributes == this)
                            {
                                parent_object.m_original_attributes = null;
                                parent_object.m_edited_attributes   = this as DocObjects.ObjectAttributes;
                            }
                        }
#endif
                        OnSwitchToNonConst();
                    }
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// Returns the effective linetype index to be used to find the
        /// linetype definition to draw an object. If an object's linetype
        /// source is LinetypeFromObject, the linetype index in the object's
        /// attributes is used. If an object's linetype source is LinetypeFromLayer
        /// the linetype index from the object's layer is used.
        /// </summary>
        /// <param name="rhinoObject">The Rhino object to use in the query.</param>
        /// <returns>The effective linetype index.</returns>
        /// <since>5.0</since>
        public int LinetypeIndexForObject(Pixel.Rhino.DocObjects.RhinoObject rhinoObject)
        {
            IntPtr pConstRhinoObject = rhinoObject.ConstPointer();

            return(UnsafeNativeMethods.CRhinoLinetypeTable_EffectiveLinetypeIndex(m_doc.RuntimeSerialNumber, pConstRhinoObject));
        }
コード例 #5
0
 /// <summary>
 /// Called before restoring a snapshot. Warns the user if the current model state is not already saved.
 /// </summary>
 /// <param name="doc">doc is the current document.</param>
 /// <param name="doc_object">doc_object is the current object.</param>
 /// <param name="archive">archive is the current state of the model.</param>
 /// <param name="archive_array">archive_array is a list of client data.</param>
 /// <param name="text_log">text_log is used to list the missing items that cannot be found in the current model.</param>
 /// <returns>return true if successful, otherwise false.</returns>
 /// <since>6.0</since>
 public abstract bool IsCurrentModelStateInAnySnapshot(RhinoDoc doc, Pixel.Rhino.DocObjects.RhinoObject doc_object, BinaryArchiveReader archive, SimpleArrayBinaryArchiveReader archive_array, TextLog text_log = null);
コード例 #6
0
 /// <summary>
 /// Called for every object that is associated with a snapshot and gets transformed in Pixel.Rhino. This is getting called for each stored snapshot and gives the client the possibility to update the stored data.
 /// </summary>
 /// <param name="doc">doc is the current document.</param>
 /// <param name="doc_object">doc_obj is the current object.</param>
 /// <param name="transform">transform is a transformation matrix. The matrix is set to identity the first time an object is associated with a snapshot.
 /// After that the matrix is updated when the object is transformed(scale, rotate etc.).</param>
 /// <param name="archive">archive is a archive which can be used to update the stored data.</param>
 /// <returns>true if successful, otherwise false.</returns>
 /// <since>6.0</since>
 public abstract bool ObjectTransformNotification(RhinoDoc doc, Pixel.Rhino.DocObjects.RhinoObject doc_object, ref Pixel.Rhino.Geometry.Transform transform, BinaryArchiveReader archive);
コード例 #7
0
 /// <summary>
 /// Called for each frame. Starting at 0.0.
 /// </summary>
 /// <param name="doc">doc is the current document.</param>
 /// <param name="doc_object">doc_obj is the current object.</param>
 /// <param name="transform">transform is a transformation matrix. The matrix is set to identity the first time an object is associated with a snapshot.
 /// After that the matrix is updated when the object is transformed(scale, rotate etc.).</param>
 /// <param name="dPos">dPos is the current frame. Starting at 0.0.</param>
 /// <param name="archive_start">archive_start is a archive to the data of the starting position.</param>
 /// <param name="archive_stop">archive_stop is a archive to the data of the ending position.</param>
 /// <returns></returns>
 /// <since>6.0</since>
 public abstract bool AnimateObject(RhinoDoc doc, Pixel.Rhino.DocObjects.RhinoObject doc_object, ref Pixel.Rhino.Geometry.Transform transform, double dPos, BinaryArchiveReader archive_start, BinaryArchiveReader archive_stop);
コード例 #8
0
 /// <summary>
 /// Called once at the start of an animation. This can be used to extend the scene bounding box to avoid clipping.
 /// </summary>
 /// <param name="doc">doc is the current document.</param>
 /// <param name="doc_object">doc_obj is the current object.</param>
 /// <param name="transform">transform is a transformation matrix. The matrix is set to identity the first time an object is associated with a snapshot.
 /// After that the matrix is updated when the object is transformed(scale, rotate etc.).</param>
 /// <param name="archive_start">archive_start is a archive to the data of the starting position.</param>
 /// <param name="archive_stop">archive_stop is a archive to the data of the ending position.</param>
 /// <param name="bbox">bbox is the current scene bounding box.</param>
 /// <since>6.0</since>
 public abstract void ExtendBoundingBoxForObjectAnimation(RhinoDoc doc, Pixel.Rhino.DocObjects.RhinoObject doc_object, ref Pixel.Rhino.Geometry.Transform transform, BinaryArchiveReader archive_start, BinaryArchiveReader archive_stop, ref Pixel.Rhino.Geometry.BoundingBox bbox);
コード例 #9
0
 /// <summary>
 /// Called once at the start of an animation.
 /// </summary>
 /// <param name="doc">doc is the current document.</param>
 /// <param name="doc_object">doc_obj is the current object.</param>
 /// <param name="transform">transform is a transformation matrix. The matrix is set to identity the first time an object is associated with a snapshot.
 /// After that the matrix is updated when the object is transformed(scale, rotate etc.).</param>
 /// <param name="archive_start">archive_start is a archive to the data of the starting position.</param>
 /// <param name="archive_stop">archive_stop is a archive to the data of the ending position.</param>
 /// <returns>true if successful, otherwise false.</returns>
 /// <since>6.0</since>
 public abstract bool PrepareForObjectAnimation(RhinoDoc doc, Pixel.Rhino.DocObjects.RhinoObject doc_object, ref Pixel.Rhino.Geometry.Transform transform, BinaryArchiveReader archive_start, BinaryArchiveReader archive_stop);
コード例 #10
0
 /// <summary>
 /// Called when the user restores a snapshot and SupportsObjects() and SupportsObject(Pixel.Rhino.DocObjects.RhinoObject doc_object) returns true.
 /// </summary>
 /// <param name="doc">doc is the current document.</param>
 /// <param name="doc_object">doc_obj is the current object.</param>
 /// <param name="transform">transform is a transformation matrix. The matrix is set to identity the first time an object is associated with a snapshot.
 /// After that the matrix is updated when the object is transformed(scale, rotate etc.).</param>
 /// <param name="archive">archive is the archive to read the data from.</param>
 /// <returns>true if successful, otherwise false.</returns>
 /// <since>6.0</since>
 public abstract bool RestoreObject(RhinoDoc doc, Pixel.Rhino.DocObjects.RhinoObject doc_object, ref Pixel.Rhino.Geometry.Transform transform, BinaryArchiveReader archive);
コード例 #11
0
 /// <summary>
 ///  Returns true if the client saves/restores object user data for the given object.
 /// </summary>
 /// <param name="doc_object">doc_object is the given object</param>
 /// <returns> true if the client saves/restores object user data for the given object.</returns>
 /// <since>6.0</since>
 public abstract bool SupportsObject(Pixel.Rhino.DocObjects.RhinoObject doc_object);
コード例 #12
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(Pixel.Rhino.DocObjects.RhinoObject obj, Pixel.Rhino.Geometry.Mesh mesh, DisplayPipeline pipeline)
 {
 }
コード例 #13
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(Pixel.Rhino.DocObjects.RhinoObject obj, Pixel.Rhino.Geometry.NurbsSurface surface, DisplayPipeline pipeline)
 {
 }
コード例 #14
0
 /// <summary>
 /// If Style==falseColor, then this virtual function must be overridden.
 /// Rhino calls this function when it is time for to set the false colors
 /// on the analysis mesh vertices.  For breps, there is one mesh per face.
 /// For mesh objects there is a single mesh.
 /// </summary>
 /// <param name="obj">The object for which to update vertex colors.</param>
 /// <param name="meshes">An array of meshes that should be updated.</param>
 protected virtual void UpdateVertexColors(Pixel.Rhino.DocObjects.RhinoObject obj, Pixel.Rhino.Geometry.Mesh[] meshes)
 {
 }
コード例 #15
0
 /// <summary>
 /// If an analysis mode needs to modify display attributes, this is the place
 /// to do it.  In particular, Style==Texture, then this function must be
 /// overridden.
 /// </summary>
 /// <remarks>
 /// Shaded analysis modes that use texture mapping, like zebra and emap,
 /// override this function set the texture, diffuse_color, and EnableLighting
 /// parameter.
 /// </remarks>
 /// <param name="obj">The object for which to set up attributes.</param>
 /// <param name="attributes">The linked attributes.</param>
 protected virtual void SetUpDisplayAttributes(Pixel.Rhino.DocObjects.RhinoObject obj, DisplayPipelineAttributes attributes)
 {
 }