Commit 63754978 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Hit test method rationalization and other minor improvements.

* All objects derived from EDA_ITEM now have consistent hit test method
  definitions.
* Remove double function calls from all classes derived from SCH_ITEM.
* Lots of Doxygen comment fixes.
parent e56f76db
...@@ -101,7 +101,7 @@ bool SCH_ITEM::operator < ( const SCH_ITEM& aItem ) const ...@@ -101,7 +101,7 @@ bool SCH_ITEM::operator < ( const SCH_ITEM& aItem ) const
} }
void SCH_ITEM::doPlot( PLOTTER* aPlotter ) void SCH_ITEM::Plot( PLOTTER* aPlotter )
{ {
wxFAIL_MSG( wxT( "doPlot() method not implemented for class " ) + GetClass() ); wxFAIL_MSG( wxT( "Plot() method not implemented for class " ) + GetClass() );
} }
...@@ -29,6 +29,7 @@ set(CVPCB_SRCS ...@@ -29,6 +29,7 @@ set(CVPCB_SRCS
../pcbnew/netlist_reader_common.cpp ../pcbnew/netlist_reader_common.cpp
../pcbnew/netlist_reader_kicad.cpp ../pcbnew/netlist_reader_kicad.cpp
../pcbnew/netlist_reader_firstformat.cpp ../pcbnew/netlist_reader_firstformat.cpp
../pcbnew/class_drc_item.cpp
autosel.cpp autosel.cpp
cfg.cpp cfg.cpp
class_components_listbox.cpp class_components_listbox.cpp
......
...@@ -54,8 +54,8 @@ ...@@ -54,8 +54,8 @@
extern void SetSchItemParent( SCH_ITEM* Struct, SCH_SCREEN* Screen ); extern void SetSchItemParent( SCH_ITEM* Struct, SCH_SCREEN* Screen );
extern void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector ); extern void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector );
extern void RotateListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& Center ); extern void RotateListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& Center );
extern void Mirror_X_ListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint ); extern void MirrorX( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint );
extern void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& Center ); extern void MirrorY( PICKED_ITEMS_LIST& aItemsList, wxPoint& Center );
extern void DuplicateItemsInList( SCH_SCREEN* screen, extern void DuplicateItemsInList( SCH_SCREEN* screen,
PICKED_ITEMS_LIST& aItemsList, PICKED_ITEMS_LIST& aItemsList,
const wxPoint aMoveVector ); const wxPoint aMoveVector );
...@@ -434,7 +434,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -434,7 +434,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
mirrorPoint = GetScreen()->GetNearestGridPosition( mirrorPoint ); mirrorPoint = GetScreen()->GetNearestGridPosition( mirrorPoint );
GetScreen()->SetCrossHairPosition( mirrorPoint ); GetScreen()->SetCrossHairPosition( mirrorPoint );
SaveCopyInUndoList( block->m_ItemsSelection, UR_MIRRORED_X, mirrorPoint ); SaveCopyInUndoList( block->m_ItemsSelection, UR_MIRRORED_X, mirrorPoint );
Mirror_X_ListOfItems( block->m_ItemsSelection, mirrorPoint ); MirrorX( block->m_ItemsSelection, mirrorPoint );
OnModify(); OnModify();
} }
GetScreen()->TestDanglingEnds( m_canvas, DC ); GetScreen()->TestDanglingEnds( m_canvas, DC );
...@@ -452,7 +452,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -452,7 +452,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
mirrorPoint = GetScreen()->GetNearestGridPosition( mirrorPoint ); mirrorPoint = GetScreen()->GetNearestGridPosition( mirrorPoint );
GetScreen()->SetCrossHairPosition( mirrorPoint ); GetScreen()->SetCrossHairPosition( mirrorPoint );
SaveCopyInUndoList( block->m_ItemsSelection, UR_MIRRORED_Y, mirrorPoint ); SaveCopyInUndoList( block->m_ItemsSelection, UR_MIRRORED_Y, mirrorPoint );
MirrorListOfItems( block->m_ItemsSelection, mirrorPoint ); MirrorY( block->m_ItemsSelection, mirrorPoint );
OnModify(); OnModify();
} }
......
...@@ -179,9 +179,9 @@ void SCH_EDIT_FRAME::MirrorImage( SCH_BITMAP* aItem, bool Is_X_axis ) ...@@ -179,9 +179,9 @@ void SCH_EDIT_FRAME::MirrorImage( SCH_BITMAP* aItem, bool Is_X_axis )
SaveCopyInUndoList( aItem, UR_CHANGED ); SaveCopyInUndoList( aItem, UR_CHANGED );
if( Is_X_axis ) if( Is_X_axis )
aItem->Mirror_X( aItem->GetPosition().y ); aItem->MirrorX( aItem->GetPosition().y );
else else
aItem->Mirror_Y( aItem->GetPosition().x ); aItem->MirrorY( aItem->GetPosition().x );
OnModify(); OnModify();
m_canvas->Refresh(); m_canvas->Refresh();
......
...@@ -198,8 +198,10 @@ public: ...@@ -198,8 +198,10 @@ public:
*/ */
virtual void SetWidth( int aWidth ) { m_Width = aWidth; } virtual void SetWidth( int aWidth ) { m_Width = aWidth; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return add_arc_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_arc_xpm; }
private: private:
......
...@@ -168,8 +168,10 @@ public: ...@@ -168,8 +168,10 @@ public:
*/ */
virtual void SetWidth( int aWidth ) { m_Width = aWidth; } virtual void SetWidth( int aWidth ) { m_Width = aWidth; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return add_circle_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_circle_xpm; }
private: private:
......
...@@ -319,8 +319,10 @@ public: ...@@ -319,8 +319,10 @@ public:
*/ */
virtual void SetWidth( int aWidth ) { m_Thickness = aWidth; } virtual void SetWidth( int aWidth ) { m_Thickness = aWidth; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return move_field_xpm; } virtual BITMAP_DEF GetMenuImage() const { return move_field_xpm; }
private: private:
......
...@@ -569,8 +569,10 @@ public: ...@@ -569,8 +569,10 @@ public:
*/ */
virtual void SetWidth( int aWidth ); virtual void SetWidth( int aWidth );
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const; virtual BITMAP_DEF GetMenuImage() const;
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
private: private:
......
...@@ -184,8 +184,10 @@ public: ...@@ -184,8 +184,10 @@ public:
*/ */
virtual void SetWidth( int aWidth ) { m_Width = aWidth; } virtual void SetWidth( int aWidth ) { m_Width = aWidth; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return add_polygon_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_polygon_xpm; }
private: private:
......
...@@ -172,8 +172,10 @@ public: ...@@ -172,8 +172,10 @@ public:
*/ */
virtual void SetWidth( int aWidth ) { m_Width = aWidth; } virtual void SetWidth( int aWidth ) { m_Width = aWidth; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return add_rectangle_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_rectangle_xpm; }
private: private:
......
...@@ -204,8 +204,10 @@ public: ...@@ -204,8 +204,10 @@ public:
*/ */
virtual void SetWidth( int aWidth ) { m_Thickness = aWidth; } virtual void SetWidth( int aWidth ) { m_Thickness = aWidth; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return add_text_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_text_xpm; }
private: private:
......
...@@ -65,23 +65,23 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, ...@@ -65,23 +65,23 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
const wxPoint aMoveVector ); const wxPoint aMoveVector );
void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint ) void MirrorY( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint )
{ {
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ ) for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
{ {
SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii ); SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii );
item->Mirror_Y( aMirrorPoint.x ); // Place it in its new position. item->MirrorY( aMirrorPoint.x ); // Place it in its new position.
item->ClearFlags(); item->ClearFlags();
} }
} }
void Mirror_X_ListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint ) void MirrorX( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint )
{ {
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ ) for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
{ {
SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii ); SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii );
item->Mirror_X( aMirrorPoint.y ); // Place it in its new position. item->MirrorX( aMirrorPoint.y ); // Place it in its new position.
item->ClearFlags(); item->ClearFlags();
} }
} }
......
...@@ -229,7 +229,7 @@ wxSize SCH_BITMAP::GetSize() const ...@@ -229,7 +229,7 @@ wxSize SCH_BITMAP::GetSize() const
/* /*
* Mirror image relative to a horizontal X axis ) * Mirror image relative to a horizontal X axis )
*/ */
void SCH_BITMAP::Mirror_X( int aXaxis_position ) void SCH_BITMAP::MirrorX( int aXaxis_position )
{ {
m_Pos.y -= aXaxis_position; m_Pos.y -= aXaxis_position;
NEGATE( m_Pos.y ); NEGATE( m_Pos.y );
...@@ -242,7 +242,7 @@ void SCH_BITMAP::Mirror_X( int aXaxis_position ) ...@@ -242,7 +242,7 @@ void SCH_BITMAP::Mirror_X( int aXaxis_position )
/* /*
* Mirror image relative to a vertical Y axis * Mirror image relative to a vertical Y axis
*/ */
void SCH_BITMAP::Mirror_Y( int aYaxis_position ) void SCH_BITMAP::MirrorY( int aYaxis_position )
{ {
m_Pos.x -= aYaxis_position; m_Pos.x -= aYaxis_position;
NEGATE( m_Pos.x ); NEGATE( m_Pos.x );
...@@ -251,9 +251,9 @@ void SCH_BITMAP::Mirror_Y( int aYaxis_position ) ...@@ -251,9 +251,9 @@ void SCH_BITMAP::Mirror_Y( int aYaxis_position )
} }
void SCH_BITMAP::Rotate( wxPoint rotationPoint ) void SCH_BITMAP::Rotate( wxPoint aPosition )
{ {
RotatePoint( &m_Pos, rotationPoint, 900 ); RotatePoint( &m_Pos, aPosition, 900 );
m_Image->Rotate( false ); m_Image->Rotate( false );
} }
...@@ -284,17 +284,17 @@ void SCH_BITMAP::Show( int nestLevel, std::ostream& os ) const ...@@ -284,17 +284,17 @@ void SCH_BITMAP::Show( int nestLevel, std::ostream& os ) const
#endif #endif
bool SCH_BITMAP::doHitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_BITMAP::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
EDA_RECT rect = GetBoundingBox(); EDA_RECT rect = GetBoundingBox();
rect.Inflate( aAccuracy ); rect.Inflate( aAccuracy );
return rect.Contains( aPoint ); return rect.Contains( aPosition );
} }
bool SCH_BITMAP::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const bool SCH_BITMAP::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{ {
EDA_RECT rect = aRect; EDA_RECT rect = aRect;
...@@ -307,13 +307,7 @@ bool SCH_BITMAP::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccurac ...@@ -307,13 +307,7 @@ bool SCH_BITMAP::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccurac
} }
bool SCH_BITMAP::doIsConnected( const wxPoint& aPosition ) const void SCH_BITMAP::Plot( PLOTTER* aPlotter )
{
return m_Pos == aPosition;
}
void SCH_BITMAP::doPlot( PLOTTER* aPlotter )
{ {
m_Image->PlotImage( aPlotter, m_Pos, ReturnLayerColor( GetLayer() ), GetPenSize() ); m_Image->PlotImage( aPlotter, m_Pos, ReturnLayerColor( GetLayer() ), GetPenSize() );
} }
...@@ -133,46 +133,52 @@ public: ...@@ -133,46 +133,52 @@ public:
*/ */
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** /** @copydoc SCH_ITEM::Move() */
* Function Move
* moves then item to a new position by \a aMoveVector.
* @param aMoveVector The displacement vector.
*/
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector )
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
/** /** @copydoc SCH_ITEM::MirrorY() */
* Function Mirror_Y virtual void MirrorY( int aYaxis_position );
* mirrors the item relative to \a aYaxis_position.
* @param aYaxis_position = the y axis position
*/
virtual void Mirror_Y( int aYaxis_position );
virtual void Mirror_X( int aXaxis_position ); /** @copydoc SCH_ITEM::MirrorX() */
virtual void MirrorX( int aXaxis_position );
virtual void Rotate( wxPoint rotationPoint ); /** @copydoc SCH_ITEM::Rotate() */
virtual void Rotate( wxPoint aPosition );
virtual bool IsSelectStateChanged( const wxRect& aRect ); virtual bool IsSelectStateChanged( const wxRect& aRect );
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const { return wxString( _( "Image" ) ); } virtual wxString GetSelectMenuText() const { return wxString( _( "Image" ) ); }
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return image_xpm; } virtual BITMAP_DEF GetMenuImage() const { return image_xpm; }
/** @copydoc SCH_ITEM::GetPosition() */
virtual wxPoint GetPosition() const { return m_Pos; }
/** @copydoc SCH_ITEM::SetPosition() */
virtual void SetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
/** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */
virtual void Plot( PLOTTER* aPlotter );
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override void Show( int nestLevel, std::ostream& os ) const; // override
#endif #endif
private: private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual bool doIsConnected( const wxPoint& aPosition ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_Pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
}; };
......
...@@ -194,7 +194,7 @@ void SCH_BUS_ENTRY::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOff ...@@ -194,7 +194,7 @@ void SCH_BUS_ENTRY::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOff
} }
void SCH_BUS_ENTRY::Mirror_X( int aXaxis_position ) void SCH_BUS_ENTRY::MirrorX( int aXaxis_position )
{ {
m_pos.y -= aXaxis_position; m_pos.y -= aXaxis_position;
NEGATE( m_pos.y ); NEGATE( m_pos.y );
...@@ -203,7 +203,7 @@ void SCH_BUS_ENTRY::Mirror_X( int aXaxis_position ) ...@@ -203,7 +203,7 @@ void SCH_BUS_ENTRY::Mirror_X( int aXaxis_position )
} }
void SCH_BUS_ENTRY::Mirror_Y( int aYaxis_position ) void SCH_BUS_ENTRY::MirrorY( int aYaxis_position )
{ {
m_pos.x -= aYaxis_position; m_pos.x -= aYaxis_position;
NEGATE( m_pos.x ); NEGATE( m_pos.x );
...@@ -212,9 +212,9 @@ void SCH_BUS_ENTRY::Mirror_Y( int aYaxis_position ) ...@@ -212,9 +212,9 @@ void SCH_BUS_ENTRY::Mirror_Y( int aYaxis_position )
} }
void SCH_BUS_ENTRY::Rotate( wxPoint rotationPoint ) void SCH_BUS_ENTRY::Rotate( wxPoint aPosition )
{ {
RotatePoint( &m_pos, rotationPoint, 900 ); RotatePoint( &m_pos, aPosition, 900 );
RotatePoint( &m_size.x, &m_size.y, 900 ); RotatePoint( &m_size.x, &m_size.y, 900 );
} }
...@@ -260,13 +260,13 @@ wxString SCH_BUS_ENTRY::GetSelectMenuText() const ...@@ -260,13 +260,13 @@ wxString SCH_BUS_ENTRY::GetSelectMenuText() const
} }
bool SCH_BUS_ENTRY::doHitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_BUS_ENTRY::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
return TestSegmentHit( aPoint, m_pos, m_End(), aAccuracy ); return TestSegmentHit( aPosition, m_pos, m_End(), aAccuracy );
} }
bool SCH_BUS_ENTRY::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const bool SCH_BUS_ENTRY::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{ {
EDA_RECT rect = aRect; EDA_RECT rect = aRect;
...@@ -279,7 +279,7 @@ bool SCH_BUS_ENTRY::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccu ...@@ -279,7 +279,7 @@ bool SCH_BUS_ENTRY::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccu
} }
void SCH_BUS_ENTRY::doPlot( PLOTTER* aPlotter ) void SCH_BUS_ENTRY::Plot( PLOTTER* aPlotter )
{ {
aPlotter->set_current_line_width( GetPenSize() ); aPlotter->set_current_line_width( GetPenSize() );
aPlotter->set_color( ReturnLayerColor( GetLayer() ) ); aPlotter->set_color( ReturnLayerColor( GetLayer() ) );
......
...@@ -123,26 +123,20 @@ public: ...@@ -123,26 +123,20 @@ public:
*/ */
virtual int GetPenSize() const; virtual int GetPenSize() const;
/** /** @copydoc SCH_ITEM::Move() */
* Function Move
* moves and item to a new position by \a aMoveVector.
* @param aMoveVector The displacement vector.
*/
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector )
{ {
m_pos += aMoveVector; m_pos += aMoveVector;
} }
/** /** @copydoc SCH_ITEM::MirrorY() */
* Function Mirror_Y virtual void MirrorY( int aYaxis_position );
* mirrors the item relative to \a aYaxis_position.
* @param aYaxis_position The Y axis coordinate to mirror around.
*/
virtual void Mirror_Y( int aYaxis_position );
virtual void Mirror_X( int aXaxis_position ); /** @copydoc SCH_ITEM::MirrorX() */
virtual void MirrorX( int aXaxis_position );
virtual void Rotate( wxPoint rotationPoint ); /** @copydoc SCH_ITEM::Rotate() */
virtual void Rotate( wxPoint aPosition );
virtual void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ); virtual void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList );
...@@ -155,21 +149,34 @@ public: ...@@ -155,21 +149,34 @@ public:
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const; virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return add_entry_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_entry_xpm; }
/** @copydoc SCH_ITEM::GetPosition() */
virtual wxPoint GetPosition() const { return m_pos; }
/** @copydoc SCH_ITEM::SetPosition() */
virtual void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
/** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */
virtual void Plot( PLOTTER* aPlotter );
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif #endif
private: private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
}; };
......
...@@ -1502,7 +1502,7 @@ void SCH_COMPONENT::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -1502,7 +1502,7 @@ void SCH_COMPONENT::DisplayInfo( EDA_DRAW_FRAME* frame )
} }
void SCH_COMPONENT::Mirror_Y( int aYaxis_position ) void SCH_COMPONENT::MirrorY( int aYaxis_position )
{ {
int dx = m_Pos.x; int dx = m_Pos.x;
...@@ -1521,7 +1521,7 @@ void SCH_COMPONENT::Mirror_Y( int aYaxis_position ) ...@@ -1521,7 +1521,7 @@ void SCH_COMPONENT::Mirror_Y( int aYaxis_position )
} }
void SCH_COMPONENT::Mirror_X( int aXaxis_position ) void SCH_COMPONENT::MirrorX( int aXaxis_position )
{ {
int dy = m_Pos.y; int dy = m_Pos.y;
...@@ -1540,11 +1540,11 @@ void SCH_COMPONENT::Mirror_X( int aXaxis_position ) ...@@ -1540,11 +1540,11 @@ void SCH_COMPONENT::Mirror_X( int aXaxis_position )
} }
void SCH_COMPONENT::Rotate( wxPoint rotationPoint ) void SCH_COMPONENT::Rotate( wxPoint aPosition )
{ {
wxPoint prev = m_Pos; wxPoint prev = m_Pos;
RotatePoint( &m_Pos, rotationPoint, 900 ); RotatePoint( &m_Pos, aPosition, 900 );
//SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE ); //SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
SetOrientation( CMP_ROTATE_CLOCKWISE ); SetOrientation( CMP_ROTATE_CLOCKWISE );
...@@ -1837,20 +1837,23 @@ SCH_ITEM& SCH_COMPONENT::operator=( const SCH_ITEM& aItem ) ...@@ -1837,20 +1837,23 @@ SCH_ITEM& SCH_COMPONENT::operator=( const SCH_ITEM& aItem )
} }
bool SCH_COMPONENT::doHitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_COMPONENT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
EDA_RECT bBox = GetBodyBoundingBox(); EDA_RECT bBox = GetBodyBoundingBox();
bBox.Inflate( aAccuracy ); bBox.Inflate( aAccuracy );
if( bBox.Contains( aPoint ) ) if( bBox.Contains( aPosition ) )
return true; return true;
return false; return false;
} }
bool SCH_COMPONENT::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const bool SCH_COMPONENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{ {
if( m_Flags & STRUCT_DELETED || m_Flags & SKIP_STRUCT )
return false;
EDA_RECT rect = aRect; EDA_RECT rect = aRect;
rect.Inflate( aAccuracy ); rect.Inflate( aAccuracy );
...@@ -1878,7 +1881,7 @@ bool SCH_COMPONENT::doIsConnected( const wxPoint& aPosition ) const ...@@ -1878,7 +1881,7 @@ bool SCH_COMPONENT::doIsConnected( const wxPoint& aPosition ) const
} }
void SCH_COMPONENT::doPlot( PLOTTER* aPlotter ) void SCH_COMPONENT::Plot( PLOTTER* aPlotter )
{ {
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
TRANSFORM temp = TRANSFORM(); TRANSFORM temp = TRANSFORM();
......
...@@ -329,11 +329,7 @@ public: ...@@ -329,11 +329,7 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** /** @copydoc SCH_ITEM::Move() */
* Function Move
* moves item to a new position by \a aMoveVector.
* @param aMoveVector The displacement to move the component
*/
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector )
{ {
if( aMoveVector == wxPoint( 0, 0 ) ) if( aMoveVector == wxPoint( 0, 0 ) )
...@@ -347,21 +343,14 @@ public: ...@@ -347,21 +343,14 @@ public:
SetModified(); SetModified();
} }
/** /** @copydoc SCH_ITEM::MirrorY() */
* Function Mirror_Y virtual void MirrorY( int aYaxis_position );
* mirrors the component relative to an Y axis about the \a aYaxis_position.
* @param aYaxis_position The y axis position
*/
virtual void Mirror_Y( int aYaxis_position );
/** /** @copydoc SCH_ITEM::MirrorX() */
* Function Mirror_X (virtual) virtual void MirrorX( int aXaxis_position );
* mirrors item relative to an X axis about the \a aXaxis_position.
* @param aXaxis_position The x axis position
*/
virtual void Mirror_X( int aXaxis_position );
virtual void Rotate( wxPoint rotationPoint ); /** @copydoc SCH_ITEM::Rotate() */
virtual void Rotate( wxPoint aPosition );
/** /**
* @copydoc EDA_ITEM::Matches() * @copydoc EDA_ITEM::Matches()
...@@ -391,8 +380,10 @@ public: ...@@ -391,8 +380,10 @@ public:
*/ */
LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT ); LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT );
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return add_component_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_component_xpm; }
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
...@@ -410,18 +401,31 @@ public: ...@@ -410,18 +401,31 @@ public:
*/ */
virtual bool IsReplaceable() const { return true; } virtual bool IsReplaceable() const { return true; }
/** @copydoc SCH_ITEM::GetPosition() */
virtual wxPoint GetPosition() const { return m_Pos; }
/** @copydoc SCH_ITEM::SetPosition() */
virtual void SetPosition( const wxPoint& aPosition ) { Move( aPosition - m_Pos ); }
/** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */
virtual void Plot( PLOTTER* aPlotter );
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override void Show( int nestLevel, std::ostream& os ) const; // override
#endif #endif
private: private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const; /** @copydoc SCH_ITEM::doIsConnected() */
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual bool doIsConnected( const wxPoint& aPosition ) const; virtual bool doIsConnected( const wxPoint& aPosition ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_Pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { Move( aPosition - m_Pos ); }
}; };
......
...@@ -458,9 +458,9 @@ bool SCH_FIELD::Replace( wxFindReplaceData& aSearchData, void* aAuxData ) ...@@ -458,9 +458,9 @@ bool SCH_FIELD::Replace( wxFindReplaceData& aSearchData, void* aAuxData )
} }
void SCH_FIELD::Rotate( wxPoint rotationPoint ) void SCH_FIELD::Rotate( wxPoint aPosition )
{ {
RotatePoint( &m_Pos, rotationPoint, 900 ); RotatePoint( &m_Pos, aPosition, 900 );
} }
...@@ -499,7 +499,7 @@ BITMAP_DEF SCH_FIELD::GetMenuImage() const ...@@ -499,7 +499,7 @@ BITMAP_DEF SCH_FIELD::GetMenuImage() const
} }
bool SCH_FIELD::doHitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_FIELD::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
// Do not hit test hidden or empty fields. // Do not hit test hidden or empty fields.
if( !IsVisible() || IsVoid() ) if( !IsVisible() || IsVoid() )
...@@ -509,11 +509,11 @@ bool SCH_FIELD::doHitTest( const wxPoint& aPoint, int aAccuracy ) const ...@@ -509,11 +509,11 @@ bool SCH_FIELD::doHitTest( const wxPoint& aPoint, int aAccuracy ) const
rect.Inflate( aAccuracy ); rect.Inflate( aAccuracy );
return rect.Contains( aPoint ); return rect.Contains( aPosition );
} }
bool SCH_FIELD::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const bool SCH_FIELD::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{ {
// Do not hit test hidden fields. // Do not hit test hidden fields.
if( !IsVisible() || IsVoid() ) if( !IsVisible() || IsVoid() )
...@@ -530,7 +530,7 @@ bool SCH_FIELD::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ...@@ -530,7 +530,7 @@ bool SCH_FIELD::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
} }
void SCH_FIELD::doPlot( PLOTTER* aPlotter ) void SCH_FIELD::Plot( PLOTTER* aPlotter )
{ {
SCH_COMPONENT* parent = ( SCH_COMPONENT* ) GetParent(); SCH_COMPONENT* parent = ( SCH_COMPONENT* ) GetParent();
...@@ -593,7 +593,7 @@ void SCH_FIELD::doPlot( PLOTTER* aPlotter ) ...@@ -593,7 +593,7 @@ void SCH_FIELD::doPlot( PLOTTER* aPlotter )
} }
void SCH_FIELD::doSetPosition( const wxPoint& aPosition ) void SCH_FIELD::SetPosition( const wxPoint& aPosition )
{ {
SCH_COMPONENT* component = (SCH_COMPONENT*) GetParent(); SCH_COMPONENT* component = (SCH_COMPONENT*) GetParent();
...@@ -608,7 +608,7 @@ void SCH_FIELD::doSetPosition( const wxPoint& aPosition ) ...@@ -608,7 +608,7 @@ void SCH_FIELD::doSetPosition( const wxPoint& aPosition )
} }
wxPoint SCH_FIELD::doGetPosition() const wxPoint SCH_FIELD::GetPosition() const
{ {
SCH_COMPONENT* component = (SCH_COMPONENT*) GetParent(); SCH_COMPONENT* component = (SCH_COMPONENT*) GetParent();
......
...@@ -163,36 +163,36 @@ public: ...@@ -163,36 +163,36 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** virtual function Move /** @copydoc SCH_ITEM::Move() */
* move item to a new position.
* @param aMoveVector = the displacement vector
*/
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector )
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
virtual void Rotate( wxPoint rotationPoint ); /** @copydoc SCH_ITEM::Rotate() */
virtual void Rotate( wxPoint aPosition );
virtual void Mirror_X( int aXaxis_position ) /**
* @copydoc SCH_ITEM::MirrorX()
*
* This overload does nothing. Fields are never mirrored alone. They are moved
* when the parent component is mirrored. This function is only needed by the
* virtual pure function of the master class.
*/
virtual void MirrorX( int aXaxis_position )
{ {
/* Do Nothing: fields are never mirrored alone.
* they are moved when the parent component is mirrored
* this function is only needed by the virtual pure function of the
* master class */
} }
/** virtual function Mirror_Y /**
* mirror item relative to an Y axis * @copydoc SCH_ITEM::MirrorY()
* @param aYaxis_position = the y axis position *
* This overload does nothing. Fields are never mirrored alone. They are moved
* when the parent component is mirrored. This function is only needed by the
* virtual pure function of the master class.
*/ */
virtual void Mirror_Y( int aYaxis_position ) virtual void MirrorY( int aYaxis_position )
{ {
/* Do Nothing: fields are never mirrored alone.
* they are moved when the parent component is mirrored
* this function is only needed by the virtual pure function of the
* master class */
} }
/** /**
...@@ -206,8 +206,10 @@ public: ...@@ -206,8 +206,10 @@ public:
*/ */
virtual bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL ); virtual bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL );
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const; virtual BITMAP_DEF GetMenuImage() const;
/** /**
...@@ -215,17 +217,28 @@ public: ...@@ -215,17 +217,28 @@ public:
*/ */
virtual bool IsReplaceable() const { return true; } virtual bool IsReplaceable() const { return true; }
/** @copydoc SCH_ITEM::GetPosition() */
virtual wxPoint GetPosition() const;
/** @copydoc SCH_ITEM::SetPosition() */
virtual void SetPosition( const wxPoint& aPosition );
/** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */
virtual void Plot( PLOTTER* aPlotter );
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif #endif
private: private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const;
virtual void doSetPosition( const wxPoint& aPosition );
}; };
......
...@@ -130,7 +130,7 @@ void SCH_JUNCTION::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs ...@@ -130,7 +130,7 @@ void SCH_JUNCTION::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs
} }
void SCH_JUNCTION::Mirror_X( int aXaxis_position ) void SCH_JUNCTION::MirrorX( int aXaxis_position )
{ {
m_pos.y -= aXaxis_position; m_pos.y -= aXaxis_position;
NEGATE( m_pos.y ); NEGATE( m_pos.y );
...@@ -138,7 +138,7 @@ void SCH_JUNCTION::Mirror_X( int aXaxis_position ) ...@@ -138,7 +138,7 @@ void SCH_JUNCTION::Mirror_X( int aXaxis_position )
} }
void SCH_JUNCTION::Mirror_Y( int aYaxis_position ) void SCH_JUNCTION::MirrorY( int aYaxis_position )
{ {
m_pos.x -= aYaxis_position; m_pos.x -= aYaxis_position;
NEGATE( m_pos.x ); NEGATE( m_pos.x );
...@@ -146,9 +146,9 @@ void SCH_JUNCTION::Mirror_Y( int aYaxis_position ) ...@@ -146,9 +146,9 @@ void SCH_JUNCTION::Mirror_Y( int aYaxis_position )
} }
void SCH_JUNCTION::Rotate( wxPoint rotationPoint ) void SCH_JUNCTION::Rotate( wxPoint aPosition )
{ {
RotatePoint( &m_pos, rotationPoint, 900 ); RotatePoint( &m_pos, aPosition, 900 );
} }
...@@ -204,18 +204,21 @@ void SCH_JUNCTION::Show( int nestLevel, std::ostream& os ) const ...@@ -204,18 +204,21 @@ void SCH_JUNCTION::Show( int nestLevel, std::ostream& os ) const
#endif #endif
bool SCH_JUNCTION::doHitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_JUNCTION::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
EDA_RECT rect = GetBoundingBox(); EDA_RECT rect = GetBoundingBox();
rect.Inflate( aAccuracy ); rect.Inflate( aAccuracy );
return rect.Contains( aPoint ); return rect.Contains( aPosition );
} }
bool SCH_JUNCTION::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const bool SCH_JUNCTION::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{ {
if( m_Flags & STRUCT_DELETED || m_Flags & SKIP_STRUCT )
return false;
EDA_RECT rect = aRect; EDA_RECT rect = aRect;
rect.Inflate( aAccuracy ); rect.Inflate( aAccuracy );
...@@ -233,7 +236,7 @@ bool SCH_JUNCTION::doIsConnected( const wxPoint& aPosition ) const ...@@ -233,7 +236,7 @@ bool SCH_JUNCTION::doIsConnected( const wxPoint& aPosition ) const
} }
void SCH_JUNCTION::doPlot( PLOTTER* aPlotter ) void SCH_JUNCTION::Plot( PLOTTER* aPlotter )
{ {
aPlotter->set_color( ReturnLayerColor( GetLayer() ) ); aPlotter->set_color( ReturnLayerColor( GetLayer() ) );
aPlotter->circle( m_pos, m_size.x, FILLED_SHAPE ); aPlotter->circle( m_pos, m_size.x, FILLED_SHAPE );
......
...@@ -84,26 +84,20 @@ public: ...@@ -84,26 +84,20 @@ public:
*/ */
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** /** @copydoc SCH_ITEM::Move() */
* Function Move
* moves then item to a new position by \a aMoveVector.
* @param aMoveVector The displacement vector.
*/
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector )
{ {
m_pos += aMoveVector; m_pos += aMoveVector;
} }
/** /** @copydoc SCH_ITEM::MirrorY() */
* Function Mirror_Y virtual void MirrorY( int aYaxis_position );
* mirrors the item relative to \a aYaxis_position.
* @param aYaxis_position = the y axis position
*/
virtual void Mirror_Y( int aYaxis_position );
virtual void Mirror_X( int aXaxis_position ); /** @copydoc SCH_ITEM::MirrorX() */
virtual void MirrorX( int aXaxis_position );
virtual void Rotate( wxPoint rotationPoint ); /** @copydoc SCH_ITEM::Rotate() */
virtual void Rotate( wxPoint aPosition );
virtual void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ); virtual void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList );
...@@ -113,25 +107,40 @@ public: ...@@ -113,25 +107,40 @@ public:
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const; virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const { return wxString( _( "Junction" ) ); } virtual wxString GetSelectMenuText() const { return wxString( _( "Junction" ) ); }
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return add_junction_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_junction_xpm; }
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath ); SCH_SHEET_PATH* aSheetPath );
/** @copydoc SCH_ITEM::GetPosition() */
virtual wxPoint GetPosition() const { return m_pos; }
/** @copydoc SCH_ITEM::SetPosition() */
virtual void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
/** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */
virtual void Plot( PLOTTER* aPlotter );
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override void Show( int nestLevel, std::ostream& os ) const; // override
#endif #endif
private: private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual bool doIsConnected( const wxPoint& aPosition ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_pos; } /** @copydoc SCH_ITEM::doIsConnected() */
virtual void doSetPosition( const wxPoint& aPosition ) { m_pos = aPosition; } virtual bool doIsConnected( const wxPoint& aPosition ) const;
}; };
......
...@@ -256,7 +256,7 @@ void SCH_LINE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, ...@@ -256,7 +256,7 @@ void SCH_LINE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
} }
void SCH_LINE::Mirror_X( int aXaxis_position ) void SCH_LINE::MirrorX( int aXaxis_position )
{ {
m_start.y -= aXaxis_position; m_start.y -= aXaxis_position;
NEGATE( m_start.y ); NEGATE( m_start.y );
...@@ -267,7 +267,7 @@ void SCH_LINE::Mirror_X( int aXaxis_position ) ...@@ -267,7 +267,7 @@ void SCH_LINE::Mirror_X( int aXaxis_position )
} }
void SCH_LINE::Mirror_Y( int aYaxis_position ) void SCH_LINE::MirrorY( int aYaxis_position )
{ {
m_start.x -= aYaxis_position; m_start.x -= aYaxis_position;
NEGATE( m_start.x ); NEGATE( m_start.x );
...@@ -278,10 +278,10 @@ void SCH_LINE::Mirror_Y( int aYaxis_position ) ...@@ -278,10 +278,10 @@ void SCH_LINE::Mirror_Y( int aYaxis_position )
} }
void SCH_LINE::Rotate( wxPoint rotationPoint ) void SCH_LINE::Rotate( wxPoint aPosition )
{ {
RotatePoint( &m_start, rotationPoint, 900 ); RotatePoint( &m_start, aPosition, 900 );
RotatePoint( &m_end, rotationPoint, 900 ); RotatePoint( &m_end, aPosition, 900 );
} }
...@@ -540,14 +540,17 @@ bool SCH_LINE::operator <( const SCH_ITEM& aItem ) const ...@@ -540,14 +540,17 @@ bool SCH_LINE::operator <( const SCH_ITEM& aItem ) const
} }
bool SCH_LINE::doHitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
return TestSegmentHit( aPoint, m_start, m_end, aAccuracy ); return TestSegmentHit( aPosition, m_start, m_end, aAccuracy );
} }
bool SCH_LINE::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const bool SCH_LINE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{ {
if( m_Flags & STRUCT_DELETED || m_Flags & SKIP_STRUCT )
return false;
EDA_RECT rect = aRect; EDA_RECT rect = aRect;
rect.Inflate( aAccuracy ); rect.Inflate( aAccuracy );
...@@ -568,7 +571,7 @@ bool SCH_LINE::doIsConnected( const wxPoint& aPosition ) const ...@@ -568,7 +571,7 @@ bool SCH_LINE::doIsConnected( const wxPoint& aPosition ) const
} }
void SCH_LINE::doPlot( PLOTTER* aPlotter ) void SCH_LINE::Plot( PLOTTER* aPlotter )
{ {
aPlotter->set_color( ReturnLayerColor( GetLayer() ) ); aPlotter->set_color( ReturnLayerColor( GetLayer() ) );
aPlotter->set_current_line_width( GetPenSize() ); aPlotter->set_current_line_width( GetPenSize() );
...@@ -584,7 +587,7 @@ void SCH_LINE::doPlot( PLOTTER* aPlotter ) ...@@ -584,7 +587,7 @@ void SCH_LINE::doPlot( PLOTTER* aPlotter )
} }
void SCH_LINE::doSetPosition( const wxPoint& aPosition ) void SCH_LINE::SetPosition( const wxPoint& aPosition )
{ {
m_end = m_end - ( m_start - aPosition ); m_end = m_end - ( m_start - aPosition );
m_start = aPosition; m_start = aPosition;
......
...@@ -118,23 +118,17 @@ public: ...@@ -118,23 +118,17 @@ public:
*/ */
virtual int GetPenSize() const; virtual int GetPenSize() const;
/** /** @copydoc SCH_ITEM::Move() */
* Function Move
* moves the item by \a aMoveVector.
* @param aMoveVector The displacement vector
*/
virtual void Move( const wxPoint& aMoveVector ); virtual void Move( const wxPoint& aMoveVector );
virtual void Mirror_X( int aXaxis_position ); /** @copydoc SCH_ITEM::MirrorX() */
virtual void MirrorX( int aXaxis_position );
/** /** @copydoc SCH_ITEM::MirrorY() */
* Function Mirror_Y virtual void MirrorY( int aYaxis_position );
* mirrors the item relative to \a aYaxis_position.
* @param aYaxis_position = the y axis position
*/
virtual void Mirror_Y( int aYaxis_position );
virtual void Rotate( wxPoint rotationPoint ); /** @copydoc SCH_ITEM::Rotate() */
virtual void Rotate( wxPoint aPosition );
/** /**
* Check line against \a aLine to see if it overlaps and merge if it does. * Check line against \a aLine to see if it overlaps and merge if it does.
...@@ -164,8 +158,10 @@ public: ...@@ -164,8 +158,10 @@ public:
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const; virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const; virtual BITMAP_DEF GetMenuImage() const;
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
...@@ -173,18 +169,31 @@ public: ...@@ -173,18 +169,31 @@ public:
virtual bool operator <( const SCH_ITEM& aItem ) const; virtual bool operator <( const SCH_ITEM& aItem ) const;
/** @copydoc SCH_ITEM::GetPosition() */
virtual wxPoint GetPosition() const { return m_start; }
/** @copydoc SCH_ITEM::SetPosition() */
virtual void SetPosition( const wxPoint& aPosition );
/** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */
virtual void Plot( PLOTTER* aPlotter );
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override void Show( int nestLevel, std::ostream& os ) const; // override
#endif #endif
private: private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const; /** @copydoc SCH_ITEM::doIsConnected() */
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual bool doIsConnected( const wxPoint& aPosition ) const; virtual bool doIsConnected( const wxPoint& aPosition ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_start; }
virtual void doSetPosition( const wxPoint& aPosition );
}; };
......
/*******************************************/ /*
/* Schematic marker object implementation. */ * This program source code file is part of KiCad, a free EDA CAD application.
/*******************************************/ *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file sch_marker.cpp
* @brief Class SCH_MARKER implementation
*/
#include <fctsys.h> #include <fctsys.h>
#include <wxstruct.h> #include <wxstruct.h>
...@@ -27,9 +52,9 @@ const wxChar* NameMarqueurType[] = ...@@ -27,9 +52,9 @@ const wxChar* NameMarqueurType[] =
}; };
/**************************/ /********************/
/* class SCH_MARKER */ /* class SCH_MARKER */
/**************************/ /********************/
SCH_MARKER::SCH_MARKER() : SCH_ITEM( NULL, SCH_MARKER_T ), MARKER_BASE() SCH_MARKER::SCH_MARKER() : SCH_ITEM( NULL, SCH_MARKER_T ), MARKER_BASE()
{ {
...@@ -145,13 +170,13 @@ void SCH_MARKER::DisplayInfo( EDA_DRAW_FRAME* aFrame ) ...@@ -145,13 +170,13 @@ void SCH_MARKER::DisplayInfo( EDA_DRAW_FRAME* aFrame )
} }
void SCH_MARKER::Rotate( wxPoint rotationPoint ) void SCH_MARKER::Rotate( wxPoint aPosition )
{ {
RotatePoint( &m_Pos, rotationPoint, 900 ); RotatePoint( &m_Pos, aPosition, 900 );
} }
void SCH_MARKER::Mirror_X( int aXaxis_position ) void SCH_MARKER::MirrorX( int aXaxis_position )
{ {
m_Pos.y -= aXaxis_position; m_Pos.y -= aXaxis_position;
m_Pos.y = -m_Pos.y; m_Pos.y = -m_Pos.y;
...@@ -159,7 +184,7 @@ void SCH_MARKER::Mirror_X( int aXaxis_position ) ...@@ -159,7 +184,7 @@ void SCH_MARKER::Mirror_X( int aXaxis_position )
} }
void SCH_MARKER::Mirror_Y( int aYaxis_position ) void SCH_MARKER::MirrorY( int aYaxis_position )
{ {
m_Pos.x -= aYaxis_position; m_Pos.x -= aYaxis_position;
m_Pos.x = -m_Pos.x; m_Pos.x = -m_Pos.x;
...@@ -180,8 +205,8 @@ bool SCH_MARKER::IsSelectStateChanged( const wxRect& aRect ) ...@@ -180,8 +205,8 @@ bool SCH_MARKER::IsSelectStateChanged( const wxRect& aRect )
} }
bool SCH_MARKER::doHitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_MARKER::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
return HitTestMarker( aPoint ); return HitTestMarker( aPosition );
} }
...@@ -89,23 +89,21 @@ public: ...@@ -89,23 +89,21 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** virtual function Move /** @copydoc SCH_ITEM::Move() */
* move item to a new position.
* @param aMoveVector = the displacement vector
*/
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector )
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
/** virtual function Mirror_Y /** @copydoc SCH_ITEM::MirrorY() */
* mirror item relative to an Y axis virtual void MirrorY( int aYaxis_position );
* @param aYaxis_position = the y axis position
*/ /** @copydoc SCH_ITEM::MirrorX() */
virtual void Mirror_Y( int aYaxis_position ); virtual void MirrorX( int aXaxis_position );
virtual void Rotate( wxPoint rotationPoint );
virtual void Mirror_X( int aXaxis_position ); /** @copydoc SCH_ITEM::Rotate() */
virtual void Rotate( wxPoint aPosition );
/** /**
* Compare DRC marker main and auxiliary text against search string. * Compare DRC marker main and auxiliary text against search string.
...@@ -125,18 +123,26 @@ public: ...@@ -125,18 +123,26 @@ public:
virtual bool IsSelectStateChanged( const wxRect& aRect ); virtual bool IsSelectStateChanged( const wxRect& aRect );
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const { return wxString( _( "ERC Marker" ) ); } virtual wxString GetSelectMenuText() const { return wxString( _( "ERC Marker" ) ); }
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return erc_xpm; } virtual BITMAP_DEF GetMenuImage() const { return erc_xpm; }
/** @copydoc SCH_ITEM::GetPosition() */
virtual wxPoint GetPosition() const { return m_Pos; }
/** @copydoc SCH_ITEM::SetPosition() */
virtual void SetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
/** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override void Show( int nestLevel, std::ostream& os ) const; // override
#endif #endif
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual wxPoint doGetPosition() const { return m_Pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
}; };
#endif // TYPE_SCH_MARKER_H_ #endif // TYPE_SCH_MARKER_H_
...@@ -146,7 +146,7 @@ void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf ...@@ -146,7 +146,7 @@ void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
} }
void SCH_NO_CONNECT::Mirror_X( int aXaxis_position ) void SCH_NO_CONNECT::MirrorX( int aXaxis_position )
{ {
m_pos.y -= aXaxis_position; m_pos.y -= aXaxis_position;
NEGATE( m_pos.y ); NEGATE( m_pos.y );
...@@ -154,7 +154,7 @@ void SCH_NO_CONNECT::Mirror_X( int aXaxis_position ) ...@@ -154,7 +154,7 @@ void SCH_NO_CONNECT::Mirror_X( int aXaxis_position )
} }
void SCH_NO_CONNECT::Mirror_Y( int aYaxis_position ) void SCH_NO_CONNECT::MirrorY( int aYaxis_position )
{ {
m_pos.x -= aYaxis_position; m_pos.x -= aYaxis_position;
NEGATE( m_pos.x ); NEGATE( m_pos.x );
...@@ -162,9 +162,9 @@ void SCH_NO_CONNECT::Mirror_Y( int aYaxis_position ) ...@@ -162,9 +162,9 @@ void SCH_NO_CONNECT::Mirror_Y( int aYaxis_position )
} }
void SCH_NO_CONNECT::Rotate( wxPoint rotationPoint ) void SCH_NO_CONNECT::Rotate( wxPoint aPosition )
{ {
RotatePoint( &m_pos, rotationPoint, 900 ); RotatePoint( &m_pos, aPosition, 900 );
} }
...@@ -207,11 +207,11 @@ bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) const ...@@ -207,11 +207,11 @@ bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) const
return m_pos == aPosition; return m_pos == aPosition;
} }
bool SCH_NO_CONNECT::doHitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_NO_CONNECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
int delta = ( ( m_size.x + g_DrawDefaultLineThickness ) / 2 ) + aAccuracy; int delta = ( ( m_size.x + g_DrawDefaultLineThickness ) / 2 ) + aAccuracy;
wxPoint dist = aPoint - m_pos; wxPoint dist = aPosition - m_pos;
if( ( ABS( dist.x ) <= delta ) && ( ABS( dist.y ) <= delta ) ) if( ( ABS( dist.x ) <= delta ) && ( ABS( dist.y ) <= delta ) )
return true; return true;
...@@ -220,7 +220,7 @@ bool SCH_NO_CONNECT::doHitTest( const wxPoint& aPoint, int aAccuracy ) const ...@@ -220,7 +220,7 @@ bool SCH_NO_CONNECT::doHitTest( const wxPoint& aPoint, int aAccuracy ) const
} }
bool SCH_NO_CONNECT::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const bool SCH_NO_CONNECT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{ {
EDA_RECT rect = aRect; EDA_RECT rect = aRect;
...@@ -233,7 +233,7 @@ bool SCH_NO_CONNECT::doHitTest( const EDA_RECT& aRect, bool aContained, int aAcc ...@@ -233,7 +233,7 @@ bool SCH_NO_CONNECT::doHitTest( const EDA_RECT& aRect, bool aContained, int aAcc
} }
void SCH_NO_CONNECT::doPlot( PLOTTER* aPlotter ) void SCH_NO_CONNECT::Plot( PLOTTER* aPlotter )
{ {
int delta = m_size.x / 2; int delta = m_size.x / 2;
int pX, pY; int pX, pY;
......
...@@ -92,25 +92,20 @@ public: ...@@ -92,25 +92,20 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** virtual function Move /** @copydoc SCH_ITEM::Move() */
* move item to a new position.
* @param aMoveVector = the displacement vector
*/
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector )
{ {
m_pos += aMoveVector; m_pos += aMoveVector;
} }
/** /** @copydoc SCH_ITEM::MirrorY() */
* Function Mirror_Y virtual void MirrorY( int aYaxis_position );
* mirrors item relative to \a aYaxis_position.
* @param aYaxis_position = the y axis position
*/
virtual void Mirror_Y( int aYaxis_position );
virtual void Mirror_X( int aXaxis_position ); /** @copydoc SCH_ITEM::MirrorX() */
virtual void MirrorX( int aXaxis_position );
virtual void Rotate( wxPoint rotationPoint ); /** @copydoc SCH_ITEM::Rotate() */
virtual void Rotate( wxPoint aPosition );
virtual bool IsSelectStateChanged( const wxRect& aRect ); virtual bool IsSelectStateChanged( const wxRect& aRect );
...@@ -118,25 +113,40 @@ public: ...@@ -118,25 +113,40 @@ public:
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const; virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const { return wxString( _( "No Connect" ) ); } virtual wxString GetSelectMenuText() const { return wxString( _( "No Connect" ) ); }
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return noconn_xpm; } virtual BITMAP_DEF GetMenuImage() const { return noconn_xpm; }
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath ); SCH_SHEET_PATH* aSheetPath );
/** @copydoc SCH_ITEM::GetPosition() */
virtual wxPoint GetPosition() const { return m_pos; }
/** @copydoc SCH_ITEM::SetPosition() */
virtual void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
/** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */
virtual void Plot( PLOTTER* aPlotter );
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif #endif
private: private:
/** @copydoc SCH_ITEM::doIsConnected() */
virtual bool doIsConnected( const wxPoint& aPosition ) const; virtual bool doIsConnected( const wxPoint& aPosition ) const;
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
}; };
......
...@@ -190,7 +190,7 @@ void SCH_POLYLINE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs ...@@ -190,7 +190,7 @@ void SCH_POLYLINE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs
} }
void SCH_POLYLINE::Mirror_X( int aXaxis_position ) void SCH_POLYLINE::MirrorX( int aXaxis_position )
{ {
for( unsigned ii = 0; ii < GetCornerCount(); ii++ ) for( unsigned ii = 0; ii < GetCornerCount(); ii++ )
{ {
...@@ -201,7 +201,7 @@ void SCH_POLYLINE::Mirror_X( int aXaxis_position ) ...@@ -201,7 +201,7 @@ void SCH_POLYLINE::Mirror_X( int aXaxis_position )
} }
void SCH_POLYLINE::Mirror_Y( int aYaxis_position ) void SCH_POLYLINE::MirrorY( int aYaxis_position )
{ {
for( unsigned ii = 0; ii < GetCornerCount(); ii++ ) for( unsigned ii = 0; ii < GetCornerCount(); ii++ )
{ {
...@@ -212,11 +212,11 @@ void SCH_POLYLINE::Mirror_Y( int aYaxis_position ) ...@@ -212,11 +212,11 @@ void SCH_POLYLINE::Mirror_Y( int aYaxis_position )
} }
void SCH_POLYLINE::Rotate( wxPoint rotationPoint ) void SCH_POLYLINE::Rotate( wxPoint aPosition )
{ {
for( unsigned ii = 0; ii < GetCornerCount(); ii++ ) for( unsigned ii = 0; ii < GetCornerCount(); ii++ )
{ {
RotatePoint( &m_points[ii], rotationPoint, 900 ); RotatePoint( &m_points[ii], aPosition, 900 );
} }
} }
...@@ -260,11 +260,11 @@ BITMAP_DEF SCH_POLYLINE::GetMenuImage() const ...@@ -260,11 +260,11 @@ BITMAP_DEF SCH_POLYLINE::GetMenuImage() const
} }
bool SCH_POLYLINE::doHitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_POLYLINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
for( size_t i = 0; i < m_points.size() - 1; i++ ) for( size_t i = 0; i < m_points.size() - 1; i++ )
{ {
if( TestSegmentHit( aPoint, m_points[i], m_points[i + 1], aAccuracy ) ) if( TestSegmentHit( aPosition, m_points[i], m_points[i + 1], aAccuracy ) )
return true; return true;
} }
...@@ -272,7 +272,7 @@ bool SCH_POLYLINE::doHitTest( const wxPoint& aPoint, int aAccuracy ) const ...@@ -272,7 +272,7 @@ bool SCH_POLYLINE::doHitTest( const wxPoint& aPoint, int aAccuracy ) const
} }
bool SCH_POLYLINE::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const bool SCH_POLYLINE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{ {
EDA_RECT rect = aRect; EDA_RECT rect = aRect;
...@@ -285,7 +285,7 @@ bool SCH_POLYLINE::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccur ...@@ -285,7 +285,7 @@ bool SCH_POLYLINE::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccur
} }
void SCH_POLYLINE::doSetPosition( const wxPoint& aPosition ) void SCH_POLYLINE::SetPosition( const wxPoint& aPosition )
{ {
wxPoint offset = m_points[0] - aPosition; wxPoint offset = m_points[0] - aPosition;
......
...@@ -112,30 +112,26 @@ public: ...@@ -112,30 +112,26 @@ public:
*/ */
virtual int GetPenSize() const; virtual int GetPenSize() const;
/** /** @copydoc SCH_ITEM::Move() */
* Function Move
* moves an item to a new position by \a aMoveVector.
* @param aMoveVector = the displacement vector
*/
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector )
{ {
for( unsigned ii = 0; ii < GetCornerCount(); ii++ ) for( unsigned ii = 0; ii < GetCornerCount(); ii++ )
m_points[ii] += aMoveVector; m_points[ii] += aMoveVector;
} }
/** /** @copydoc SCH_ITEM::MirrorY() */
* Function Mirror_Y virtual void MirrorY( int aYaxis_position );
* mirrors an item relative to \a aYaxis_position.
* @param aYaxis_position The y axis position to mirror around.
*/
virtual void Mirror_Y( int aYaxis_position );
virtual void Mirror_X( int aXaxis_position ); /** @copydoc SCH_ITEM::MirrorX() */
virtual void MirrorX( int aXaxis_position );
virtual void Rotate( wxPoint rotationPoint ); /** @copydoc SCH_ITEM::Rotate() */
virtual void Rotate( wxPoint aPosition );
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const; virtual BITMAP_DEF GetMenuImage() const;
/** /**
...@@ -153,16 +149,25 @@ public: ...@@ -153,16 +149,25 @@ public:
return m_points[ aIndex ]; return m_points[ aIndex ];
} }
/** @copydoc SCH_ITEM::GetPosition() */
virtual wxPoint GetPosition() const { return m_points[0]; }
/** @copydoc SCH_ITEM::SetPosition() */
virtual void SetPosition( const wxPoint& aPosition );
/** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif #endif
private: private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual wxPoint doGetPosition() const { return m_points[0]; }
virtual void doSetPosition( const wxPoint& aPosition );
}; };
......
...@@ -514,7 +514,7 @@ SCH_SHEET_PIN* SCH_SHEET::GetPin( const wxPoint& aPosition ) ...@@ -514,7 +514,7 @@ SCH_SHEET_PIN* SCH_SHEET::GetPin( const wxPoint& aPosition )
{ {
BOOST_FOREACH( SCH_SHEET_PIN& pin, m_pins ) BOOST_FOREACH( SCH_SHEET_PIN& pin, m_pins )
{ {
if( pin.HitTest( aPosition ) ) if( pin.HitTest( aPosition, 0 ) )
return &pin; return &pin;
} }
...@@ -837,9 +837,9 @@ void SCH_SHEET::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -837,9 +837,9 @@ void SCH_SHEET::DisplayInfo( EDA_DRAW_FRAME* frame )
} }
void SCH_SHEET::Rotate(wxPoint rotationPoint) void SCH_SHEET::Rotate(wxPoint aPosition)
{ {
RotatePoint( &m_pos, rotationPoint, 900 ); RotatePoint( &m_pos, aPosition, 900 );
RotatePoint( &m_size.x, &m_size.y, 900 ); RotatePoint( &m_size.x, &m_size.y, 900 );
if( m_size.x < 0 ) if( m_size.x < 0 )
...@@ -856,12 +856,12 @@ void SCH_SHEET::Rotate(wxPoint rotationPoint) ...@@ -856,12 +856,12 @@ void SCH_SHEET::Rotate(wxPoint rotationPoint)
BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, m_pins ) BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, m_pins )
{ {
sheetPin.Rotate( rotationPoint ); sheetPin.Rotate( aPosition );
} }
} }
void SCH_SHEET::Mirror_X( int aXaxis_position ) void SCH_SHEET::MirrorX( int aXaxis_position )
{ {
m_pos.y -= aXaxis_position; m_pos.y -= aXaxis_position;
NEGATE( m_pos.y ); NEGATE( m_pos.y );
...@@ -870,12 +870,12 @@ void SCH_SHEET::Mirror_X( int aXaxis_position ) ...@@ -870,12 +870,12 @@ void SCH_SHEET::Mirror_X( int aXaxis_position )
BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, m_pins ) BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, m_pins )
{ {
sheetPin.Mirror_X( aXaxis_position ); sheetPin.MirrorX( aXaxis_position );
} }
} }
void SCH_SHEET::Mirror_Y( int aYaxis_position ) void SCH_SHEET::MirrorY( int aYaxis_position )
{ {
m_pos.x -= aYaxis_position; m_pos.x -= aYaxis_position;
NEGATE( m_pos.x ); NEGATE( m_pos.x );
...@@ -884,7 +884,7 @@ void SCH_SHEET::Mirror_Y( int aYaxis_position ) ...@@ -884,7 +884,7 @@ void SCH_SHEET::Mirror_Y( int aYaxis_position )
BOOST_FOREACH( SCH_SHEET_PIN& label, m_pins ) BOOST_FOREACH( SCH_SHEET_PIN& label, m_pins )
{ {
label.Mirror_Y( aYaxis_position ); label.MirrorY( aYaxis_position );
} }
} }
...@@ -1048,17 +1048,17 @@ wxString SCH_SHEET::GetSelectMenuText() const ...@@ -1048,17 +1048,17 @@ wxString SCH_SHEET::GetSelectMenuText() const
} }
bool SCH_SHEET::doHitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_SHEET::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
EDA_RECT rect = GetBoundingBox(); EDA_RECT rect = GetBoundingBox();
rect.Inflate( aAccuracy ); rect.Inflate( aAccuracy );
return rect.Contains( aPoint ); return rect.Contains( aPosition );
} }
bool SCH_SHEET::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const bool SCH_SHEET::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{ {
EDA_RECT rect = aRect; EDA_RECT rect = aRect;
...@@ -1102,7 +1102,7 @@ void SCH_SHEET::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, ...@@ -1102,7 +1102,7 @@ void SCH_SHEET::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
} }
void SCH_SHEET::doPlot( PLOTTER* aPlotter ) void SCH_SHEET::Plot( PLOTTER* aPlotter )
{ {
EDA_Colors txtcolor = UNSPECIFIED_COLOR; EDA_Colors txtcolor = UNSPECIFIED_COLOR;
wxSize size; wxSize size;
......
...@@ -80,8 +80,6 @@ private: ...@@ -80,8 +80,6 @@ private:
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
public: public:
SCH_SHEET_PIN( SCH_SHEET* parent, SCH_SHEET_PIN( SCH_SHEET* parent,
const wxPoint& pos = wxPoint( 0, 0 ), const wxPoint& pos = wxPoint( 0, 0 ),
...@@ -178,24 +176,20 @@ public: ...@@ -178,24 +176,20 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** virtual function Move /** @copydoc SCH_ITEM::Move() */
* move item to a new position.
* @param aMoveVector = the displacement vector
*/
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector )
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
/** virtual function Mirror_Y /** @copydoc SCH_ITEM::MirrorY() */
* mirror item relative to an Y axis virtual void MirrorY( int aYaxis_position );
* @param aYaxis_position = the y axis position
*/
virtual void Mirror_Y( int aYaxis_position );
virtual void Rotate( wxPoint rotationPoint ); /** @copydoc SCH_ITEM::Rotate() */
virtual void Rotate( wxPoint aPosition );
virtual void Mirror_X( int aXaxis_position ); /** @copydoc SCH_ITEM::MirrorX() */
virtual void MirrorX( int aXaxis_position );
/** /**
* @copydoc EDA_ITEM::Matches(wxFindReplaceData&,void*,wxPoint*) * @copydoc EDA_ITEM::Matches(wxFindReplaceData&,void*,wxPoint*)
...@@ -219,15 +213,16 @@ public: ...@@ -219,15 +213,16 @@ public:
virtual bool IsConnectable() const { return true; } virtual bool IsConnectable() const { return true; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return add_hierar_pin_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_hierar_pin_xpm; }
private: virtual void SetPosition( const wxPoint& aPosition ) { ConstrainOnEdge( aPosition ); }
virtual void doSetPosition( const wxPoint& aPosition )
{ /** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */
ConstrainOnEdge( aPosition ); virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
}
}; };
...@@ -551,10 +546,7 @@ public: ...@@ -551,10 +546,7 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** virtual function Move /** @copydoc SCH_ITEM::Move() */
* move item to a new position.
* @param aMoveVector = the displacement vector
*/
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector )
{ {
m_pos += aMoveVector; m_pos += aMoveVector;
...@@ -565,13 +557,14 @@ public: ...@@ -565,13 +557,14 @@ public:
} }
} }
/** virtual function Mirror_Y /** @copydoc SCH_ITEM::MirrorY() */
* mirror item relative to an Y axis virtual void MirrorY( int aYaxis_position );
* @param aYaxis_position = the y axis position
*/ /** @copydoc SCH_ITEM::MirrorX() */
virtual void Mirror_Y( int aYaxis_position ); virtual void MirrorX( int aXaxis_position );
virtual void Mirror_X( int aXaxis_position );
virtual void Rotate( wxPoint rotationPoint ); /** @copydoc SCH_ITEM::Rotate() */
virtual void Rotate( wxPoint aPosition );
/** /**
* @copydoc EDA_ITEM::Matches(wxFindReplaceData&,void*,wxPoint*) * @copydoc EDA_ITEM::Matches(wxFindReplaceData&,void*,wxPoint*)
...@@ -622,8 +615,10 @@ public: ...@@ -622,8 +615,10 @@ public:
virtual SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, virtual SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] ); const KICAD_T scanTypes[] );
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return add_hierarchical_subsheet_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_hierarchical_subsheet_xpm; }
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
...@@ -631,6 +626,22 @@ public: ...@@ -631,6 +626,22 @@ public:
SCH_ITEM& operator=( const SCH_ITEM& aSheet ); SCH_ITEM& operator=( const SCH_ITEM& aSheet );
/** @copydoc SCH_ITEM::GetPosition() */
virtual wxPoint GetPosition() const { return m_pos; }
/** @copydoc SCH_ITEM::SetPosition() */
virtual void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
/** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */
virtual void Plot( PLOTTER* aPlotter );
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override void Show( int nestLevel, std::ostream& os ) const; // override
#endif #endif
...@@ -647,12 +658,7 @@ protected: ...@@ -647,12 +658,7 @@ protected:
void renumberPins(); void renumberPins();
private: private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
}; };
......
...@@ -378,7 +378,7 @@ bool SCH_SHEET_PIN::Matches( wxFindReplaceData& aSearchData, ...@@ -378,7 +378,7 @@ bool SCH_SHEET_PIN::Matches( wxFindReplaceData& aSearchData,
} }
void SCH_SHEET_PIN::Mirror_X( int aXaxis_position ) void SCH_SHEET_PIN::MirrorX( int aXaxis_position )
{ {
int p = m_Pos.y - aXaxis_position; int p = m_Pos.y - aXaxis_position;
...@@ -397,7 +397,7 @@ void SCH_SHEET_PIN::Mirror_X( int aXaxis_position ) ...@@ -397,7 +397,7 @@ void SCH_SHEET_PIN::Mirror_X( int aXaxis_position )
} }
void SCH_SHEET_PIN::Mirror_Y( int aYaxis_position ) void SCH_SHEET_PIN::MirrorY( int aYaxis_position )
{ {
int p = m_Pos.x - aYaxis_position; int p = m_Pos.x - aYaxis_position;
...@@ -416,9 +416,9 @@ void SCH_SHEET_PIN::Mirror_Y( int aYaxis_position ) ...@@ -416,9 +416,9 @@ void SCH_SHEET_PIN::Mirror_Y( int aYaxis_position )
} }
void SCH_SHEET_PIN::Rotate( wxPoint rotationPoint ) void SCH_SHEET_PIN::Rotate( wxPoint aPosition )
{ {
RotatePoint( &m_Pos, rotationPoint, 900 ); RotatePoint( &m_Pos, aPosition, 900 );
switch( m_edge ) switch( m_edge )
{ {
...@@ -484,7 +484,7 @@ wxString SCH_SHEET_PIN::GetSelectMenuText() const ...@@ -484,7 +484,7 @@ wxString SCH_SHEET_PIN::GetSelectMenuText() const
} }
bool SCH_SHEET_PIN::doHitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_SHEET_PIN::HitTest( const wxPoint& aPoint, int aAccuracy ) const
{ {
EDA_RECT rect = GetBoundingBox(); EDA_RECT rect = GetBoundingBox();
......
...@@ -182,7 +182,7 @@ bool SCH_TEXT::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint ...@@ -182,7 +182,7 @@ bool SCH_TEXT::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint
} }
void SCH_TEXT::Mirror_Y( int aYaxis_position ) void SCH_TEXT::MirrorY( int aYaxis_position )
{ {
// Text is NOT really mirrored; it is moved to a suitable position // Text is NOT really mirrored; it is moved to a suitable position
// which is the closest position for a true mirrored text // which is the closest position for a true mirrored text
...@@ -223,7 +223,7 @@ void SCH_TEXT::Mirror_Y( int aYaxis_position ) ...@@ -223,7 +223,7 @@ void SCH_TEXT::Mirror_Y( int aYaxis_position )
} }
void SCH_TEXT::Mirror_X( int aXaxis_position ) void SCH_TEXT::MirrorX( int aXaxis_position )
{ {
// Text is NOT really mirrored; it is moved to a suitable position // Text is NOT really mirrored; it is moved to a suitable position
// which is the closest position for a true mirrored text // which is the closest position for a true mirrored text
...@@ -264,11 +264,11 @@ void SCH_TEXT::Mirror_X( int aXaxis_position ) ...@@ -264,11 +264,11 @@ void SCH_TEXT::Mirror_X( int aXaxis_position )
} }
void SCH_TEXT::Rotate( wxPoint rotationPoint ) void SCH_TEXT::Rotate( wxPoint aPosition )
{ {
int dy; int dy;
RotatePoint( &m_Pos, rotationPoint, 900 ); RotatePoint( &m_Pos, aPosition, 900 );
SetOrientation( (GetOrientation() + 1) % 4 ); SetOrientation( (GetOrientation() + 1) % 4 );
switch( GetOrientation() ) switch( GetOrientation() )
...@@ -671,19 +671,19 @@ void SCH_TEXT::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, ...@@ -671,19 +671,19 @@ void SCH_TEXT::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
} }
bool SCH_TEXT::doHitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
return TextHitTest( aPoint, aAccuracy ); return TextHitTest( aPosition, aAccuracy );
} }
bool SCH_TEXT::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const bool SCH_TEXT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{ {
return TextHitTest( aRect, aContained, aAccuracy ); return TextHitTest( aRect, aContained, aAccuracy );
} }
void SCH_TEXT::doPlot( PLOTTER* aPlotter ) void SCH_TEXT::Plot( PLOTTER* aPlotter )
{ {
static std::vector <wxPoint> Poly; static std::vector <wxPoint> Poly;
...@@ -776,7 +776,7 @@ void SCH_LABEL::SetOrientation( int aOrientation ) ...@@ -776,7 +776,7 @@ void SCH_LABEL::SetOrientation( int aOrientation )
} }
void SCH_LABEL::Mirror_X( int aXaxis_position ) void SCH_LABEL::MirrorX( int aXaxis_position )
{ {
// Text is NOT really mirrored; it is moved to a suitable position // Text is NOT really mirrored; it is moved to a suitable position
// which is the closest position for a true mirrored text // which is the closest position for a true mirrored text
...@@ -791,9 +791,9 @@ void SCH_LABEL::Mirror_X( int aXaxis_position ) ...@@ -791,9 +791,9 @@ void SCH_LABEL::Mirror_X( int aXaxis_position )
} }
void SCH_LABEL::Rotate( wxPoint rotationPoint ) void SCH_LABEL::Rotate( wxPoint aPosition )
{ {
RotatePoint( &m_Pos, rotationPoint, 900 ); RotatePoint( &m_Pos, aPosition, 900 );
SetOrientation( (GetOrientation() + 1) % 4 ); SetOrientation( (GetOrientation() + 1) % 4 );
} }
...@@ -944,9 +944,9 @@ wxString SCH_LABEL::GetSelectMenuText() const ...@@ -944,9 +944,9 @@ wxString SCH_LABEL::GetSelectMenuText() const
} }
bool SCH_LABEL::doHitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_LABEL::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
return TextHitTest( aPoint, aAccuracy ); return TextHitTest( aPosition, aAccuracy );
} }
...@@ -1055,7 +1055,7 @@ bool SCH_GLOBALLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -1055,7 +1055,7 @@ bool SCH_GLOBALLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
} }
void SCH_GLOBALLABEL::Mirror_Y( int aYaxis_position ) void SCH_GLOBALLABEL::MirrorY( int aYaxis_position )
{ {
/* The global label is NOT really mirrored. /* The global label is NOT really mirrored.
* for an horizontal label, the schematic orientation is changed. * for an horizontal label, the schematic orientation is changed.
...@@ -1079,7 +1079,7 @@ void SCH_GLOBALLABEL::Mirror_Y( int aYaxis_position ) ...@@ -1079,7 +1079,7 @@ void SCH_GLOBALLABEL::Mirror_Y( int aYaxis_position )
} }
void SCH_GLOBALLABEL::Mirror_X( int aXaxis_position ) void SCH_GLOBALLABEL::MirrorX( int aXaxis_position )
{ {
switch( GetOrientation() ) switch( GetOrientation() )
{ {
...@@ -1098,9 +1098,9 @@ void SCH_GLOBALLABEL::Mirror_X( int aXaxis_position ) ...@@ -1098,9 +1098,9 @@ void SCH_GLOBALLABEL::Mirror_X( int aXaxis_position )
} }
void SCH_GLOBALLABEL::Rotate( wxPoint rotationPoint ) void SCH_GLOBALLABEL::Rotate( wxPoint aPosition )
{ {
RotatePoint( &m_Pos, rotationPoint, 900 ); RotatePoint( &m_Pos, aPosition, 900 );
SetOrientation( (GetOrientation() + 3) % 4 ); SetOrientation( (GetOrientation() + 3) % 4 );
} }
...@@ -1373,9 +1373,9 @@ wxString SCH_GLOBALLABEL::GetSelectMenuText() const ...@@ -1373,9 +1373,9 @@ wxString SCH_GLOBALLABEL::GetSelectMenuText() const
} }
bool SCH_GLOBALLABEL::doHitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_GLOBALLABEL::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
return TextHitTest( aPoint, aAccuracy ); return TextHitTest( aPosition, aAccuracy );
} }
...@@ -1663,7 +1663,7 @@ wxPoint SCH_HIERLABEL::GetSchematicTextOffset() const ...@@ -1663,7 +1663,7 @@ wxPoint SCH_HIERLABEL::GetSchematicTextOffset() const
} }
void SCH_HIERLABEL::Mirror_Y( int aYaxis_position ) void SCH_HIERLABEL::MirrorY( int aYaxis_position )
{ {
/* The hierarchical label is NOT really mirrored for an horizontal label, the schematic /* The hierarchical label is NOT really mirrored for an horizontal label, the schematic
* orientation is changed. For a vertical label, the schematic orientation is not changed * orientation is changed. For a vertical label, the schematic orientation is not changed
...@@ -1687,7 +1687,7 @@ void SCH_HIERLABEL::Mirror_Y( int aYaxis_position ) ...@@ -1687,7 +1687,7 @@ void SCH_HIERLABEL::Mirror_Y( int aYaxis_position )
} }
void SCH_HIERLABEL::Mirror_X( int aXaxis_position ) void SCH_HIERLABEL::MirrorX( int aXaxis_position )
{ {
switch( GetOrientation() ) switch( GetOrientation() )
{ {
...@@ -1706,9 +1706,9 @@ void SCH_HIERLABEL::Mirror_X( int aXaxis_position ) ...@@ -1706,9 +1706,9 @@ void SCH_HIERLABEL::Mirror_X( int aXaxis_position )
} }
void SCH_HIERLABEL::Rotate( wxPoint rotationPoint ) void SCH_HIERLABEL::Rotate( wxPoint aPosition )
{ {
RotatePoint( &m_Pos, rotationPoint, 900 ); RotatePoint( &m_Pos, aPosition, 900 );
SetOrientation( (GetOrientation() + 3) % 4 ); SetOrientation( (GetOrientation() + 3) % 4 );
} }
...@@ -1723,7 +1723,7 @@ wxString SCH_HIERLABEL::GetSelectMenuText() const ...@@ -1723,7 +1723,7 @@ wxString SCH_HIERLABEL::GetSelectMenuText() const
} }
bool SCH_HIERLABEL::doHitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_HIERLABEL::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{ {
return TextHitTest( aPoint, aAccuracy ); return TextHitTest( aPosition, aAccuracy );
} }
...@@ -187,25 +187,20 @@ public: ...@@ -187,25 +187,20 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** virtual function Move /** @copydoc SCH_ITEM::Move() */
* move item to a new position.
* @param aMoveVector = the displacement vector
*/
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector )
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
/** /** @copydoc SCH_ITEM::MirrorY() */
* Function Mirror_Y virtual void MirrorY( int aYaxis_position );
* mirrors the item relative to \a aYaxisPosition.
* @param aYaxis_position The y axis coordinate to mirror around.
*/
virtual void Mirror_Y( int aYaxis_position );
virtual void Rotate( wxPoint rotationPoint ); /** @copydoc SCH_ITEM::MirrorX() */
virtual void MirrorX( int aXaxis_position );
virtual void Mirror_X( int aXaxis_position ); /** @copydoc SCH_ITEM::Rotate() */
virtual void Rotate( wxPoint aPosition );
/** /**
* @copydoc EDA_ITEM::Matches(wxFindReplaceData&,void*,wxPoint*) * @copydoc EDA_ITEM::Matches(wxFindReplaceData&,void*,wxPoint*)
...@@ -237,24 +232,37 @@ public: ...@@ -237,24 +232,37 @@ public:
virtual bool CanIncrementLabel() const { return true; } virtual bool CanIncrementLabel() const { return true; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return add_text_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_text_xpm; }
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath ); SCH_SHEET_PATH* aSheetPath );
/** @copydoc SCH_ITEM::GetPosition() */
virtual wxPoint GetPosition() const { return m_Pos; }
/** @copydoc SCH_ITEM::SetPosition() */
virtual void SetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
/** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(EDA_RECT&,bool=false,int=0) */
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */
virtual void Plot( PLOTTER* aPlotter );
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override void Show( int nestLevel, std::ostream& os ) const; // override
#endif #endif
private: private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const;
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const;
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const { return m_Pos; }
virtual void doSetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
}; };
...@@ -303,9 +311,11 @@ public: ...@@ -303,9 +311,11 @@ public:
*/ */
virtual wxPoint GetSchematicTextOffset() const; virtual wxPoint GetSchematicTextOffset() const;
virtual void Mirror_X( int aXaxis_position ); /** @copydoc SCH_ITEM::MirrorX() */
virtual void MirrorX( int aXaxis_position );
virtual void Rotate( wxPoint rotationPoint ); /** @copydoc SCH_ITEM::Rotate() */
virtual void Rotate( wxPoint aPosition );
/** /**
* Function GetBoundingBox * Function GetBoundingBox
...@@ -337,8 +347,10 @@ public: ...@@ -337,8 +347,10 @@ public:
virtual bool IsConnectable() const { return true; } virtual bool IsConnectable() const { return true; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return add_line_label_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_line_label_xpm; }
/** /**
...@@ -346,9 +358,13 @@ public: ...@@ -346,9 +358,13 @@ public:
*/ */
virtual bool IsReplaceable() const { return true; } virtual bool IsReplaceable() const { return true; }
/** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
private: private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const; /** @copydoc SCH_ITEM::doIsConnected() */
virtual bool doIsConnected( const wxPoint& aPosition ) const { return m_Pos == aPosition; } virtual bool doIsConnected( const wxPoint& aPosition ) const { return m_Pos == aPosition; }
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
}; };
...@@ -434,25 +450,30 @@ public: ...@@ -434,25 +450,30 @@ public:
*/ */
virtual void CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& aPos ); virtual void CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& aPos );
/** virtual function Mirror_Y /** @copydoc SCH_ITEM::MirrorY() */
* mirror item relative to an Y axis virtual void MirrorY( int aYaxis_position );
* @param aYaxis_position = the y axis position
*/
virtual void Mirror_Y( int aYaxis_position );
virtual void Mirror_X( int aXaxis_position ); /** @copydoc SCH_ITEM::MirrorX() */
virtual void MirrorX( int aXaxis_position );
virtual void Rotate( wxPoint rotationPoint ); /** @copydoc SCH_ITEM::Rotate() */
virtual void Rotate( wxPoint aPosition );
virtual bool IsConnectable() const { return true; } virtual bool IsConnectable() const { return true; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return add_glabel_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_glabel_xpm; }
/** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
private: private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const; /** @copydoc SCH_ITEM::doIsConnected() */
virtual bool doIsConnected( const wxPoint& aPosition ) const { return m_Pos == aPosition; } virtual bool doIsConnected( const wxPoint& aPosition ) const { return m_Pos == aPosition; }
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
}; };
...@@ -540,25 +561,30 @@ public: ...@@ -540,25 +561,30 @@ public:
*/ */
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
/** virtual function Mirror_Y /** @copydoc SCH_ITEM::MirrorY() */
* mirror item relative to an Y axis virtual void MirrorY( int aYaxis_position );
* @param aYaxis_position = the y axis position
*/
virtual void Mirror_Y( int aYaxis_position );
virtual void Mirror_X( int aXaxis_position ); /** @copydoc SCH_ITEM::MirrorX() */
virtual void MirrorX( int aXaxis_position );
virtual void Rotate( wxPoint rotationPoint ); /** @copydoc SCH_ITEM::Rotate() */
virtual void Rotate( wxPoint aPosition );
virtual bool IsConnectable() const { return true; } virtual bool IsConnectable() const { return true; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return add_hierarchical_label_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_hierarchical_label_xpm; }
/** @copydoc SCH_ITEM::HitTest(wxPoint&,int) */
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
private: private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const; /** @copydoc SCH_ITEM::doIsConnected() */
virtual bool doIsConnected( const wxPoint& aPosition ) const { return m_Pos == aPosition; } virtual bool doIsConnected( const wxPoint& aPosition ) const { return m_Pos == aPosition; }
virtual EDA_ITEM* doClone() const; virtual EDA_ITEM* doClone() const;
}; };
......
...@@ -304,11 +304,11 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed ...@@ -304,11 +304,11 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
break; break;
case UR_MIRRORED_Y: case UR_MIRRORED_Y:
item->Mirror_Y( aList->m_TransformPoint.x ); item->MirrorY( aList->m_TransformPoint.x );
break; break;
case UR_MIRRORED_X: case UR_MIRRORED_X:
item->Mirror_X( aList->m_TransformPoint.y ); item->MirrorX( aList->m_TransformPoint.y );
break; break;
case UR_ROTATED: case UR_ROTATED:
......
...@@ -68,6 +68,7 @@ set(GERBVIEW_SRCS ...@@ -68,6 +68,7 @@ set(GERBVIEW_SRCS
set(GERBVIEW_EXTRA_SRCS set(GERBVIEW_EXTRA_SRCS
../pcbnew/layer_widget.cpp ../pcbnew/layer_widget.cpp
../pcbnew/printout_controler.cpp ../pcbnew/printout_controler.cpp
../pcbnew/class_drc_item.cpp
) )
### ###
...@@ -114,7 +115,7 @@ endif(APPLE) ...@@ -114,7 +115,7 @@ endif(APPLE)
### ###
# Link executable target gerbview with correct libraries # Link executable target gerbview with correct libraries
### ###
target_link_libraries(gerbview common pcbcommon 3d-viewer polygon bitmaps kbool target_link_libraries(gerbview pcbcommon common 3d-viewer polygon bitmaps kbool
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES}) ${GDI_PLUS_LIBRARIES})
......
...@@ -490,23 +490,29 @@ public: ...@@ -490,23 +490,29 @@ public:
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if \a aPosition is contained within or on the bounding area of an item.
* @param refPos A wxPoint to test *
* @return bool - true if a hit, else false * @note This function cannot be const because some of the derive objects perform
* intermediate calculations which change object members. Make sure derived
* objects do not declare this as const.
*
* @param aPosition A reference to a wxPoint object containing the coordinates to test.
* @return True if \a aPosition is within or on the item bounding area.
*/ */
virtual bool HitTest( const wxPoint& refPos ) virtual bool HitTest( const wxPoint& aPosition )
{ {
return false; // derived classes should override this function return false; // derived classes should override this function
} }
/** /**
* Function HitTest (overlaid) * Function HitTest
* tests if the given EDA_RECT intersect this object. * tests if the \a aRect intersects this object.
* For now, an ending point must be inside this rect. * For now, an ending point must be inside \a aRect.
* @param refArea : the given EDA_RECT *
* @return bool - true if a hit, else false * @param aRect A reference to an EDA_RECT object containg the area to test.
* @return True if \a aRect intersects the object, otherwise false.
*/ */
virtual bool HitTest( EDA_RECT& refArea ) virtual bool HitTest( const EDA_RECT& aRect ) const
{ {
return false; // derived classes should override this function return false; // derived classes should override this function
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* Class DRC_ITEM * Class DRC_ITEM
* is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item. * is a holder for a DRC (in Pcbnew) or ERC (in Eeschema) error item.
* It is generated when two objects are too close (DRC) * It is generated when two objects are too close (DRC)
* or two connected objects (pins) have incompatibleelectrical type (ERC). * or two connected objects (pins) have incompatible electrical types (ERC).
* There are holders for information on two items. The * There are holders for information on two items. The
* information held is the board coordinate and the MenuText for each item. * information held is the board coordinate and the MenuText for each item.
* Also held is the type of error by number and the location of the MARKER. * Also held is the type of error by number and the location of the MARKER.
......
...@@ -83,13 +83,13 @@ enum DANGLING_END_T { ...@@ -83,13 +83,13 @@ enum DANGLING_END_T {
/** /**
* Class DANLIGN_END_ITEM * Class DANGLING_END_ITEM
* is a helper class used to store the state of schematic items that can be connected to * is a helper class used to store the state of schematic items that can be connected to
* other schematic items. * other schematic items.
*/ */
class DANGLING_END_ITEM class DANGLING_END_ITEM
{ {
/// A pointer to the connectable ojbect. /// A pointer to the connectable object.
const void* m_item; const void* m_item;
/// The position of the connection point. /// The position of the connection point.
...@@ -186,15 +186,26 @@ public: ...@@ -186,15 +186,26 @@ public:
virtual void Move( const wxPoint& aMoveVector ) = 0; virtual void Move( const wxPoint& aMoveVector ) = 0;
/** /**
* Function Mirror_Y * Function MirrorY
* mirrors item relative to an Y axis about \a aYaxis_position. * mirrors item relative to the Y axis about \a aYaxis_position.
* @param aYaxis_position The Y axis position to mirror around. * @param aYaxis_position The Y axis position to mirror around.
*/ */
virtual void Mirror_Y( int aYaxis_position ) = 0; virtual void MirrorY( int aYaxis_position ) = 0;
virtual void Mirror_X( int aXaxis_position ) = 0; /**
* Function MirrorX
* mirrors item relative to the X axis about \a aXaxis_position.
* @param aXaxis_position The X axis position to mirror around.
*/
virtual void MirrorX( int aXaxis_position ) = 0;
virtual void Rotate( wxPoint rotationPoint ) = 0; /**
* Function Rotate
* rotates the item around \a aPosition 90 degrees in the clockwise direction.
* @param aPosition A reference to a wxPoint object containing the coordinates to
* rotate around.
*/
virtual void Rotate( wxPoint aPosition ) = 0;
/** /**
* Function Save * Function Save
...@@ -285,7 +296,7 @@ public: ...@@ -285,7 +296,7 @@ public:
* Function IsConnected * Function IsConnected
* tests the item to see if it is connected to \a aPoint. * tests the item to see if it is connected to \a aPoint.
* *
* @param aPoint - Position to test for connection. * @param aPoint A reference to a wxPoint object containing the coordinates to test.
* @return True if connection to \a aPoint exists. * @return True if connection to \a aPoint exists.
*/ */
bool IsConnected( const wxPoint& aPoint ) const; bool IsConnected( const wxPoint& aPoint ) const;
...@@ -294,34 +305,37 @@ public: ...@@ -294,34 +305,37 @@ public:
/** /**
* Function HitTest * Function HitTest
* tests if \a aPoint is contained within or on the bounding box of an item. * tests if \a aPosition is contained within or on the bounding box of an item.
* *
* @param aPoint - Point to test. * @param aPosition A reference to a wxPoint object containing the coordinates to test.
* @param aAccuracy - Increase the item bounding box by this amount. * @param aAccuracy Increase the item bounding box by this amount.
* @return True if \a aPoint is within the item bounding box. * @return True if \a aPosition is within the item bounding box.
*/ */
bool HitTest( const wxPoint& aPoint, int aAccuracy = 0 ) const virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const { return false; }
{
return doHitTest( aPoint, aAccuracy );
}
/** /**
* Function HitTest * Function HitTest
* tests if \a aRect intersects or is contained within the bounding box of an item. * tests if \a aRect intersects or is contained within the bounding box of an item.
* *
* @param aRect - Rectangle to test. * @param aRect A reference to a EDA_RECT object containing the rectangle to test.
* @param aContained - Set to true to test for containment instead of an intersection. * @param aContained Set to true to test for containment instead of an intersection.
* @param aAccuracy - Increase aRect by this amount. * @param aAccuracy Increase \a aRect by this amount.
* @return True if \a aRect contains or intersects the item bounding box. * @return True if \a aRect contains or intersects the item bounding box.
*/ */
bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const
{ {
return doHitTest( aRect, aContained, aAccuracy ); return false;
} }
virtual bool CanIncrementLabel() const { return false; } virtual bool CanIncrementLabel() const { return false; }
void Plot( PLOTTER* aPlotter ) { doPlot( aPlotter ); } /**
* Function Plot
* plots the schematic item to \a aPlotter.
*
* @param aPlotter A pointer to a #PLOTTER object.
*/
virtual void Plot( PLOTTER* aPlotter );
/** /**
* Function GetNetListItem * Function GetNetListItem
...@@ -331,15 +345,16 @@ public: ...@@ -331,15 +345,16 @@ public:
* Not all schematic objects have net list items associated with them. This * Not all schematic objects have net list items associated with them. This
* method only needs to be overridden for those schematic objects that have * method only needs to be overridden for those schematic objects that have
* net list objects associated with them. * net list objects associated with them.
* </p>
*/ */
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath ) { } SCH_SHEET_PATH* aSheetPath ) { }
/** /**
* Function GetPosition * Function GetPosition
* @return the schematic item position. * @return A wxPoint object containing the schematic item position.
*/ */
wxPoint GetPosition() const { return doGetPosition(); } virtual wxPoint GetPosition() const = 0;
/** /**
* Function SetPosition * Function SetPosition
...@@ -347,34 +362,26 @@ public: ...@@ -347,34 +362,26 @@ public:
* *
* @param aPosition A reference to a wxPoint object containing the new position. * @param aPosition A reference to a wxPoint object containing the new position.
*/ */
void SetPosition( const wxPoint& aPosition ) { doSetPosition( aPosition ); } virtual void SetPosition( const wxPoint& aPosition ) = 0;
virtual bool operator <( const SCH_ITEM& aItem ) const; virtual bool operator <( const SCH_ITEM& aItem ) const;
private:
/** /**
* @note - The DoXXX() functions below are used to enforce the interface while retaining * Function doIsConnected
* the ability of change the implementation behavior of derived classes. See * provides the object specific test to see if it is connected to \a aPosition.
* Herb Sutters explanation of virtuality as to why you might want to do this at: *
* http://www.gotw.ca/publications/mill18.htm. * @note Override this function if the derived object can be connect to another
* object such as a wire, bus, or junction. Do not override this function
* for objects that cannot have connections. The default will always return
* false. This functions is call through the public function IsConnected()
* which performs tests common to all schematic items before calling the
* item specific connection testing.
*
* @param aPosition A reference to a wxPoint object containing the test position.
* @return True if connection to \a aPosition exists.
*/ */
private:
virtual bool doHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
return false;
}
virtual bool doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
return false;
}
virtual bool doIsConnected( const wxPoint& aPosition ) const { return false; } virtual bool doIsConnected( const wxPoint& aPosition ) const { return false; }
virtual void doPlot( PLOTTER* aPlotter );
virtual wxPoint doGetPosition() const = 0;
virtual void doSetPosition( const wxPoint& aPosition ) = 0;
}; };
......
...@@ -445,12 +445,12 @@ void DIMENSION::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -445,12 +445,12 @@ void DIMENSION::DisplayInfo( EDA_DRAW_FRAME* frame )
} }
bool DIMENSION::HitTest( const wxPoint& aPoint ) bool DIMENSION::HitTest( const wxPoint& aPosition )
{ {
int ux0, uy0; int ux0, uy0;
int dx, dy, spot_cX, spot_cY; int dx, dy, spot_cX, spot_cY;
if( m_Text.TextHitTest( aPoint ) ) if( m_Text.TextHitTest( aPosition ) )
return true; return true;
// Locate SEGMENTS? // Locate SEGMENTS?
...@@ -461,8 +461,8 @@ bool DIMENSION::HitTest( const wxPoint& aPoint ) ...@@ -461,8 +461,8 @@ bool DIMENSION::HitTest( const wxPoint& aPoint )
dx = m_crossBarFx - ux0; dx = m_crossBarFx - ux0;
dy = m_crossBarFy - uy0; dy = m_crossBarFy - uy0;
spot_cX = aPoint.x - ux0; spot_cX = aPosition.x - ux0;
spot_cY = aPoint.y - uy0; spot_cY = aPosition.y - uy0;
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) ) if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true; return true;
...@@ -473,8 +473,8 @@ bool DIMENSION::HitTest( const wxPoint& aPoint ) ...@@ -473,8 +473,8 @@ bool DIMENSION::HitTest( const wxPoint& aPoint )
dx = m_featureLineGFx - ux0; dx = m_featureLineGFx - ux0;
dy = m_featureLineGFy - uy0; dy = m_featureLineGFy - uy0;
spot_cX = aPoint.x - ux0; spot_cX = aPosition.x - ux0;
spot_cY = aPoint.y - uy0; spot_cY = aPosition.y - uy0;
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) ) if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true; return true;
...@@ -485,8 +485,8 @@ bool DIMENSION::HitTest( const wxPoint& aPoint ) ...@@ -485,8 +485,8 @@ bool DIMENSION::HitTest( const wxPoint& aPoint )
dx = m_featureLineDFx - ux0; dx = m_featureLineDFx - ux0;
dy = m_featureLineDFy - uy0; dy = m_featureLineDFy - uy0;
spot_cX = aPoint.x - ux0; spot_cX = aPosition.x - ux0;
spot_cY = aPoint.y - uy0; spot_cY = aPosition.y - uy0;
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) ) if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true; return true;
...@@ -497,8 +497,8 @@ bool DIMENSION::HitTest( const wxPoint& aPoint ) ...@@ -497,8 +497,8 @@ bool DIMENSION::HitTest( const wxPoint& aPoint )
dx = m_arrowD1Fx - ux0; dx = m_arrowD1Fx - ux0;
dy = m_arrowD1Fy - uy0; dy = m_arrowD1Fy - uy0;
spot_cX = aPoint.x - ux0; spot_cX = aPosition.x - ux0;
spot_cY = aPoint.y - uy0; spot_cY = aPosition.y - uy0;
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) ) if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true; return true;
...@@ -509,8 +509,8 @@ bool DIMENSION::HitTest( const wxPoint& aPoint ) ...@@ -509,8 +509,8 @@ bool DIMENSION::HitTest( const wxPoint& aPoint )
dx = m_arrowD2Fx - ux0; dx = m_arrowD2Fx - ux0;
dy = m_arrowD2Fy - uy0; dy = m_arrowD2Fy - uy0;
spot_cX = aPoint.x - ux0; spot_cX = aPosition.x - ux0;
spot_cY = aPoint.y - uy0; spot_cY = aPosition.y - uy0;
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) ) if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true; return true;
...@@ -521,8 +521,8 @@ bool DIMENSION::HitTest( const wxPoint& aPoint ) ...@@ -521,8 +521,8 @@ bool DIMENSION::HitTest( const wxPoint& aPoint )
dx = m_arrowG1Fx - ux0; dx = m_arrowG1Fx - ux0;
dy = m_arrowG1Fy - uy0; dy = m_arrowG1Fy - uy0;
spot_cX = aPoint.x - ux0; spot_cX = aPosition.x - ux0;
spot_cY = aPoint.y - uy0; spot_cY = aPosition.y - uy0;
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) ) if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true; return true;
...@@ -533,8 +533,8 @@ bool DIMENSION::HitTest( const wxPoint& aPoint ) ...@@ -533,8 +533,8 @@ bool DIMENSION::HitTest( const wxPoint& aPoint )
dx = m_arrowG2Fx - ux0; dx = m_arrowG2Fx - ux0;
dy = m_arrowG2Fy - uy0; dy = m_arrowG2Fy - uy0;
spot_cX = aPoint.x - ux0; spot_cX = aPosition.x - ux0;
spot_cY = aPoint.y - uy0; spot_cY = aPosition.y - uy0;
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) ) if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
return true; return true;
...@@ -543,9 +543,9 @@ bool DIMENSION::HitTest( const wxPoint& aPoint ) ...@@ -543,9 +543,9 @@ bool DIMENSION::HitTest( const wxPoint& aPoint )
} }
bool DIMENSION::HitTest( EDA_RECT& refArea ) bool DIMENSION::HitTest( const EDA_RECT& aRect ) const
{ {
if( refArea.Contains( m_Pos ) ) if( aRect.Contains( m_Pos ) )
return true; return true;
return false; return false;
......
...@@ -151,22 +151,11 @@ public: ...@@ -151,22 +151,11 @@ public:
*/ */
void DisplayInfo( EDA_DRAW_FRAME* frame ); void DisplayInfo( EDA_DRAW_FRAME* frame );
/** /** @copydoc EDA_ITEM::HitTest(wxPoint&) */
* Function HitTest bool HitTest( const wxPoint& aPosition );
* tests if the given wxPoint is within the bounds of this object.
* @param ref_pos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool HitTest( const wxPoint& ref_pos );
/** /** @copydoc EDA_ITEM::HitTest(EDA_RECT&) */
* Function HitTest (overlaid) bool HitTest( const EDA_RECT& aRect ) const;
* tests if the given EDA_RECT intersect this object.
* For now, the anchor must be inside this rect.
* @param refArea : the given EDA_RECT
* @return bool - true if a hit, else false
*/
bool HitTest( EDA_RECT& refArea );
/** /**
* Function GetClass * Function GetClass
......
...@@ -439,10 +439,10 @@ EDA_RECT DRAWSEGMENT::GetBoundingBox() const ...@@ -439,10 +439,10 @@ EDA_RECT DRAWSEGMENT::GetBoundingBox() const
} }
bool DRAWSEGMENT::HitTest( const wxPoint& aRefPos ) bool DRAWSEGMENT::HitTest( const wxPoint& aPosition )
{ {
/* Calculate coordinates to test relative to segment origin. */ /* Calculate coordinates to test relative to segment origin. */
wxPoint relPos = aRefPos - m_Start; wxPoint relPos = aPosition - m_Start;
switch( m_Shape ) switch( m_Shape )
{ {
...@@ -476,13 +476,13 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aRefPos ) ...@@ -476,13 +476,13 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aRefPos )
case S_CURVE: case S_CURVE:
for( unsigned int i= 1; i < m_BezierPoints.size(); i++) for( unsigned int i= 1; i < m_BezierPoints.size(); i++)
{ {
if( TestSegmentHit( aRefPos,m_BezierPoints[i-1], m_BezierPoints[i-1], m_Width / 2 ) ) if( TestSegmentHit( aPosition, m_BezierPoints[i-1], m_BezierPoints[i-1], m_Width / 2 ) )
return true; return true;
} }
break; break;
case S_SEGMENT: case S_SEGMENT:
if( TestSegmentHit( aRefPos, m_Start, m_End, m_Width / 2 ) ) if( TestSegmentHit( aPosition, m_Start, m_End, m_Width / 2 ) )
return true; return true;
break; break;
...@@ -494,15 +494,16 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aRefPos ) ...@@ -494,15 +494,16 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aRefPos )
} }
bool DRAWSEGMENT::HitTest( EDA_RECT& refArea ) bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect ) const
{ {
switch( m_Shape ) switch( m_Shape )
{ {
case S_CIRCLE: case S_CIRCLE:
{ {
int radius = GetRadius(); int radius = GetRadius();
// Text if area intersects the circle: // Text if area intersects the circle:
EDA_RECT area = refArea; EDA_RECT area = aRect;
area.Inflate( radius ); area.Inflate( radius );
if( area.Contains( m_Start ) ) if( area.Contains( m_Start ) )
...@@ -512,9 +513,10 @@ bool DRAWSEGMENT::HitTest( EDA_RECT& refArea ) ...@@ -512,9 +513,10 @@ bool DRAWSEGMENT::HitTest( EDA_RECT& refArea )
case S_ARC: case S_ARC:
case S_SEGMENT: case S_SEGMENT:
if( refArea.Contains( GetStart() ) ) if( aRect.Contains( GetStart() ) )
return true; return true;
if( refArea.Contains( GetEnd() ) )
if( aRect.Contains( GetEnd() ) )
return true; return true;
break; break;
} }
......
...@@ -186,22 +186,11 @@ public: ...@@ -186,22 +186,11 @@ public:
*/ */
virtual EDA_RECT GetBoundingBox() const; virtual EDA_RECT GetBoundingBox() const;
/** /** @copydoc EDA_ITEM::HitTest(wxPoint&) */
* Function HitTest bool HitTest( const wxPoint& aPosition );
* tests if the given wxPoint is within the bounds of this object.
* @param aRefPos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool HitTest( const wxPoint& aRefPos );
/** /** @copydoc EDA_ITEM::HitTest(EDA_RECT&) */
* Function HitTest (overlayed) bool HitTest( const EDA_RECT& aRect ) const;
* tests if the given EDA_RECT intersect this object.
* For now, an ending point must be inside this rect.
* @param refArea the given EDA_RECT to test
* @return bool - true if a hit, else false
*/
bool HitTest( EDA_RECT& refArea );
/** /**
* Function GetClass * Function GetClass
......
...@@ -80,14 +80,10 @@ public: ...@@ -80,14 +80,10 @@ public:
const wxPoint& GetPosition() const { return m_Pos; } const wxPoint& GetPosition() const { return m_Pos; }
void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; } void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; }
/** /** @copydoc EDA_ITEM::HitTest(wxPoint&) */
* Function HitTest bool HitTest( const wxPoint& aPosition )
* @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test
*/
bool HitTest( const wxPoint& aPosRef )
{ {
return HitTestMarker( aPosRef ); return HitTestMarker( aPosition );
} }
/** /**
......
...@@ -162,24 +162,18 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wx ...@@ -162,24 +162,18 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wx
} }
/** bool PCB_TARGET::HitTest( const wxPoint& aPosition )
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
* @param refPos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool PCB_TARGET::HitTest( const wxPoint& refPos )
{ {
int dX = refPos.x - m_Pos.x; int dX = aPosition.x - m_Pos.x;
int dY = refPos.y - m_Pos.y; int dY = aPosition.y - m_Pos.y;
int radius = m_Size / 2; int radius = m_Size / 2;
return abs( dX ) <= radius && abs( dY ) <= radius; return abs( dX ) <= radius && abs( dY ) <= radius;
} }
bool PCB_TARGET::HitTest( EDA_RECT& refArea ) bool PCB_TARGET::HitTest( const EDA_RECT& aRect ) const
{ {
if( refArea.Contains( m_Pos ) ) if( aRect.Contains( m_Pos ) )
return true; return true;
return false; return false;
......
...@@ -118,22 +118,11 @@ public: ...@@ -118,22 +118,11 @@ public:
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode,
const wxPoint& offset = ZeroOffset ); const wxPoint& offset = ZeroOffset );
/** /** @copydoc EDA_ITEM::HitTest(wxPoint&) */
* Function HitTest bool HitTest( const wxPoint& aPosition );
* tests if the given wxPoint is within the bounds of this object.
* @param refPos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool HitTest( const wxPoint& refPos );
/** /** @copydoc EDA_ITEM::HitTest(EDA_RECT&) */
* Function HitTest (overlaid) bool HitTest( const EDA_RECT& aRect ) const;
* tests if the given EDA_RECT intersect this object.
* For now, the anchor must be inside this rect.
* @param refArea : the given EDA_RECT
* @return bool - true if a hit, else false
*/
bool HitTest( EDA_RECT& refArea );
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
......
...@@ -508,27 +508,27 @@ void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -508,27 +508,27 @@ void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame )
} }
bool MODULE::HitTest( const wxPoint& aRefPos ) bool MODULE::HitTest( const wxPoint& aPosition )
{ {
if( m_BoundaryBox.Contains( aRefPos ) ) if( m_BoundaryBox.Contains( aPosition ) )
return true; return true;
return false; return false;
} }
bool MODULE::HitTest( EDA_RECT& aRefArea ) bool MODULE::HitTest( const EDA_RECT& aRect ) const
{ {
if( m_BoundaryBox.GetX() < aRefArea.GetX() ) if( m_BoundaryBox.GetX() < aRect.GetX() )
return false; return false;
if( m_BoundaryBox.GetY() < aRefArea.GetY() ) if( m_BoundaryBox.GetY() < aRect.GetY() )
return false; return false;
if( m_BoundaryBox.GetRight() > aRefArea.GetRight() ) if( m_BoundaryBox.GetRight() > aRect.GetRight() )
return false; return false;
if( m_BoundaryBox.GetBottom() > aRefArea.GetBottom() ) if( m_BoundaryBox.GetBottom() > aRect.GetBottom() )
return false; return false;
return true; return true;
......
...@@ -321,21 +321,11 @@ public: ...@@ -321,21 +321,11 @@ public:
*/ */
void DisplayInfo( EDA_DRAW_FRAME* frame ); void DisplayInfo( EDA_DRAW_FRAME* frame );
/** /** @copydoc EDA_ITEM::HitTest(wxPoint&) */
* Function HitTest bool HitTest( const wxPoint& aPosition );
* tests if the given wxPoint is within the bounds of this object.
* @param aRefPos is a wxPoint to test.
* @return bool - true if a hit, else false.
*/
bool HitTest( const wxPoint& aRefPos );
/** /** @copydoc EDA_ITEM::HitTest(EDA_RECT&) */
* Function HitTest (overlaid) bool HitTest( const EDA_RECT& aRect ) const;
* tests if the given EDA_RECT intersect the bounds of this object.
* @param aRefArea is the given EDA_RECT.
* @return bool - true if a hit, else false.
*/
bool HitTest( EDA_RECT& aRefArea );
/** /**
* Function GetReference * Function GetReference
......
...@@ -175,7 +175,7 @@ void D_PAD::AppendConfigs( PARAM_CFG_ARRAY* aResult ) ...@@ -175,7 +175,7 @@ void D_PAD::AppendConfigs( PARAM_CFG_ARRAY* aResult )
// Returns the position of the pad. // Returns the position of the pad.
const wxPoint D_PAD::ReturnShapePos() const wxPoint D_PAD::ReturnShapePos() const
{ {
if( m_Offset.x == 0 && m_Offset.y == 0 ) if( m_Offset.x == 0 && m_Offset.y == 0 )
return m_Pos; return m_Pos;
...@@ -664,14 +664,14 @@ bool D_PAD::IsOnLayer( int aLayer ) const ...@@ -664,14 +664,14 @@ bool D_PAD::IsOnLayer( int aLayer ) const
} }
bool D_PAD::HitTest( const wxPoint& refPos ) bool D_PAD::HitTest( const wxPoint& aPosition )
{ {
int dx, dy; int dx, dy;
double dist; double dist;
wxPoint shape_pos = ReturnShapePos(); wxPoint shape_pos = ReturnShapePos();
wxPoint delta = refPos - shape_pos; wxPoint delta = aPosition - shape_pos;
// first test: a test point must be inside a minimum sized bounding circle. // first test: a test point must be inside a minimum sized bounding circle.
int radius = GetBoundingRadius(); int radius = GetBoundingRadius();
......
...@@ -353,10 +353,11 @@ public: ...@@ -353,10 +353,11 @@ public:
{ {
m_boundingRadius = boundingRadius(); m_boundingRadius = boundingRadius();
} }
return m_boundingRadius; return m_boundingRadius;
} }
const wxPoint ReturnShapePos(); const wxPoint ReturnShapePos() const;
/** /**
* Function GetSubRatsnest * Function GetSubRatsnest
...@@ -385,13 +386,8 @@ public: ...@@ -385,13 +386,8 @@ public:
*/ */
bool IsOnLayer( int aLayer ) const; bool IsOnLayer( int aLayer ) const;
/** /** @copydoc EDA_ITEM::HitTest(wxPoint&) */
* Function HitTest bool HitTest( const wxPoint& aPosition );
* tests if the given wxPoint is within the bounds of this object.
* @param refPos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool HitTest( const wxPoint& refPos );
/** /**
* Function GetClass * Function GetClass
......
...@@ -108,26 +108,16 @@ public: ...@@ -108,26 +108,16 @@ public:
*/ */
void DisplayInfo( EDA_DRAW_FRAME* frame ); void DisplayInfo( EDA_DRAW_FRAME* frame );
/** /** @copydoc EDA_ITEM::HitTest(wxPoint&) */
* Function HitTest bool HitTest( const wxPoint& aPosition )
* tests if the given wxPoint is within the bounds of this object.
* @param refPos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool HitTest( const wxPoint& refPos )
{ {
return TextHitTest( refPos ); return TextHitTest( aPosition );
} }
/** /** @copydoc EDA_ITEM::HitTest(EDA_RECT&) */
* Function HitTest (overloaded) bool HitTest( const EDA_RECT& aRect )
* tests if the given EDA_RECT intersect this object.
* @param refArea the given EDA_RECT to test
* @return bool - true if a hit, else false
*/
bool HitTest( EDA_RECT& refArea )
{ {
return TextHitTest( refArea ); return TextHitTest( aRect );
} }
/** /**
......
...@@ -184,13 +184,7 @@ EDA_RECT TEXTE_MODULE::GetTextRect( void ) const ...@@ -184,13 +184,7 @@ EDA_RECT TEXTE_MODULE::GetTextRect( void ) const
} }
/** bool TEXTE_MODULE::HitTest( const wxPoint& aPosition )
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
* @param aRefPos A wxPoint to test
* @return true if a hit, else false
*/
bool TEXTE_MODULE::HitTest( const wxPoint& aRefPos )
{ {
wxPoint rel_pos; wxPoint rel_pos;
EDA_RECT area = GetTextRect(); EDA_RECT area = GetTextRect();
...@@ -199,7 +193,7 @@ bool TEXTE_MODULE::HitTest( const wxPoint& aRefPos ) ...@@ -199,7 +193,7 @@ bool TEXTE_MODULE::HitTest( const wxPoint& aRefPos )
* to test if refPos is within area (which is relative to an horizontal * to test if refPos is within area (which is relative to an horizontal
* text) * text)
*/ */
rel_pos = aRefPos; rel_pos = aPosition;
RotatePoint( &rel_pos, m_Pos, -GetDrawRotation() ); RotatePoint( &rel_pos, m_Pos, -GetDrawRotation() );
if( area.Contains( rel_pos ) ) if( area.Contains( rel_pos ) )
......
...@@ -167,13 +167,8 @@ public: ...@@ -167,13 +167,8 @@ public:
void DisplayInfo( EDA_DRAW_FRAME* frame ); void DisplayInfo( EDA_DRAW_FRAME* frame );
/** /** @copydoc EDA_ITEM::HitTest(wxPoint&) */
* Function HitTest bool HitTest( const wxPoint& aPosition );
* tests if the given wxPoint is within the bounds of this object.
* @param aRefPos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool HitTest( const wxPoint& aRefPos );
/** /**
* Function IsOnLayer * Function IsOnLayer
......
...@@ -1179,7 +1179,7 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame ) ...@@ -1179,7 +1179,7 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame )
} }
bool TRACK::HitTest( const wxPoint& refPos ) bool TRACK::HitTest( const wxPoint& aPosition )
{ {
int radius = m_Width >> 1; int radius = m_Width >> 1;
...@@ -1188,8 +1188,8 @@ bool TRACK::HitTest( const wxPoint& refPos ) ...@@ -1188,8 +1188,8 @@ bool TRACK::HitTest( const wxPoint& refPos )
int dy = m_End.y - m_Start.y; int dy = m_End.y - m_Start.y;
// (spot_cX, spot_cY) is a vector from m_Start to ref_pos (an origin of m_Start) // (spot_cX, spot_cY) is a vector from m_Start to ref_pos (an origin of m_Start)
int spot_cX = refPos.x - m_Start.x; int spot_cX = aPosition.x - m_Start.x;
int spot_cY = refPos.y - m_Start.y; int spot_cY = aPosition.y - m_Start.y;
if( Type() == PCB_VIA_T ) if( Type() == PCB_VIA_T )
{ {
...@@ -1205,12 +1205,12 @@ bool TRACK::HitTest( const wxPoint& refPos ) ...@@ -1205,12 +1205,12 @@ bool TRACK::HitTest( const wxPoint& refPos )
} }
bool TRACK::HitTest( EDA_RECT& refArea ) bool TRACK::HitTest( const EDA_RECT& aRect ) const
{ {
if( refArea.Contains( m_Start ) ) if( aRect.Contains( m_Start ) )
return true; return true;
if( refArea.Contains( m_End ) ) if( aRect.Contains( m_End ) )
return true; return true;
return false; return false;
......
...@@ -303,22 +303,11 @@ public: ...@@ -303,22 +303,11 @@ public:
const KICAD_T scanTypes[] ); const KICAD_T scanTypes[] );
/** /** @copydoc EDA_ITEM::HitTest(wxPoint&) */
* Function HitTest bool HitTest( const wxPoint& aPosition );
* tests if the given wxPoint is within the bounds of this object.
* @param refPos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool HitTest( const wxPoint& refPos );
/** /** @copydoc EDA_ITEM::HitTest(EDA_RECT&) */
* Function HitTest (overlaid) bool HitTest( const EDA_RECT& aRect ) const;
* tests if the given wxRect intersect this object.
* For now, an ending point must be inside this rect.
* @param refArea an EDA_RECT to test
* @return bool - true if a hit, else false
*/
bool HitTest( EDA_RECT& refArea );
/** /**
* Function GetVia * Function GetVia
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -468,12 +467,12 @@ int ZONE_CONTAINER::GetThermalReliefCopperBridge( D_PAD* aPad ) const ...@@ -468,12 +467,12 @@ int ZONE_CONTAINER::GetThermalReliefCopperBridge( D_PAD* aPad ) const
} }
bool ZONE_CONTAINER::HitTest( const wxPoint& refPos ) bool ZONE_CONTAINER::HitTest( const wxPoint& aPosition )
{ {
if( HitTestForCorner( refPos ) ) if( HitTestForCorner( aPosition ) )
return true; return true;
if( HitTestForEdge( refPos ) ) if( HitTestForEdge( aPosition ) )
return true; return true;
return false; return false;
...@@ -584,22 +583,22 @@ bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos ) ...@@ -584,22 +583,22 @@ bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
} }
bool ZONE_CONTAINER::HitTest( EDA_RECT& refArea ) bool ZONE_CONTAINER::HitTest( const EDA_RECT& aRect ) const
{ {
bool is_out_of_box = false; bool is_out_of_box = false;
CRect rect = m_Poly->GetCornerBounds(); CRect rect = m_Poly->GetCornerBounds();
if( rect.left < refArea.GetX() ) if( rect.left < aRect.GetX() )
is_out_of_box = true; is_out_of_box = true;
if( rect.top < refArea.GetY() ) if( rect.top < aRect.GetY() )
is_out_of_box = true; is_out_of_box = true;
if( rect.right > refArea.GetRight() ) if( rect.right > aRect.GetRight() )
is_out_of_box = true; is_out_of_box = true;
if( rect.bottom > refArea.GetBottom() ) if( rect.bottom > aRect.GetBottom() )
is_out_of_box = true; is_out_of_box = true;
return is_out_of_box ? false : true; return is_out_of_box ? false : true;
...@@ -633,7 +632,7 @@ int ZONE_CONTAINER::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const ...@@ -633,7 +632,7 @@ int ZONE_CONTAINER::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const
} }
bool ZONE_CONTAINER::HitTestFilledArea( const wxPoint& aRefPos ) bool ZONE_CONTAINER::HitTestFilledArea( const wxPoint& aRefPos ) const
{ {
unsigned indexstart = 0, indexend; unsigned indexstart = 0, indexend;
bool inside = false; bool inside = false;
......
...@@ -297,14 +297,8 @@ public: ...@@ -297,14 +297,8 @@ public:
int GetMinThickness() const { return m_ZoneMinThickness; } int GetMinThickness() const { return m_ZoneMinThickness; }
void SetMinThickness( int aMinThickness ) { m_ZoneMinThickness = aMinThickness; } void SetMinThickness( int aMinThickness ) { m_ZoneMinThickness = aMinThickness; }
/** /** @copydoc EDA_ITEM::HitTest(wxPoint&) */
* Function HitTest bool HitTest( const wxPoint& aPosition );
* tests if the given wxPoint is within the bounds of this object.
* For zones, this means near an outline segment
* @param refPos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool HitTest( const wxPoint& refPos );
/** /**
* Function HitTestFilledArea * Function HitTestFilledArea
...@@ -312,7 +306,7 @@ public: ...@@ -312,7 +306,7 @@ public:
* @param aRefPos A wxPoint to test * @param aRefPos A wxPoint to test
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool HitTestFilledArea( const wxPoint& aRefPos ); bool HitTestFilledArea( const wxPoint& aRefPos ) const;
/** /**
* Function BuildFilledPolysListData * Function BuildFilledPolysListData
...@@ -377,13 +371,8 @@ public: ...@@ -377,13 +371,8 @@ public:
*/ */
bool HitTestForEdge( const wxPoint& refPos ); bool HitTestForEdge( const wxPoint& refPos );
/** /** @copydoc EDA_ITEM::HitTest(EDA_RECT&) */
* Function HitTest (overloaded) bool HitTest( const EDA_RECT& refArea ) const;
* tests if the given EDA_RECT contains the bounds of this object.
* @param refArea : the given EDA_RECT
* @return bool - true if a hit, else false
*/
bool HitTest( EDA_RECT& refArea );
/** /**
* Function Fill_Zone * Function Fill_Zone
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment