Пример #1
0
  /**
   * Paint the poly. This works if generate() has been successful.
   *
   * @param g java.awt.Graphics to paint the poly onto.
   */
  public void render(Graphics g) {
    super.render(g);

    if (!paintOnlyPoly) {
      renderPoints(g);
      renderLabels(g);
    }
  }
Пример #2
0
  /**
   * Draw the EditableOMPoly parts into the java.awt.Graphics object. The grab points are only
   * rendered if the poly machine state is PolySelectedState.POLY_SELECTED.
   *
   * @param graphics java.awt.Graphics.
   */
  public void render(java.awt.Graphics graphics) {
    Debug.message("eomg", "EditableOMPoly.render()");

    State state = getStateMachine().getState();

    if (poly != null && !(state instanceof PolyUndefinedState)) {
      poly.setVisible(true);
      poly.render(graphics);
      poly.setVisible(false);
    } else {
      Debug.message("eomg", "EditableOMPoly.render: null or undefined poly.");
      return;
    }

    // Render the points actually on the polygon
    if (state instanceof GraphicSelectedState
        || state instanceof PolyAddNodeState
        || state instanceof PolyDeleteNodeState) {
      for (GrabPoint gb : polyGrabPoints) {
        if (gb != null) {
          gb.setVisible(true);
          gb.render(graphics);
          gb.setVisible(false);
        }
      }
    }

    // In certain conditions, render the offset grab point.

    if (state instanceof GraphicSelectedState || state instanceof GraphicEditState /*
                                                                                        * ||
                                                                                        * state
                                                                                        * instanceof
                                                                                        * PolySetOffsetState
                                                                                        */) {
      if (gpo != null && poly.getRenderType() == OMGraphic.RENDERTYPE_OFFSET) {
        gpo.setVisible(true);
        gpo.render(graphics);
        gpo.setVisible(false);
      }
    }
  }