private fun drawLine(iter: DBIDRef): Element? { val path = SVGPath() val obj: SpatialComparable = relation.get(iter) val dims: Int = proj.getVisibleDimensions() var drawn = false var valid = 0 var prevpos = Double.NaN for (i in 0 until dims) { val d: Int = proj.getDimForAxis(i) val minPos: Double = proj.fastProjectDataToRenderSpace(obj.getMin(d), i) if (minPos != minPos) { valid = 0 continue } ++valid if (valid > 1) { if (valid == 2) { path.moveTo(getVisibleAxisX(d - 1), prevpos) } path.lineTo(getVisibleAxisX(d), minPos) drawn = true } prevpos = minPos } valid = 0 for (i in dims - 1 downTo 0) { val d: Int = proj.getDimForAxis(i) val maxPos: Double = proj.fastProjectDataToRenderSpace(obj.getMax(d), i) if (maxPos != maxPos) { valid = 0 continue } ++valid if (valid > 1) { if (valid == 2) { path.moveTo(getVisibleAxisX(d + 1), prevpos) } path.lineTo(getVisibleAxisX(d), maxPos) drawn = true } prevpos = maxPos } return if (!drawn) { null } else path.makeElement(svgp) }
Draw a single line .