コード例 #1
1
 protected static boolean checkIdle(final Point p) throws NimbitsException {
   final Calendar c = Calendar.getInstance();
   c.add(Calendar.SECOND, p.getIdleSeconds() * -1);
   boolean retVal = false;
   final List<Entity> result =
       EntityServiceFactory.getInstance()
           .getEntityByKey(
               UserServiceFactory.getServerInstance().getAdmin(), p.getOwner(), EntityType.user);
   if (!result.isEmpty()) {
     final User u = (User) result.get(0);
     final List<Value> v = ValueServiceFactory.getInstance().getCurrentValue(p);
     if (p.getIdleSeconds() > 0
         && !v.isEmpty()
         && v.get(0).getTimestamp().getTime() <= c.getTimeInMillis()
         && !p.getIdleAlarmSent()) {
       p.setIdleAlarmSent(true);
       EntityServiceFactory.getInstance().addUpdateEntity(u, p);
       // PointServiceFactory.getInstance().updatePoint(u, p);
       final Value va = ValueFactory.createValueModel(v.get(0), AlertType.IdleAlert);
       SubscriptionServiceFactory.getInstance().processSubscriptions(u, p, va);
       retVal = true;
     }
   }
   return retVal;
 }
コード例 #2
0
ファイル: PolygonValue.java プロジェクト: inutard/cra
 /** NOTE: the connection from java to matlab */
 public RCvalue java2Matlab() throws EvalException {
   if (rc == null) {
     if (poly != null) {
       Value[] v = new Value[poly.degree()];
       for (int i = 0; i < v.length; i++) {
         Point pt = poly.point(i);
         assert pt.type() == CohoDouble.type
             : "The result type is not CohoDouble, it is " + pt.type();
         //					if(pt.type()!=CohoDouble.type){
         //					throw new RuntimeException("The result type is not CohoDouble, it is "+pt.type() );
         //					}
         v[i] =
             RCvalue.factory()
                 .create(
                     new Value[] {
                       DoubleValue.factory()
                           .create(new Double(((CohoDouble) pt.x()).doubleValue()), null),
                       DoubleValue.factory()
                           .create(new Double(((CohoDouble) pt.y()).doubleValue()), null)
                     },
                     false);
       }
       rc = (RCvalue) (RCvalue.factory().create(v, true));
     } else { // empty polygon
       rc = (RCvalue) (RCvalue.factory().create(new Value[0], true));
     }
   }
   return (rc);
 }
コード例 #3
0
ファイル: LoginBox.java プロジェクト: timburrow/ovj3
  /** Write file with position and size of the login box */
  public static void writePersistence() {

    Messages.postDebug("LoginBox", "LoginBox.writePersistence");
    // If the panel has not been created, don't try to write a file
    if (position == null) return;

    String filepath = FileUtil.savePath("USER/PERSISTENCE/LoginPanel");

    FileWriter fw;
    PrintWriter os;
    try {
      File file = new File(filepath);
      fw = new FileWriter(file);
      os = new PrintWriter(fw);
      os.println("Login Panel");

      os.println(height);
      os.println(width);
      double xd = position.getX();
      int xi = (int) xd;
      os.println(xi);
      double yd = position.getY();
      int yi = (int) yd;
      os.println(yi);

      os.close();
    } catch (Exception er) {
      Messages.postError("Problem creating  " + filepath);
      Messages.writeStackTrace(er);
    }
  }
コード例 #4
0
  public void marshal(DataOutputStream dos) {
    super.marshal(dos);
    try {
      minefieldID.marshal(dos);
      requestingEntityID.marshal(dos);
      dos.writeByte((byte) requestID);
      dos.writeByte((byte) requestedPerimeterPoints.size());
      dos.writeByte((byte) pad2);
      dos.writeByte((byte) sensorTypes.size());
      dos.writeInt((int) dataFilter);
      requestedMineType.marshal(dos);

      for (int idx = 0; idx < requestedPerimeterPoints.size(); idx++) {
        Point aPoint = requestedPerimeterPoints.get(idx);
        aPoint.marshal(dos);
      } // end of list marshalling

      for (int idx = 0; idx < sensorTypes.size(); idx++) {
        TwoByteChunk aTwoByteChunk = sensorTypes.get(idx);
        aTwoByteChunk.marshal(dos);
      } // end of list marshalling

    } // end try
    catch (Exception e) {
      System.out.println(e);
    }
  } // end of marshal method
