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
a4995ae7
Commit
a4995ae7
authored
May 05, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrote GetEnd(), GetStart(), GetLength(), embellished Display_Infos()
parent
71390134
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
9 deletions
+92
-9
class_drawsegment.cpp
pcbnew/class_drawsegment.cpp
+67
-9
class_drawsegment.h
pcbnew/class_drawsegment.h
+25
-0
No files found.
pcbnew/class_drawsegment.cpp
View file @
a4995ae7
...
...
@@ -144,6 +144,45 @@ bool DRAWSEGMENT::ReadDrawSegmentDescr( FILE* File, int* LineNum )
}
wxPoint
DRAWSEGMENT
::
GetStart
()
const
{
switch
(
m_Shape
)
{
case
S_ARC
:
return
m_End
;
// the start of the arc is held in field m_End, center point is in m_Start.
case
S_SEGMENT
:
default
:
return
m_Start
;
}
}
wxPoint
DRAWSEGMENT
::
GetEnd
()
const
{
switch
(
m_Shape
)
{
case
S_ARC
:
{
// rotate the starting point of the arc, given by m_End, through the angle m_Angle
// to get the ending point of the arc.
wxPoint
center
=
m_Start
;
// center point of the arc
wxPoint
start
=
m_End
;
// start of arc
RotatePoint
(
&
start
.
x
,
&
start
.
y
,
center
.
x
,
center
.
y
,
-
m_Angle
);
return
start
;
// after rotation, the end of the arc.
}
break
;
case
S_SEGMENT
:
default
:
return
m_End
;
}
}
void
DRAWSEGMENT
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
int
draw_mode
,
const
wxPoint
&
notUsed
)
{
...
...
@@ -249,6 +288,7 @@ void DRAWSEGMENT::Display_Infos( WinEDA_DrawFrame* frame )
{
int
itype
;
wxString
msg
;
wxString
coords
;
BOARD
*
board
=
(
BOARD
*
)
m_Parent
;
wxASSERT
(
board
);
...
...
@@ -261,25 +301,35 @@ void DRAWSEGMENT::Display_Infos( WinEDA_DrawFrame* frame )
Affiche_1_Parametre
(
frame
,
1
,
_
(
"Type"
),
msg
,
DARKCYAN
);
Affiche_1_Parametre
(
frame
,
16
,
_
(
"Shape"
),
wxEmptyString
,
RED
);
wxString
shape
=
_
(
"Shape"
);
if
(
m_Shape
==
S_CIRCLE
)
Affiche_1_Parametre
(
frame
,
-
1
,
wxEmptyString
,
_
(
"Circle"
),
RED
);
Affiche_1_Parametre
(
frame
,
10
,
shape
,
_
(
"Circle"
),
RED
);
else
if
(
m_Shape
==
S_ARC
)
{
Affiche_1_Parametre
(
frame
,
-
1
,
wxEmptyString
,
_
(
" Arc "
),
RED
);
msg
.
Printf
(
wxT
(
"%d"
),
m_Angle
);
Affiche_1_Parametre
(
frame
,
32
,
wxT
(
" l.arc "
),
msg
,
RED
);
Affiche_1_Parametre
(
frame
,
10
,
shape
,
_
(
"Arc"
),
RED
);
msg
.
Printf
(
wxT
(
"%d.%d"
),
m_Angle
/
10
,
m_Angle
%
10
);
Affiche_1_Parametre
(
frame
,
18
,
_
(
"Angle"
),
msg
,
RED
);
}
else
Affiche_1_Parametre
(
frame
,
-
1
,
wxEmptyString
,
_
(
"Segment"
),
RED
);
Affiche_1_Parametre
(
frame
,
10
,
shape
,
_
(
"Segment"
),
RED
);
wxString
start
;
start
<<
GetStart
();
Affiche_1_Parametre
(
frame
,
48
,
_
(
"Layer"
),
wxString
end
;
end
<<
GetEnd
();
Affiche_1_Parametre
(
frame
,
22
,
start
,
end
,
BLACK
);
Affiche_1_Parametre
(
frame
,
36
,
_
(
"Layer"
),
board
->
GetLayerName
(
m_Layer
),
BROWN
);
valeur_param
(
(
unsigned
)
m_Width
,
msg
);
Affiche_1_Parametre
(
frame
,
60
,
_
(
"Width"
),
msg
,
DARKCYAN
);
Affiche_1_Parametre
(
frame
,
50
,
_
(
"Width"
),
msg
,
DARKCYAN
);
}
...
...
@@ -366,10 +416,18 @@ void DRAWSEGMENT::Show( int nestLevel, std::ostream& os )
{
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
" shape=
\"
"
<<
m_Shape
<<
'"'
<<
/*
" layer=\"" << GetLayer() << '"' <<
" width=\"" << m_Width << '"' <<
" angle=\"" << m_Angle << '"' << // Used only for Arcs: Arc angle in 1/10 deg
*/
'>'
<<
"<start"
<<
m_Start
<<
"/>"
<<
"<end"
<<
m_End
<<
"/>"
;
"<end"
<<
m_End
<<
"/>"
"<GetStart"
<<
GetStart
()
<<
"/>"
<<
"<GetEnd"
<<
GetEnd
()
<<
"/>"
;
os
<<
"</"
<<
GetClass
().
Lower
().
mb_str
()
<<
">
\n
"
;
}
...
...
pcbnew/class_drawsegment.h
View file @
a4995ae7
...
...
@@ -33,6 +33,18 @@ public:
}
/**
* Function GetStart
* returns the starting point of the graphic
*/
wxPoint
GetStart
()
const
;
/**
* Function GetEnd
* returns the ending point of the graphic
*/
wxPoint
GetEnd
()
const
;
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
...
...
@@ -90,6 +102,19 @@ public:
}
/**
* Function GetLength
* returns the length of the track using the hypotenuse calculation.
* @return double - the length of the track
*/
double
GetLength
()
const
{
wxPoint
delta
=
GetEnd
()
-
GetStart
();
return
hypot
(
delta
.
x
,
delta
.
y
);
}
#if defined(DEBUG)
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
...
...
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