Search in sources :

Example 1 with LongHash

use of org.cytoscape.util.intr.LongHash in project cytoscape-impl by cytoscape.

the class DGraphView method getSelectedEdgeNodes.

/**
 * @return An LongEnumerator listing the nodes that are endpoints of the currently selected edges.
 */
private LongEnumerator getSelectedEdgeNodes() {
    synchronized (m_lock) {
        final LongEnumerator selectedEdges = m_selectedEdges.searchRange(Integer.MIN_VALUE, Integer.MAX_VALUE, false);
        final LongHash nodeIds = new LongHash();
        while (selectedEdges.numRemaining() > 0) {
            final long edge = selectedEdges.nextLong();
            CyEdge currEdge = model.getEdge(edge);
            CyNode source = currEdge.getSource();
            long sourceId = source.getSUID();
            nodeIds.put(sourceId);
            CyNode target = currEdge.getTarget();
            long targetId = target.getSUID();
            nodeIds.put(targetId);
        }
        return nodeIds.elements();
    }
}
Also used : LongEnumerator(org.cytoscape.util.intr.LongEnumerator) LongHash(org.cytoscape.util.intr.LongHash) CyNode(org.cytoscape.model.CyNode) CyEdge(org.cytoscape.model.CyEdge)

Example 2 with LongHash

use of org.cytoscape.util.intr.LongHash in project cytoscape-impl by cytoscape.

the class DGraphView method drawSnapshot.

/**
 * This method is called by the BirdsEyeView to get a snapshot of the graphics.
 */
// TODO: Need to fix up scaling and sizing.
public void drawSnapshot(VolatileImage img, GraphLOD lod, Paint bgPaint, double xMin, double yMin, double xCenter, double yCenter, double scaleFactor) {
    // First paint the background
    m_backgroundCanvas.drawCanvas(img, xMin, yMin, xCenter, yCenter, scaleFactor);
    // final VisualMappingManager vmm = serviceRegistrar.getService(VisualMappingManager.class);
    final Set<VisualPropertyDependency<?>> dependencies = vmm.getVisualStyle(this).getAllVisualPropertyDependencies();
    // synchronized (m_lock) {
    try {
        // System.out.println("Calling renderGraph to draw snapshot: bgPaint="+bgPaint);
        GraphRenderer.renderGraph(this, dummySpacialFactory.createSpacialIndex2D(), lod, m_nodeDetails, m_edgeDetails, new LongHash(), new GraphGraphics(img, false, false), bgPaint, xCenter, yCenter, scaleFactor, haveZOrder, dependencies);
    } catch (Exception e) {
        // We probably had a node or edge view removed out from underneath us.  Just quietly return, but
        // set content changed so we redraw again
        setContentChanged();
    }
    // }
    // Finally, draw the foreground
    m_foregroundCanvas.drawCanvas(img, xMin, yMin, xCenter, yCenter, scaleFactor);
}
Also used : LongHash(org.cytoscape.util.intr.LongHash) VisualPropertyDependency(org.cytoscape.view.vizmap.VisualPropertyDependency) GraphGraphics(org.cytoscape.graph.render.immed.GraphGraphics) IOException(java.io.IOException)

Example 3 with LongHash

use of org.cytoscape.util.intr.LongHash in project cytoscape-impl by cytoscape.

the class InnerCanvas method renderSubgraph.

// Render just a portion of the graph.  This is used for selections when we want to overwrite
// a limited number of nodes and edges
private void renderSubgraph(GraphGraphics graphics, final boolean setLastRenderDetail, final GraphLOD lod, List<CyNode> nodes, List<CyEdge> edges) {
    // Pass the color even though we won't use it if we actually only render the subgraph.  If we're
    // not in largeModel mode, or we're only painting a small portion of the network, we'll wind up
    // calling renderGraph anyways and we'll need to clear the image
    final Color backgroundColor = new Color(m_backgroundColor.getRed(), m_backgroundColor.getGreen(), m_backgroundColor.getBlue(), 0);
    synchronized (m_lock) {
        int lastRenderDetail = m_view.renderSubgraph(graphics, lod, backgroundColor, m_xCenter, m_yCenter, m_scaleFactor, new LongHash(), nodes, edges);
        if (setLastRenderDetail)
            m_lastRenderDetail = lastRenderDetail;
    }
    repaint();
}
Also used : LongHash(org.cytoscape.util.intr.LongHash) Color(java.awt.Color) Point(java.awt.Point)

Aggregations

LongHash (org.cytoscape.util.intr.LongHash)3 Color (java.awt.Color)1 Point (java.awt.Point)1 IOException (java.io.IOException)1 GraphGraphics (org.cytoscape.graph.render.immed.GraphGraphics)1 CyEdge (org.cytoscape.model.CyEdge)1 CyNode (org.cytoscape.model.CyNode)1 LongEnumerator (org.cytoscape.util.intr.LongEnumerator)1 VisualPropertyDependency (org.cytoscape.view.vizmap.VisualPropertyDependency)1