Permalink
Browse files

Polyline creation

  • Loading branch information...
feragon committed Jun 24, 2016
1 parent 91d7255 commit 0e047bafced0a130ffd22e22f5688bacd7a40be1
View
@@ -14,5 +14,6 @@
<file alias="dim_angular.svg">icons/dim_angular.svg</file>
<file alias="spline.svg">icons/spline.svg</file>
<file alias="quit.svg">icons/quit.svg</file>
<file alias="polylines.svg">icons/polylines.svg</file>
</qresource>
</RCC>
@@ -9,6 +9,7 @@ require 'actions.dimdiametricoperations'
require 'actions.dimlinearoperations'
require 'actions.dimradialoperations'
require 'actions.splineoperations'
require 'actions.lwpolylineoperations'
Operations = {}
Operations.__index = Operations
@@ -55,4 +56,4 @@ function Operations:getCoordinate(coordinate)
end
function Operations:close()
end
end
View
@@ -1,8 +1,8 @@
require 'ui.mainwindow'
require 'ui.cadmdichild'
require 'ui.operations'
require 'ui.commandline'
require 'ui.toolbar'
require 'actions.operations'
require 'ui.operations'
create_main_window()
View
@@ -1,15 +1,17 @@
local function finish_operation()
if(op[active_widget().id] ~= nil) then
op[active_widget().id]:close()
end
local function remove_operation_group()
local tab = toolbar:tabByName("Quick Access")
local group = tab:groupByName("Current operation")
if(group ~= nil) then
tab:removeGroup(group)
end
end
local function finish_operation()
if(op[active_widget().id] ~= nil) then
op[active_widget().id]:close()
end
end
local function create_cancel_button()
local tab = toolbar:tabByName("Quick Access")
local operationGroup = tab:addGroup("Current operation")
@@ -19,6 +21,8 @@ local function create_cancel_button()
luaInterface:luaConnect(cancelButton, "pressed()", finish_operation)
end
event.register("operationFinished", remove_operation_group)
function create_line()
finish_operation()
op[active_widget().id] = LineOperations(active_widget().id)
@@ -73,4 +77,26 @@ function create_spline()
finish_operation()
create_cancel_button()
op[active_widget().id] = SplineOperations(active_widget().id)
end
end
function create_lw_polyline()
finish_operation()
create_cancel_button()
local tab = toolbar:tabByName("Quick Access")
local group = tab:groupByName("Current operation")
local lineButton = create_button("", ":/icons/linesnormal.png")
tab:addButton(group, lineButton, 0, 1, 1, 1)
luaInterface:luaConnect(lineButton, "pressed()", function()
op[active_widget().id]:createLine()
end)
local arcButton = create_button("", ":/icons/arc.svg")
tab:addButton(group, arcButton, 1, 1, 1, 1)
luaInterface:luaConnect(arcButton, "pressed()", function()
op[active_widget().id]:createArc()
end)
op[active_widget().id] = LWPolylineOperations(active_widget().id)
end
View
@@ -45,6 +45,11 @@ function add_toolbar()
quickAccess:addButton(creationGroup, spline, 2, 0, 1, 1)
luaInterface:luaConnect(spline, "pressed()", create_spline)
local polylineButton = create_button("", ":/icons/polylines.svg")
quickAccess:addButton(creationGroup, polylineButton, 2, 1, 1, 1)
luaInterface:luaConnect(polylineButton, "pressed()", create_lw_polyline)
--
-- Ellipses
--
@@ -86,4 +91,4 @@ function add_toolbar()
local dimRadial = create_button("", ":/icons/dim_radial.svg")
quickAccess:addButton(dimGroup, dimRadial, 2, 0, 1, 1)
luaInterface:luaConnect(dimRadial, "pressed()", create_dim_radial)
end
end
@@ -272,11 +272,22 @@ void lua_openlckernel(lua_State* L) {
.beginClass<entity::LWVertex2D>("LWVertex2D")
.addConstructor(LUA_ARGS(
const geo::Coordinate & pos, _opt<double>, _opt<double>, _opt<double>))
.addFunction("location", &lc::entity::LWVertex2D::location)
.addFunction("bulge", &lc::entity::LWVertex2D::bulge)
.addFunction("startWidth", &lc::entity::LWVertex2D::startWidth)
.addFunction("endWidth", &lc::entity::LWVertex2D::endWidth)
.endClass()
.beginExtendClass<entity::LWPolyline, entity::CADEntity>("LWPolyline_")
.beginExtendClass<entity::LWPolyline, entity::CADEntity>("LWPolyline")
.addConstructor(LUA_SP(entity::LWPolyline_SPtr), LUA_ARGS(
const std::vector<entity::LWVertex2D>&,
double,
double,
double,
bool,
const geo::Coordinate,
const Layer_CSPtr,
const MetaInfo_CSPtr
))
.addFunction("width", &lc::entity::LWPolyline::width)
.addFunction("elevation", &lc::entity::LWPolyline::elevation)
.addFunction("tickness", &lc::entity::LWPolyline::tickness)
@@ -74,10 +74,10 @@ namespace lc {
}
public:
const geo::Coordinate _location;
const double _startWidth;
const double _endWidth;
const double _bulge;
geo::Coordinate _location;
double _startWidth;
double _endWidth;
double _bulge;
};
/**

0 comments on commit 0e047ba

Please sign in to comment.