示例#1
0
  // ------------------------------------------------------------------
  // the UserCanvas constructor
  UserCanvas(
      ForcesMaster f,
      int p,
      int m,
      int pM,
      String w,
      String an,
      String ac,
      String cS,
      ProblemCanvas v) {

    problemNo = p;
    maxTriesEachForce = m;
    problemMode = pM;
    cgiScript = cS;
    problemCanvas = v;
    forcesMaster = f;
    weightIn = w;
    angleIn = an;
    accelerationIn = ac;
    problemSelector = new ProblemSelector(problemNo, angleIn, weightIn, accelerationIn);
    problemCanvas.setProblemSelectorHandle(problemSelector);

    numForces = problemSelector.getNumForces();
    matchForceComps = problemSelector.getMatchForceComps();
    numEquations = problemSelector.getNumEquations();
    units = problemSelector.getUnits();
    scale = problemSelector.getScale();
    // if (!weightIn.equals("none")) {scale = 18 * scale /(double)(Integer.parseInt(weightIn));}
    forceTolerance = (int) Math.round(scale * userTolerance);
    resultsSpacingStrings = problemSelector.getResultsSpacingStrings();
    blinkerStrings = problemSelector.getBlinkerStrings();
    messageStrings = problemSelector.getMessageStrings();
    forceNames = problemSelector.getForceNames();
    truAnsX = problemSelector.getTruAnsX();
    truAnsY = problemSelector.getTruAnsY();
    tailPosX = problemSelector.getTailPosX();
    tailPosY = problemSelector.getTailPosY();
    cosSin = problemSelector.getCosSin();
    truHdsX = problemSelector.getTruHdsX();
    truHdsY = problemSelector.getTruHdsY();
    cost = cosSin[0];
    sint = cosSin[1];

    // initialize the force variables
    maxForceNumber = numForces - 1;
    mouseUpsString = "";
    for (int n = 0; n <= numForces; n++) {
      mouseUpsString += "0";
    }

    ifBrowserPaint = false;

    // initialize to the "see data" message
    ifDataMessage = true;
    forceNumber = -1;
    fInit = mUp = mDown = mDrag = false;
  }