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
953f71df
Commit
953f71df
authored
Jul 09, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move() method updates local coordinates in EDGE_MODULE, D_PAD and TEXTE_MODULE classes.
parent
2ee890d7
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
7 deletions
+76
-7
class_edge_mod.cpp
pcbnew/class_edge_mod.cpp
+19
-0
class_edge_mod.h
pcbnew/class_edge_mod.h
+11
-0
class_pad.cpp
pcbnew/class_pad.cpp
+32
-0
class_pad.h
pcbnew/class_pad.h
+8
-1
class_text_mod.cpp
pcbnew/class_text_mod.cpp
+2
-3
class_text_mod.h
pcbnew/class_text_mod.h
+4
-3
No files found.
pcbnew/class_edge_mod.cpp
View file @
953f71df
...
@@ -90,6 +90,25 @@ void EDGE_MODULE::Copy( EDGE_MODULE* source )
...
@@ -90,6 +90,25 @@ void EDGE_MODULE::Copy( EDGE_MODULE* source )
}
}
void
EDGE_MODULE
::
SetLocalCoord
()
{
MODULE
*
module
=
(
MODULE
*
)
m_Parent
;
if
(
module
==
NULL
)
{
m_Start0
=
m_Start
;
m_End0
=
m_End
;
return
;
}
m_Start0
=
m_Start
-
module
->
GetPosition
();
m_End0
=
m_End
-
module
->
GetPosition
();
double
angle
=
module
->
GetOrientation
();
RotatePoint
(
&
m_Start0
.
x
,
&
m_Start0
.
y
,
-
angle
);
RotatePoint
(
&
m_End0
.
x
,
&
m_End0
.
y
,
-
angle
);
}
void
EDGE_MODULE
::
SetDrawCoord
()
void
EDGE_MODULE
::
SetDrawCoord
()
{
{
MODULE
*
module
=
(
MODULE
*
)
m_Parent
;
MODULE
*
module
=
(
MODULE
*
)
m_Parent
;
...
...
pcbnew/class_edge_mod.h
View file @
953f71df
...
@@ -61,12 +61,23 @@ public:
...
@@ -61,12 +61,23 @@ public:
void
Copy
(
EDGE_MODULE
*
source
);
// copy structure
void
Copy
(
EDGE_MODULE
*
source
);
// copy structure
void
Move
(
const
wxPoint
&
aMoveVector
)
{
m_Start
+=
aMoveVector
;
m_End
+=
aMoveVector
;
SetLocalCoord
();
}
void
SetStart0
(
const
wxPoint
&
aPoint
)
{
m_Start0
=
aPoint
;
}
void
SetStart0
(
const
wxPoint
&
aPoint
)
{
m_Start0
=
aPoint
;
}
const
wxPoint
&
GetStart0
()
const
{
return
m_Start0
;
}
const
wxPoint
&
GetStart0
()
const
{
return
m_Start0
;
}
void
SetEnd0
(
const
wxPoint
&
aPoint
)
{
m_End0
=
aPoint
;
}
void
SetEnd0
(
const
wxPoint
&
aPoint
)
{
m_End0
=
aPoint
;
}
const
wxPoint
&
GetEnd0
()
const
{
return
m_End0
;
}
const
wxPoint
&
GetEnd0
()
const
{
return
m_End0
;
}
///> Set relative coordinates.
void
SetLocalCoord
();
///> Set absolute coordinates.
void
SetDrawCoord
();
void
SetDrawCoord
();
/* drawing functions */
/* drawing functions */
...
...
pcbnew/class_pad.cpp
View file @
953f71df
...
@@ -228,6 +228,38 @@ const EDA_RECT D_PAD::GetBoundingBox() const
...
@@ -228,6 +228,38 @@ const EDA_RECT D_PAD::GetBoundingBox() const
}
}
void
D_PAD
::
SetDrawCoord
()
{
MODULE
*
module
=
(
MODULE
*
)
m_Parent
;
m_Pos
=
m_Pos0
;
if
(
module
==
NULL
)
return
;
double
angle
=
module
->
GetOrientation
();
RotatePoint
(
&
m_Pos
.
x
,
&
m_Pos
.
y
,
angle
);
m_Pos
+=
module
->
GetPosition
();
}
void
D_PAD
::
SetLocalCoord
()
{
MODULE
*
module
=
(
MODULE
*
)
m_Parent
;
if
(
module
==
NULL
)
{
m_Pos0
=
m_Pos
;
return
;
}
m_Pos0
=
m_Pos
-
module
->
GetPosition
();
double
angle
=
module
->
GetOrientation
();
RotatePoint
(
&
m_Pos0
.
x
,
&
m_Pos0
.
y
,
-
angle
);
}
void
D_PAD
::
SetAttribute
(
PAD_ATTR_T
aAttribute
)
void
D_PAD
::
SetAttribute
(
PAD_ATTR_T
aAttribute
)
{
{
m_Attribute
=
aAttribute
;
m_Attribute
=
aAttribute
;
...
...
pcbnew/class_pad.h
View file @
953f71df
...
@@ -381,6 +381,12 @@ public:
...
@@ -381,6 +381,12 @@ public:
// Virtual function:
// Virtual function:
const
EDA_RECT
GetBoundingBox
()
const
;
const
EDA_RECT
GetBoundingBox
()
const
;
///> Set absolute coordinates.
void
SetDrawCoord
();
///> Set relative coordinates.
void
SetLocalCoord
();
/**
/**
* Function Compare
* Function Compare
* compares two pads and return 0 if they are equal.
* compares two pads and return 0 if they are equal.
...
@@ -391,6 +397,7 @@ public:
...
@@ -391,6 +397,7 @@ public:
void
Move
(
const
wxPoint
&
aMoveVector
)
void
Move
(
const
wxPoint
&
aMoveVector
)
{
{
m_Pos
+=
aMoveVector
;
m_Pos
+=
aMoveVector
;
SetLocalCoord
();
}
}
...
...
pcbnew/class_text_mod.cpp
View file @
953f71df
...
@@ -129,7 +129,7 @@ int TEXTE_MODULE::GetLength() const
...
@@ -129,7 +129,7 @@ int TEXTE_MODULE::GetLength() const
return
m_Text
.
Len
();
return
m_Text
.
Len
();
}
}
// Update draw coordinates
void
TEXTE_MODULE
::
SetDrawCoord
()
void
TEXTE_MODULE
::
SetDrawCoord
()
{
{
MODULE
*
module
=
(
MODULE
*
)
m_Parent
;
MODULE
*
module
=
(
MODULE
*
)
m_Parent
;
...
@@ -146,8 +146,6 @@ void TEXTE_MODULE::SetDrawCoord()
...
@@ -146,8 +146,6 @@ void TEXTE_MODULE::SetDrawCoord()
}
}
// Update "local" coordinates (coordinates relatives to the footprint
// anchor point)
void
TEXTE_MODULE
::
SetLocalCoord
()
void
TEXTE_MODULE
::
SetLocalCoord
()
{
{
MODULE
*
module
=
(
MODULE
*
)
m_Parent
;
MODULE
*
module
=
(
MODULE
*
)
m_Parent
;
...
@@ -163,6 +161,7 @@ void TEXTE_MODULE::SetLocalCoord()
...
@@ -163,6 +161,7 @@ void TEXTE_MODULE::SetLocalCoord()
RotatePoint
(
&
m_Pos0
.
x
,
&
m_Pos0
.
y
,
-
angle
);
RotatePoint
(
&
m_Pos0
.
x
,
&
m_Pos0
.
y
,
-
angle
);
}
}
bool
TEXTE_MODULE
::
HitTest
(
const
wxPoint
&
aPosition
)
const
bool
TEXTE_MODULE
::
HitTest
(
const
wxPoint
&
aPosition
)
const
{
{
wxPoint
rel_pos
;
wxPoint
rel_pos
;
...
...
pcbnew/class_text_mod.h
View file @
953f71df
...
@@ -71,7 +71,6 @@ public:
...
@@ -71,7 +71,6 @@ public:
return
aItem
&&
PCB_MODULE_TEXT_T
==
aItem
->
Type
();
return
aItem
&&
PCB_MODULE_TEXT_T
==
aItem
->
Type
();
}
}
virtual
const
wxPoint
&
GetPosition
()
const
virtual
const
wxPoint
&
GetPosition
()
const
{
{
return
m_Pos
;
return
m_Pos
;
...
@@ -117,9 +116,11 @@ public:
...
@@ -117,9 +116,11 @@ public:
// Virtual function
// Virtual function
const
EDA_RECT
GetBoundingBox
()
const
;
const
EDA_RECT
GetBoundingBox
()
const
;
void
SetDrawCoord
();
// Set absolute coordinates.
///> Set absolute coordinates.
void
SetDrawCoord
();
void
SetLocalCoord
();
// Set relative coordinates.
///> Set relative coordinates.
void
SetLocalCoord
();
/* drawing functions */
/* drawing functions */
void
Draw
(
EDA_DRAW_PANEL
*
panel
,
void
Draw
(
EDA_DRAW_PANEL
*
panel
,
...
...
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