コード例 #5
0
ファイル: Rules.java プロジェクト: bitsai/courses
  /** Returns angle in degrees from specified origin to specified destination. */
  public static int getAngle(Point origin, Point destination) // origin != destination
      {
    double distance = getDistance(origin, destination);
    int add = 0;
    int x = destination.getx() - origin.getx();
    int y = origin.gety() - destination.gety(); // Java flips things around

    double angleRad = Math.asin(Math.abs(y) / distance);
    double angleDeg = Math.toDegrees(angleRad);

    if ((x >= 0) && (y >= 0)) // Quadrant 1
    {
      angleDeg = angleDeg;
    }
    if ((x < 0) && (y > 0)) // Quadrant 2
    {
      angleDeg = 180 - angleDeg;
    }
    if ((x <= 0) && (y <= 0)) // Quadrant 3
    {
      angleDeg = 180 + angleDeg;
    }
    if ((x > 0) && (y < 0)) // Quadrant 4
    {
      angleDeg = 360 - angleDeg;
    }

    float angleFloat = Math.round(angleDeg);
    int angleInt = Math.round(angleFloat);

    return (angleInt);
  }
コード例 #6
0
 @Override
 protected RelativePoint getPointToShowResults() {
   Rectangle rect = myEntryTable.getCellRect(myEntryTable.getSelectedRow(), 1, false);
   Point location = rect.getLocation();
   location.y += rect.height;
   return new RelativePoint(myEntryTable, location);
 }
コード例 #7
0
 public void scaleBy(double factor) throws Exception {
   for (int i = 0; i < points.size(); i++) {
     Point point = points.get(i);
     point.x *= factor;
     point.y *= factor;
   }
 }
コード例 #8
0
 protected RelativePoint getPointToShowResults() {
   final int selectedRow = myTree.getSelectionRows()[0];
   final Rectangle rowBounds = myTree.getRowBounds(selectedRow);
   final Point location = rowBounds.getLocation();
   location.x += rowBounds.width;
   return new RelativePoint(myTree, location);
 }
コード例 #9
0
ファイル: KMeansDriver.java プロジェクト: ktzoumas/flink-perf
    @Override
    protected void map(LongWritable key, Text value, Context context)
        throws IOException, InterruptedException {
      String line = value.toString();
      StringTokenizer tokenizer = new StringTokenizer(line, " ");
      int dim = tokenizer.countTokens();
      double[] coords = new double[dim];
      for (int i = 0; i < dim; i++) {
        coords[i] = Double.valueOf(tokenizer.nextToken());
      }
      Point point = new Point(coords);

      Centroid nearest = null;
      double nearestDistance = Double.MAX_VALUE;
      for (Centroid c : centers) {
        double dist = point.euclideanDistance(c);
        if (nearest == null) {
          nearest = c;
          nearestDistance = dist;
        } else {
          if (dist < nearestDistance) {
            nearest = c;
            nearestDistance = dist;
          }
        }
      }
      context.write(nearest, point);
    }
コード例 #10
0
  private void showSliderMenu() {
    Point location = new Point(getX(), getY() + getHeight());

    SwingUtilities.convertPointToScreen(location, InputVolumeControlButton.this.getParent());

    if (isFullScreen()) {
      location.setLocation(
          location.getX(),
          location.getY() - sliderMenu.getPreferredSize().getHeight() - getHeight());
    }

    sliderMenu.setLocation(location);

    sliderMenu.addPopupMenuListener(
        new PopupMenuListener() {
          public void popupMenuWillBecomeVisible(PopupMenuEvent ev) {
            sliderMenuIsVisible = true;
          }

          public void popupMenuWillBecomeInvisible(PopupMenuEvent ev) {
            sliderMenuIsVisible = false;
          }

          public void popupMenuCanceled(PopupMenuEvent ev) {}
        });

    sliderMenu.setVisible(!sliderMenu.isVisible());
  }
