From 55f9aaabd7ff5215b32a91c9175677a6b9512627 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 12 Mar 2014 14:58:49 +0100 Subject: [PATCH 1/3] Workarounded SWIG problems (does not support nested C++ classes, more on the subject: http://www.swig.org/Doc1.3/SWIGPlus.html#SWIGPlus_nested_classes). --- pcbnew/class_board.h | 2 ++ pcbnew/class_netinfo.h | 15 ++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index cac0f66ffd..92058d0af6 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -871,6 +871,7 @@ public: m_NetInfo.AppendNet( aNewNet ); } +#ifndef SWIG /** * Function BeginNets * @return iterator to the first element of the NETINFO_ITEMs list @@ -888,6 +889,7 @@ public: { return m_NetInfo.end(); } +#endif /** * Function GetNetCount diff --git a/pcbnew/class_netinfo.h b/pcbnew/class_netinfo.h index f566926fcc..64e6e9f8b8 100644 --- a/pcbnew/class_netinfo.h +++ b/pcbnew/class_netinfo.h @@ -145,6 +145,7 @@ public: */ int Translate( int aNetCode ) const; +#ifndef SWIG ///> Wrapper class, so you can iterate through NETINFO_ITEM*s, not ///> std::pair class iterator @@ -212,6 +213,7 @@ public: { return iterator( m_netMapping.end(), this ); } +#endif /** * Function GetSize @@ -329,6 +331,7 @@ public: typedef boost::unordered_map NETNAMES_MAP; typedef boost::unordered_map NETCODES_MAP; +#ifndef SWIG ///> Wrapper class, so you can iterate through NETINFO_ITEM*s, not ///> std::pair class iterator @@ -388,6 +391,7 @@ public: { return iterator( m_netNames.end() ); } +#endif private: /** @@ -438,25 +442,22 @@ class NETINFO_ITEM friend class NETINFO_LIST; private: - const int m_NetCode; ///< A number equivalent to the net name. + int m_NetCode; ///< A number equivalent to the net name. ///< Used for fast comparisons in ratsnest and DRC computations. - const wxString m_Netname; ///< Full net name like /mysheet/mysubsheet/vout - ///< used by Eeschema + wxString m_Netname; ///< Full net name like /mysheet/mysubsheet/vout used by Eeschema - const wxString m_ShortNetname; // short net name, like vout from - // /mysheet/mysubsheet/vout + wxString m_ShortNetname; ///< short net name, like vout from /mysheet/mysubsheet/vout wxString m_NetClassName; // Net Class name. if void this is equivalent // to "default" (the first // item of the net classes list - NETCLASS* m_NetClass; BOARD_ITEM* m_parent; ///< The parent board item object the net belongs to. public: - std::vector m_PadInNetList; // List of pads connected to this net + std::vector m_PadInNetList; ///< List of pads connected to this net unsigned m_RatsnestStartIdx; /* Starting point of ratsnests of this * net (included) in a general buffer of From c7e3887ba47d2c0b9b863e5631e58d0a59ba160f Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 12 Mar 2014 15:00:14 +0100 Subject: [PATCH 2/3] Fixed erroneous hit testing for polygons in ratsnest for GAL. --- pcbnew/ratsnest_data.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pcbnew/ratsnest_data.cpp b/pcbnew/ratsnest_data.cpp index 6b9d2b043a..2845e04475 100644 --- a/pcbnew/ratsnest_data.cpp +++ b/pcbnew/ratsnest_data.cpp @@ -356,8 +356,8 @@ bool RN_POLY::HitTest( const RN_NODE_PTR& aNode ) const x2 = xOld; y2 = yOld; } - if( ( xNew < xt ) == ( xt <= xOld ) /* edge "open" at left end */ - && ( yt - y1 ) * ( x2 - x1 ) < ( y2 - y1 ) * ( xt - x1 ) ) + if( ( xNew < xt ) == ( xt <= xOld ) && /* edge "open" at left end */ + (float)( yt - y1 ) * (float)( x2 - x1 ) < (float)( y2 - y1 ) * (float)( xt - x1 ) ) { inside = !inside; } From 52791f2375223ab54c9a278ee5d9aa1cfa0019a2 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 12 Mar 2014 22:42:08 +0100 Subject: [PATCH 3/3] Changed cast from float to double in RN_POLY::HitTest. --- pcbnew/ratsnest_data.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pcbnew/ratsnest_data.cpp b/pcbnew/ratsnest_data.cpp index 2845e04475..97f04e29b0 100644 --- a/pcbnew/ratsnest_data.cpp +++ b/pcbnew/ratsnest_data.cpp @@ -357,7 +357,7 @@ bool RN_POLY::HitTest( const RN_NODE_PTR& aNode ) const } if( ( xNew < xt ) == ( xt <= xOld ) && /* edge "open" at left end */ - (float)( yt - y1 ) * (float)( x2 - x1 ) < (float)( y2 - y1 ) * (float)( xt - x1 ) ) + (double)( yt - y1 ) * (double)( x2 - x1 ) < (double)( y2 - y1 ) * (double)( xt - x1 ) ) { inside = !inside; }