Exemplo n.º 1
0
  private void polishAnnotation(V object, Annotation annotation) {
    if (textAttributeSpec.isCenterX() != null) annotation.setCenterX(textAttributeSpec.isCenterX());
    if (textAttributeSpec.isCenterY() != null) annotation.setCenterY(textAttributeSpec.isCenterY());

    if (textAttributeSpec.getColor() != null)
      annotation.setColor(
          EncPainterUtils.convertColorSpecToFloatArray(textAttributeSpec.getColor()));

    if (textAttributeSpec.getFont() != null) {
      AnnotationFont font = AnnotationFont.valueOf(textAttributeSpec.getFont().value());
      annotation.setFont(font.getFont());
    }
  }
Exemplo n.º 2
0
  @Override
  public void paintEnc(GeoContext geoContext, V object) {
    if (object.getGeoShapes().isEmpty()) return;

    GeoAttribute attributeValue = object.getGeoAttribute(getAttributeTypeToAnnotate());
    if (attributeValue == null) {
      return;
    }
    String attributeValueText = attributeValue.getAttributeValueAsString();
    if (attributeValueText == null) {
      return;
    }

    AnnotationPainter annotationPainter = geoContext.getAnnotationPainter();
    double[] centerXY = findCenterPoint(geoContext.getProjection(), object);
    Annotation annotation =
        new Annotation(attributeValueText, (float) centerXY[0], (float) centerXY[1], true, true);
    polishAnnotation(object, annotation);

    assert (annotation.getText() != null) : "null text";
    annotationPainter.addAnnotation(annotation);
  }