Skip to content

Commit

Permalink
Merge pull request #2121 from avancinirodrigo/master
Browse files Browse the repository at this point in the history
Fixing Layer:fill without overlap
  • Loading branch information
pedro-andrade-inpe authored Jan 25, 2018
2 parents ec0243b + 8a9f1d1 commit d3b241f
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/gis/lua/TerraLib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,10 @@ local function vectorToVector(fromLayer, toLayer, operation, select, outConnInfo
v2v:setParams(select, OperationMapper[operation], toDst)

local err = v2v:pRun() -- TODO: OGR RELEASE SHAPE PROBLEM (REVIEW)

if err ~= "" then
customError(err) -- SKIP
binding.te.da.DataSourceManager.getInstance():detachAll()
customError(err)
end

propCreatedName = select.."_"..VectorAttributeCreatedMapper[operation]
Expand Down
4 changes: 2 additions & 2 deletions packages/gis/tests/functional/alternative/Layer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -957,8 +957,8 @@ return{

unitTest:assertError(op4NotAvailable, "The operation 'presence' is not available for layers with raster data.")

File(projName):deleteIfExists()
File(filePath1):deleteIfExists()
File(projName):delete()
File(filePath1):delete()
end,
simplify = function(unitTest)
local projName = "layer_func_alt.tview"
Expand Down
41 changes: 41 additions & 0 deletions packages/gis/tests/functional/alternative/TerraLib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,47 @@
-------------------------------------------------------------------------------------------

return {
attributeFill = function(unitTest)
local proj = {}
proj.file = "amazonia.tview"
proj.title = "TerraLib Tests"
proj.author = "Avancini Rodrigo"

File(proj.file):deleteIfExists()

TerraLib().createProject(proj, {})

local layerName1 = "ES"
local layerFile1 = filePath("test/limite_es_poly_wgs84.shp", "gis")
TerraLib().addShpLayer(proj, layerName1, layerFile1, nil, 29101)

local layerName2 = "PA"
local layerFile2 = filePath("test/limitePA_polyc_pol.shp", "gis")
TerraLib().addShpLayer(proj, layerName2, layerFile2, nil, 29101)

local clName = "esCs"
local clFile = File(clName..".shp")
clFile:deleteIfExists()

local resolution = 20e3
local mask = true
TerraLib().addShpCellSpaceLayer(proj, layerName1, clName, resolution, clFile, mask)

local operation = "distance"
local attribute = "pol"
local select = "FID"
local area = nil
local default = 0

local layersNotIntersect = function()
TerraLib().attributeFill(proj, layerName2, clName, nil, attribute, operation, select, area, default)
end

unitTest:assertError(layersNotIntersect, "The two layers do not intersect.")

proj.file:delete()
clFile:delete()
end,
createProject = function(unitTest)
local proj = {}
proj.file = "file.xml"
Expand Down

0 comments on commit d3b241f

Please sign in to comment.