Search in sources :

Example 16 with ConstellationColor

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;
}
Also used : ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor)

Example 17 with ConstellationColor

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;
}
Also used : ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor)

Example 18 with ConstellationColor

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);
}
Also used : ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) NodeGlyphStream(au.gov.asd.tac.constellation.visual.opengl.utilities.glyphs.NodeGlyphStream) GL3(com.jogamp.opengl.GL3) TextureUnits(au.gov.asd.tac.constellation.visual.opengl.renderer.TextureUnits) SharedDrawable(au.gov.asd.tac.constellation.visual.opengl.utilities.SharedDrawable) FloatBuffer(java.nio.FloatBuffer) ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) LabelUtilities(au.gov.asd.tac.constellation.visual.opengl.utilities.LabelUtilities) IOException(java.io.IOException) ArrayList(java.util.ArrayList) GLRenderableUpdateTask(au.gov.asd.tac.constellation.visual.opengl.renderer.GLRenderable.GLRenderableUpdateTask) VisualAccess(au.gov.asd.tac.constellation.utilities.visual.VisualAccess) IntBuffer(java.nio.IntBuffer) Camera(au.gov.asd.tac.constellation.utilities.camera.Camera) NodeGlyphStreamContext(au.gov.asd.tac.constellation.visual.opengl.utilities.glyphs.NodeGlyphStreamContext) Matrix44f(au.gov.asd.tac.constellation.utilities.graphics.Matrix44f) GL(com.jogamp.opengl.GL) Collections(java.util.Collections)

Example 19 with ConstellationColor

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;
}
Also used : ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) ListView(javafx.scene.control.ListView) ComboBox(javafx.scene.control.ComboBox) ListCell(javafx.scene.control.ListCell) Rectangle(javafx.scene.shape.Rectangle)

Example 20 with ConstellationColor

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);
}
Also used : ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) Color(java.awt.Color) ConstellationColor(au.gov.asd.tac.constellation.utilities.color.ConstellationColor) Date(java.util.Date)

Aggregations

ConstellationColor (au.gov.asd.tac.constellation.utilities.color.ConstellationColor)67 ArrayList (java.util.ArrayList)13 Test (org.testng.annotations.Test)11 Color (java.awt.Color)9 BitSet (java.util.BitSet)9 PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)8 IOException (java.io.IOException)7 Graph (au.gov.asd.tac.constellation.graph.Graph)6 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)6 PluginException (au.gov.asd.tac.constellation.plugins.PluginException)6 List (java.util.List)6 File (java.io.File)5 HashMap (java.util.HashMap)5 WritableGraph (au.gov.asd.tac.constellation.graph.WritableGraph)4 Plugin (au.gov.asd.tac.constellation.plugins.Plugin)4 Camera (au.gov.asd.tac.constellation.utilities.camera.Camera)4 Matrix44f (au.gov.asd.tac.constellation.utilities.graphics.Matrix44f)4 VisualAccess (au.gov.asd.tac.constellation.utilities.visual.VisualAccess)4 GLRenderableUpdateTask (au.gov.asd.tac.constellation.visual.opengl.renderer.GLRenderable.GLRenderableUpdateTask)4 TextureUnits (au.gov.asd.tac.constellation.visual.opengl.renderer.TextureUnits)4