Ejemplo n.º 1
0
  /**
   * Initializes this object from the given properties
   *
   * @param props the <code>Properties</code> holding settings for this object
   */
  public void setProperties(String prefix, Properties props) {
    if (Debug.debugging("areas")) {
      Debug.output("AreaHandler: setting properties");
    }

    setPropertyPrefix(prefix);
    originalProperties = props;

    // These will get initialized when someone asks for it.
    // Otherwise, it delays the startup of the map.
    politicalAreas = null;

    String realPrefix = PropUtils.getScopedPropertyPrefix(prefix);

    String transClassName = props.getProperty(realPrefix + ShapeLayer.TransformProperty);
    if (transClassName != null) {
      try {
        coordTransform =
            (GeoCoordTransformation)
                ComponentFactory.create(
                    transClassName, realPrefix + ShapeLayer.TransformProperty, props);
      } catch (ClassCastException cce) {

      }
    }
  }
Ejemplo n.º 2
0
  /**
   * The method needs more information from the properties than the CodePosition version of this
   * method provides, like getting the base symbol code for the scheme and the hierarchy addition.
   */
  public CodePosition addPositionChoice(int index, String entry, String prefix, Properties props) {

    CodeScheme cs = (CodeScheme) super.addPositionChoice(index, entry, prefix, props);
    prefix = PropUtils.getScopedPropertyPrefix(prefix) + entry + ".";

    String next = props.getProperty(prefix + NextProperty);

    if (next != null) {
      String nextClassName = props.getProperty(next + ".class");
      if (nextClassName != null) {
        CodePosition cp = (CodePosition) ComponentFactory.create(nextClassName);
        if (DEBUG) {
          Debug.output("CodeScheme created next class(" + next + "), " + nextClassName);
        }
        if (cp != null) {
          cs.nextPosition = cp;
          cp.parsePositions(next, props);
        }
      } else {
        if (DEBUG) {
          Debug.output("CodeScheme couldn't create next class(" + next + "), " + nextClassName);
        }
      }
    }

    cs.defaultSymbolCode = props.getProperty(prefix + DefaultSymbolCodeProperty);
    cs.hierarchyAddition = props.getProperty(prefix + HierarchyCodeAdditionProperty, "");
    // Don't need to add to choices, already done in super class
    // method.
    return cs;
  }