Commit a8a99abe authored by Wayne Stambaugh's avatar Wayne Stambaugh
Browse files

Schematic object hit testing improvements.

parent 95f3d88b
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -4,6 +4,17 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.


2010-dec-13 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++common
  * Make base marker hit test method const.
++EESchema
  * Improve hit testing for schematic components.
  * Add initial support for hit test filtering.
  * Moved static function CountConnectedItems() into SCH_SCREEN object.
  * Add IsConnected() method to SCH_ITEM object.


2010-dec-10 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
2010-dec-10 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
================================================================================
++All
++All
+3 −4
Original line number Original line Diff line number Diff line
@@ -112,9 +112,7 @@ void MARKER_BASE::SetData( int aErrorCode, const wxPoint& aMarkerPos,
}
}




/******************************************************/
bool MARKER_BASE::HitTestMarker( const wxPoint& refPos ) const
bool MARKER_BASE::HitTestMarker( const wxPoint& refPos )
/******************************************************/
{
{
    wxPoint rel_pos = refPos - m_Pos;
    wxPoint rel_pos = refPos - m_Pos;
    rel_pos.x /= m_ScalingFactor;
    rel_pos.x /= m_ScalingFactor;
@@ -123,6 +121,7 @@ bool MARKER_BASE::HitTestMarker( const wxPoint& refPos )
    return m_ShapeBoundingBox.Inside( rel_pos );
    return m_ShapeBoundingBox.Inside( rel_pos );
}
}



/**
/**
 * Function GetBoundingBoxMarker
 * Function GetBoundingBoxMarker
 * returns the orthogonal, bounding box of this object for display purposes.
 * returns the orthogonal, bounding box of this object for display purposes.
+9 −0
Original line number Original line Diff line number Diff line
@@ -94,3 +94,12 @@ bool SCH_ITEM::Matches( const wxString& aText, wxFindReplaceData& aSearchData )


    return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
    return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
}
}


bool SCH_ITEM::IsConnected( const wxPoint& aPosition ) const
{
    if( m_Flags & STRUCT_DELETED || m_Flags & SKIP_STRUCT )
        return false;

    return DoIsConnected( aPosition );
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -769,7 +769,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
        if( item )
        if( item )
            return TRUE;
            return TRUE;


        pin = LocateAnyPin( screen->GetDrawItems(), pos, &LibItem );
        pin = screen->GetPin( pos, &LibItem );


        if( pin && LibItem )
        if( pin && LibItem )
        {
        {
+2 −2
Original line number Original line Diff line number Diff line
@@ -66,7 +66,7 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( bool IncludePin )
        break;
        break;


    case SCH_COMPONENT_T:
    case SCH_COMPONENT_T:
        Pin = LocateAnyPin( GetScreen()->GetDrawItems(), GetScreen()->m_Curseur, &LibItem );
        Pin = GetScreen()->GetPin( GetScreen()->m_Curseur, &LibItem );
        if( Pin )
        if( Pin )
            break;  // Priority is probing a pin first
            break;  // Priority is probing a pin first
        LibItem = (SCH_COMPONENT*) DrawStruct;
        LibItem = (SCH_COMPONENT*) DrawStruct;
@@ -74,7 +74,7 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( bool IncludePin )
        break;
        break;


    default:
    default:
        Pin = LocateAnyPin( GetScreen()->GetDrawItems(), GetScreen()->m_Curseur, &LibItem );
        Pin = GetScreen()->GetPin( GetScreen()->m_Curseur, &LibItem );
        break;
        break;


    case LIB_PIN_T:
    case LIB_PIN_T:
Loading