bool LIB_FIELD::HitTest( const wxPoint &aPosition, int aThreshold, const TRANSFORM& aTransform ) const { if( aThreshold < 0 ) aThreshold = 0; // Build a temporary copy of the text for hit testing EDA_TEXT tmp_text( *this ); // Reference designator text has one or 2 additional character (displays // U? or U?A) if( m_id == REFERENCE ) { wxString extended_text = tmp_text.GetText(); extended_text.Append('?'); const LIB_COMPONENT* parent = static_cast<const LIB_COMPONENT*>( m_Parent ); if ( parent && ( parent->GetPartCount() > 1 ) ) extended_text.Append('A'); tmp_text.SetText( extended_text ); } tmp_text.SetTextPosition( aTransform.TransformCoordinate( m_Pos ) ); /* The text orientation may need to be flipped if the * transformation matrix causes xy axes to be flipped. * this simple algo works only for schematic matrix (rot 90 or/and mirror) */ int t1 = ( aTransform.x1 != 0 ) ^ ( m_Orient != 0 ); tmp_text.SetOrientation( t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT ); return tmp_text.TextHitTest( aPosition ); }
bool LIB_FIELD::HitTest( const wxPoint& aPosition, int aAccuracy ) const { // Because HitTest is mainly used to select the field return false if it is void if( IsVoid() ) return false; // Build a temporary copy of the text for hit testing EDA_TEXT tmp_text( *this ); // Reference designator text has one or 2 additional character (displays // U? or U?A) if( m_id == REFERENCE ) { wxString extended_text = tmp_text.GetText(); extended_text.Append('?'); const LIB_PART* parent = static_cast<const LIB_PART*>( m_Parent ); if ( parent && ( parent->GetUnitCount() > 1 ) ) extended_text.Append('A'); tmp_text.SetText( extended_text ); } tmp_text.SetTextPos( DefaultTransform.TransformCoordinate( GetTextPos() ) ); /* The text orientation may need to be flipped if the * transformation matrix causes xy axes to be flipped. * this simple algo works only for schematic matrix (rot 90 or/and mirror) */ bool t1 = ( DefaultTransform.x1 != 0 ) ^ ( GetTextAngle() != 0 ); tmp_text.SetTextAngle( t1 ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT ); return tmp_text.TextHitTest( aPosition, aAccuracy ); }
bool LIB_TEXT::HitTest( const wxPoint &aPosition, int aThreshold, const TRANSFORM& aTransform ) const { if( aThreshold < 0 ) aThreshold = 0; EDA_TEXT tmp_text( *this ); tmp_text.SetTextPosition( aTransform.TransformCoordinate( m_Pos ) ); /* The text orientation may need to be flipped if the * transformation matrix causes xy axes to be flipped. * this simple algo works only for schematic matrix (rot 90 or/and mirror) */ int t1 = ( aTransform.x1 != 0 ) ^ ( m_Orient != 0 ); tmp_text.SetOrientation( t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT ); return tmp_text.TextHitTest( aPosition ); }