Beispiel #1
0
 private void removeAttribute() {
   List<MiniPlotWidget> mpwList = getGroupActiveList();
   for (MiniPlotWidget mpw : mpwList) {
     WebPlotView pv = mpw.getPlotView();
     pv.removeAttribute(WebPlot.ACTIVE_DISTANCE);
     WebEvent ev = new WebEvent<WebPlotView>(this, Name.LINE_SELECTION, pv);
     pv.fireEvent(ev);
   }
 }
Beispiel #2
0
 private void setAttribute(LineSelection o) {
   List<MiniPlotWidget> mpwList = getGroupActiveList();
   WebPlotView pv;
   for (MiniPlotWidget mpw : mpwList) {
     pv = mpw.getPlotView();
     pv.setAttribute(WebPlot.ACTIVE_DISTANCE, o);
     WebEvent<Boolean> ev = new WebEvent<Boolean>(this, Name.LINE_SELECTION, true);
     pv.fireEvent(ev);
   }
 }
Beispiel #3
0
 private void drag(WebPlotView pv, ScreenPt spt) {
   WebPlot plot = pv.getPrimaryPlot();
   _mouseInfo.setEnableAllPersistent(true);
   _mouseInfo.setEnableAllExclusive(false);
   _currentPt = plot.getImageWorkSpaceCoords(spt);
   _dataConnect.setData(makeSelectedObj(plot));
   _drawMan.redraw();
 }
Beispiel #4
0
  private void begin(WebPlotView pv, ScreenPt spt) {
    WebPlot plot = pv.getPrimaryPlot();
    pv.fixScrollPosition();
    _mouseInfo.setEnableAllPersistent(true);
    _mouseInfo.setEnableAllExclusive(false);

    switch (_mode) {
      case SELECT:
        _firstPt = plot.getImageWorkSpaceCoords(spt);
        _currentPt = _firstPt;
        break;
      case EDIT:
        LineSelection sel = (LineSelection) pv.getAttribute(WebPlot.ACTIVE_DISTANCE);
        if (sel == null) {
          WebAssert.tst(false, "no RecSelection found in plot");
        }

        ImageWorkSpacePt ptAry[] = new ImageWorkSpacePt[] {sel.getPt1(), sel.getPt2()};

        int idx = findClosestPtIdx(plot, ptAry, spt);
        if (idx < 0) return;
        ScreenPt testPt = plot.getScreenCoords(ptAry[idx]);
        double dist = distance(testPt, spt);
        if (dist < EDIT_DISTANCE && dist > -1) {
          int oppoIdx = idx == 0 ? 1 : 0;
          _firstPt = ptAry[oppoIdx];
          _currentPt = ptAry[idx];
        } else {
          _firstPt = plot.getImageWorkSpaceCoords(spt);
          _currentPt = _firstPt;
        }

        break;
      case OFF:
        releaseMouse();
        break;
      default:
        WebAssert.argTst(false, "only support for SelectType of SELECT EDIT, OFF");
        break;
    }
  }