IOsnapManager Class Reference

IOsnapManager Class Referenceabstract

#include <omanapi.h>

Class Description

See also
Class OsnapHit, Class INode, Class ViewExp, Class Matrix3, The Advanced Topics section on Snapping.

Description:
This class provides an interface to the OsnapManager. Developers who implement osnaps need to record hits with the osnap manager. Developers implementing command modes are responsible for getting the snap preview done and may be responsible for initializing and closing point sequences. See the Advanced Topics section on Snapping for more details.
+ Inheritance diagram for IOsnapManager:

Public Member Functions

virtual BOOL getactive () const =0
 
virtual BOOL getAxisConstraint ()=0
 
virtual void RecordHit (OsnapHit *somehit)=0
 
virtual BOOL OKForRelativeSnap ()=0
 
virtual BOOL RefPointWasSnapped ()=0
 
virtual Point3 GetRefPoint (BOOL top=TRUE)=0
 
virtual BOOL IsHolding ()=0
 
virtual OsnapHitGetHit ()=0
 
virtual ViewExpGetVpt ()=0
 
virtual INodeGetNode ()=0
 
virtual int GetSnapStrength ()=0
 
virtual Matrix3 GetObjectTM ()=0
 
virtual TimeValue GetTime ()=0
 
virtual void wTranspoint (Point3 *inpt, IPoint3 *outpt)=0
 
virtual void Reset ()=0
 
virtual BOOL TestAFlag (int mask)=0
 
virtual Point3 GetCurrentPoint ()=0
 
- Public Member Functions inherited from BaseInterface
virtual UtilExport ~BaseInterface ()
 Destructor. More...
 
UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
virtual UtilExport Interface_ID GetID ()
 
virtual LifetimeType LifetimeControl ()
 
virtual bool RegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual void UnRegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual BaseInterfaceAcquireInterface ()
 
virtual void ReleaseInterface ()
 
virtual void DeleteInterface ()
 
virtual BaseInterfaceCloneInterface (void *remapDir=NULL)
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 

Additional Inherited Members

- Public Types inherited from BaseInterface
enum  LifetimeType { noRelease, immediateRelease, wantsRelease, serverControlled }
 
- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 

Member Function Documentation

virtual BOOL getactive ( ) const
pure virtual
Remarks
This method is used internally but may be called to determine if the OsnapManager is currently on.
virtual BOOL getAxisConstraint ( )
pure virtual
Remarks
This method is used internally but may be called to determine if the OsnapManager will use the system level axis constraints when performing translation.
virtual void RecordHit ( OsnapHit somehit)
pure virtual
Remarks
When a plugin osnap finds a hit, it should call this method to record it with the manager. This will enter the hit in a stack which is sorted based on proximity to the cursor position. When multiple hits are recorded with the manager, the user has the ability to cycle throught the stack.
Parameters:
OsnapHit* somehit

A pointer to the hit to record. The Osnap plugin should instantiate the hits and the manager is responsible for freeing them.
virtual BOOL OKForRelativeSnap ( )
pure virtual
Remarks
Some snaps only make sense relative to a reference point. Consider, for example, the tangent snap which looks for points of tangency on splines. You can only find a tangent point relative to a second point. As objects are created and manipulated, the OsnapManager maintains a list of the Points that have been input to the current command mode. This method tells you if the first point has been recorded.
virtual BOOL RefPointWasSnapped ( )
pure virtual
Remarks
This method tells you if the point on the top of the reference stack was actually snapped.
virtual Point3 GetRefPoint ( BOOL  top = TRUE)
pure virtual
Remarks
This method retrieves the Point on the top of the reference stack. The point returned is in world space. Note that calling this method when the stack is empty will crash the program. Remember to call OKForRelativeSnap() first. Here are the first few lines of the tangent snap's main method.

void ShapeSnap::Snap(Object* pobj, IPoint2 *p, TimeValue t) {
if(!theman->OKForRelativeSnap())
return;
// Get the reference point
Point3 relpoint(theman->GetRefPoint()); //the last point the user clicked.
// Transform the reference point into the node's coordinate system
Matrix3 tm = theman->GetObjectTM();
relpoint = Inverse(tm) * relpoint;
// . . .
}
Parameters:
BOOL top = TRUE

The default is to return the top of the stack, i.e. the last point which was input to the command mode. If you pass FALSE, the bottom of the stack will be returned.
virtual BOOL IsHolding ( )
pure virtual
Remarks
This method is used internally. This method tells if the any hits were recorded with the OsnapManager during the last scene traversal.
virtual OsnapHit& GetHit ( )
pure virtual
Remarks
This method is used internally. It returns the current hit i.e. the hit which the manager is currently displaying.
virtual ViewExp* GetVpt ( )
pure virtual
Remarks
Returns a pointer to a ViewExp. This is only valid for the duration of the current scene traversal. It is guaranteed to be valid while in a plugin's Snap() method.
virtual INode* GetNode ( )
pure virtual
Remarks
Returns a pointer to the node which is currently being snapped.
virtual int GetSnapStrength ( )
pure virtual
Remarks
Returns the current snap strength. This is the radius of a circular area about the cursor. It is the plugin's responsibility to determine if any "interesting" parts of the object lie within this area. For testing points, see the method OsnapManager::CheckPotentialHit().
virtual Matrix3 GetObjectTM ( )
pure virtual
Remarks
Returns the object transformation matrix of the node which is currently being snapped.
virtual TimeValue GetTime ( )
pure virtual
Remarks
Returns the animation time of the current scene traversal.
virtual void wTranspoint ( Point3 inpt,
IPoint3 outpt 
)
pure virtual
Remarks
This method is not currently used. The method transforms a point in the current node's object space into screen space.
Parameters:
Point3 *inpt

A pointer to the object space point.

IPoint3 *outpt

A pointer to storage for the screen space point.
virtual void Reset ( )
pure virtual
Remarks
This method may be called to clear out the OsnapManager's reference point stack. Typically this is handled internally. However, objects which implement their own creation processes may need to call this method upon completion of a creation cycle.
virtual BOOL TestAFlag ( int  mask)
pure virtual
virtual Point3 GetCurrentPoint ( )
pure virtual