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
1828edba
Commit
1828edba
authored
Apr 02, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring EDIT_POINTS, part 3: constraints split to EDIT_POINTs and EDIT_LINEs.
parent
0379247f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
17 deletions
+39
-17
edit_constraints.cpp
pcbnew/tools/edit_constraints.cpp
+5
-5
edit_constraints.h
pcbnew/tools/edit_constraints.h
+5
-8
edit_points.h
pcbnew/tools/edit_points.h
+27
-1
point_editor.cpp
pcbnew/tools/point_editor.cpp
+2
-3
No files found.
pcbnew/tools/edit_constraints.cpp
View file @
1828edba
...
@@ -90,8 +90,8 @@ void EC_CIRCLE::Apply( EDIT_POINT& aHandle )
...
@@ -90,8 +90,8 @@ void EC_CIRCLE::Apply( EDIT_POINT& aHandle )
EC_CONVERGING
::
EC_CONVERGING
(
EDIT_LINE
&
aLine
,
EDIT_POINTS
&
aPoints
)
:
EC_CONVERGING
::
EC_CONVERGING
(
EDIT_LINE
&
aLine
,
EDIT_POINTS
&
aPoints
)
:
EDIT_CONSTRAINT
<
EDIT_
POINT
>
(
aLine
.
GetOrigin
()
),
EDIT_CONSTRAINT
<
EDIT_
LINE
>
(
aLine
),
m_colinearConstraint
(
NULL
),
m_
line
(
aLine
),
m_
editPoints
(
aPoints
)
m_colinearConstraint
(
NULL
),
m_editPoints
(
aPoints
)
{
{
// Dragged segment endings
// Dragged segment endings
EDIT_POINT
&
origin
=
aLine
.
GetOrigin
();
EDIT_POINT
&
origin
=
aLine
.
GetOrigin
();
...
@@ -128,11 +128,11 @@ EC_CONVERGING::~EC_CONVERGING()
...
@@ -128,11 +128,11 @@ EC_CONVERGING::~EC_CONVERGING()
}
}
void
EC_CONVERGING
::
Apply
(
EDIT_
POINT
&
aHandle
)
void
EC_CONVERGING
::
Apply
(
EDIT_
LINE
&
aHandle
)
{
{
// The dragged segment endpoints
// The dragged segment endpoints
EDIT_POINT
&
origin
=
m_
line
.
GetOrigin
();
EDIT_POINT
&
origin
=
m_
constrained
.
GetOrigin
();
EDIT_POINT
&
end
=
m_
line
.
GetEnd
();
EDIT_POINT
&
end
=
m_
constrained
.
GetEnd
();
if
(
m_colinearConstraint
)
if
(
m_colinearConstraint
)
{
{
...
...
pcbnew/tools/edit_constraints.h
View file @
1828edba
...
@@ -127,8 +127,8 @@ private:
...
@@ -127,8 +127,8 @@ private:
/**
/**
* Class EC_45DEGREE
* Class EC_45DEGREE
*
*
* EDIT_CONSTRAINT that imposes a constraint that two
to be located at angle of 45 degree
* EDIT_CONSTRAINT that imposes a constraint that two
points have to be located at angle of 45
* multiplicity.
*
degree
multiplicity.
*/
*/
class
EC_45DEGREE
:
public
EDIT_CONSTRAINT
<
EDIT_POINT
>
class
EC_45DEGREE
:
public
EDIT_CONSTRAINT
<
EDIT_POINT
>
{
{
...
@@ -205,10 +205,10 @@ private:
...
@@ -205,10 +205,10 @@ private:
/**
/**
* Class EC_CONVERGING
* Class EC_CONVERGING
*
*
* EDIT_CONSTRAINT for 3 segment: dragged and two adjacent ones, enforcing to keep their slopes
* EDIT_CONSTRAINT for 3 segment
s
: dragged and two adjacent ones, enforcing to keep their slopes
* and allows only to change ending points. Applied to zones.
* and allows only to change ending points. Applied to zones.
*/
*/
class
EC_CONVERGING
:
public
EDIT_CONSTRAINT
<
EDIT_
POINT
>
class
EC_CONVERGING
:
public
EDIT_CONSTRAINT
<
EDIT_
LINE
>
{
{
public
:
public
:
EC_CONVERGING
(
EDIT_LINE
&
aLine
,
EDIT_POINTS
&
aPoints
);
EC_CONVERGING
(
EDIT_LINE
&
aLine
,
EDIT_POINTS
&
aPoints
);
...
@@ -216,7 +216,7 @@ public:
...
@@ -216,7 +216,7 @@ public:
virtual
~
EC_CONVERGING
();
virtual
~
EC_CONVERGING
();
///> @copydoc EDIT_CONSTRAINT::Apply()
///> @copydoc EDIT_CONSTRAINT::Apply()
virtual
void
Apply
(
EDIT_
POINT
&
aHandle
);
virtual
void
Apply
(
EDIT_
LINE
&
aHandle
);
private
:
private
:
///> Constraint for origin side segment.
///> Constraint for origin side segment.
...
@@ -229,9 +229,6 @@ private:
...
@@ -229,9 +229,6 @@ private:
///> m_[origin/end]SideConstraint, so it should not be freed.
///> m_[origin/end]SideConstraint, so it should not be freed.
EDIT_CONSTRAINT
<
EDIT_POINT
>*
m_colinearConstraint
;
EDIT_CONSTRAINT
<
EDIT_POINT
>*
m_colinearConstraint
;
///> Dragged segment.
EDIT_LINE
&
m_line
;
///> EDIT_POINTS instance that stores currently modified lines.
///> EDIT_POINTS instance that stores currently modified lines.
EDIT_POINTS
&
m_editPoints
;
EDIT_POINTS
&
m_editPoints
;
...
...
pcbnew/tools/edit_points.h
View file @
1828edba
...
@@ -165,7 +165,7 @@ public:
...
@@ -165,7 +165,7 @@ public:
///> Single point size in pixels
///> Single point size in pixels
static
const
int
POINT_SIZE
=
10
;
static
const
int
POINT_SIZE
=
10
;
pr
otected
:
pr
ivate
:
///> Position of EDIT_POINT
///> Position of EDIT_POINT
VECTOR2I
m_position
;
VECTOR2I
m_position
;
...
@@ -221,6 +221,29 @@ public:
...
@@ -221,6 +221,29 @@ public:
m_constraint
->
Apply
();
m_constraint
->
Apply
();
}
}
/**
* Function SetConstraint()
*
* Sets a constraint for and EDIT_POINT.
* @param aConstraint is the constraint to be set.
*/
void
SetConstraint
(
EDIT_CONSTRAINT
<
EDIT_LINE
>*
aConstraint
)
{
m_constraint
.
reset
(
aConstraint
);
}
/**
* Function GetConstraint()
*
* Returns the constraint imposed on an EDIT_POINT. If there are no constraints, NULL is
* returned.
*/
EDIT_CONSTRAINT
<
EDIT_LINE
>*
GetConstraint
()
const
{
return
m_constraint
.
get
();
}
/**
/**
* Function GetOrigin()
* Function GetOrigin()
*
*
...
@@ -264,6 +287,9 @@ public:
...
@@ -264,6 +287,9 @@ public:
private
:
private
:
EDIT_POINT
&
m_origin
;
///< Origin point for a line
EDIT_POINT
&
m_origin
;
///< Origin point for a line
EDIT_POINT
&
m_end
;
///< End point for a line
EDIT_POINT
&
m_end
;
///< End point for a line
///> Constraint for the point, NULL if none
boost
::
shared_ptr
<
EDIT_CONSTRAINT
<
EDIT_LINE
>
>
m_constraint
;
};
};
...
...
pcbnew/tools/point_editor.cpp
View file @
1828edba
...
@@ -575,12 +575,11 @@ void POINT_EDITOR::setAltConstraint( bool aEnabled )
...
@@ -575,12 +575,11 @@ void POINT_EDITOR::setAltConstraint( bool aEnabled )
if
(
aEnabled
)
if
(
aEnabled
)
{
{
EDIT_LINE
*
line
=
dynamic_cast
<
EDIT_LINE
*>
(
m_dragPoint
);
EDIT_LINE
*
line
=
dynamic_cast
<
EDIT_LINE
*>
(
m_dragPoint
);
if
(
line
)
if
(
line
)
{
{
if
(
m_editPoints
->
GetParent
()
->
Type
()
==
PCB_ZONE_AREA_T
)
if
(
m_editPoints
->
GetParent
()
->
Type
()
==
PCB_ZONE_AREA_T
)
{
m_altConstraint
.
reset
(
(
EDIT_CONSTRAINT
<
EDIT_POINT
>*
)(
new
EC_CONVERGING
(
*
line
,
*
m_editPoints
)
)
);
m_altConstraint
.
reset
(
new
EC_CONVERGING
(
*
line
,
*
m_editPoints
)
);
}
}
}
else
else
{
{
...
...
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