layer marking

This commit is contained in:
Alexander Nozik 2021-07-15 12:28:25 +03:00
parent 38c76e824d
commit e1138be861
2 changed files with 3 additions and 5 deletions

View File

@ -55,12 +55,12 @@ public fun SolidGroup.markLayers(thresholds: List<Int> = listOf(500, 1000, 20000
val counterTree = VisionCounterTree(Name.EMPTY, this, hashMapOf())
val totalCount = counterTree.childrenCount
if (totalCount > thresholds.firstOrNull() ?: 0) {
val allNodes = counterTree.topToBottom().filter { it.selfCount > 1 }.distinct().toMutableList()
val allNodes = counterTree.topToBottom().distinct().toMutableList()
//println("tree construction finished")
allNodes.sortWith(
compareBy<VisionCounterTree>(
{ it.name.length },
{ it.childrenCount * it.selfCount }
{ (it.children.size + 1) * it.selfCount }
).reversed()
)
@ -76,7 +76,7 @@ public fun SolidGroup.markLayers(thresholds: List<Int> = listOf(500, 1000, 20000
if (layerIndex == 0) break
node.vision.layer = layerIndex
remaining -= node.selfCount * node.childrenCount
remaining -= node.selfCount * (node.children.size + 1)
logger?.apply {
if (node.selfCount > 1) {
info { "Prototype with name ${node.name} moved to layer $layerIndex. $remaining nodes remains" }

View File

@ -37,8 +37,6 @@ public interface Solid : Vision {
override val descriptor: NodeDescriptor get() = Companion.descriptor
public companion object {
// val SELECTED_KEY = "selected".asName()
public val DETAIL_KEY: Name = "detail".asName()