use of au.gov.asd.tac.constellation.utilities.color.ConstellationColor in project constellation by constellation-app.
the class LineBatcher method bufferColorInfo.
private int bufferColorInfo(final int pos, final FloatBuffer colorBuffer, final VisualAccess access) {
if (connectionPosToBufferPos.containsKey(pos)) {
final ConstellationColor color = access.getConnectionColor(pos);
colorBuffer.put(color.getRed());
colorBuffer.put(color.getGreen());
colorBuffer.put(color.getBlue());
colorBuffer.put(access.getConnectionVisibility(pos));
colorBuffer.put(color.getRed());
colorBuffer.put(color.getGreen());
colorBuffer.put(color.getBlue());
colorBuffer.put(access.getConnectionVisibility(pos));
return connectionPosToBufferPos.get(pos);
}
return -1;
}
use of au.gov.asd.tac.constellation.utilities.color.ConstellationColor in project constellation by constellation-app.
the class LoopBatcher method bufferColorInfo.
private int bufferColorInfo(final int pos, final FloatBuffer colorBuffer, final VisualAccess access) {
if (loopPosToBufferPos.containsKey(pos)) {
final ConstellationColor color = access.getConnectionColor(pos);
colorBuffer.put(color.getRed());
colorBuffer.put(color.getGreen());
colorBuffer.put(color.getBlue());
colorBuffer.put(access.getConnectionVisibility(pos));
return loopPosToBufferPos.get(pos);
}
return -1;
}
use of au.gov.asd.tac.constellation.utilities.color.ConstellationColor in project constellation by constellation-app.
the class NodeLabelBatcher method setBottomLabelColors.
public GLRenderableUpdateTask setBottomLabelColors(final VisualAccess access) {
final int numBottomLabels = Math.min(LabelUtilities.MAX_LABELS_TO_DRAW, access.getBottomLabelCount());
for (int i = 0; i < numBottomLabels; i++) {
final ConstellationColor labelColor = access.getBottomLabelColor(i);
labelBottomInfoReference.setRow(labelColor.getRed(), labelColor.getGreen(), labelColor.getBlue(), labelBottomInfoReference.get(i, 3), i);
}
return gl -> labelBottomInfo.set(labelBottomInfoReference);
}
use of au.gov.asd.tac.constellation.utilities.color.ConstellationColor in project constellation by constellation-app.
the class ColorInputPane method makeNamedCombo.
private ComboBox<ConstellationColor> makeNamedCombo() {
final ObservableList<ConstellationColor> namedColors = FXCollections.observableArrayList();
for (final ConstellationColor c : ConstellationColor.NAMED_COLOR_LIST) {
namedColors.add(c);
}
final ComboBox<ConstellationColor> namedCombo = new ComboBox<>(namedColors);
namedCombo.setValue(ConstellationColor.WHITE);
final Callback<ListView<ConstellationColor>, ListCell<ConstellationColor>> cellFactory = (final ListView<ConstellationColor> p) -> new ListCell<ConstellationColor>() {
@Override
protected void updateItem(final ConstellationColor item, boolean empty) {
super.updateItem(item, empty);
if (item != null) {
final Rectangle r = new Rectangle(12, 12, item.getJavaFXColor());
r.setStroke(Color.BLACK);
setText(item.getName());
setGraphic(r);
}
}
};
namedCombo.setCellFactory(cellFactory);
namedCombo.setButtonCell(cellFactory.call(null));
return namedCombo;
}
use of au.gov.asd.tac.constellation.utilities.color.ConstellationColor in project constellation by constellation-app.
the class DnaGraphBuilderPlugin method edit.
@Override
public void edit(final GraphWriteMethods graph, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException, PluginException {
interaction.setProgress(0, 0, "Building...", true);
final float N = 1;
final float NPAIRS = 360 * N;
final float RADIUS_BIG = 100;
final float RADIUS_STRAND = 10;
final float RADIUS_SMALL = 0.5F;
final float maxColor = 255F;
final int vxNameAttr = VisualConcept.VertexAttribute.LABEL.ensure(graph);
final int vxIdentifierAttr = VisualConcept.VertexAttribute.IDENTIFIER.ensure(graph);
final int vxXAttr = VisualConcept.VertexAttribute.X.ensure(graph);
final int vxYAttr = VisualConcept.VertexAttribute.Y.ensure(graph);
final int vxZAttr = VisualConcept.VertexAttribute.Z.ensure(graph);
final int vxRadiusAttr = VisualConcept.VertexAttribute.NODE_RADIUS.ensure(graph);
final int vxColorAttr = VisualConcept.VertexAttribute.COLOR.ensure(graph);
final int vxBackgroundIconAttr = VisualConcept.VertexAttribute.BACKGROUND_ICON.ensure(graph);
final int txColorAttr = VisualConcept.TransactionAttribute.COLOR.ensure(graph);
final int txDateTimeAttr = TemporalConcept.TransactionAttribute.DATETIME.ensure(graph);
final ConstellationColor edgeColor = ConstellationColor.getColorValue(0, 0, 1, 1);
long dt = new Date().getTime();
for (int i = 0; i < NPAIRS; i++) {
final double theta = i / N;
final float ry = (float) (RADIUS_BIG * Math.sin(Math.toRadians(theta)));
final float rz = (float) (RADIUS_BIG * Math.cos(Math.toRadians(theta)));
final Color vc = new Color(Color.HSBtoRGB((float) i / NPAIRS, 0.5F, 1));
final int n0 = graph.addVertex();
graph.setStringValue(vxNameAttr, n0, String.valueOf(i * 2));
graph.setStringValue(vxIdentifierAttr, n0, String.valueOf(i * 2));
graph.setStringValue(vxBackgroundIconAttr, n0, "Background.Round Circle" + ((i % 2 == 0) ? "" : "_64"));
graph.setFloatValue(vxRadiusAttr, n0, RADIUS_SMALL);
graph.setObjectValue(vxColorAttr, n0, ConstellationColor.getColorValue(vc.getRed() / maxColor, vc.getGreen() / maxColor, vc.getBlue() / maxColor, 1F));
final float x0 = RADIUS_STRAND * (float) Math.sin(Math.toRadians(i * 4.0));
final float y0 = RADIUS_STRAND * (float) Math.cos(Math.toRadians(i * 4.0));
ConstructionUtilities.setxyz(graph, n0, vxXAttr, vxYAttr, vxZAttr, x0, ry + y0, rz);
final int n1 = graph.addVertex();
graph.setStringValue(vxNameAttr, n1, String.valueOf(i * 2 + 1));
graph.setStringValue(vxIdentifierAttr, n0, String.valueOf(i * 2 + 1));
graph.setStringValue(vxBackgroundIconAttr, n1, "Background.Round Circle" + ((i % 2 == 1) ? "" : "_64"));
graph.setFloatValue(vxRadiusAttr, n1, RADIUS_SMALL);
graph.setObjectValue(vxColorAttr, n1, ConstellationColor.getColorValue(1 - vc.getRed() / maxColor, 1 - vc.getGreen() / maxColor, 1 - vc.getBlue() / maxColor, 1F));
final float x1 = -x0;
final float y1 = -y0;
ConstructionUtilities.setxyz(graph, n1, vxXAttr, vxYAttr, vxZAttr, x1, ry + y1, rz);
final int tx = graph.addTransaction(n0, n1, false);
graph.setLongValue(txDateTimeAttr, tx, dt++);
graph.setObjectValue(txColorAttr, tx, edgeColor);
}
PluginExecution.withPlugin(InteractiveGraphPluginRegistry.RESET_VIEW).executeNow(graph);
interaction.setProgress(1, 0, "Completed successfully", true);
}
Aggregations