Package chunmap.model.coord

Examples of chunmap.model.coord.CPoint


  @Test
  public void testIntersection10() {
    MonotonyChain chain1 = new MonotonyChain();
    MonotonyChain chain2 = new MonotonyChain();

    CPoint p1 = new Coordinate2D(0, 0);
    CPoint p2 = new Coordinate2D(1, 2);
    CPoint p4 = new Coordinate2D(2, 2);
    CPoint p5 = new Coordinate2D(0.5, 2.8);
    CPoint p6 = new Coordinate2D(3, 3);
    CPoint p7 = new Coordinate2D(2, 1);

    chain1.add(p1);
    chain1.add(p2);
    chain1.add(p4);
    chain1.add(p6);
View Full Code Here


  @Test
  public void testIntersection11() {
    MonotonyChain chain1 = new MonotonyChain();
    MonotonyChain chain2 = new MonotonyChain();

    CPoint p1 = new Coordinate2D(0, 0);
    CPoint p2 = new Coordinate2D(0, 2);

    chain1.add(p1);
    chain1.add(p2);

    chain2.add(p2);
View Full Code Here

  @Test
  public void testIntersection12() {
    MonotonyChain chain1 = new MonotonyChain();
    MonotonyChain chain2 = new MonotonyChain();

    CPoint p1 = new Coordinate2D(0, 0);
    CPoint p2 = new Coordinate2D(1, 0);
    CPoint p3 = new Coordinate2D(2, 0);

    chain1.add(p1);
    chain1.add(p2);

    chain2.add(p2);
View Full Code Here

  /**
   * {@link chunmap.model.elem.Triangle#computeArea()} 的测试方法。
   */
  @Test
  public void testComputeArea2() {
    CPoint p1 = new Coordinate2D(2, 2);
    CPoint p2 = new Coordinate2D(0, 0);
    CPoint p3 = new Coordinate2D(2, 0);
    Triangle tria = new Triangle(p1, p2, p3);
    double are = tria.computeArea();

    assertTrue(MyDouble.approximateEquals(are, 2.0));
  }
View Full Code Here

  /**
   * {@link chunmap.model.elem.Triangle#computeOuterCenter()} 的测试方法。
   */
  @Test
  public void testComputeOuterCenter() {
    CPoint p1 = new Coordinate2D(2, 2);
    CPoint p2 = new Coordinate2D(0, 0);
    CPoint p3 = new Coordinate2D(2, 0);
    Triangle tria = new Triangle(p1, p2, p3);
    CPoint p = tria.computeOuterCenter();
    CPoint ep = new Coordinate2D(1, 1);
    assertTrue(p.equals(ep));
  }
View Full Code Here

    assertTrue(p.equals(ep));
  }

  @Test
  public void testComputeCenter() {
    CPoint p1 = new Coordinate2D(-1, 0);
    CPoint p2 = new Coordinate2D(1, 0);
    CPoint p3 = new Coordinate2D(0, 2);
    Triangle tria = new Triangle(p1, p2, p3);
    CPoint p = tria.computeCenter();
    CPoint ep = new Coordinate2D(0, 2d / 3d);
    assertTrue(p.equals(ep));
  }
View Full Code Here

    String name = tile.toString();
    Image image = cache.find(name);
    if (image != null)
      return image;

    CPoint p=tile.getEnvelop().getCenter();
//    Mercator proj=new Mercator();
//    p=proj.getReverseTransform().convert(p);
   
    String url = getString(p.getX(),p.getY(), tile.z);
    try {
      Image tm = request(url);
      image=ImageUtil.imageCopy(tm, 0, 0, GoogleMapCode.tileSize, GoogleMapCode.tileSize);
     
    } catch (IOException exp) {
View Full Code Here

    double af = 6.28 / pointNum;
    for (double a = 0; a < 6.28; a += af) {
      double dx = Math.sin(a) * distance;
      double dy = Math.cos(a) * distance;

      CPoint pp = new Coordinate2D(p.getX() + dx, p.getY() + dy);
      points.add(pp);
    }
    CoordSeqEditor ls = new CoordSeqEditor(points);
    ls.close();
    Polygon pg = new Polygon(new Ring(ls.toCoordinateSeq()));
View Full Code Here

      return LineDim;
    }
    // 用自己的折点将线串打断
    CoordSeqEditor tLine = new CoordSeqEditor(l1.getPoints());
    for (int i = 0, n = r2.size(); i < n; i++) {
      CPoint p = r2.getPoint(i);
      tLine.tryInsertPoint(p);
    }
    // 片段在里面
    for (int i = 0, n = tLine.size() - 1; i < n; i++) {
      LineSegment lseg = tLine.getLineSegment(i);
      CPoint mp = lseg.getMiddlePoint();
      if (r2.containIn(mp) && !r2.onLineString(mp)) {
        return LineDim;
      }
    }
    return EmptyDim;
View Full Code Here

        LineSegment s2 = l2.getLineSegment(j);
        Object g = s1.intersection(s2);
        if (g == null) {
          continue;
        } else if (g instanceof CPoint) {
          CPoint p = (CPoint) g;
          if (!isSegmentBorder(s1, s2, p)) {
            return true;
          }
        }
      }
View Full Code Here

TOP

Related Classes of chunmap.model.coord.CPoint

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.