Package chunmap.model.relate.relateop

Source Code of chunmap.model.relate.relateop.Point_LineStringTest

/**
* Copyright (c) 2009-2011, chunquedong(YangJiandong)
*
* This file is part of ChunMap project
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
*
* History:
*     2010-05-05  Jed Young  Creation
*/
package chunmap.model.relate.relateop;

import static org.junit.Assert.*;

import org.junit.Test;

import chunmap.model.geom.GeoPoint;
import chunmap.model.geom.Geometry;
import chunmap.model.geom.LineString;
import chunmap.model.geom.WktReader;
import chunmap.model.relate.ComputeImFactory;
import chunmap.model.relate.IntersectionMatrix;

public class Point_LineStringTest {

  @Test
  public void testGetIM() {
    WktReader wkt = new WktReader();
    Geometry g = wkt.read("LINESTRING(1 2,3 1,4 0,3 -2,0 0,1 2)");
    LineString ls = (LineString) g;
    GeoPoint p1 = new GeoPoint(1, 0);

    IntersectionMatrix rt = ComputeImFactory.getInstance().getImComputer(p1, ls).getIM();

    assertTrue(rt.match(IntersectionMatrix.DisjointPattern));
  }

  @Test
  public void testGetIM2() {
    WktReader wkt = new WktReader();
    Geometry g = wkt.read("LINESTRING(1 2,3 1,4 0,3 -2,0 0,1 2)");
    LineString ls = (LineString) g;
    GeoPoint p1 = new GeoPoint(0, 0);

    IntersectionMatrix rt = ComputeImFactory.getInstance().getImComputer(p1, ls).getIM();

    assertFalse(rt.match(IntersectionMatrix.DisjointPattern));
  }

  @Test
  public void testMultiPoint2LineString() {
    WktReader wkt = new WktReader();
    Geometry g = wkt.read("LINESTRING(1.0 2.0,2.0 2.0,3.0 2.0,4.0 2.0)");
    LineString ls = (LineString) g;
    GeoPoint p1 = new GeoPoint(1.0, 1.0);

    IntersectionMatrix rt = ComputeImFactory.getInstance().getImComputer(p1, ls).getIM();

    assertTrue(rt.match(IntersectionMatrix.DisjointPattern));
  }
}
TOP

Related Classes of chunmap.model.relate.relateop.Point_LineStringTest

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.