Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1c035e05

Přidáno uživatelem Tomáš Šimandl před více než 6 roky(ů)

Removed positions array and added vertex.position and group.positioin item

Zobrazit rozdíly:

sources/src/main/java/cz/zcu/kiv/offscreen/api/GraphExport.java
22 22
    private Map<String, List<String>> possibleEnumValues;
23 23

  
24 24
    private List<Group> groups;
25
    private List<Position> positions;
26 25
    private List<SideBar> sideBar;
27 26
    private int selectedVertex;
28 27
    private int selectedEdge;
......
38 37
        this.attributeTypes = new ArrayList<>(graph.getAttributeTypes());
39 38
        this.possibleEnumValues = graph.getPossibleEnumValues();
40 39
        this.groups = graph.getGraphState().getGroups();
41
        this.positions = graph.getGraphState().getPositions();
42 40
        this.sideBar = graph.getGraphState().getSideBar();
43 41
        this.selectedVertex = graph.getGraphState().getSelectedVertex();
44 42
        this.selectedEdge = graph.getGraphState().getSelectedEdge();
......
77 75
        return groups;
78 76
    }
79 77

  
80
    public List<Position> getPositions() {
81
        return positions;
82
    }
83

  
84 78
    public List<SideBar> getSideBar() {
85 79
        return sideBar;
86 80
    }
sources/src/main/java/cz/zcu/kiv/offscreen/api/Group.java
20 20
    private List<Integer> verticesEdgeFromId;
21 21
    /** List of vertices id whose incoming edges are visible. */
22 22
    private List<Integer> verticesEdgeToId;
23
    /** Relative position in graph */
24
    private Position position;
23 25

  
24 26
    public Group(int groupId, int id, String name){
25 27
        this.groupId = groupId;
26 28
        this.id = id;
27 29
        this.name = name;
28
        verticesId = new ArrayList<>();
29
        verticesEdgeFromId = new ArrayList<>();
30
        verticesEdgeToId = new ArrayList<>();
30
        this.verticesId = new ArrayList<>();
31
        this.verticesEdgeFromId = new ArrayList<>();
32
        this.verticesEdgeToId = new ArrayList<>();
33
        this.position = null;
31 34
    }
32 35

  
33 36
    public Group(int groupId, int id, String name, List<Integer> verticesId, List<Integer> verticesEdgeFromId, List<Integer> verticesEdgeToId) {
......
37 40
        this.verticesId = verticesId;
38 41
        this.verticesEdgeFromId = verticesEdgeFromId;
39 42
        this.verticesEdgeToId = verticesEdgeToId;
43
        this.position = null;
40 44
    }
41 45

  
42 46
    public int getGroupId() {
......
98 102
    public void addVetexEdgeFromId(int vertexId){
99 103
        this.verticesEdgeFromId.add(vertexId);
100 104
    }
105

  
106
    public Position getPosition() {
107
        return position;
108
    }
109

  
110
    public void setPosition(Position position) {
111
        this.position = position;
112
    }
101 113
}
sources/src/main/java/cz/zcu/kiv/offscreen/api/Position.java
5 5
 */
6 6
public class Position {
7 7

  
8
    /** Identification number of vertex or group which was generated in application. */
9
    private int vertexId;
10 8
    /** Relative X position. */
11 9
    private float x;
12 10
    /** Relative Y position */
13 11
    private float y;
14 12

  
15
    public Position(int vertexId, float x, float y) {
16
        this.vertexId = vertexId;
13
    public Position(float x, float y) {
17 14
        this.x = x;
18 15
        this.y = y;
19 16
    }
20 17

  
21
    public int getVertexId() {
22
        return vertexId;
23
    }
24

  
25
    public void setVertexId(int vertexId) {
26
        this.vertexId = vertexId;
27
    }
28

  
29 18
    public float getX() {
30 19
        return x;
31 20
    }
sources/src/main/java/cz/zcu/kiv/offscreen/api/Vertex.java
9 9

  
10 10
    /** List of all tributes. Every attribute is stored in String array in pair as {attribute name, attribute value}. */
11 11
    private List<String[]> attributes;
12
    /** Relative position in graph */
13
    private Position position;
12 14

  
13 15
    /**
14 16
     * Create new vertex.
......
22 24
    public Vertex(int id, int originalId, String name, int archetypeIndex, String text, List<String[]> attributes) {
23 25
        super(id, originalId, name, archetypeIndex, text);
24 26
        this.attributes = attributes;
27
        this.position = null;
25 28
    }
26 29

  
27 30
    public List<String[]> getAttributes() {
......
31 34
    public void setAttributes(List<String[]> attributes) {
32 35
        this.attributes = attributes;
33 36
    }
37

  
38
    public Position getPosition() {
39
        return position;
40
    }
41

  
42
    public void setPosition(Position position) {
43
        this.position = position;
44
    }
34 45
}
sources/src/main/java/cz/zcu/kiv/offscreen/graph/GraphState.java
1 1
package cz.zcu.kiv.offscreen.graph;
2 2

  
3 3
import cz.zcu.kiv.offscreen.api.Group;
4
import cz.zcu.kiv.offscreen.api.Position;
5 4
import cz.zcu.kiv.offscreen.api.SideBar;
6 5

  
7 6
import java.util.ArrayList;
......
11 10
public class GraphState {
12 11

  
13 12
    private List<Group> groups = new ArrayList<>();
14
    private List<Position> positions = new ArrayList<>();
15 13
    private List<SideBar> sideBar = new ArrayList<>();
16 14
    private int selectedVertex;
17 15
    private int selectedEdge;
......
21 19
        return groups;
22 20
    }
23 21

  
24
    public List<Position> getPositions() {
25
        return positions;
26
    }
27

  
28 22
    public List<SideBar> getSideBar() {
29 23
        return sideBar;
30 24
    }
......
41 35
        this.groups.add(group);
42 36
    }
43 37

  
44
    public void addPosition(Position position){
45
        this.positions.add(position);
46
    }
47

  
48 38
    public void addSideBar(SideBar sideBar){
49 39
        this.sideBar.add(sideBar);
50 40
    }
......
53 43
        this.groups.addAll(collection);
54 44
    }
55 45

  
56
    public void addPositionsAll(Collection<Position> collection){
57
        this.positions.addAll(collection);
58
    }
59

  
60 46
    public void addSideBarsAll(Collection<SideBar> collection){
61 47
        this.sideBar.addAll(collection);
62 48
    }

Také k dispozici: Unified diff