コード例 #11
0
ファイル: TabSpawnable.java プロジェクト: cflewis/argouml
  public TabSpawnable spawn() {
    JFrame f = new JFrame();
    f.getContentPane().setLayout(new BorderLayout());
    f.setTitle(_title);
    TabSpawnable newPanel = (TabSpawnable) clone();
    if (newPanel == null) return null; // failed to clone
    newPanel.setTitle(_title);
    if (newPanel instanceof TabToDoTarget) {
      TabToDoTarget me = (TabToDoTarget) this;
      TabToDoTarget it = (TabToDoTarget) newPanel;
      it.setTarget(me.getTarget());
    } else if (newPanel instanceof TabModelTarget) {
      TabModelTarget me = (TabModelTarget) this;
      TabModelTarget it = (TabModelTarget) newPanel;
      it.setTarget(me.getTarget());
    }
    f.getContentPane().add(newPanel, BorderLayout.CENTER);
    Rectangle bounds = getBounds();
    bounds.height += OVERLAPP * 2;
    f.setBounds(bounds);

    Point loc = new Point(0, 0);
    SwingUtilities.convertPointToScreen(loc, this);
    loc.y -= OVERLAPP;
    f.setLocation(loc);
    f.setVisible(true);

    if (_tear && (getParent() instanceof JTabbedPane)) ((JTabbedPane) getParent()).remove(this);

    return newPanel;
  }
コード例 #12
0
  public void unmarshal(DataInputStream dis) {
    super.unmarshal(dis);

    try {
      minefieldID.unmarshal(dis);
      requestingEntityID.unmarshal(dis);
      requestID = (short) dis.readUnsignedByte();
      numberOfPerimeterPoints = (short) dis.readUnsignedByte();
      pad2 = (short) dis.readUnsignedByte();
      numberOfSensorTypes = (short) dis.readUnsignedByte();
      dataFilter = dis.readInt();
      requestedMineType.unmarshal(dis);
      for (int idx = 0; idx < numberOfPerimeterPoints; idx++) {
        Point anX = new Point();
        anX.unmarshal(dis);
        requestedPerimeterPoints.add(anX);
      }

      for (int idx = 0; idx < numberOfSensorTypes; idx++) {
        TwoByteChunk anX = new TwoByteChunk();
        anX.unmarshal(dis);
        sensorTypes.add(anX);
      }

    } // end try
    catch (Exception e) {
      System.out.println(e);
    }
  } // end of unmarshal method
コード例 #13
0
 public Geobuf.Data.Geometry pointToGeobuf(Point point) {
   return Geobuf.Data.Geometry.newBuilder()
       .setType(Geobuf.Data.Geometry.Type.POINT)
       .addCoords((long) (point.getX() * precisionMultiplier))
       .addCoords((long) (point.getY() * precisionMultiplier))
       .build();
 }
コード例 #14
0
ファイル: Rules.java プロジェクト: bitsai/courses
  /** Returns distance between specified coordinates. */
  public static double getDistance(Point origin, Point destination) {
    int x = destination.getx() - origin.getx();
    int y = destination.gety() - origin.gety();
    double distance = Math.sqrt(x * x + y * y);

    return distance;
  }
コード例 #15
0
 // ------------------------------
 public void
     scrollToCaret() { // not called - fixed with putting visible scrollbars on JScrollPane
   //
   Rectangle rect1 = scroller1.getViewport().getViewRect();
   double x1 = rect1.getX();
   double y1 = rect1.getY();
   double r1height = rect1.getHeight();
   double r1width = rect1.getWidth();
   Caret caret1 = editor1.getCaret();
   Point pt2 = caret1.getMagicCaretPosition(); // the end of the string
   double x2 = pt2.getX();
   double y2 = pt2.getY();
   if (((x2 > x1) && (x2 < (x1 + r1width))) && ((y2 > y1) && (y2 < (y1 + r1height)))) {
     // inview
   } else {
     double newheight = r1height / 2;
     double newwidth = r1width / 2;
     double x3 = pt2.getX() - newwidth;
     double y3 = pt2.getY() - newheight;
     if (x3 < 0) x3 = 0;
     if (y3 < 0) y3 = 0;
     Rectangle rect3 = new Rectangle((int) x3, (int) y3, (int) newwidth, (int) newheight);
     editor1.scrollRectToVisible(rect3);
   }
 } // end scrollToCaret
コード例 #16
0
ファイル: fdg.java プロジェクト: ilangray/braun-and-blew
    private Point getOffset(Rect r) {
      Point screenCenter = new Point((bounds.x + bounds.w / 2), (bounds.y + bounds.h / 2));
      Point rectCenter = r.getCenter();

      Point diff = rectCenter.diff(screenCenter).scale(PERCENT_DIST, PERCENT_DIST);
      return diff;
    }
