Package org.mati.geotech.model

Examples of org.mati.geotech.model.Rect


import org.mati.geotech.model.Rect;

public class GoogleMapPathMaker extends PathMaker {
  public String makePathFor(Rect cell, Rect start) {
    String path = "t";
    Rect r = new Rect(0,0,0,0);
   
    r.setSameGeometry(start);
   
    while(cell.haveOverlap(r) && r.getWidth() > cell.getWidth()) {
      // 0 - q, 1 - r,  2 - t, 3 - s
      Rect [] sl = r.newFourBySplit();
      if(cell.haveOverlap(sl[0])) {
        r.setSameGeometry(sl[0]);
        path+="q";
      }
      else if(cell.haveOverlap(sl[1])) {
        r.setSameGeometry(sl[1]);
        path+="r";
      }
      else if(cell.haveOverlap(sl[2])) {
        r.setSameGeometry(sl[2]);
        path+="t";
      }
      else if(cell.haveOverlap(sl[3])) {
        r.setSameGeometry(sl[3]);
        path+="s";
      } else {
        System.out.println("error in: "+path);
        return null;
      }
View Full Code Here


public class VirtualMapPathMaker extends PathMaker {

  @Override
  public String makePathFor(Rect cell, Rect start) {
    String path = "";
    Rect r = new Rect(0,0,0,0);
   
    r.setSameGeometry(start);
   
    while(cell.haveOverlap(r) && r.getWidth() > cell.getWidth()) {
      // 0 - q, 1 - r,  2 - t, 3 - s
      Rect [] sl = r.newFourBySplit();
      if(cell.haveOverlap(sl[0])) {
        r.setSameGeometry(sl[0]);
        path+="0";
      }
      else if(cell.haveOverlap(sl[1])) {
        r.setSameGeometry(sl[1]);
        path+="1";
      }
      else if(cell.haveOverlap(sl[2])) {
        r.setSameGeometry(sl[2]);
        path+="2";
      }
      else if(cell.haveOverlap(sl[3])) {
        r.setSameGeometry(sl[3]);
        path+="3";
      } else {
        System.out.println("error in: "+path);
        return null;
      }
View Full Code Here

            gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE,
                    GL.GL_REPLACE);
            for (int i = 0; i < cellCover.getCellCountH(); i++) {
                for (int j = 0; j < cellCover.getCellCountW(); j++) {
                    if (mapGrid[i][j]
                            .haveOverlap(new Rect(-180, -90, 360, 180)))
                        drawCell(gl, mapGrid[i][j]);
                }
            }
        }
    }
View Full Code Here

    // System.out.println("splitNode()");
    int i1=0, i2=1,i1max=0,i2max=1;
    double aspendMax = 0;
    double aspend=0;
   
    Rect r1,r2;
    for(i1=1; i1 < node.getChildCount(); i1++) {
      r1 = node.getChildren().get(i1).getRect();
      for(i2=0; i2 < node.getChildCount(); i2++) {
        r2 = node.getChildren().get(i2).getRect();
        aspend = r1.getBoundRectWith(r2).getArea() - r1.getArea() - r2.getArea();
        if(aspend > aspendMax) {
          aspendMax = aspend;
          i1max=i1; i2max=i2;
        }
       
View Full Code Here

    else path.add(node);
   
    Vector<RNode> snodes = node.getChildren();
   
    int iMin = 0;
    Rect minRect = snodes.get(0).getRect().getBoundRectWith(newElement);
    for(int i = 1; i < snodes.size(); i++) {
      Rect nodeRect=snodes.get(i).getRect();
      if(nodeRect.getBoundRectWith(newElement).getArea() < minRect.getArea()) {
        minRect=nodeRect.getBoundRectWith(newElement);
        iMin=i;
      }
    }
    //path.add(snodes.get(iMin));
    return chooseLeaf(newElement, snodes.get(iMin),path);
View Full Code Here

  public Rect scrToMapRect(Rect rect) {
    return worldToMapRect(scrToWorldRect(rect));
  }

  public Rect scrToWorldRect(Rect rect) {
    Rect res =
      new Rect(
        scrToWorldX(rect.getX()),
        scrToWorldY(rect.getY()),
        scrToWorldX(rect.getX()+rect.getWidth())
          -scrToWorldX(rect.getX()),
        scrToWorldY(rect.getY()+rect.getHeight())
View Full Code Here

   
    return res;
  }
 
  public Rect worldToMapRect(Rect rect) {
    Rect res =
      new Rect(
        worldToMapX(rect.getX()),
        worldToMapY(rect.getY()+rect.getHeight()),
        worldToMapX(rect.getX()+rect.getWidth())-worldToMapX(rect.getX()),
        worldToMapY(rect.getY())-worldToMapY(rect.getY()+rect.getHeight())
      );
View Full Code Here

            gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE,
                    GL.GL_REPLACE);
            for (int i = 0; i < cellCover.getCellCountH(); i++) {
                for (int j = 0; j < cellCover.getCellCountW(); j++) {
                    if (mapGrid[i][j]
                            .haveOverlap(new Rect(-180, -90, 360, 180)))
                        drawCell(gl, mapGrid[i][j]);
                }
            }
        }
    }
View Full Code Here

    addMouseMotionListener(new MouseMotionAdapter() {
      @Override
      public void mouseMoved(MouseEvent e) {
        super.mouseMoved(e);
        Rect w = getModel().getDisplayRect();
        getCCModel().updateView(
//            (mapToScrX(w.getX()+w.getWidth())-mapToScrX(w.getX()))/w.getWidth(),
//            (mapToScrY(w.getY()+w.getHeight())-mapToScrY(w.getY()))/w.getHeight()
            getScreenWidth()/w.getWidth(),
            getScreenHeight()/w.getHeight()
        );
        repaint();
      }
    })
   
    addMouseWheelListener(new MouseWheelListener() {
      @Override
      public void mouseWheelMoved(MouseWheelEvent e) {
        if(!e.isControlDown()) {
          double r = e.getWheelRotation();
          r=0.10*r*(getModel().getDisplayRect().getWidth());
          getModel().getDisplayRect().setX(getModel().getDisplayRect().getX()-r/2);
          getModel().getDisplayRect().setY(getModel().getDisplayRect().getY()-r/2);
          getModel().getDisplayRect().setWidth(getModel().getDisplayRect().getWidth()+r);
          getModel().getDisplayRect().setHeight(getModel().getDisplayRect().getHeight()+r);
         
          Rect w = getModel().getDisplayRect();
          // System.out.print("scr: "+(mapToScrX(w.getX()+w.getWidth())-mapToScrX(w.getX())));
          // System.out.println(" vp: "+w.getWidth());
          getCCModel().updateView(
//              (mapToScrX(w.getX()+w.getWidth())-mapToScrX(w.getX()))/w.getWidth(),
//              (mapToScrY(w.getY()+w.getHeight())-mapToScrY(w.getY()))/w.getHeight()
              getScreenWidth()/w.getWidth(),
              getScreenHeight()/w.getHeight()

          );
          repaint();
        }
      }
View Full Code Here

TOP

Related Classes of org.mati.geotech.model.Rect

Copyright © 2018 www.massapicom. 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.