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
3ecae4fa
Commit
3ecae4fa
authored
Feb 14, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GAL::GetGridPoint() returns point in world coordinates.
parent
a7cb90de
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
graphics_abstraction_layer.cpp
common/gal/graphics_abstraction_layer.cpp
+4
-4
wx_view_controls.cpp
common/view/wx_view_controls.cpp
+1
-1
graphics_abstraction_layer.h
include/gal/graphics_abstraction_layer.h
+3
-3
No files found.
common/gal/graphics_abstraction_layer.cpp
View file @
3ecae4fa
...
@@ -237,10 +237,10 @@ void GAL::DrawGrid()
...
@@ -237,10 +237,10 @@ void GAL::DrawGrid()
VECTOR2D
GAL
::
GetGridPoint
(
const
VECTOR2D
&
aPoint
)
const
VECTOR2D
GAL
::
GetGridPoint
(
const
VECTOR2D
&
aPoint
)
const
{
{
VECTOR2D
pointWorld
=
ToWorld
(
aPoint
)
;
VECTOR2D
gridPoint
;
pointWorld
.
x
=
round
(
pointWorld
.
x
/
gridSize
.
x
)
*
gridSize
.
x
;
gridPoint
.
x
=
round
(
aPoint
.
x
/
gridSize
.
x
)
*
gridSize
.
x
;
pointWorld
.
y
=
round
(
pointWorld
.
y
/
gridSize
.
y
)
*
gridSize
.
y
;
gridPoint
.
y
=
round
(
aPoint
.
y
/
gridSize
.
y
)
*
gridSize
.
y
;
return
ToScreen
(
pointWorld
)
;
return
gridPoint
;
}
}
common/view/wx_view_controls.cpp
View file @
3ecae4fa
...
@@ -247,7 +247,7 @@ VECTOR2D WX_VIEW_CONTROLS::GetCursorPosition() const
...
@@ -247,7 +247,7 @@ VECTOR2D WX_VIEW_CONTROLS::GetCursorPosition() const
VECTOR2D
mousePosition
=
GetMousePosition
();
VECTOR2D
mousePosition
=
GetMousePosition
();
if
(
m_snappingEnabled
)
if
(
m_snappingEnabled
)
return
m_view
->
ToWorld
(
m_view
->
GetGAL
()
->
GetGridPoint
(
mousePosition
)
);
return
m_view
->
GetGAL
()
->
GetGridPoint
(
m_view
->
ToWorld
(
mousePosition
)
);
else
else
return
m_view
->
ToWorld
(
mousePosition
);
return
m_view
->
ToWorld
(
mousePosition
);
}
}
...
...
include/gal/graphics_abstraction_layer.h
View file @
3ecae4fa
...
@@ -717,15 +717,15 @@ public:
...
@@ -717,15 +717,15 @@ public:
gridLineWidth
=
aGridLineWidth
;
gridLineWidth
=
aGridLineWidth
;
}
}
/// @brief Draw the grid
///
>
@brief Draw the grid
void
DrawGrid
();
void
DrawGrid
();
/**
/**
* Function GetGridPoint()
* Function GetGridPoint()
* For a given point it returns the nearest point belonging to the grid in
screen
coordinates.
* For a given point it returns the nearest point belonging to the grid in
world
coordinates.
*
*
* @param aPoint is the point for which the grid point is searched.
* @param aPoint is the point for which the grid point is searched.
* @return The nearest grid point in
screen
coordinates.
* @return The nearest grid point in
world
coordinates.
*/
*/
VECTOR2D
GetGridPoint
(
const
VECTOR2D
&
aPoint
)
const
;
VECTOR2D
GetGridPoint
(
const
VECTOR2D
&
aPoint
)
const
;
...
...
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