예제 #1
0
  /**
   * Get the control parameters of the given primitive.
   *
   * @return a vector of ParameterDescription containing each control parameter. The first
   *     parameters should always be the virtual points.
   */
  public Vector<ParameterDescription> getControls() {
    Vector<ParameterDescription> v = new Vector<ParameterDescription>(10);
    ParameterDescription pd = new ParameterDescription();

    pd.parameter = name;
    pd.description = Globals.messages.getString("ctrl_name");
    pd.isExtension = true;
    v.add(pd);

    pd = new ParameterDescription();

    pd.parameter = value;
    pd.description = Globals.messages.getString("ctrl_value");
    pd.isExtension = true;

    v.add(pd);
    return v;
  }
예제 #2
0
  /**
   * Set the control parameters of the given primitive. This method is specular to getControls().
   *
   * @param v a vector of ParameterDescription containing each control parameter. The first
   *     parameters should always be the virtual points.
   * @return the next index in v to be scanned (if needed) after the execution of this function.
   */
  public int setControls(Vector<ParameterDescription> v) {
    int i = 0;
    ParameterDescription pd;

    changed = true;

    pd = (ParameterDescription) v.get(i);
    ++i;
    // Check, just for sure...
    if (pd.parameter instanceof String) name = ((String) pd.parameter);
    else System.out.println("Warning: unexpected parameter!" + pd);

    pd = (ParameterDescription) v.get(i);
    ++i;
    // Check, just for sure...
    if (pd.parameter instanceof String) value = ((String) pd.parameter);
    else System.out.println("Warning: unexpected parameter!" + pd);

    return i;
  }