Public Member Functions | Friends

OsnapHit Class Reference

Search for all occurrences

Detailed Description

See also:
Class IOsnapManager, Class Osnap, Class HitMesh, Class Point3, Class IPoint3, The Advanced Topics section on Snapping.

Description:
This class is available in release 2.0 and later only.

This class encapsulates the data required to record a snapped point. Typically a plug-in creates instances of this class and records them with the OsnapManager. The manager is responsible for freeing the memory associated with recorded hits. All the methods of this class are implemented by the system. If a snap plugin needs to record additional data for its hits, it should derive from this class and provide a clone method which copies this additional data and calls the base classes clone method.

#include <osnaphit.h>

Inheritance diagram for OsnapHit:
Inheritance graph
[legend]

List of all members.

Public Member Functions

CoreExport  OsnapHit (Point3 p3, Osnap *s, int sub, HitMesh *m)
CoreExport  OsnapHit (Point3 pt)
CoreExport  OsnapHit (const OsnapHit &h)
virtual CoreExport OsnapHit operator= (const OsnapHit &h)
virtual CoreExport  ~OsnapHit ()
virtual CoreExport OsnapHit clone ()
void  setscreendata (IPoint3 screen3, int len)
virtual CoreExport boolean  display (ViewExp *vpt, TimeValue t, Point3 color, int markersize, boolean markers=TRUE, boolean hilite=TRUE)
CoreExport void  erase (ViewExp *vpt, TimeValue t) const
CoreExport void  GetViewportRect (TimeValue t, ViewExp *vpt, Rect *rect, int marksize) const
CoreExport Point3  GetHitpoint ()
CoreExport Point3  GetWorldHitpoint ()
CoreExport IPoint3  GetHitscreen ()
CoreExport int  GetSubsnap ()
CoreExport POINT  GetCursor ()
INode GetNode ()
void  Dump () const
CoreExport BOOL  operator< (OsnapHit &hit)
CoreExport BOOL  operator> (OsnapHit &hit)
void  Update (TimeValue t)
CoreExport Point3  ReEvaluate (TimeValue t)
virtual bool  IsWorldSpaceHit ()

Friends

class  OsnapManager
class  Osnap
class  TypedHit

Constructor & Destructor Documentation

CoreExport OsnapHit ( Point3  p3,
Osnap s,
int  sub,
HitMesh m 
)
Remarks:
Constructor. The data members are initialized to the values passed.
Parameters:
Point3 p3

The point that was hit in object space.

Osnap* s

Points to the Osnap instance which made this hit.

int sub

The sub-snap index which made this hit.

HitMesh *m

Points to the mesh used to hilite the topology that was hit.
CoreExport OsnapHit ( Point3  pt )
CoreExport OsnapHit ( const OsnapHit h )
Remarks:
Constructor. The data members are initialized from the OsnapHit passed.
Parameters:
const OsnapHit& h

The data members are copied from this OsnapHit.
virtual CoreExport ~OsnapHit ( ) [virtual]
Remarks:
Destructor. If a HitMesh was allocated it is deleted.

Member Function Documentation

virtual CoreExport OsnapHit& operator= ( const OsnapHit h ) [virtual]
Remarks:
Assignment operator.
Parameters:
const OsnapHit& h

The OsnapHit to assign.
virtual CoreExport OsnapHit* clone ( ) [virtual]
Remarks:
Returns a pointer to a new instance of the OsnapHit class and initializes it with this instance. Developers deriving from this class should overide this method.
void setscreendata ( IPoint3  screen3,
int  len 
)
Remarks:
This method is used internally. Sets the data members associated with screen hit data.
Parameters:
IPoint3 screen3

The hit location in screen space.

int len

The distance from the cursor.
virtual CoreExport boolean display ( ViewExp vpt,
TimeValue  t,
Point3  color,
int  markersize,
boolean  markers = TRUE,
boolean  hilite = TRUE 
) [virtual]
Remarks:
This display method is implemented by the system and used internally.
Parameters:
ViewExp *vpt

The viewport to display in.

TimeValue t

The current time.

Point3 color

The color to draw it in.

int markersize

The relative size of the icon.

boolean markers = TRUE

Controls whether or not the hit icon is drawn.

boolean hilite = TRUE

Controls whether or not the mesh part of the hit is drawn.

Reimplemented in TypedHit.

CoreExport void erase ( ViewExp vpt,
TimeValue  t 
) const
Remarks:
This method is not currently used.
CoreExport void GetViewportRect ( TimeValue  t,
ViewExp vpt,
Rect rect,
int  marksize 
) const
Remarks:
Implemented by the system.

This method determines the damage rectangle for this hit.
Parameters:
TimeValue t

The time at which to compute the rectangle.

ViewExp *vpt

The viewport in which to compute the rectangle.

Rect *rect

Points to storage for the computed result.

int marksize

The size of the icon.
CoreExport Point3 GetHitpoint ( ) [inline]
Remarks:
Returns the hit location in object space.
{return hitpoint;};
CoreExport Point3 GetWorldHitpoint ( ) [inline]
Remarks:
Returns the hit location in world space.
{return worldpoint;};
CoreExport IPoint3 GetHitscreen ( ) [inline]
Remarks:
Returns the hit location in screen space. IPoint3.z is the depth in screen space.
{return m_hitscreen;};
CoreExport int GetSubsnap ( ) [inline]
Remarks:
Returns the sub-snap index which made this hit.
{return subsnap;}
CoreExport POINT GetCursor ( ) [inline]
{return m_cursor;}
INode* GetNode ( ) [inline]
Remarks:
Returns a pointer to the node which got hit.
{return node;}
void Dump ( ) const
Remarks:
This method is used internally for debugging and is not implemented for plug-in use.
Operators:
CoreExport BOOL operator< ( OsnapHit hit )
Remarks:
This comparison operator is used in sorting.
Parameters:
OsnapHit& hit

The OsnapHit to compare.
Returns:
TRUE if the distance from the cursor is less than hit; otherwise checks if the depth in Z space is less than hit: If so TRUE; otherwise FALSE.
CoreExport BOOL operator> ( OsnapHit hit )
Remarks:
This comparison operator is used in sorting.
Parameters:
OsnapHit& hit

The OsnapHit to compare.
Returns:
TRUE if the distance from the cursor is less than hit; otherwise checks if the depth in Z space is less than hit: If so TRUE; otherwise FALSE.
void Update ( TimeValue  t )
Remarks:
This method is not currently implemented.
CoreExport Point3 ReEvaluate ( TimeValue  t )
Remarks:
Implemented by the System.

This method updates the internal data to reflect a change in time. For example, if a hit is recorded on the endpoint of a particular edge of a mesh, the node moving would invalidate the hit data and a call to this method would be required before using its data.
Parameters:
TimeValue t

The time at which to reevaluate it.
Returns:
The updated point in world space.
virtual bool IsWorldSpaceHit ( ) [inline, virtual]

Reimplemented in TypedHit.

{return false;}

Friends And Related Function Documentation

friend class OsnapManager [friend]
friend class Osnap [friend]
friend class TypedHit [friend]

OsnapHit OsnapHit OsnapHit OsnapHit OsnapHit OsnapHit OsnapHit OsnapHit OsnapHit OsnapHit
OsnapHit OsnapHit OsnapHit OsnapHit OsnapHit OsnapHit OsnapHit OsnapHit OsnapHit OsnapHit