Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
hdi::core::HitData Class Reference

Allows for hit data creation, metadata access, snapping, etc. More...

#include <hdicoreHitData.h>

Public Types

enum  HitType {
  NothingHit = 0 , SegPointHit = 10 , SegInPointHit = 20 , SegOutPointHit = 30 ,
  SegInteriorHit = 40 , FillHit = 50
}
 Describes the type hit that was actually detected from a request. More...
 

Public Member Functions

 HitData ()
 Constructs an empty HitData object.
 
 HitData (const HitData &hitData_)
 Constructs a HitData object from an existing HitData object (copy constructor)
 
 HitData (const Art *const art_, const ArtboardPoint &pt_, const HitRequest request_, const double tolerance_=2.0, const bool adjustToZoom_=true)
 Constructs a HitData object from a hit test, with an optional tolerance and zoom adjustment.
 
virtual ~HitData ()
 Destructs a HitData object.
 
virtual bool isEmpty () const
 Gets whether the target HitData object is empty (constructed with the default ctor)
 
virtual HitDataoperator= (const HitData &rhs_)
 Assigns one HitData object to another.
 
virtual bool operator== (const HitData &rhs_) const
 Tests whether a given HitData object is the same as another.
 
virtual bool operator!= (const HitData &rhs_) const
 Tests whether a given HitData object is not the same as another.
 
virtual HitRequest request () const
 Gets the original type of hit test performed.
 
virtual bool hit () const
 Reports whether some art was hit.
 
virtual HitType hitType () const
 Gets the type of hit detected.
 
virtual std::unique_ptr< Artart () const
 Gets the art that was hit (or NULL if none)
 
virtual int16_t segPointIndex () const
 Gets the segment point hit.
 
virtual int16_t segIndex () const
 Gets the segment number of a path that was hit.
 
virtual double tValue () const
 Gets the t-value of the hit along a path.
 
virtual ArtboardPoint point () const
 Gets the point hit.
 
virtual std::unique_ptr< Bezierbezier () const
 Gets the bezier for the segment hit.
 
virtual std::unique_ptr< TextRangetextRange () const
 Gets the text range that was hit (preset to the range of the character that is at the hit point)
 
virtual bool snapForHit (ArtboardPoint &pt__) const
 Convenience method to modify and "snap" a given point if a hit has occurred.
 
virtual bool snapForHitType (const HitType type_, ArtboardPoint &pt__) const
 Convenience method to modify and "snap" a given point only if a certain type of hit has occurred.
 

Friends

aip::HitData * __accessImpl (const HitData &)
 
HitData __accessCtor (const aip::HitData &)
 

Detailed Description

Allows for hit data creation, metadata access, snapping, etc.

Member Enumeration Documentation

◆ HitType

Describes the type hit that was actually detected from a request.

Note
See the comment for each enum value for what type of request might result in the indicated hit.

Constructor & Destructor Documentation

◆ HitData() [1/3]

hdi::core::HitData::HitData ( )

Constructs an empty HitData object.

Author
GW
Date
08/2013
Note
To test if a HitData object is empty, call isEmpty() on it
Empty HitData objects do not relate to any actual hit on the Illustrator artboard; they are designed to be "receivers" of some other HitData object via the overloaded assignment operator. Empty HitData objects are useless until such time (though it is safe to call any of their methods).

◆ HitData() [2/3]

hdi::core::HitData::HitData ( const HitData hitData_)

Constructs a HitData object from an existing HitData object (copy constructor)

Author
GW
Date
08/2013
Parameters
hitData_Existing HitData object

◆ HitData() [3/3]

hdi::core::HitData::HitData ( const Art *const  art_,
const ArtboardPoint pt_,
const HitRequest  request_,
const double  tolerance_ = 2.0,
const bool  adjustToZoom_ = true 
)

Constructs a HitData object from a hit test, with an optional tolerance and zoom adjustment.

Author
GW
Date
08/2013
Parameters
art_Root art of a "tree" to restrict the hit, or NULL to search to whole document
pt_Point at which to perform the hit test
request_Type of hit test to perform
tolerance_Point radius around pt_ in which a hit is valid
adjustToZoom_Adjust the tolerance_ argument to take document zoom into account
Note
If adjustToZoom_ is true, then the tolerance_ argument specifies the point radius around pt_ at 100% document zoom. If the document is zoomed to 200%, tolerance_ will be adjusted to 1/2 the given value; if zoomed to 400%, tolerance_ will be adjusted to 1/4 the given value; etc.
Warning
This method does not assume responsibility of the memory for the art_ argument.

◆ ~HitData()

virtual hdi::core::HitData::~HitData ( )
virtual

Destructs a HitData object.

Author
GW
Date
08/2013

Member Function Documentation

◆ art()

virtual std::unique_ptr< Art > hdi::core::HitData::art ( ) const
virtual

Gets the art that was hit (or NULL if none)

Author
GW
Date
08/2013
Returns
The art that was hit, or NULL if none

◆ bezier()

virtual std::unique_ptr< Bezier > hdi::core::HitData::bezier ( ) const
virtual

