Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
539f4e1e
Commit
539f4e1e
authored
Dec 06, 2011
by
Wayne Stambaugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Encapsulate DANGLING_END_ITEM class.
parent
68d752bb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
33 deletions
+43
-33
sch_bus_entry.cpp
eeschema/sch_bus_entry.cpp
+3
-5
sch_component.cpp
eeschema/sch_component.cpp
+1
-2
sch_junction.cpp
eeschema/sch_junction.cpp
+1
-2
sch_line.cpp
eeschema/sch_line.cpp
+8
-8
sch_sheet_pin.cpp
eeschema/sch_sheet_pin.cpp
+1
-2
sch_text.cpp
eeschema/sch_text.cpp
+6
-6
sch_item_struct.h
include/sch_item_struct.h
+23
-8
No files found.
eeschema/sch_bus_entry.cpp
View file @
539f4e1e
...
@@ -205,12 +205,10 @@ void SCH_BUS_ENTRY::Rotate( wxPoint rotationPoint )
...
@@ -205,12 +205,10 @@ void SCH_BUS_ENTRY::Rotate( wxPoint rotationPoint )
void
SCH_BUS_ENTRY
::
GetEndPoints
(
std
::
vector
<
DANGLING_END_ITEM
>&
aItemList
)
void
SCH_BUS_ENTRY
::
GetEndPoints
(
std
::
vector
<
DANGLING_END_ITEM
>&
aItemList
)
{
{
DANGLING_END_ITEM
item
(
ENTRY_END
,
this
);
DANGLING_END_ITEM
item
(
ENTRY_END
,
this
,
m_Pos
);
item
.
m_Pos
=
m_Pos
;
DANGLING_END_ITEM
item1
(
ENTRY_END
,
this
);
item1
.
m_Pos
=
m_End
();
aItemList
.
push_back
(
item
);
aItemList
.
push_back
(
item
);
DANGLING_END_ITEM
item1
(
ENTRY_END
,
this
,
m_End
()
);
aItemList
.
push_back
(
item1
);
aItemList
.
push_back
(
item1
);
}
}
...
...
eeschema/sch_component.cpp
View file @
539f4e1e
...
@@ -1560,8 +1560,7 @@ void SCH_COMPONENT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
...
@@ -1560,8 +1560,7 @@ void SCH_COMPONENT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
if
(
Pin
->
GetConvert
()
&&
m_convert
&&
(
m_convert
!=
Pin
->
GetConvert
()
)
)
if
(
Pin
->
GetConvert
()
&&
m_convert
&&
(
m_convert
!=
Pin
->
GetConvert
()
)
)
continue
;
continue
;
DANGLING_END_ITEM
item
(
PIN_END
,
Pin
);
DANGLING_END_ITEM
item
(
PIN_END
,
Pin
,
GetPinPhysicalPosition
(
Pin
)
);
item
.
m_Pos
=
GetPinPhysicalPosition
(
Pin
);
aItemList
.
push_back
(
item
);
aItemList
.
push_back
(
item
);
}
}
}
}
...
...
eeschema/sch_junction.cpp
View file @
539f4e1e
...
@@ -163,8 +163,7 @@ void SCH_JUNCTION::Rotate( wxPoint rotationPoint )
...
@@ -163,8 +163,7 @@ void SCH_JUNCTION::Rotate( wxPoint rotationPoint )
void
SCH_JUNCTION
::
GetEndPoints
(
std
::
vector
<
DANGLING_END_ITEM
>&
aItemList
)
void
SCH_JUNCTION
::
GetEndPoints
(
std
::
vector
<
DANGLING_END_ITEM
>&
aItemList
)
{
{
DANGLING_END_ITEM
item
(
JUNCTION_END
,
this
);
DANGLING_END_ITEM
item
(
JUNCTION_END
,
this
,
m_Pos
);
item
.
m_Pos
=
m_Pos
;
aItemList
.
push_back
(
item
);
aItemList
.
push_back
(
item
);
}
}
...
...
eeschema/sch_line.cpp
View file @
539f4e1e
...
@@ -356,12 +356,12 @@ void SCH_LINE::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
...
@@ -356,12 +356,12 @@ void SCH_LINE::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
if
(
(
GetLayer
()
==
LAYER_BUS
)
||
(
GetLayer
()
==
LAYER_WIRE
)
)
if
(
(
GetLayer
()
==
LAYER_BUS
)
||
(
GetLayer
()
==
LAYER_WIRE
)
)
{
{
DANGLING_END_ITEM
item
(
(
GetLayer
()
==
LAYER_BUS
)
?
BUS_START_END
:
WIRE_START_END
,
this
);
DANGLING_END_ITEM
item
(
(
GetLayer
()
==
LAYER_BUS
)
?
BUS_START_END
:
WIRE_START_END
,
this
,
item
.
m_Pos
=
m_Start
;
m_Start
);
DANGLING_END_ITEM
item1
(
(
GetLayer
()
==
LAYER_BUS
)
?
BUS_END_END
:
WIRE_END_END
,
this
);
item1
.
m_Pos
=
m_End
;
aItemList
.
push_back
(
item
);
aItemList
.
push_back
(
item
);
DANGLING_END_ITEM
item1
(
(
GetLayer
()
==
LAYER_BUS
)
?
BUS_END_END
:
WIRE_END_END
,
this
,
m_End
);
aItemList
.
push_back
(
item1
);
aItemList
.
push_back
(
item1
);
}
}
}
}
...
@@ -378,13 +378,13 @@ bool SCH_LINE::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi
...
@@ -378,13 +378,13 @@ bool SCH_LINE::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi
{
{
BOOST_FOREACH
(
DANGLING_END_ITEM
item
,
aItemList
)
BOOST_FOREACH
(
DANGLING_END_ITEM
item
,
aItemList
)
{
{
if
(
item
.
m_Item
==
this
)
if
(
item
.
GetItem
()
==
this
)
continue
;
continue
;
if
(
m_Start
==
item
.
m_Pos
)
if
(
m_Start
==
item
.
GetPosition
()
)
m_StartIsDangling
=
false
;
m_StartIsDangling
=
false
;
if
(
m_End
==
item
.
m_Pos
)
if
(
m_End
==
item
.
GetPosition
()
)
m_EndIsDangling
=
false
;
m_EndIsDangling
=
false
;
if
(
(
m_StartIsDangling
==
false
)
&&
(
m_EndIsDangling
==
false
)
)
if
(
(
m_StartIsDangling
==
false
)
&&
(
m_EndIsDangling
==
false
)
)
...
...
eeschema/sch_sheet_pin.cpp
View file @
539f4e1e
...
@@ -516,8 +516,7 @@ void SCH_SHEET_PIN::CreateGraphicShape( std::vector <wxPoint>& aPoints, const wx
...
@@ -516,8 +516,7 @@ void SCH_SHEET_PIN::CreateGraphicShape( std::vector <wxPoint>& aPoints, const wx
void
SCH_SHEET_PIN
::
GetEndPoints
(
std
::
vector
<
DANGLING_END_ITEM
>&
aItemList
)
void
SCH_SHEET_PIN
::
GetEndPoints
(
std
::
vector
<
DANGLING_END_ITEM
>&
aItemList
)
{
{
DANGLING_END_ITEM
item
(
SHEET_LABEL_END
,
this
);
DANGLING_END_ITEM
item
(
SHEET_LABEL_END
,
this
,
m_Pos
);
item
.
m_Pos
=
m_Pos
;
aItemList
.
push_back
(
item
);
aItemList
.
push_back
(
item
);
}
}
...
...
eeschema/sch_text.cpp
View file @
539f4e1e
...
@@ -529,8 +529,7 @@ void SCH_TEXT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
...
@@ -529,8 +529,7 @@ void SCH_TEXT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
if
(
Type
()
==
SCH_TEXT_T
)
if
(
Type
()
==
SCH_TEXT_T
)
return
;
return
;
DANGLING_END_ITEM
item
(
LABEL_END
,
this
);
DANGLING_END_ITEM
item
(
LABEL_END
,
this
,
m_Pos
);
item
.
m_Pos
=
m_Pos
;
aItemList
.
push_back
(
item
);
aItemList
.
push_back
(
item
);
}
}
...
@@ -548,16 +547,17 @@ bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi
...
@@ -548,16 +547,17 @@ bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi
{
{
DANGLING_END_ITEM
&
item
=
aItemList
[
ii
];
DANGLING_END_ITEM
&
item
=
aItemList
[
ii
];
if
(
item
.
m_Item
==
this
)
if
(
item
.
GetItem
()
==
this
)
continue
;
continue
;
switch
(
item
.
m_Type
)
switch
(
item
.
GetType
()
)
{
{
case
PIN_END
:
case
PIN_END
:
case
LABEL_END
:
case
LABEL_END
:
case
SHEET_LABEL_END
:
case
SHEET_LABEL_END
:
if
(
m_Pos
==
item
.
m_Pos
)
if
(
m_Pos
==
item
.
GetPosition
()
)
m_IsDangling
=
false
;
m_IsDangling
=
false
;
break
;
break
;
case
WIRE_START_END
:
case
WIRE_START_END
:
...
@@ -571,7 +571,7 @@ bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi
...
@@ -571,7 +571,7 @@ bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi
wxT
(
"Dangling end type list overflow. Bad programmer!"
)
);
wxT
(
"Dangling end type list overflow. Bad programmer!"
)
);
DANGLING_END_ITEM
&
nextItem
=
aItemList
[
ii
];
DANGLING_END_ITEM
&
nextItem
=
aItemList
[
ii
];
m_IsDangling
=
!
SegmentIntersect
(
item
.
m_Pos
,
nextItem
.
m_Pos
,
m_Pos
);
m_IsDangling
=
!
SegmentIntersect
(
item
.
GetPosition
(),
nextItem
.
GetPosition
()
,
m_Pos
);
}
}
break
;
break
;
...
...
include/sch_item_struct.h
View file @
539f4e1e
...
@@ -78,19 +78,34 @@ enum DANGLING_END_T {
...
@@ -78,19 +78,34 @@ enum DANGLING_END_T {
SHEET_LABEL_END
SHEET_LABEL_END
};
};
// A helper class to store a list of items that can be connected to something:
/**
* Class DANLIGN_END_ITEM
* is a helper class used to store the state of schematic items that can be connected to
* other schematic items.
*/
class
DANGLING_END_ITEM
class
DANGLING_END_ITEM
{
{
public
:
/// A pointer to the connectable ojbect.
const
void
*
m_Item
;
// a pointer to the parent
const
void
*
m_item
;
wxPoint
m_Pos
;
// the position of the connecting point
DANGLING_END_T
m_Type
;
// type of parent
DANGLING_END_ITEM
(
DANGLING_END_T
type
,
const
void
*
aItem
)
/// The position of the connection point.
wxPoint
m_pos
;
/// The type of connection of #m_item.
DANGLING_END_T
m_type
;
public
:
DANGLING_END_ITEM
(
DANGLING_END_T
aType
,
const
void
*
aItem
,
const
wxPoint
&
aPosition
)
{
{
m_Item
=
aItem
;
m_item
=
aItem
;
m_Type
=
type
;
m_type
=
aType
;
m_pos
=
aPosition
;
}
}
wxPoint
GetPosition
()
const
{
return
m_pos
;
}
const
void
*
GetItem
()
const
{
return
m_item
;
}
DANGLING_END_T
GetType
()
const
{
return
m_type
;
}
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment