Ejemplo n.º 1
0
 /** Standard constructor */
 public MapCoordinates() {
   xCenter = 0.0;
   yCenter = 0.0;
   xMagnitude = 1.0;
   yMagnitude = 1.0;
   orientation = 0;
   xGridStep = 5;
   yGridStep = 5;
   isMacro = false;
   snapActive = true;
   resetMinMax();
   stack = new Stack<MapCoordinates>();
 }
Ejemplo n.º 2
0
  /**
   * Draw the macro contents.
   *
   * @param g the graphic context.
   * @param coordSys the coordinate system.
   * @param layerV the vector containing all layers.
   */
  private void drawMacroContents(GraphicsInterface g, MapCoordinates coordSys, Vector layerV) {
    /* in the macro primitive, the the virtual point represents
    the position of the reference point of the macro to be drawn. */
    if (changed) {
      changed = false;
      x1 = virtualPoint[0].x;
      y1 = virtualPoint[0].y;

      macroCoord.setXMagnitude(coordSys.getXMagnitude());
      macroCoord.setYMagnitude(coordSys.getYMagnitude());

      macroCoord.setXCenter(coordSys.mapXr(x1, y1));
      macroCoord.setYCenter(coordSys.mapYr(x1, y1));
      macroCoord.setOrientation((o + coordSys.getOrientation()) % 4);
      macroCoord.mirror = m ^ coordSys.mirror;
      macroCoord.isMacro = true;
      macroCoord.resetMinMax();

      macro.setChanged(true);
    }

    if (getSelected()) {
      new SelectionActions(macro).setSelectionAll(true);
      selected = true;
    } else if (selected) {
      new SelectionActions(macro).setSelectionAll(false);
      selected = false;
    }

    macro.setDrawOnlyLayer(drawOnlyLayer);
    macro.setDrawOnlyPads(drawOnlyPads);

    drawingAgent = new Drawing(macro);
    drawingAgent.draw(g, macroCoord);

    if (macroCoord.getXMax() > macroCoord.getXMin()
        && macroCoord.getYMax() > macroCoord.getYMin()) {
      coordSys.trackPoint(macroCoord.getXMax(), macroCoord.getYMax());
      coordSys.trackPoint(macroCoord.getXMin(), macroCoord.getYMin());
    }
  }