Examples of Rectangle


Examples of com.github.davidmoten.rtree.geometry.Rectangle

        return new ListPair<T>(group1, group2);
    }

    private <T extends HasGeometry> void assignRemaining(final List<T> group1,
            final List<T> group2, final List<T> remaining, final int minGroupSize) {
        final Rectangle mbr1 = Util.mbr(group1);
        final Rectangle mbr2 = Util.mbr(group2);
        final T item1 = getBestCandidateForGroup(remaining, group1, mbr1);
        final T item2 = getBestCandidateForGroup(remaining, group2, mbr2);
        final boolean area1LessThanArea2 = item1.geometry().mbr().add(mbr1).area() <= item2
                .geometry().mbr().add(mbr2).area();
View Full Code Here

Examples of com.github.jmkgreen.morphia.testmodel.Rectangle

    Random rnd = new Random();
   
    //create 100 circles and rectangles
    for(int i = 0; i < 100; i++){
      ads.insert("shapes", new Circle(rnd.nextDouble()));
      ads.insert("shapes", new Rectangle(rnd.nextDouble(), rnd.nextDouble()));
    }
    String map = "function () { if(this['radius']) { emit('circle', {count:1}); return; } emit('rect', {count:1}); }";
    String reduce = "function (key, values) { var total = 0; for ( var i=0; i<values.length; i++ ) {total += values[i].count;} return { count : total }; }";
    MapreduceResults<ResultEntity> mrRes = ds.mapReduce(MapreduceType.REPLACE, ads.createQuery(Shape.class), map, reduce, null, null, ResultEntity.class);
    Assert.assertEquals(2, mrRes.createQuery().countAll());
View Full Code Here

Examples of com.google.code.appengine.awt.Rectangle

    public Rectangle getBounds() {
        int x1 = (int)Math.floor(getMinX());
        int y1 = (int)Math.floor(getMinY());
        int x2 = (int)Math.ceil(getMaxX());
        int y2 = (int)Math.ceil(getMaxY());
        return new Rectangle(x1, y1, x2 - x1, y2 - y1);
    }
View Full Code Here

Examples of com.google.gwt.maeglin89273.game.ashinyballonthecross.client.core.creation.shape.Rectangle

  /* (non-Javadoc)
   * @see com.google.gwt.maeglin89273.game.ashinyballonthecross.client.core.dot.BombDot#generateShape(com.google.gwt.maeglin89273.game.mengine.physics.Point, double)
   */
  @Override
  protected PhysicalShape generateShape(Point position, double angle) {
    return new Rectangle(this.controller, position , angle, 5+Random.nextInt(16), 5+Random.nextInt(16), this.dotColor);
  }
View Full Code Here

Examples of com.googlecode.jumpnevolve.math.Rectangle

    System.out.println("Zeit neu benötigt: " + (endTime - startTime));
  }

  @Test
  public void testSpeedOldRectCollisions() {
    Shape rect = new Rectangle(new Vector(10, 100), 20, 20);
    // Rectangle rect2 = new Rectangle(new Vector(10, 90), 20, 20);
    Shape rect2 = new Circle(new Vector(10, 90), 10);
    Date start = new Date();
    long startTime = start.getTime();
    for (int i = 0; i < 1000000; i++) {
      if (rect.doesCollide(rect2)) {
        rect.getCollision(rect2, false, true);
      }
      rect = rect.modifyCenter(rect.getCenter().add(
          new Vector(0, 0.000001f)));
    }
    Date end = new Date();
    long endTime = end.getTime();
    System.out.println("Zeit benötigt: " + (endTime - startTime));
View Full Code Here

Examples of com.itextpdf.text.Rectangle

                width *= INCH;
                height *= INCH;
            }
            float w = (float) width;
            float h = (float) height;
            Rectangle rect = new Rectangle(w, h);
            pdfExporter.setPageSize(rect);
        } else {
            pdfExporter.setPageSize(((PageSizeItem) pageSizeCombo.getSelectedItem()).getPageSize());
        }

View Full Code Here

Examples of com.jgraph.gaeawt.java.awt.Rectangle

    public Rectangle getBounds() {
        int x1 = (int)Math.floor(getMinX());
        int y1 = (int)Math.floor(getMinY());
        int x2 = (int)Math.ceil(getMaxX());
        int y2 = (int)Math.ceil(getMaxY());
        return new Rectangle(x1, y1, x2 - x1, y2 - y1);
    }
