use of com.sldeditor.common.output.impl.SLDWriterImpl in project sldeditor by robward-scisys.
the class SLDExternalImagesTest method testGetExternalImagesLine.
/**
* Test method for {@link
* com.sldeditor.common.data.SLDExternalImages#getExternalImages(java.net.URL,
* org.geotools.styling.StyledLayerDescriptor)}.
*/
@Test
public void testGetExternalImagesLine() {
SLDWriterImpl writer = new SLDWriterImpl();
File f = new File("D:/temp/test.png");
URL url = null;
URL resourceLocator = null;
try {
url = f.toURI().toURL();
resourceLocator = new URL(f.getParentFile().toURI().toURL().toExternalForm() + "/");
} catch (MalformedURLException e) {
e.printStackTrace();
}
StyledLayerDescriptor lineSLD = createTestLine(url);
List<String> imageList = SLDExternalImages.getExternalImages(resourceLocator, lineSLD);
String result = writer.encodeSLD(resourceLocator, lineSLD);
assertTrue(checkResult(f, result, 2));
assertEquals(2, imageList.size());
}
use of com.sldeditor.common.output.impl.SLDWriterImpl in project sldeditor by robward-scisys.
the class SLDExternalImagesTest method testGetExternalImagesPoint.
/**
* Test method for {@link
* com.sldeditor.common.data.SLDExternalImages#getExternalImages(java.net.URL,
* org.geotools.styling.StyledLayerDescriptor)}.
*/
@Test
public void testGetExternalImagesPoint() {
File f = new File("D:/temp/test.png");
URL url = null;
URL resourceLocator = null;
try {
url = f.toURI().toURL();
resourceLocator = new URL(f.getParentFile().toURI().toURL().toExternalForm() + "/");
} catch (MalformedURLException e) {
e.printStackTrace();
}
StyledLayerDescriptor pointSLD = createTestPoint(url);
List<String> imageList = SLDExternalImages.getExternalImages(resourceLocator, null);
assertEquals(0, imageList.size());
imageList = SLDExternalImages.getExternalImages(resourceLocator, pointSLD);
SLDWriterImpl writer = new SLDWriterImpl();
String result = writer.encodeSLD(resourceLocator, pointSLD);
assertTrue(checkResult(f, result, 1));
assertEquals(1, imageList.size());
}
use of com.sldeditor.common.output.impl.SLDWriterImpl in project sldeditor by robward-scisys.
the class SLDWriterImplTest method testEncodeSLD.
/**
* Test method for {@link
* com.sldeditor.common.output.impl.SLDWriterImpl#encodeSLD(org.geotools.styling.StyledLayerDescriptor)}.
*/
@Test
public void testEncodeSLD() {
SLDWriterImpl writer = new SLDWriterImpl();
String result = writer.encodeSLD(null, null);
assertEquals("", result);
SLDData sldData = new SLDData(null, expectedSld);
StyledLayerDescriptor sld = SLDUtils.createSLDFromString(sldData);
// No resource locator
result = writer.encodeSLD(null, sld);
assertTrue(!result.isEmpty());
}
use of com.sldeditor.common.output.impl.SLDWriterImpl in project sldeditor by robward-scisys.
the class SLDExternalImagesTest method testGetExternalImagesPolygon.
/**
* Test method for {@link
* com.sldeditor.common.data.SLDExternalImages#getExternalImages(java.net.URL,
* org.geotools.styling.StyledLayerDescriptor)}.
*/
@Test
public void testGetExternalImagesPolygon() {
SLDWriterImpl writer = new SLDWriterImpl();
File f = new File("D:/temp/test.png");
URL url = null;
URL resourceLocator = null;
try {
url = f.toURI().toURL();
resourceLocator = new URL(f.getParentFile().toURI().toURL().toExternalForm() + "/");
} catch (MalformedURLException e) {
e.printStackTrace();
}
StyledLayerDescriptor polygonSLD = createTestPolygon(url);
List<String> imageList = SLDExternalImages.getExternalImages(resourceLocator, polygonSLD);
String result = writer.encodeSLD(resourceLocator, polygonSLD);
assertTrue(checkResult(f, result, 3));
assertEquals(3, imageList.size());
}
Aggregations