Search in sources :

Example 1 with WKTType

use of com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType in project sldeditor by robward-scisys.

the class WKTConversionTest method testCreateEmpty.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTConversion#createEmpty(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType)}.
 */
@Test
public void testCreateEmpty() {
    WKTType wktType = null;
    WKTGeometry geometry = WKTConversion.createEmpty(wktType);
    assertNull(geometry.getGeometryType());
    wktType = new WKTType("name", false, 5, "", false, true);
    geometry = WKTConversion.createEmpty(wktType);
    assertEquals(wktType, geometry.getGeometryType());
}
Also used : WKTGeometry(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry) WKTType(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType) Test(org.junit.Test)

Example 2 with WKTType

use of com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType in project sldeditor by robward-scisys.

the class WKTGeometryTest method testHashCode.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry#hashCode()}.
 */
@Test
public void testHashCode() {
    WKTGeometry g = new WKTGeometry();
    String expectedListItem = "listitem";
    WKTType wktType = new WKTType("name", false, 5, expectedListItem, false, true);
    g.setGeometryType(wktType);
    g.addNewShape();
    g.addNewShape();
    g.addNewShape();
    WKTGeometry g2 = new WKTGeometry();
    g2.setGeometryType(wktType);
    g2.addNewShape();
    g2.addNewShape();
    assertTrue(g.hashCode() != g2.hashCode());
    assertTrue(g.equals(g));
    assertFalse(g.equals(null));
    assertFalse(g.equals(expectedListItem));
    WKTGeometry g3 = new WKTGeometry();
    WKTType wktType2 = new WKTType("name", false, 5, expectedListItem, true, true);
    g3.setGeometryType(wktType2);
    g3.addNewShape();
    g3.addNewShape();
    g3.addNewShape();
    assertFalse(g.equals(g3));
}
Also used : WKTGeometry(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry) WKTType(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType) Test(org.junit.Test)

Example 3 with WKTType

use of com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType in project sldeditor by robward-scisys.

the class WKTGeometryTest method testAddNewSegment.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry#addNewSegment()}. Test
 * method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry#addNewSegment(int)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry#isEmpty()}. Test
 * method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry#getSegmentList(int)}.
 */
@Test
public void testAddNewSegment() {
    WKTGeometry g = new WKTGeometry();
    WKTType wktType = new WKTType("name", false, 5, "", false, true);
    g.setGeometryType(wktType);
    g.addNewSegment();
    assertFalse(g.isEmpty());
    assertEquals(1, g.getNoOfSegments());
    assertEquals(-1, g.addNewSegment(-3));
    assertFalse(g.isEmpty());
    assertEquals(1, g.getNoOfSegments());
    assertEquals(0, g.addNewSegment(3));
    assertFalse(g.isEmpty());
    assertEquals(2, g.getNoOfSegments());
}
Also used : WKTGeometry(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry) WKTType(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType) Test(org.junit.Test)

Example 4 with WKTType

use of com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType in project sldeditor by robward-scisys.

the class WKTConversionTest method testGetWKTTypeData.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTConversion#getWKTTypeData()}.
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTConversion#getWKTType(java.lang.String)}.
 */
@Test
public void testGetWKTTypeData() {
    String geometryType = "POLYGON";
    WKTType wktType = WKTConversion.getWKTType(geometryType);
    assertNotNull(wktType);
    List<WKTType> data = WKTConversion.getWKTTypeData();
    assertFalse(data.isEmpty());
    data = WKTConversion.getWKTTypeData();
    assertFalse(data.isEmpty());
    wktType = WKTConversion.getWKTType(geometryType);
    assertNotNull(wktType);
}
Also used : WKTType(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType) Test(org.junit.Test)

Example 5 with WKTType

use of com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType in project sldeditor by robward-scisys.

the class WKTGeometryTest method testGetGeometryType.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry#getGeometryType()}.
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry#setGeometryType(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType)}.
 */
@Test
public void testGetGeometryType() {
    WKTGeometry g = new WKTGeometry();
    WKTType wktType = new WKTType("name", false, 5, "", false, true);
    g.setGeometryType(wktType);
    assertEquals(wktType, g.getGeometryType());
}
Also used : WKTGeometry(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry) WKTType(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType) Test(org.junit.Test)

Aggregations

WKTType (com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType)8 Test (org.junit.Test)8 WKTGeometry (com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTGeometry)5 WKTPoint (com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTPoint)1 WKTPointModel (com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTPointModel)1 WKTSegmentList (com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTSegmentList)1 DirectPosition2D (org.geotools.geometry.DirectPosition2D)1 DirectPosition (org.opengis.geometry.DirectPosition)1