Beispiel #1
0
 /**
  * Sets the start frame for this model. Also sets the initial time to the video clip time at the
  * start frame.
  *
  * @param n the desired start frame
  */
 public void setStartFrame(int n) {
   VideoClip clip = trackerPanel.getPlayer().getVideoClip();
   n = Math.max(n, clip.getFirstFrameNumber()); // not less than first frame
   int end = clip.getLastFrameNumber();
   n = Math.min(n, end); // not greater than last frame
   n = Math.min(n, getEndFrame()); // not greater than endFrame
   if (n == startFrame) return;
   startFrame = n;
   refreshInitialTime();
   lastValidFrame = -1;
   refreshSteps();
   trackerPanel.repaint();
   firePropertyChange("model_start", null, getStartFrame()); // $NON-NLS-1$
 }
Beispiel #2
0
 /**
  * Gets the particle inspector.
  *
  * @return the inspector
  */
 public FunctionTool getInspector() {
   if (trackerPanel == null) return null;
   if (inspector == null) {
     inspector = trackerPanel.getModelBuilder();
     inspector.addPanel(getName(), functionPanel);
     inspector.addPropertyChangeListener(this);
     if (trackerPanel.getTFrame() != null) {
       trackerPanel.getTFrame().addPropertyChangeListener("tab", this); // $NON-NLS-1$
     }
     if (getInitEditor().getValues()[0] == 0) {
       refreshInitialTime();
       getInitEditor().getTable().clearSelection();
     }
   }
   return inspector;
 }
Beispiel #3
0
  /**
   * Responds to property change events.
   *
   * @param e the property change event
   */
  public void propertyChange(PropertyChangeEvent e) {
    super.propertyChange(e);
    if (trackerPanel == null) return;
    String name = e.getPropertyName();
    //		System.out.println(name);
    if (name.equals("function") && !loading) { // $NON-NLS-1$
      trackerPanel.changed = true;
    } else if (name.equals("tab") && inspector != null) { // $NON-NLS-1$
      if (trackerPanel != null
          && e.getNewValue() == trackerPanel
          && trackerPanel.isModelBuilderVisible) {
        inspector.setVisible(true);
      } else if (inspector.isVisible()) {
        inspector.setVisible(false);
        trackerPanel.isModelBuilderVisible = true;
      }

    } else if (name.equals("selectedtrack") // $NON-NLS-1$
        && e.getNewValue() == this
        && inspector != null
        && !inspector.getSelectedName().equals(getName())) {
      inspector.setSelectedPanel(getName());
    }
    if (name.equals("function") // $NON-NLS-1$
        || name.equals("starttime") // $NON-NLS-1$
        || name.equals("frameduration") // $NON-NLS-1$
        || name.equals("startframe") // $NON-NLS-1$
        || name.equals("stepsize")) { // $NON-NLS-1$
      lastValidFrame = -1;
    }
    if (name.equals("transform")) { // $NON-NLS-1$
      // workaround to prevent infinite loop
      ImageCoordSystem coords = trackerPanel.getCoords();
      if (!(coords instanceof ReferenceFrame
          && ((ReferenceFrame) coords).getOriginTrack() == this)) {
        lastValidFrame = -1;
      }
    }
    if (!refreshing && isModelsVisible()) {
      if (name.equals("function")) { // $NON-NLS-1$
        repaint();
      } else if (name.equals("adjusting")) { // $NON-NLS-1$
        refreshStepsLater = (Boolean) e.getNewValue();
        if (!refreshStepsLater) { // stopped adjusting, so refresh steps
          refreshSteps();
        }
      }
      if (name.equals("transform")) { // $NON-NLS-1$
        // workaround to prevent infinite loop
        ImageCoordSystem coords = trackerPanel.getCoords();
        if (!(coords instanceof ReferenceFrame
            && ((ReferenceFrame) coords).getOriginTrack() == this)) {
          refreshSteps();
        }
      } else if (name.equals("starttime") // $NON-NLS-1$
          || name.equals("frameduration") // $NON-NLS-1$
          || name.equals("startframe")) { // $NON-NLS-1$
        refreshInitialTime();
        refreshSteps();
      } else if (name.equals("stepsize")) { // $NON-NLS-1$
        refreshSteps();
      }
    }
  }