diff --git a/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/ReportRunner.kt b/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/ReportRunner.kt index 29165db..e815361 100644 --- a/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/ReportRunner.kt +++ b/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/ReportRunner.kt @@ -5,7 +5,10 @@ import org.ephyra.acropolis.report.api.IReportRunner import org.ephyra.acropolis.report.api.model.Graph import org.ephyra.acropolis.report.api.model.GraphContainer import org.ephyra.acropolis.report.api.model.Node +import org.ephyra.acropolis.report.impl.render.CardBuilder import org.ephyra.acropolis.report.impl.render.DiagramRenderer +import org.ephyra.acropolis.report.impl.render.Position2D +import org.ephyra.acropolis.report.impl.render.Size2D import org.slf4j.LoggerFactory import org.springframework.stereotype.Component import java.io.File @@ -46,7 +49,7 @@ internal class ReportRunner : IReportRunner { tempDepthCounts[depth] = count } - val positions = HashMap() + val positions = HashMap() depthMap.forEach { node, depth -> val currentDepthCount = tempDepthCounts[depth] ?: throw IllegalStateException("missing temp depth count") @@ -55,7 +58,7 @@ internal class ReportRunner : IReportRunner { val y = diagramPadding + (currentDepthCount - 1) * tileHeight + (currentDepthCount - 1) * cardSeparationVertical - val position = Position( + val position = Position2D( x.toFloat(), y.toFloat() ) @@ -69,6 +72,11 @@ internal class ReportRunner : IReportRunner { DiagramRenderer(diagramWidth, diagramHeight).use { renderer -> positions.forEach { node, position -> + CardBuilder(position, Size2D(tileWidth.toFloat(), tileHeight.toFloat())) + .withImage(imageSource.get(node.representedByResourceName)) + .withLabel(node.label) + .build(renderer) + val imageResource = imageSource.get(node.representedByResourceName) renderer.addImage(position.x.toInt(), position.y.toInt(), imageResource) } @@ -127,11 +135,3 @@ internal class ReportRunner : IReportRunner { } } } - -/** - * Represents a position on a 2D plane - */ -class Position( - val x: Float, - val y: Float -) diff --git a/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/render/CardBuilder.kt b/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/render/CardBuilder.kt new file mode 100644 index 0000000..262d9ae --- /dev/null +++ b/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/render/CardBuilder.kt @@ -0,0 +1,26 @@ +package org.ephyra.acropolis.report.impl.render + +import java.io.InputStream + +class CardBuilder( + private val position2D: Position2D, + + private val size2D: Size2D +) { + private var source: InputStream? = null + private var label: String? = null + + fun withImage(source: InputStream): CardBuilder { + this.source = source + return this + } + + fun withLabel(label: String): CardBuilder { + this.label = label + return this + } + + fun build(renderer: DiagramRenderer) { + + } +} \ No newline at end of file diff --git a/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/render/Position2D.kt b/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/render/Position2D.kt new file mode 100644 index 0000000..a2ed0d7 --- /dev/null +++ b/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/render/Position2D.kt @@ -0,0 +1,9 @@ +package org.ephyra.acropolis.report.impl.render + +/** + * Represents a position on a 2D plane + */ +class Position2D( + val x: Float, + val y: Float +) \ No newline at end of file diff --git a/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/render/Size2D.kt b/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/render/Size2D.kt new file mode 100644 index 0000000..0651977 --- /dev/null +++ b/acropolis-report/src/main/kotlin/org/ephyra/acropolis/report/impl/render/Size2D.kt @@ -0,0 +1,6 @@ +package org.ephyra.acropolis.report.impl.render + +class Size2D( + val width: Float, + val height: Float +) \ No newline at end of file