Example #1
0
  /**
   * Given a OMGeometry, it calls generate/regenerate on it, and then adds the GeneralPath shape
   * within it to the OMGeometryList shape object. Calls setShape() with the new current shape,
   * which is a synchronized method.
   *
   * @param geometry the geometry to append
   * @param p the current projection
   * @param forceProject flag to force re-generation
   * @deprecated use the new paradigm from the other updateShape
   */
  protected void updateShape(OMGeometry geometry, Projection p, boolean forceProject) {

    if (geometry.isVisible()) {
      if (forceProject) {
        geometry.generate(p);
      } else {
        geometry.regenerate(p);
      }

      setShape(appendShapeEdge(getShape(), geometry.getShape(), connectParts));
    }
  }
Example #2
0
  /**
   * Given an OMGeometry, check its visibility and if visible, generate it if required and add the
   * result to the provided current shape. Does not call setShape().
   *
   * @param currentShape the current shape
   * @param geometry the geometry to test
   * @param p the current projection
   * @param forceProject flag to force regeneration
   * @return the newly combined shape.
   */
  protected GeneralPath updateShape(
      GeneralPath currentShape, OMGeometry geometry, Projection p, boolean forceProject) {

    GeneralPath newShapePart = null;
    if (geometry != null && geometry.isVisible()) {
      if (forceProject) {
        geometry.generate(p);
      } else {
        geometry.regenerate(p);
      }

      newShapePart = geometry.getShape();
    }

    return appendShapeEdge(currentShape, newShapePart, connectParts);
  }
Example #3
0
  protected void renderGeometry(OMGeometry geometry, Graphics gr) {

    Shape shp = geometry.getShape();

    boolean isRenderable = !geometry.getNeedToRegenerate() && geometry.isVisible() && shp != null;

    if (isRenderable) {
      if (matted) {
        if (gr instanceof Graphics2D && stroke instanceof BasicStroke) {
          ((Graphics2D) gr).setStroke(new BasicStroke(((BasicStroke) stroke).getLineWidth() + 2f));
          setGraphicsColor(gr, mattingPaint);
          draw(gr, shp);
        }
      }

      setGraphicsForFill(gr);
      fill(gr, shp);
      setGraphicsForEdge(gr);
      draw(gr, shp);
    }
  }