Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 74fed7b3

Přidáno uživatelem Patrik Harag před téměř 6 roky(ů)

Add simple initial elimination (refs #7468)

Zobrazit rozdíly:

sources/imiger-core/src/main/webapp/js/services/graphLoader.js
198 198
		if (Utils.isDefined(highlightedNode)) {
199 199
			highlightedNode.highlightWithNeighbours(true);
200 200
		}
201

  
202
		let MAX_VISIBLE_COMPONENTS = 20;
203
		new InitialElimination(MAX_VISIBLE_COMPONENTS).run();
201 204
	}
202 205
}
203 206

  
sources/imiger-core/src/main/webapp/js/services/initialElimination.js
1
class InitialElimination {
2
    /**
3
     * @constructor
4
     */
5
    constructor(maxVisibleComponents) {
6
        this._maxVisibleComponents = maxVisibleComponents;
7
    }
8

  
9
    /**
10
     * Run initial elimination.
11
     */
12
    run() {
13
        let visibleVertices = app.viewportComponent.vertexList;
14
        let visibleGroups = app.viewportComponent.groupList;
15

  
16
        let visibleComponentsCount = visibleVertices.length + visibleGroups.length;
17

  
18
        if (visibleComponentsCount > this._maxVisibleComponents) {
19
            let numberOfVerticesToGroup = Math.min(
20
                    visibleVertices.length,
21
                    visibleComponentsCount - this._maxVisibleComponents);
22

  
23
            if (numberOfVerticesToGroup > 0) {
24
                // pack the first n vertices into a group
25
                let group = Group.create();
26
                visibleVertices.slice(0, numberOfVerticesToGroup).forEach(vertex => {
27
                    group.addVertex(vertex);
28
                });
29
                app.nodeList.push(group);
30
                app.groupList.push(group);
31
                app.viewportComponent.addNode(group);
32
            }
33
        }
34
    }
35
}
sources/imiger-core/src/main/webapp/showGraph.jsp
86 86
		<script src="js/services/filters/VertexArchetypeFilter.js"></script>
87 87
		<script src="js/services/filters/VertexAttributeFilter.js"></script>
88 88
		<script src="js/services/forceDirected.js"></script>
89
		<script src="js/services/initialElimination.js"></script>
89 90
		<script src="js/services/graphLoader.js"></script>
90 91
		<script src="js/services/graphExporter.js"></script>
91 92
		<script src="js/services/markSymbol.js"></script>

Také k dispozici: Unified diff