Пример #1
0
  private void calculateAndWriteVertex(
      int sizeX, int sizeY, GraphicLayoutInfo graphicLayoutInfo, GraphVertex vertex) {

    Position position = graphicLayoutInfo.mapToOriginal(vertex.getPosition());

    // Determine color for vertex.
    Color color = vertex.getColor();
    if (options.getOption(OptionsEnum.depDegreeColor).getBool()) {
      float redValue = vertex.getDegreeOut() / graph.getMaxOutdegree();
      color = new Color(redValue, 1 - redValue, 0);
    }

    if (vertex.getShape() == Shape.FIXED_SIZE_BOX) {
      int radius = 2;
      writeVertex(vertex, (int) position.x, (int) position.y, (int) position.z, radius, color);

    } else if (vertex.getShape() == Shape.FILLER_RECT) {
      int width = Math.max(1, Math.round(sizeX / graphicLayoutInfo.getWidth()));
      int height = Math.max(1, Math.round(sizeY / graphicLayoutInfo.getHeight()));
      writeVertex(
          vertex, (int) position.x, (int) position.y, (int) position.z, width, height, color);

    } else {
      int radius = calculateVertexRadius(vertex.getDegree());
      writeVertex(vertex, (int) position.x, (int) position.y, (int) position.z, radius, color);
    }
  }