use of com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTSegmentList in project sldeditor by robward-scisys.
the class WKTPointModelTest method testPopulateWKTSegmentList.
/**
* Test method for
* {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTPointModel#setWKTType(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTType)}.
* Test method for
* {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTPointModel#populate(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTSegmentList)}.
*/
@Test
public void testPopulateWKTSegmentList() {
WKTSegmentList segmentList = new WKTSegmentList();
DirectPosition pos1 = new DirectPosition2D(1.0, 1.0);
DirectPosition pos2 = new DirectPosition2D(2.0, 2.0);
DirectPosition pos3 = new DirectPosition2D(3.0, 3.0);
DirectPosition pos4 = new DirectPosition2D(4.0, 4.0);
segmentList.addPoint(new WKTPoint(pos1));
segmentList.addPoint(new WKTPoint(pos2));
segmentList.addPoint(new WKTPoint(pos3));
segmentList.addPoint(new WKTPoint(pos4));
WKTPointModel model = new WKTPointModel();
WKTType wktType = new WKTType("name", false, 5, "", false, false);
model.setWKTType(wktType);
model.populate(null);
assertTrue(model.getRowCount() == 0);
model.populate(segmentList);
assertTrue(model.getRowCount() == 4);
model.populate(segmentList);
assertTrue(model.getRowCount() == 4);
segmentList.addPoint(new WKTPoint(pos1));
assertTrue(model.getRowCount() == 5);
// Set WKTType to null is the same as first and last points flag = false
model.setWKTType(null);
model.populate(segmentList);
assertTrue(model.getRowCount() == 5);
}
use of com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTSegmentList in project sldeditor by robward-scisys.
the class WKTSegmentListTest method testGetWktPointList.
/**
* Test method for {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTSegmentList#getWktPointList(boolean)}.
* Test method for {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTSegmentList#setWktPointList(java.util.List)}.
* Test method for {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTSegmentList#addPoint(com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTPoint)}.
* Test method for {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTSegmentList#getWKTString()}.
* Test method for {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.WKTSegmentList#getWKTString(boolean)}.
*/
@Test
public void testGetWktPointList() {
WKTSegmentList segmentList = new WKTSegmentList();
DirectPosition pos1 = new DirectPosition2D(1.0, 1.0);
segmentList.addPoint(new WKTPoint(pos1));
String actualValue = segmentList.getWKTString();
assertTrue(actualValue.compareTo("(1 1)") == 0);
List<WKTPoint> ptList = new ArrayList<WKTPoint>();
ptList.add(new WKTPoint(pos1));
DirectPosition pos2 = new DirectPosition2D(2.0, 2.0);
DirectPosition pos3 = new DirectPosition2D(3.0, 3.0);
DirectPosition pos4 = new DirectPosition2D(4.0, 4.0);
ptList.add(new WKTPoint(pos2));
ptList.add(new WKTPoint(pos3));
ptList.add(new WKTPoint(pos4));
segmentList.setWktPointList(ptList);
actualValue = segmentList.getWKTString();
assertTrue(actualValue.compareTo("(1 1, 2 2, 3 3, 4 4)") == 0);
actualValue = segmentList.getWKTString(false, false);
assertTrue(actualValue.compareTo("1 1, 2 2, 3 3, 4 4") == 0);
actualValue = segmentList.getWKTString(false, true);
assertTrue(actualValue.compareTo("1 1, 2 2, 3 3, 4 4, 1 1") == 0);
ptList.add(new WKTPoint(pos1));
segmentList.setWktPointList(ptList);
assertTrue(segmentList.getWktPointList(false).size() == ptList.size());
assertTrue((segmentList.getWktPointList(true).size() + 1) == ptList.size());
ptList.clear();
ptList.add(new WKTPoint(pos1));
assertTrue(segmentList.getWktPointList(false).size() == ptList.size());
assertTrue(segmentList.getWktPointList(true).size() == ptList.size());
segmentList.addPoint(new WKTPoint(pos2));
assertTrue(segmentList.getWktPointList(false).size() == ptList.size());
assertTrue(segmentList.getWktPointList(true).size() == ptList.size());
}
Aggregations