コード例 #17
0
ファイル: JImage.java プロジェクト: RussTedrake/lcm
    public void mouseDragged(MouseEvent e) {
      int mods = e.getModifiersEx();
      Point dragEnd = e.getPoint();
      boolean shift = (mods & MouseEvent.SHIFT_DOWN_MASK) > 0;
      boolean ctrl = (mods & MouseEvent.CTRL_DOWN_MASK) > 0;
      boolean alt = shift & ctrl;
      ctrl = ctrl & (!alt);
      shift = shift & (!alt);
      boolean nomods = !(shift | ctrl | alt);

      if (dragBegin == null) dragBegin = dragEnd;

      nodrag = false;

      if ((mods & InputEvent.BUTTON3_DOWN_MASK) > 0 || true) {
        double dx = dragEnd.getX() - dragBegin.getX();
        double dy = dragEnd.getY() - dragBegin.getY();

        synchronized (JImage.this) {
          t.preConcatenate(AffineTransform.getTranslateInstance(dx, dy));
        }

        dragBegin = dragEnd;
        repaint();
      }
    }
コード例 #18
0
 /** Returns the coordinates of the top left corner of the value at the given index. */
 public Point getCoordinates(int index) {
   JScrollBar bar = scrollPane.getVerticalScrollBar();
   Rectangle r = segmentTable.getCellRect(index, 1, true);
   segmentTable.scrollRectToVisible(r);
   setTopLevelLocation();
   return new Point(
       (int) (r.getX() + topLevelLocation.getX()), (int) (r.getY() + topLevelLocation.getY()));
 }
コード例 #19
0
ファイル: KMeansDriver.java プロジェクト: ktzoumas/flink-perf
 public Point deepCopy() {
   Point out = new Point();
   out.n = this.n;
   out.coord = new double[out.n];
   for (int i = 0; i < out.n; i++) {
     out.coord[i] = this.coord[i];
   }
   return out;
 }
コード例 #20
0
ファイル: SelectWindow.java プロジェクト: RKX1209/RPG
  /* カーソル移動 */
  public void move_cursor(Object.DIRECTION dir) {
    int nx = select_point.x + Object.DirectionVector[dir.ordinal()][0];
    int ny = select_point.y + Object.DirectionVector[dir.ordinal()][1];

    if (inner(nx, ny)) {
      select_point.x = nx;
      select_point.y = ny;
    }
  }
コード例 #21
0
ファイル: VCaretEntry.java プロジェクト: timburrow/OpenVnmrJ
 public Point getLocation() {
   if (inEditMode) {
     tmpLoc.x = defLoc.x;
     tmpLoc.y = defLoc.y;
   } else {
     tmpLoc.x = curLoc.x;
     tmpLoc.y = curLoc.y;
   }
   return tmpLoc;
 }
コード例 #22
0
ファイル: Mainclass.java プロジェクト: rhnvrm/java_learn
  public static void main(String args[]) {

    Scanner s = new Scanner(System.in);

    Point x = new Point();

    Triangle t = new Triangle();

    LineSegment l = new LineSegment();

    /*System.out.println("Enter Tester Point Values:");
    	x.setFromUser();
    	System.out.println("Enter Tester Triangle Values:");
    	t.setFromUser();
    	System.out.println("Enter Tester Line Values:");
    	l.setFromUser();
    */
    boolean exit = false;

    while (!exit) {
      System.out.println("Check for point or line is in a triangle or want to exit (1/2/3)");
      int choice = s.nextInt();

      if (choice == 1) {
        x.setFromUser();

        System.out.println("Check if is inside line or triangle or exit(1/2/3)");
        int secondchoice = s.nextInt();

        if (secondchoice == 1) {
          l.setFromUser();
          System.out.println(l.isInside(x));
        } else if (secondchoice == 2) {
          t.setFromUser();
          System.out.println(t.isInside(x));
        } else if (secondchoice == 3) {
          exit = true;
        }
      } else if (choice == 2) {
        l.setFromUser();

        System.out.println("Check if is inside triangle or exit(1/2)");
        int secondchoice = s.nextInt();

        if (secondchoice == 1) {
          t.setFromUser();
          System.out.println(t.isInside(x));
        } else if (secondchoice == 2) {
          exit = true;
        }
      } else if (choice == 3) {
        exit = true;
      }
    }
  }