Gets the bezier for the segment hit.

Author
GW
Date
08/2013
Returns
A Bezier object for the segment hit, or NULL if no segment was hit

◆ hit()

virtual bool hdi::core::HitData::hit ( ) const
virtual

Reports whether some art was hit.

Author
GW
Date
08/2013
Returns
true if some art was hit, false otherwise

◆ hitType()

virtual HitType hdi::core::HitData::hitType ( ) const
virtual

Gets the type of hit detected.

Author
GW
Date
08/2013
Returns
The type of hit actually detected; see HitType enum docs for more info

◆ isEmpty()

virtual bool hdi::core::HitData::isEmpty ( ) const
virtual

Gets whether the target HitData object is empty (constructed with the default ctor)

Author
GW
Date
08/2013
Returns
true if the target HitData object is empty, false otherwise

◆ operator!=()

virtual bool hdi::core::HitData::operator!= ( const HitData rhs_) const
virtual

Tests whether a given HitData object is not the same as another.

Author
GW
Date
08/2013
Parameters
rhs_HitData to compare against (righthand side of inequality operator)
Returns
true for the target and rhs_ being different data, false otherwise

◆ operator=()

virtual HitData & hdi::core::HitData::operator= ( const HitData rhs_)
virtual

Assigns one HitData object to another.

Author
GW
Date
08/2013
Parameters
rhs_Existing HitData object to copy values from
Returns
The target HitData object, but with its values updated to match that of the rhs_ argument

◆ operator==()

virtual bool hdi::core::HitData::operator== ( const HitData rhs_) const
virtual

Tests whether a given HitData object is the same as another.

Author
GW
Date
08/2013
Parameters
rhs_HitData to compare against (righthand side of equality operator)
Returns
true for the target and rhs_ being the same data, false otherwise

◆ point()

virtual ArtboardPoint hdi::core::HitData::point ( ) const
virtual

Gets the point hit.

Author
GW
Date
08/2013
Returns
Either the point at which a hit was detected within some given tolerance, or the original point at which the hit test was performed (in the case of no hit or, often, a fill hit)

◆ request()

virtual HitRequest hdi::core::HitData::request ( ) const
virtual

Gets the original type of hit test performed.

Author
GW
Date
08/2013
Returns
Type of hit request originally provided to a HitData constructor, or UnknownRequest if none

◆ segIndex()

virtual int16_t hdi::core::HitData::segIndex ( ) const
virtual

Gets the segment number of a path that was hit.

Author
GW
Date
08/2013
Returns
The index of the segment that was hit, or (generally) -1 if the hit type is not SegInteriorHit
Note
If the hit type is SegPointHit, SegInPointHit, or SegOutPointHit, this method attempts to provide a meaningful value; typically, the "segment index" hit will be the same as calling segPointIndex() with the exception of the last point being hit in an open path (then it's n-1).

◆ segPointIndex()

virtual int16_t hdi::core::HitData::segPointIndex ( ) const
virtual

Gets the segment point hit.

Author
GW
Date
08/2013
Returns
The index of the segment point that was hit, or (generally) -1 if the hit type is not SegPointHit, SegInPointHit, or SegOutPointHit
Note
If the hit type is SegInteriorHit, this method attempts to provide a meaningful value; typically, this value will be the same as calling the segIndex() method.

◆ snapForHit()

virtual bool hdi::core::HitData::snapForHit ( ArtboardPoint pt__) const
virtual

Convenience method to modify and "snap" a given point if a hit has occurred.

Author
GW
Date
08/2013
Parameters
pt__Existing point, only modified if a hit has occurred
Returns
true if pt__ was "snapped" to point(), false otherwise
Note
This method is useful for e.g. snapping the actual cursor location to some art that was hit before drawing new art.

◆ snapForHitType()

virtual bool hdi::core::HitData::snapForHitType ( const HitType  type_,
ArtboardPoint pt__ 
) const
virtual

Convenience method to modify and "snap" a given point only if a certain type of hit has occurred.

Author
GW
Date
08/2013
Parameters
type_Type of hit desired for snapping
pt__Existing point, only modified if the correct type of hit has occurred
Returns
true if pt__ was "snapped" to point(), false otherwise
Note
This method is useful for e.g. snapping the actual cursor location to some art that was hit before drawing new art.

◆ textRange()

virtual std::unique_ptr< TextRange > hdi::core::HitData::textRange ( ) const
virtual

Gets the text range that was hit (preset to the range of the character that is at the hit point)

Author
GW
Date
08/2014
Returns
The text range that was hit if the art is of type ArtTypeText, NULL otherwise

◆ tValue()

virtual double hdi::core::HitData::tValue ( ) const
virtual

Gets the t-value of the hit along a path.

Author
GW
Date
08/2013
Returns
The t-value that was hit, or (generally) 0.0 if the hit type is not SegInteriorHit
Note
If the hit type is SegPointHit, SegInPointHit, or SegOutPointHit, this method attempts to provide a meaningful value; typically, the t-value hit will be 0.0 with the exception of the last point being hit in an open path (then it's 1.0).