layer marking
This commit is contained in:
parent
38c76e824d
commit
e1138be861
@ -55,12 +55,12 @@ public fun SolidGroup.markLayers(thresholds: List<Int> = listOf(500, 1000, 20000
|
|||||||
val counterTree = VisionCounterTree(Name.EMPTY, this, hashMapOf())
|
val counterTree = VisionCounterTree(Name.EMPTY, this, hashMapOf())
|
||||||
val totalCount = counterTree.childrenCount
|
val totalCount = counterTree.childrenCount
|
||||||
if (totalCount > thresholds.firstOrNull() ?: 0) {
|
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")
|
//println("tree construction finished")
|
||||||
allNodes.sortWith(
|
allNodes.sortWith(
|
||||||
compareBy<VisionCounterTree>(
|
compareBy<VisionCounterTree>(
|
||||||
{ it.name.length },
|
{ it.name.length },
|
||||||
{ it.childrenCount * it.selfCount }
|
{ (it.children.size + 1) * it.selfCount }
|
||||||
).reversed()
|
).reversed()
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ public fun SolidGroup.markLayers(thresholds: List<Int> = listOf(500, 1000, 20000
|
|||||||
if (layerIndex == 0) break
|
if (layerIndex == 0) break
|
||||||
|
|
||||||
node.vision.layer = layerIndex
|
node.vision.layer = layerIndex
|
||||||
remaining -= node.selfCount * node.childrenCount
|
remaining -= node.selfCount * (node.children.size + 1)
|
||||||
logger?.apply {
|
logger?.apply {
|
||||||
if (node.selfCount > 1) {
|
if (node.selfCount > 1) {
|
||||||
info { "Prototype with name ${node.name} moved to layer $layerIndex. $remaining nodes remains" }
|
info { "Prototype with name ${node.name} moved to layer $layerIndex. $remaining nodes remains" }
|
||||||
|
@ -37,8 +37,6 @@ public interface Solid : Vision {
|
|||||||
|
|
||||||
override val descriptor: NodeDescriptor get() = Companion.descriptor
|
override val descriptor: NodeDescriptor get() = Companion.descriptor
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public companion object {
|
public companion object {
|
||||||
// val SELECTED_KEY = "selected".asName()
|
// val SELECTED_KEY = "selected".asName()
|
||||||
public val DETAIL_KEY: Name = "detail".asName()
|
public val DETAIL_KEY: Name = "detail".asName()
|
||||||
|
Loading…
Reference in New Issue
Block a user