コード例 #23
0
ファイル: FirePower.java プロジェクト: wuilkysb/net-bomberman
 public void run() {
   picNo++;
   if (picNo == imageLen) {
     timer.cancel();
     map[(int) p.getX()][(int) p.getY()][1] = null;
     interfaz.refresh();
     return;
   }
   image = orgImage.getSubimage(0 + picNo * 32, picType * 32, 32, 32);
   interfaz.refresh();
 }
コード例 #24
0
ファイル: AOJ0081.java プロジェクト: t8m8/AOJ
 static void solve() {
   String[] s = in.next().split(",");
   Point p =
       reflect(
           new Line(
               Double.parseDouble(s[0]),
               Double.parseDouble(s[1]),
               Double.parseDouble(s[2]),
               Double.parseDouble(s[3])),
           new Point(Double.parseDouble(s[4]), Double.parseDouble(s[5])));
   out.println(p.getX() + " " + p.getY());
 }
コード例 #25
0
  public void parseFile(Plate plate, String attributeName, File envisionFile) {

    Sheet sheet = StringTable.openWorkSheet(envisionFile).getSheetAt(0);

    Point tableTopLeftPos = StringTable.findNextPlatePosition(sheet, new Point(1, 1));

    int numSkipTables = propTableIndex.getIntValue() - 1;
    while (tableTopLeftPos != null && numSkipTables > 0) {
      tableTopLeftPos =
          StringTable.findNextPlatePosition(
              sheet, new Point((int) tableTopLeftPos.getX(), (int) (tableTopLeftPos.getY() + 1)));
      numSkipTables--;
    }

    if (tableTopLeftPos == null) {
      throw new RuntimeException("Could not find readout-table in file " + envisionFile);
    }

    Rectangle tableBounds = StringTable.guessPlateBounds(sheet, tableTopLeftPos);
    StringTable envisionTable = StringTable.readStringGridFromExcel(tableBounds, sheet);

    // either set the plate dimensions or validate them
    if (plate.getNumRows() < 0) {
      plate.setNumColumns(envisionTable.getWidth() - 1);
      plate.setNumRows(envisionTable.getHeight() - 1);
    } else {
      assert envisionTable.getWidth() - 1 == plate.getNumColumns();
      assert envisionTable.getHeight() - 1 == plate.getNumRows();
    }

    for (int colIndex = 0; colIndex < plate.getNumColumns(); colIndex++) {
      for (int rowIndex = 0; rowIndex < plate.getNumRows(); rowIndex++) {
        int plateRow = rowIndex + 1; // this inversion looks weired but it is correct
        int plateColumn = colIndex + 1;

        Well well = plate.getWell(plateColumn, plateRow);
        if (well == null) {
          well = new Well();

          well.setPlateRow(plateRow);
          well.setPlateColumn(plateColumn);
          well.setPlate(plate);

          plate.addWell(well);
        }

        Double readout = ScreenImportUtils.parseDouble(envisionTable.get(plateRow, plateColumn));
        if (readout != null) {
          well.getWellStatistics().put(attributeName, readout);
        }
      }
    }
  }
コード例 #26
0
ファイル: H.java プロジェクト: Mityai/nncworkspaces
 boolean solve2() {
   int t = nextInt();
   if (t == 0) return false;
   int n = nextInt();
   Tower[] towers = new Tower[t];
   for (int i = 0; i < t; i++) {
     towers[i] = new Tower(new Point(nextInt(), nextInt()), nextInt());
   }
   n++;
   Point[] p = new Point[n];
   for (int i = 0; i < n; i++) {
     p[i] = new Point(nextInt(), nextInt());
   }
   // System.err.println(Arrays.toString(p));
   ArrayList<Point> points = new ArrayList<Point>();
   double r = 1;
   for (int i = 0; i < n - 1; i++) {
     double dist = p[i].dist(p[i + 1]) - (1 - r);
     int e = (int) Math.floor(dist + 1 - EPS);
     Point v = p[i + 1].subtract(p[i]).norm();
     for (int j = 0; j < e; j++) {
       points.add(p[i].add(v.multiply(j).add(v.multiply(1 - r))));
     }
     r = p[i + 1].dist(points.get(points.size() - 1));
   }
   if (p[n - 1].dist(points.get(points.size() - 1)) > 0.5 - EPS) {
     points.add(p[n - 1]);
   }
   // System.err.println(points);
   char last = 0;
   ArrayList<String> ans = new ArrayList<String>();
   for (int i = 0; i < points.size(); i++) {
     double maxP = Integer.MIN_VALUE;
     char here = 0;
     for (int j = 0; j < t; j++) {
       double w = towers[j].get(points.get(i));
       if (maxP < w - EPS) {
         maxP = w;
         here = (char) (j + 'A');
       }
     }
     if (here != last) {
       ans.add("(" + i + "," + here + ")");
     }
     last = here;
   }
   for (int i = 0; i < ans.size(); i++) {
     if (i != 0) out.print(" ");
     out.print(ans.get(i));
   }
   out.println();
   return true;
 }