View Full Code Here

Examples of com.jme3.font.Rectangle

        sceneNode.attachChild(logo);
       
       
        BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt");
        BitmapText txt = new BitmapText(fnt, false);
        txt.setBox(new Rectangle(-2, -2.5f, 6, 3));
        txt.setQueueBucket(Bucket.Transparent);
        txt.setSize( 0.5f );
        txt.setText(txtB);
        sceneNode.attachChild(txt);
       
View Full Code Here

Examples of com.kjoshi.shareit.responsible.Rectangle

public class ChainOfResponsibility {
  public static void main(String[] args) {
    // I am keeping Circle in the last in the chain so starting from Circle
    Area circle = new Circle();
    Area triangle = new Triangle(circle);
    Area rectangle = new Rectangle(triangle);
    Area square = new Square(rectangle);
    for (String shape : listOfShapes()) {
      square.findArea(shape);
    }
  }
View Full Code Here

Examples of com.lowagie.text.Rectangle

                case Element.ANNOTATION: {
                    if (line == null) {
                        carriageReturn();
                    }
                    Annotation annot = (Annotation) element;
                    Rectangle rect = new Rectangle(0, 0);
                    if (line != null)
                      rect = new Rectangle(annot.llx(indentRight() - line.widthLeft()), annot.lly(indentTop() - currentHeight), annot.urx(indentRight() - line.widthLeft() + 20), annot.ury(indentTop() - currentHeight - 20));
                    PdfAnnotation an = PdfAnnotationsImp.convertAnnotation(writer, annot, rect);
                    annotationsImp.addPlainAnnotation(an);
                    pageEmpty = false;
                    break;
                }
                case Element.PHRASE: {
                  leadingCount++;
                    // we cast the element to a phrase and set the leading of the document
                    leading = ((Phrase) element).getLeading();
                    // we process the element
                    element.process(this);
                    leadingCount--;
                    break;
                }
                case Element.PARAGRAPH: {
                  leadingCount++;
                    // we cast the element to a paragraph
                    Paragraph paragraph = (Paragraph) element;
                    addSpacing(paragraph.spacingBefore(), leading, paragraph.getFont());
                   
                    // we adjust the parameters of the document
                    alignment = paragraph.getAlignment();
                    leading = paragraph.getTotalLeading();
                    carriageReturn();
                   
                    // we don't want to make orphans/widows
                    if (currentHeight + line.height() + leading > indentTop() - indentBottom()) {
                        newPage();
                    }
                    indentation.indentLeft += paragraph.getIndentationLeft();
                    indentation.indentRight += paragraph.getIndentationRight();
                    carriageReturn();
    
                    PdfPageEvent pageEvent = writer.getPageEvent();
                    if (pageEvent != null && !isSectionTitle)
                        pageEvent.onParagraph(writer, this, indentTop() - currentHeight);
                   
                    // if a paragraph has to be kept together, we wrap it in a table object
                    if (paragraph.getKeepTogether()) {
                      carriageReturn();
                        PdfPTable table = new PdfPTable(1);
                        table.setWidthPercentage(100f);
                        PdfPCell cell = new PdfPCell();
                        cell.addElement(paragraph);
                        cell.setBorder(Table.NO_BORDER);
                        cell.setPadding(0);
                        table.addCell(cell);
                        indentation.indentLeft -= paragraph.getIndentationLeft();
                        indentation.indentRight -= paragraph.getIndentationRight();
                        this.add(table);
                        indentation.indentLeft += paragraph.getIndentationLeft();
                        indentation.indentRight += paragraph.getIndentationRight();
                    }
                    else {
                      line.setExtraIndent(paragraph.getFirstLineIndent());
                      element.process(this);
                        carriageReturn();
                        addSpacing(paragraph.spacingAfter(), paragraph.getTotalLeading(), paragraph.getFont());
                    }

                    if (pageEvent != null && !isSectionTitle)
                        pageEvent.onParagraphEnd(writer, this, indentTop() - currentHeight);
                   
                    alignment = Element.ALIGN_LEFT;
                    indentation.indentLeft -= paragraph.getIndentationLeft();
                    indentation.indentRight -= paragraph.getIndentationRight();
                    carriageReturn();
                    leadingCount--;
                    break;
                }
                case Element.SECTION:
                case Element.CHAPTER: {
                    // Chapters and Sections only differ in their constructor
                    // so we cast both to a Section
                    Section section = (Section) element;
                    PdfPageEvent pageEvent = writer.getPageEvent();
                   
                    boolean hasTitle = section.isNotAddedYet()
                      && section.getTitle() != null;
                   
                    // if the section is a chapter, we begin a new page
                    if (section.isTriggerNewPage()) {
                        newPage();
                    }

                    if (hasTitle) {
                      float fith = indentTop() - currentHeight;
                      int rotation = pageSize.getRotation();
                      if (rotation == 90 || rotation == 180)
                        fith = pageSize.getHeight() - fith;
                      PdfDestination destination = new PdfDestination(PdfDestination.FITH, fith);
                      while (currentOutline.level() >= section.getDepth()) {
                        currentOutline = currentOutline.parent();
                      }
                      PdfOutline outline = new PdfOutline(currentOutline, destination, section.getBookmarkTitle(), section.isBookmarkOpen());
                      currentOutline = outline;
                    }
                   
                    // some values are set
                    carriageReturn();
                    indentation.sectionIndentLeft += section.getIndentationLeft();
                    indentation.sectionIndentRight += section.getIndentationRight();
     
                    if (section.isNotAddedYet() && pageEvent != null)
                        if (element.type() == Element.CHAPTER)
                            pageEvent.onChapter(writer, this, indentTop() - currentHeight, section.getTitle());
                        else
                            pageEvent.onSection(writer, this, indentTop() - currentHeight, section.getDepth(), section.getTitle());
                   
                    // the title of the section (if any has to be printed)
                    if (hasTitle) {
                        isSectionTitle = true;
                        add(section.getTitle());
                        isSectionTitle = false;
                    }
                    indentation.sectionIndentLeft += section.getIndentation();
                    // we process the section
                    element.process(this);
                    flushLines();
                    // some parameters are set back to normal again
                    indentation.sectionIndentLeft -= (section.getIndentationLeft() + section.getIndentation());
                    indentation.sectionIndentRight -= section.getIndentationRight();

                    if (section.isComplete() && pageEvent != null)
                        if (element.type() == Element.CHAPTER)
                            pageEvent.onChapterEnd(writer, this, indentTop() - currentHeight);
                        else
                            pageEvent.onSectionEnd(writer, this, indentTop() - currentHeight);

                    break;
                }
                case Element.LIST: {
                    // we cast the element to a List
                    List list = (List) element;
                    if (list.isAlignindent()) {
                      list.normalizeIndentation();
                    }
                    // we adjust the document
                    indentation.listIndentLeft += list.getIndentationLeft();
                    indentation.indentRight += list.getIndentationRight();
                    // we process the items in the list
                    element.process(this);
                    // some parameters are set back to normal again
                    indentation.listIndentLeft -= list.getIndentationLeft();
                    indentation.indentRight -= list.getIndentationRight();
                    carriageReturn();
                    break;
                }
                case Element.LISTITEM: {
                  leadingCount++;
                    // we cast the element to a ListItem
                    ListItem listItem = (ListItem) element;
                   
                    addSpacing(listItem.spacingBefore(), leading, listItem.getFont());
                  
                    // we adjust the document
                    alignment = listItem.getAlignment();
                    indentation.listIndentLeft += listItem.getIndentationLeft();
                    indentation.indentRight += listItem.getIndentationRight();
                    leading = listItem.getTotalLeading();
                    carriageReturn();
                   
                    // we prepare the current line to be able to show us the listsymbol
                    line.setListItem(listItem);
                    // we process the item
                    element.process(this);

                    addSpacing(listItem.spacingAfter(), listItem.getTotalLeading(), listItem.getFont());
                  
                    // if the last line is justified, it should be aligned to the left
                    if (line.hasToBeJustified()) {
                      line.resetAlignment();
                    }
                    // some parameters are set back to normal again
                    carriageReturn();
                    indentation.listIndentLeft -= listItem.getIndentationLeft();
                    indentation.indentRight -= listItem.getIndentationRight();
                    leadingCount--;
                    break;
                }
                case Element.RECTANGLE: {
                    Rectangle rectangle = (Rectangle) element;
                    graphics.rectangle(rectangle);
                    pageEmpty = false;
                    break;
                }
                case Element.PTABLE: {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.