small refactorings in inx of contour scanner

This commit is contained in:
Mario Voigt 2021-06-23 11:34:50 +02:00
parent 22f7860c21
commit a2c079d8c9
2 changed files with 10 additions and 7 deletions

View File

@ -97,8 +97,11 @@
<option value="default">Use default sub split style</option>
<option value="apply_from_highlightings">Apply highlighting styles</option>
<option value="apply_from_original">Apply original path styles</option>
</param>
<param name="apply_style_to_trimmed" type="bool" gui-text="Original style for trimmed lines" gui-description="Apply original path style to trimmed lines.">true</param>
</param>
<param name="trimmed_style" type="optiongroup" appearance="combo" gui-text="Trimmed line style">
<option value="apply_from_trimmed">Apply default trimming styles</option>
<option value="apply_from_original">Apply original path styles</option>
</param>
</vbox>
</hbox>
</page>
@ -108,7 +111,7 @@
- Uses Bentley-Ottmann algorithm to detect intersections
- Allows to separate different contour types by colors
- Works with paths which have Live Path Effects (LPE)
- Does not find overlapping colinear lines (sweep line algorithm does not intersect them)
- Finds overlapping / collinear lines
Tips:
- If nothings is selected, the whole document will be processed, regardless of groups. In contrast, if you made a custom selection, check to handle or not to handle groups.

View File

@ -296,9 +296,9 @@ class ContourScannerAndTrimmer(inkex.EffectExtension):
#if trimGroupParentTransform is not None:
# trimLine.path = trimLine.path.transform(-trimGroupParentTransform)
if self.options.apply_style_to_trimmed is False:
if self.options.trimmed_style == "apply_from_trimmed":
trimLine.style = trimLineStyle
else:
elif self.options.trimmed_style == "apply_from_original":
trimLine.style = subSplitLineArray[subSplitIndex].attrib['originalPathStyle']
trimGroup.add(trimLine)
return trimGroup
@ -526,7 +526,7 @@ class ContourScannerAndTrimmer(inkex.EffectExtension):
self.msg("trim group {} has {} combinable segments:".format(trimGroup.get('id'), len(newPathData)))
self.msg("{}".format(newPathData))
combinedPath.path = Path(newPathData)
if self.options.apply_style_to_trimmed is False:
if self.options.trimmed_style is False:
combinedPath.style = trimNonIntersectedStyle
if totalIntersectionsAtPath == 0:
combinedPath.style = nonTrimLineStyle
@ -634,7 +634,7 @@ class ContourScannerAndTrimmer(inkex.EffectExtension):
pars.add_argument("--removefillsetstroke", type=inkex.Boolean, default=False, help="Remove fill and define stroke for original paths")
pars.add_argument("--bezier_trimming", type=inkex.Boolean, default=False, help="If true we try to use the calculated t parameters from intersection points to receive splitted bezier curves")
pars.add_argument("--subsplit_style", default="default", help="Sub split line style")
pars.add_argument("--apply_style_to_trimmed", type=inkex.Boolean, default=True, help="Apply original path style to trimmed lines")
pars.add_argument("--trimmed_style", default="apply_from_trimmed", help="Trimmed line style")
#Style - Scanning Colors (Highlighting things)
pars.add_argument("--color_subsplit", type=Color, default='1630897151', help="sub split lines")