コード例 #1
0
  // Handle dragging of control points
  public void selected(SelectEvent event) {
    // Ignore select events if the tools is armed, or in a move/rotate action. In either case we
    // don't
    // want to change the currently selected or hightlighted control point.
    if (measureTool == null || (this.isArmed() && this.isUseRubberBand()) || this.isMoving())
      return;

    if (dragger == null) dragger = new BasicDragger(measureTool.getWwd());

    // Have rollover events highlight the rolled-over object.
    if (event.getEventAction().equals(SelectEvent.ROLLOVER) && !dragger.isDragging()) {
      this.highlight(event.getTopObject());
      this.measureTool.getWwd().redraw();
    }

    this.doSelected(event);

    // We missed any roll-over events while dragging, so highlight any under the cursor now,
    // or de-highlight the dragged control point if it's no longer under the cursor.
    if (event.getEventAction().equals(SelectEvent.DRAG_END)) {
      PickedObjectList pol = this.measureTool.getWwd().getObjectsAtCurrentPosition();
      if (pol != null) {
        this.highlight(pol.getTopObject());
        this.measureTool.getWwd().redraw();
      }
    }
  }