コード例 #1
0
  public XMLEntity getXMLEntity() {
    XMLEntity xml = new XMLEntity();
    xml.putProperty("className", getClassName());
    xml.putProperty("labelingStrategy", "labelingStrategy");

    try {
      if (getHeightField() != null) {
        xml.putProperty("HeightField", getHeightField());
      }
    } catch (DataException e) {
      Logger.getAnonymousLogger()
          .log(Level.SEVERE, "Acessing TextHeight field.\n" + e.getMessage());
    }

    try {
      if (getColorField() != null) {
        xml.putProperty("ColorField", getColorField());
      }
    } catch (DataException e) {
      Logger.getAnonymousLogger()
          .log(Level.SEVERE, "Acessing ColorField field.\n" + e.getMessage());
    }

    try {
      if (getTextField() != null) {
        xml.putProperty("TextField", getTextField());
      }
    } catch (DataException e) {
      Logger.getAnonymousLogger().log(Level.SEVERE, "Acessing TextField field.\n" + e.getMessage());
    }

    try {
      if (getRotationField() != null) {
        xml.putProperty("RotationField", getRotationField());
      }
    } catch (DataException e) {
      Logger.getAnonymousLogger()
          .log(Level.SEVERE, "Acessing RotationField field.\n" + e.getMessage());
    }

    if (getFont() != null) {
      xml.putProperty("fontSize", getFont().getSize());
      xml.putProperty("fontName", getFont().getName());
      xml.putProperty("fontStyle", getFont().getStyle());
    }
    if (getColorFont() != null) {
      xml.putProperty("Color", StringUtilities.color2String(getColorFont()));
    }
    xml.putProperty("useFixedSize", useFixedSize);
    xml.putProperty("useFixedColor", useFixedColor);
    xml.putProperty("fixedColor", StringUtilities.color2String(fixedColor));
    xml.putProperty("fixedSize", fixedSize);
    xml.putProperty("Unit", unit);
    xml.putProperty("referenceSystem", referenceSystem);
    return xml;
  }
コード例 #2
0
  public void setXMLEntity(XMLEntity xml) {
    if (xml.contains("TextField")) {
      setTextField(xml.getStringProperty("TextField"));
    }

    if (xml.contains("HeightField")) {
      setHeightField(xml.getStringProperty("HeightField"));
    }

    if (xml.contains("ColorField")) {
      setColorField(xml.getStringProperty("ColorField"));
    }

    if (xml.contains("RotationField")) {
      setRotationField(xml.getStringProperty("RotationField"));
    }

    if (xml.contains("Unit")) {
      setUnit(xml.getIntProperty("Unit"));
    }

    if (xml.contains("fontName")) {
      Font font =
          new Font(
              xml.getStringProperty("fontName"),
              xml.getIntProperty("fontStyle"),
              xml.getIntProperty("fontSize"));
      setFont(font);
    }
    if (xml.contains("useFixedSize")) {
      useFixedSize = xml.getBooleanProperty("useFixedSize");
      fixedSize = xml.getDoubleProperty("fixedSize");
    }
    if (xml.contains("useFixedColor")) {
      useFixedColor = xml.getBooleanProperty("useFixedColor");
      fixedColor = StringUtilities.string2Color(xml.getStringProperty("fixedColor"));
    }
    if (xml.contains("referenceSystem")) {
      referenceSystem = xml.getIntProperty("referenceSystem");
    }
  }
コード例 #3
0
  public XMLEntity getXMLEntity() {
    XMLEntity xml = new XMLEntity();
    xml.putProperty("className", getClassName());
    xml.putProperty("isShapeVisible", isShapeVisible());
    // color (necessite)
    if (getFillColor() != null)
      xml.putProperty("color", StringUtilities.color2String(getFillColor()));
    xml.putProperty("desc", getDescription());
    xml.putProperty("referenceSystem", getReferenceSystem());
    xml.putProperty("unit", getUnit());
    xml.addChild(markerSymbol.getXMLEntity());
    xml.addChild(markerFillProperties.getXMLEntity());

    if (getOutline() != null) {
      XMLEntity outlineXML = getOutline().getXMLEntity();
      outlineXML.putProperty("id", "outline symbol");
      xml.addChild(outlineXML);
    }
    xml.putProperty("hasOutline", hasOutline());
    return xml;
  }