Esempio n. 1
0
  /**
   * Method to access appearance of highlighted nodes in 3D
   *
   * @param initValue false if appearance has to be changed according to user value
   */
  public static void setHighlightedAppearanceValues(Object initValue) {
    Color userColor = new Color(User.getColor(User.ColorPrefType.HIGHLIGHT_3D));

    if (highlightApp == null)
      highlightApp = new J3DAppearance(TransparencyAttributes.BLENDED, 0.5f, userColor);
    else if (initValue == null) // redoing color only when it was changed in GUI
    highlightApp.set3DColor(null, userColor);
  }
Esempio n. 2
0
  /**
   * Method to access appearance for cells in 3D
   *
   * @param initValue no null if appearance has to be changed according to user value. Using this
   *     mechanism to avoid the creation of new Boolean() just for the checking
   */
  public static void setCellAppearanceValues(Object initValue) {
    Color3f userColor = new Color3f(new Color(User.getColor(User.ColorPrefType.INSTANCE_3D)));

    if (cellApp == null) {
      cellApp = new J3DAppearance(TransparencyAttributes.SCREEN_DOOR, 0, null);

      RenderingAttributes ra = new RenderingAttributes();
      ra.setCapability(RenderingAttributes.ALLOW_VISIBLE_READ);
      ra.setCapability(RenderingAttributes.ALLOW_VISIBLE_WRITE);
      ra.setVisible(J3DUtils.is3DCellBndOn());
      cellApp.setRenderingAttributes(ra);

      // Set up the polygon attributes
      PolygonAttributes pa = new PolygonAttributes();
      pa.setCullFace(PolygonAttributes.CULL_NONE);
      pa.setPolygonMode(PolygonAttributes.POLYGON_LINE);
      cellApp.setPolygonAttributes(pa);

      //            TextureAttributes texAttr = new TextureAttributes();
      //            texAttr.setTextureMode(TextureAttributes.MODULATE);
      //            //texAttr.setTextureColorTable(pattern);
      //            cellApp.setTextureAttributes(texAttr);

      LineAttributes lineAttr = new LineAttributes();
      lineAttr.setLineAntialiasingEnable(true);
      cellApp.setLineAttributes(lineAttr);

      // ** Data for cells
      ColoringAttributes ca = new ColoringAttributes();
      ca.setCapability(ColoringAttributes.ALLOW_COLOR_WRITE);
      ca.setCapability(ColoringAttributes.ALLOW_COLOR_READ);
      ca.setColor(userColor);
      cellApp.setColoringAttributes(ca);
      cellApp.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ);
      cellApp.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);
    } else if (initValue == null) // redoing color only when it was changed in GUI
    {
      ColoringAttributes ca = cellApp.getColoringAttributes();
      Color3f curColor = new Color3f();
      ca.getColor(curColor);
      if (!userColor.equals(curColor)) ca.setColor(userColor);
    }
  }
Esempio n. 3
0
 /**
  * Set visibility of appearance assigned to cell bounding box
  *
  * @param value
  */
 public static void setCellVisibility(boolean value) {
   assert (cellApp != null);
   cellApp.getRenderingAttributes().setVisible(value);
 }