Пример #1
0
  private boolean evaluatePaint() {

    final GraphicFill graphicFill = styleElement.getGraphicFill();

    if (graphicFill != null) {
      cachedGraphic = CachedGraphic.cache(graphicFill);

      if (cachedGraphic.isStaticVisible() == VisibilityState.UNVISIBLE) {
        // graphic is not visible even if some value are dynamic
        // this fill is not visible neither
        isStaticVisible = VisibilityState.UNVISIBLE;
        return false;
      } else if (cachedGraphic.isStaticVisible() == VisibilityState.DYNAMIC) {
        // graphic visibility is dynamic, so this fill too
        if (isStaticVisible != VisibilityState.UNVISIBLE) isStaticVisible = VisibilityState.DYNAMIC;
      } else {
        // this graphic is visible
        if (isStaticVisible == VisibilityState.NOT_DEFINED)
          isStaticVisible = VisibilityState.VISIBLE;
      }

      cachedGraphic.getRequieredAttributsName(requieredAttributs);

    } else {
      final Expression expColor = styleElement.getColor();

      if (GO2Utilities.isStatic(expColor)) {
        Color j2dColor = GO2Utilities.evaluate(expColor, null, Color.class, Color.BLACK);

        // we return false, opacity is 0 no need to cache or draw anything
        if (j2dColor.getAlpha() == 0) {
          isStaticVisible = VisibilityState.UNVISIBLE;
          return false;
        }

        // this style is visible even if something else is dynamic
        // evaluatePaint may change this value
        if (isStaticVisible == VisibilityState.NOT_DEFINED)
          isStaticVisible = VisibilityState.VISIBLE;

        // we cache the paint
        cachedPaint = j2dColor;
      } else {
        // this style visibility is dynamic
        if (isStaticVisible != VisibilityState.UNVISIBLE) isStaticVisible = VisibilityState.DYNAMIC;
        isStatic = false;
        GO2Utilities.getRequieredAttributsName(expColor, requieredAttributs);
      }
    }

    // TODO missing Graphic Stroke

    return true;
  }