Ejemplo n.º 1
0
    @Override
    public void render(DrawContext dc) {
      if (dc.isPickingMode() && this.isResizeable()) return;

      // This is called twice: once during normal rendering, then again during ordered surface
      // rendering. During
      // normal renering we render both the interior and border shapes. During ordered surface
      // rendering, both
      // shapes are already added to the DrawContext and both will be individually processed.
      // Therefore we just
      // call our superclass behavior
      if (dc.isOrderedRenderingMode()) {
        super.render(dc);
        return;
      }

      if (!this.isResizeable()) {
        if (this.hasSelection()) {
          this.doRender(dc);
        }
        return;
      }

      PickedObjectList pos = dc.getPickedObjects();
      PickedObject terrainObject = pos != null ? pos.getTerrainObject() : null;

      if (terrainObject == null) return;

      if (this.getStartPosition() != null) {
        Position end = terrainObject.getPosition();
        if (!this.getStartPosition().equals(end)) {
          this.setEndPosition(end);
          this.setSector(Sector.boundingSector(this.getStartPosition(), this.getEndPosition()));
          this.doRender(dc);
        }
      } else {
        this.setStartPosition(pos.getTerrainObject().getPosition());
      }
    }
Ejemplo n.º 2
0
 protected void doRenderInterior(DrawContext dc) {
   super.render(dc);
 }