- writeShapeLines(mcMesh, fullGrpName, nodeChains, offsetX, offsetY)
- writeShapePoints(mcMesh, fullGrpName, nodeChains, offsetX, offsetY)
-
-
-def fitShapePointsToMesh(freeBorderShapefile, shapefileToAdjust):
+ filename = writeShapeLines(mcMesh, fullGrpName, nodeChains, outputDirectory, offsetX, offsetY)
+ writeShapePoints(mcMesh, fullGrpName, nodeChains, outputDirectory, offsetX, offsetY)
+ filenames.append(filename)
+ shapesListFile = os.path.join(outputDirectory, "shapesList.json")
+ with open(shapesListFile, 'w') as f:
+ json.dump(filenames, f)
+
+def fitShapePointsToMesh(freeBorderShapefile, shapefileToAdjust, outputDirectory="", splitFreeBorder=True, splitShapeAdjusted=True):
+ """
+ shapeFileToAdjust must be a closed line or polygon crossing freeBorderShapefile in 2 points.
+ Find in shapeFileToAdjust and in freeBorderShapefile the two closest corresponding points and move the points in shapeFileToAdjust to correspond to the points found in freeBorderShapefile. Split shapeFileToAdjust in two parts (inside or outside freeBorder). If requested, split freeBorderShapefile in two parts. Same for shapeFileToAdjust.
+ parameters:
+ freeBorderShapefile: a set of free border lines, as generated by the functions freeBordersGroup and exploreEdgeGroups.
+ shapefileToAdjust: a closed line or polygon, supposed to be drawn in qgis to pass as close as possible to the points to be connected, on the free border.
+ outputDirectory: if empty, write the resulting shapefiles in their respective directory, with the suffix '_adj', otherwise write in the outputDirectory.
+ splitFreeBorder: boolean default True
+ splitShapeAdjusted: boolean default True
+ """