Add string export
This commit is contained in:
parent
28663a010d
commit
77e27c7eb6
@ -26,13 +26,12 @@ fun SchemeFeaturesState.snapshot(): FeatureStateSnapshot =
|
||||
features(),
|
||||
features().values.filterIsInstance<PainterFeature>().associateWith { it.painter() })
|
||||
|
||||
|
||||
fun FeatureStateSnapshot.exportToSvg(
|
||||
fun FeatureStateSnapshot.generateSvg(
|
||||
viewPoint: SchemeViewPoint,
|
||||
width: Double,
|
||||
height: Double,
|
||||
path: java.nio.file.Path,
|
||||
) {
|
||||
id: String? = null
|
||||
): String{
|
||||
|
||||
fun SchemeCoordinates.toOffset(): Offset = Offset(
|
||||
(width / 2 + (x - viewPoint.focus.x) * viewPoint.scale).toFloat(),
|
||||
@ -132,6 +131,17 @@ fun FeatureStateSnapshot.exportToSvg(
|
||||
drawFeature(viewPoint.scale, feature)
|
||||
}
|
||||
}
|
||||
|
||||
SVGUtils.writeToSVG(path.toFile(), svgGraphics2D.svgElement)
|
||||
return svgGraphics2D.getSVGElement(id)
|
||||
}
|
||||
|
||||
fun FeatureStateSnapshot.exportToSvg(
|
||||
viewPoint: SchemeViewPoint,
|
||||
width: Double,
|
||||
height: Double,
|
||||
path: java.nio.file.Path,
|
||||
) {
|
||||
|
||||
val svgString = generateSvg(viewPoint, width, height)
|
||||
|
||||
SVGUtils.writeToSVG(path.toFile(), svgString)
|
||||
}
|
Loading…
Reference in New Issue
Block a user