private Set<View<CyNode>> getLayoutNodes(CyLayoutAlgorithm layout, CyNetworkView networkView) {
   if (layout.getSupportsSelectedOnly() && selectedTunable.selectedNodesOnly) {
     Set<View<CyNode>> nodeViews = new HashSet<View<CyNode>>();
     CyNetwork network = networkView.getModel();
     for (View<CyNode> view : networkView.getNodeViews()) {
       if (network.getRow(view.getModel()).get(CyNetwork.SELECTED, Boolean.class)
           && view.getVisualProperty(BasicVisualLexicon.NODE_VISIBLE)) {
         nodeViews.add(view);
       }
     }
     return nodeViews;
   }
   return CyLayoutAlgorithm.ALL_NODE_VIEWS;
 }
Пример #2
0
  /**
   * Apply bypass
   *
   * @param netView
   * @param graphObjectView
   * @param vp
   */
  private final void applBypassValue(
      final CyNetworkView netView,
      final View<? extends CyIdentifiable> graphObjectView,
      VisualProperty<?> vp) {
    final ValueEditor<Object> editor =
        (ValueEditor<Object>) editorManager.getValueEditor(vp.getRange().getType());
    final Object bypassValue = editor.showEditor(null, graphObjectView.getVisualProperty(vp));

    // Set lock for the vp
    graphObjectView.setLockedValue(vp, bypassValue);

    // Apply the new value only for the given view
    // TODO don't do this, because it overwrites some bypassed values with default ones!!! Calling
    // setLockedValue should be enough
    //		final CyRow row = netView.getModel().getRow(graphObjectView.getModel());
    //		vmm.getCurrentVisualStyle().apply(row, graphObjectView);

    // Redraw the view
    netView.updateView();
  }
 NodeLocations(final View<CyNode> nodeView) {
   xLocation = nodeView.getVisualProperty(NODE_X_LOCATION);
   yLocation = nodeView.getVisualProperty(NODE_Y_LOCATION);
   zLocation = nodeView.getVisualProperty(NODE_Z_LOCATION);
 }
  private void checkView(final CyNetworkView view) {
    assertEquals(Color.BLACK, view.getVisualProperty(NETWORK_BACKGROUND_PAINT));
    assertEquals(new Double(639.0d), view.getVisualProperty(NETWORK_WIDTH));
    assertEquals(new Double(624.0d), view.getVisualProperty(NETWORK_HEIGHT));
    assertEquals(
        new Double(3091.2991395970175d), view.getVisualProperty(NETWORK_CENTER_X_LOCATION));
    assertEquals(new Double(3610.396738076269d), view.getVisualProperty(NETWORK_CENTER_Y_LOCATION));
    assertEquals(new Double(0.05044042295795177d), view.getVisualProperty(NETWORK_SCALE_FACTOR));

    // All nodes have the same size, border and shape
    final View<CyNode> nv = view.getNodeView(view.getModel().getNodeList().iterator().next());
    assertEquals(80, nv.getVisualProperty(NODE_WIDTH).intValue());
    assertEquals(30, nv.getVisualProperty(NODE_HEIGHT).intValue());
    assertEquals(NodeShapeVisualProperty.ROUND_RECTANGLE, nv.getVisualProperty(NODE_SHAPE));
    assertEquals(180, nv.getVisualProperty(NODE_TRANSPARENCY).intValue());
    assertEquals(2, nv.getVisualProperty(NODE_BORDER_WIDTH).intValue());
    assertEquals(LineTypeVisualProperty.SOLID, nv.getVisualProperty(NODE_BORDER_LINE_TYPE));
    assertEquals(new Color(153, 153, 255), nv.getVisualProperty(NODE_BORDER_PAINT));
    assertEquals(255, nv.getVisualProperty(NODE_BORDER_TRANSPARENCY).intValue());
    assertEquals(new Color(255, 255, 255), nv.getVisualProperty(NODE_LABEL_COLOR));
    assertEquals(255, nv.getVisualProperty(NODE_LABEL_TRANSPARENCY).intValue());

    // All edges have the same width and other properties
    final View<CyEdge> ev = view.getEdgeView(view.getModel().getEdgeList().iterator().next());
    assertEquals(new Double(1.0), ev.getVisualProperty(EDGE_WIDTH));
    assertEquals(255, ev.getVisualProperty(EDGE_TRANSPARENCY).intValue());
    assertEquals(ArrowShapeVisualProperty.NONE, ev.getVisualProperty(EDGE_SOURCE_ARROW_SHAPE));
    assertEquals(ArrowShapeVisualProperty.NONE, ev.getVisualProperty(EDGE_TARGET_ARROW_SHAPE));
  }