Package chunmap.model.coord

Examples of chunmap.model.coord.CPoint


    /// <param name="points"></param>
    /// <returns></returns>
    static public boolean containIn(CoordinateSeq points, CPoint point)
    {
        double arf = 0;
        CPoint p0 = null;
        for (CPoint p : points)
        {
            if (p0 == null)
            {
                p0 = p;
View Full Code Here


        else
            throw new GeometryException("notSimpleGeometry");
    }
    static private int maxPoint(CoordinateSeq points)
    {
        CPoint maxP = points.getCoordinate(0);
        int maxI = 0;
        for (int i = 1, n = points.size(); i < n; i++)
        {
            CPoint p = points.getCoordinate(i);
            if (p.compareTo(maxP) > 0)
            {
                maxP = p;
                maxI = i;
            }
        }
View Full Code Here

    //------------------------------------------------------------------------

    static public double computeArea(CoordinateSeq points)
    {
        double area = 0;
        CPoint p = points.getCoordinate(0);
        for (int i = 1, n = points.size() - 1; i < n; i++)
        {
            Triangle trian = new Triangle(p, points.getCoordinate(i), points.getCoordinate(i + 1));
            area += trian.computeArea();
        }
View Full Code Here

    static public CPoint computeCenter(CoordinateSeq points)
    {
        double xh = 0;// x的和
        double he = 0;// 权和
        double yh = 0;// y的和
        CPoint p = points.startPoint();
        for (int i = 1, n = points.size() - 1; i < n; i++)
        {
            Triangle trian = new Triangle(p, points.getCoordinate(i), points.getCoordinate(i + 1));
            CPoint center = trian.computeCenter();
            double area = trian.computeArea();
            xh += area * center.getX();
            yh += area * center.getY();
            he += area;
        }
        double x = xh / he;
        double y = yh / he;

View Full Code Here

   * @param point
   * @return
   */
  public double distance(CPoint point) {
    Line vertical = new Line(point, getVerticalK());
    CPoint crossP = crossPoint(vertical);
    return point.distance2D(crossP);
  }
View Full Code Here

    }
    return false;
  }

  public boolean join(MonotonyChain other) {
    CPoint p1 = this.getLast();
    CPoint p2 = other.getFirst();
    if (p1.getX() >= p2.getX()) {
      points.addAll(other.points);
      return true;
    }
    return false;
  }
View Full Code Here

    return new java.awt.Polygon(getXa(ls,view), getYa(ls,view), ls.size());
  }

  private void drawPoints4Line(Graphics2D g, LineString ls, Style2D style,View view) {
    for (int i = 1, n = ls.size(); i < n; i++) {
      CPoint p = ls.getPoint(i);

      int pointSize = style.getPointSize();
      double half = pointSize / 2d;

      double x = view.x2Screen(p.getX()) - half;
      double y = view.y2Screen(p.getY()) - half;

      g.setPaint(style.getPointColor());
      g.setStroke(style.getStroke());

      g.drawRect((int) x, (int) y, pointSize, pointSize);
View Full Code Here

    /// <returns></returns>
    public static CoordinateSeq subLineString(CoordinateSeq points, double start, double end)
    {
        checkArgument(points, start);
        checkArgument(points, end);
        CPoint sp = refPoint(points, start);
        CPoint ep = refPoint(points, end);
        if (start < end)
        {
            return middleLineString(points, sp, ep);
        }
        else if (start > end)
View Full Code Here

    double y = (minY + maxY) / 2d;
    return new Coordinate2D(x, y);
  }

  public Envelope transform(Transform transf) {
    CPoint p1 = transf.convert(getMinPoint());
    CPoint p2 = transf.convert(getMaxPoint());
    return new Envelope(p1, p2);
  }
View Full Code Here

    return pg;
  }
 
  public Ring toRing() {
    List<CPoint> points = new ArrayList<CPoint>();
    CPoint p1 = new Coordinate2D(minX, minY);
    CPoint p2 = new Coordinate2D(maxX, minY);
    CPoint p3 = new Coordinate2D(maxX, maxY);
    CPoint p4 = new Coordinate2D(minX, maxY);
    points.add(p1);
    points.add(p2);
    points.add(p3);
    points.add(p4);
    points.add(p1);
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.