use of au.gov.asd.tac.constellation.graph.StoreGraph in project constellation by constellation-app.
the class BoundingBox2DNGTest method generateGraph.
@BeforeClass
public static void generateGraph() {
baseGraph = new StoreGraph();
int attrX = VisualConcept.VertexAttribute.X.ensure(baseGraph);
if (attrX == Graph.NOT_FOUND) {
fail();
}
int attrY = VisualConcept.VertexAttribute.Y.ensure(baseGraph);
if (attrY == Graph.NOT_FOUND) {
fail();
}
// Top left
int vxId1 = baseGraph.addVertex();
baseGraph.setFloatValue(attrX, vxId1, -1.0f);
baseGraph.setFloatValue(attrY, vxId1, 1.0f);
// Top right
int vxId2 = baseGraph.addVertex();
baseGraph.setFloatValue(attrX, vxId2, 1.0f);
baseGraph.setFloatValue(attrY, vxId2, 1.0f);
// Bottom right
int vxId3 = baseGraph.addVertex();
baseGraph.setFloatValue(attrX, vxId3, 1.0f);
baseGraph.setFloatValue(attrY, vxId3, -1.0f);
// Bottom left
int vxId4 = baseGraph.addVertex();
baseGraph.setFloatValue(attrX, vxId4, -1.0f);
baseGraph.setFloatValue(attrY, vxId4, -1.0f);
}
use of au.gov.asd.tac.constellation.graph.StoreGraph in project constellation by constellation-app.
the class BoundingBox2DTest method generateGraph.
@BeforeClass
public static void generateGraph() {
baseGraph = new StoreGraph();
int attrX = VisualConcept.VertexAttribute.X.ensure(baseGraph);
if (attrX == Graph.NOT_FOUND) {
fail();
}
int attrY = VisualConcept.VertexAttribute.Y.ensure(baseGraph);
if (attrY == Graph.NOT_FOUND) {
fail();
}
// Top left
int vxId1 = baseGraph.addVertex();
baseGraph.setFloatValue(attrX, vxId1, -1.0f);
baseGraph.setFloatValue(attrY, vxId1, 1.0f);
// Top right
int vxId2 = baseGraph.addVertex();
baseGraph.setFloatValue(attrX, vxId2, 1.0f);
baseGraph.setFloatValue(attrY, vxId2, 1.0f);
// Bottom right
int vxId3 = baseGraph.addVertex();
baseGraph.setFloatValue(attrX, vxId3, 1.0f);
baseGraph.setFloatValue(attrY, vxId3, -1.0f);
// Bottom left
int vxId4 = baseGraph.addVertex();
baseGraph.setFloatValue(attrX, vxId4, -1.0f);
baseGraph.setFloatValue(attrY, vxId4, -1.0f);
}
use of au.gov.asd.tac.constellation.graph.StoreGraph in project constellation by constellation-app.
the class BoundingBox2DTest method testConstructorThrowsException.
/**
* Test the constructor throws an exception when given an empty graph.
*/
@Test(expectedExceptions = IllegalArgumentException.class)
public void testConstructorThrowsException() {
StoreGraph emptyGraph = new StoreGraph();
VisualConcept.VertexAttribute.X.ensure(emptyGraph);
VisualConcept.VertexAttribute.Y.ensure(emptyGraph);
// This should fail as the graph has no verticies.
new BoundingBox2D(emptyGraph);
}
use of au.gov.asd.tac.constellation.graph.StoreGraph in project constellation by constellation-app.
the class BoundingBox3DNGTest method generateGraph.
@BeforeClass
public static void generateGraph() {
baseGraph = new StoreGraph();
int attrX = VisualConcept.VertexAttribute.X.ensure(baseGraph);
if (attrX == Graph.NOT_FOUND) {
fail();
}
int attrY = VisualConcept.VertexAttribute.Y.ensure(baseGraph);
if (attrY == Graph.NOT_FOUND) {
fail();
}
int attrZ = VisualConcept.VertexAttribute.Z.ensure(baseGraph);
if (attrZ == Graph.NOT_FOUND) {
fail();
}
// Top left front
int vxId1 = baseGraph.addVertex();
baseGraph.setFloatValue(attrX, vxId1, -1.0f);
baseGraph.setFloatValue(attrY, vxId1, 1.0f);
baseGraph.setFloatValue(attrZ, vxId1, 1.0f);
// Top right front
int vxId2 = baseGraph.addVertex();
baseGraph.setFloatValue(attrX, vxId2, 1.0f);
baseGraph.setFloatValue(attrY, vxId2, 1.0f);
baseGraph.setFloatValue(attrZ, vxId2, 1.0f);
// Bottom right front
int vxId3 = baseGraph.addVertex();
baseGraph.setFloatValue(attrX, vxId3, 1.0f);
baseGraph.setFloatValue(attrY, vxId3, -1.0f);
baseGraph.setFloatValue(attrZ, vxId3, 1.0f);
// Bottom left front
int vxId4 = baseGraph.addVertex();
baseGraph.setFloatValue(attrX, vxId4, -1.0f);
baseGraph.setFloatValue(attrY, vxId4, -1.0f);
baseGraph.setFloatValue(attrZ, vxId4, 1.0f);
// Top left back
int vxId5 = baseGraph.addVertex();
baseGraph.setFloatValue(attrX, vxId5, -1.0f);
baseGraph.setFloatValue(attrY, vxId5, 1.0f);
baseGraph.setFloatValue(attrZ, vxId5, -1.0f);
// Top right back
int vxId6 = baseGraph.addVertex();
baseGraph.setFloatValue(attrX, vxId6, 1.0f);
baseGraph.setFloatValue(attrY, vxId6, 1.0f);
baseGraph.setFloatValue(attrZ, vxId6, -1.0f);
// Bottom right back
int vxId7 = baseGraph.addVertex();
baseGraph.setFloatValue(attrX, vxId7, 1.0f);
baseGraph.setFloatValue(attrY, vxId7, -1.0f);
baseGraph.setFloatValue(attrZ, vxId7, -1.0f);
// Bottom left back
int vxId8 = baseGraph.addVertex();
baseGraph.setFloatValue(attrX, vxId8, -1.0f);
baseGraph.setFloatValue(attrY, vxId8, -1.0f);
baseGraph.setFloatValue(attrZ, vxId8, -1.0f);
}
use of au.gov.asd.tac.constellation.graph.StoreGraph in project constellation by constellation-app.
the class MergeNodesByPrefixNGTest method setUpMethod.
@BeforeMethod
public void setUpMethod() throws Exception {
// Create graph.
schema = SchemaFactoryUtilities.getSchemaFactory(AnalyticSchemaFactory.ANALYTIC_SCHEMA_ID).createSchema();
graph = new StoreGraph(schema);
// Add attributes.
vertexIdentifierAttribute = VisualConcept.VertexAttribute.IDENTIFIER.ensure(graph);
vertexSelectedAttribute = VisualConcept.VertexAttribute.SELECTED.ensure(graph);
// Add vertices.
vxId1 = graph.addVertex();
vxId2 = graph.addVertex();
vxId3 = graph.addVertex();
vxId4 = graph.addVertex();
vxId5 = graph.addVertex();
// Set vertice identifiers.
graph.setStringValue(vertexIdentifierAttribute, vxId1, "pre v1");
graph.setStringValue(vertexIdentifierAttribute, vxId2, "pre v2");
graph.setStringValue(vertexIdentifierAttribute, vxId3, "prefix v3");
graph.setStringValue(vertexIdentifierAttribute, vxId4, "fix v4");
graph.setStringValue(vertexIdentifierAttribute, vxId5, "fix v5");
// Set vertice selection.
graph.setBooleanValue(vertexSelectedAttribute, vxId1, true);
graph.setBooleanValue(vertexSelectedAttribute, vxId2, true);
graph.setBooleanValue(vertexSelectedAttribute, vxId3, false);
graph.setBooleanValue(vertexSelectedAttribute, vxId4, false);
graph.setBooleanValue(vertexSelectedAttribute, vxId5, false);
}
Aggregations