コード例 #27
0
ファイル: VCaretEntry.java プロジェクト: timburrow/OpenVnmrJ
 public void setSizeRatio(double x, double y) {
   xRatio = x;
   yRatio = y;
   if (x > 1.0) xRatio = x - 1.0;
   if (y > 1.0) yRatio = y - 1.0;
   if (defDim.width <= 0) defDim = getPreferredSize();
   curLoc.x = (int) ((double) defLoc.x * xRatio);
   curLoc.y = (int) ((double) defLoc.y * yRatio);
   curDim.width = (int) ((double) defDim.width * xRatio);
   curDim.height = (int) ((double) defDim.height * yRatio);
   if (!inEditMode) setBounds(curLoc.x, curLoc.y, curDim.width, curDim.height);
 }
コード例 #28
0
  private void setSizeAndDimensions(
      @NotNull JTable table,
      @NotNull JBPopup popup,
      @NotNull RelativePoint popupPosition,
      @NotNull List<UsageNode> data) {
    JComponent content = popup.getContent();
    Window window = SwingUtilities.windowForComponent(content);
    Dimension d = window.getSize();

    int width = calcMaxWidth(table);
    width = (int) Math.max(d.getWidth(), width);
    Dimension headerSize = ((AbstractPopup) popup).getHeaderPreferredSize();
    width = Math.max((int) headerSize.getWidth(), width);
    width = Math.max(myWidth, width);

    if (myWidth == -1) myWidth = width;
    int newWidth = Math.max(width, d.width + width - myWidth);

    myWidth = newWidth;

    int rowsToShow = Math.min(30, data.size());
    Dimension dimension = new Dimension(newWidth, table.getRowHeight() * rowsToShow);
    Rectangle rectangle = fitToScreen(dimension, popupPosition, table);
    dimension = rectangle.getSize();
    Point location = window.getLocation();
    if (!location.equals(rectangle.getLocation())) {
      window.setLocation(rectangle.getLocation());
    }

    if (!data.isEmpty()) {
      TableScrollingUtil.ensureSelectionExists(table);
    }
    table.setSize(dimension);
    // table.setPreferredSize(dimension);
    // table.setMaximumSize(dimension);
    // table.setPreferredScrollableViewportSize(dimension);

    Dimension footerSize = ((AbstractPopup) popup).getFooterPreferredSize();

    int newHeight =
        (int) (dimension.height + headerSize.getHeight() + footerSize.getHeight())
            + 4 /* invisible borders, margins etc*/;
    Dimension newDim = new Dimension(dimension.width, newHeight);
    window.setSize(newDim);
    window.setMinimumSize(newDim);
    window.setMaximumSize(newDim);

    window.validate();
    window.repaint();
    table.revalidate();
    table.repaint();
  }
コード例 #29
0
  /** Constrains a point to the current grid. */
  protected Point constrainPoint(Point p) {
    // constrain to view size
    Dimension size = getSize();
    // p.x = Math.min(size.width, Math.max(1, p.x));
    // p.y = Math.min(size.height, Math.max(1, p.y));
    p.x = Geom.range(1, size.width, p.x);
    p.y = Geom.range(1, size.height, p.y);

    if (fConstrainer != null) {
      return fConstrainer.constrainPoint(p);
    }
    return p;
  }
コード例 #30
0
ファイル: Drawing.java プロジェクト: DracZakk/tpAdapter
 public void duplication() {
   if (shapes.size() != 0) {
     for (Shape shape : shapes) {
       Shape clone = shape.duplicateShape();
       Point point = new Point(shape.origin());
       point.y += 120;
       clone.setOrigin(point);
       shapesCloneList.add(clone);
       System.out.println("shape is duplicated");
     }
     this.repaint();
   }
 }