use of com.sldeditor.common.vendoroption.minversion.VendorOptionPresent in project sldeditor by robward-scisys.
the class VOGeoServerFTSRuleEvaluation method getMinimumVersion.
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.iface.PopulateDetailsInterface#getMinimumVersion(java.lang.Object,
* java.util.List)
*/
@Override
public void getMinimumVersion(Object parentObj, Object sldObj, List<VendorOptionPresent> vendorOptionsPresentList) {
if (sldObj instanceof FeatureTypeStyle) {
FeatureTypeStyle fts = (FeatureTypeStyle) sldObj;
Map<String, String> options = fts.getOptions();
if (options.containsKey(FeatureTypeStyle.KEY_EVALUATION_MODE)) {
VendorOptionPresent voPresent = new VendorOptionPresent(sldObj, getVendorOptionInfo());
vendorOptionsPresentList.add(voPresent);
}
}
}
use of com.sldeditor.common.vendoroption.minversion.VendorOptionPresent in project sldeditor by robward-scisys.
the class VOGeoServerFTSSortBy method getMinimumVersion.
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.iface.PopulateDetailsInterface#getMinimumVersion(java.lang.Object,
* java.util.List)
*/
@Override
public void getMinimumVersion(Object parentObj, Object sldObj, List<VendorOptionPresent> vendorOptionsPresentList) {
if (sldObj instanceof FeatureTypeStyle) {
FeatureTypeStyle fts = (FeatureTypeStyle) sldObj;
Map<String, String> options = fts.getOptions();
if (options.containsKey(FeatureTypeStyle.SORT_BY) || options.containsKey(FeatureTypeStyle.SORT_BY_GROUP)) {
VendorOptionPresent voPresent = new VendorOptionPresent(sldObj, getVendorOptionInfo());
vendorOptionsPresentList.add(voPresent);
}
}
}
use of com.sldeditor.common.vendoroption.minversion.VendorOptionPresent in project sldeditor by robward-scisys.
the class FieldConfigMarkerQGIS method getMinimumVersion.
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.detail.config.symboltype.FieldState#getMinimumVersion(java.lang.Object, java.util.List)
*/
@Override
public void getMinimumVersion(Object parentObj, Object sldObj, List<VendorOptionPresent> vendorOptionsPresentList) {
VendorOptionPresent voPresent = new VendorOptionPresent(sldObj, getVendorOptionInfo());
vendorOptionsPresentList.add(voPresent);
}
use of com.sldeditor.common.vendoroption.minversion.VendorOptionPresent in project sldeditor by robward-scisys.
the class VOGeoServerTextSpacingTest method testVOGeoServerTextSpacingTest.
/**
* Test method for
* {@link com.sldeditor.ui.detail.vendor.geoserver.text.VOGeoServerTextSpacingTest#VOGeoServerTextSpacingTest(java.lang.Class, com.sldeditor.filter.v2.function.FunctionNameInterface)}.
*/
@Test
public void testVOGeoServerTextSpacingTest() {
TextSymbolizerDetails panel = new TextSymbolizerDetails();
TextSymbolizer2 textSymbolizer = null;
VOGeoServerTextSpacing testObj = new VOGeoServerTextSpacing(panel.getClass());
testObj.setParentPanel(panel);
testObj.populate(textSymbolizer);
testObj.updateSymbol(textSymbolizer);
StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
textSymbolizer = (TextSymbolizer2) styleFactory.createTextSymbolizer();
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
Literal featureDescription = ff.literal("feature description");
textSymbolizer.setFeatureDescription(featureDescription);
OtherText otherText = new OtherTextImpl();
otherText.setTarget("target");
Literal otherTextExpression = ff.literal("other text");
otherText.setText(otherTextExpression);
textSymbolizer.setOtherText(otherText);
Literal snippet = ff.literal("snippet");
textSymbolizer.setSnippet(snippet);
// Try with marker symbol
Graphic graphic = styleFactory.createDefaultGraphic();
graphic.graphicalSymbols().add(styleFactory.createMark());
textSymbolizer.setGraphic(graphic);
Controller.getInstance().setPopulating(true);
testObj.populate(textSymbolizer);
Controller.getInstance().setPopulating(false);
testObj.updateSymbol(textSymbolizer);
// Try with external graphic
graphic = styleFactory.createDefaultGraphic();
try {
graphic.graphicalSymbols().add(styleFactory.createExternalGraphic(new File("test.png").toURI().toURL(), "png"));
} catch (MalformedURLException e) {
e.printStackTrace();
}
textSymbolizer.setGraphic(graphic);
textSymbolizer.getOptions().put("wordSpacing", String.valueOf(42));
textSymbolizer.getOptions().put("charSpacing", String.valueOf(21));
Controller.getInstance().setPopulating(true);
testObj.populate(textSymbolizer);
Controller.getInstance().setPopulating(false);
testObj.updateSymbol(textSymbolizer);
// Find minimum version with textSymbolizer2 values set
List<VendorOptionPresent> vendorOptionsPresentList = new ArrayList<VendorOptionPresent>();
testObj.getMinimumVersion(null, textSymbolizer, vendorOptionsPresentList);
assertEquals(2, vendorOptionsPresentList.size());
// Find minimum version with no textSymbolizer2 values set
vendorOptionsPresentList.clear();
testObj.getMinimumVersion(null, styleFactory.createTextSymbolizer(), vendorOptionsPresentList);
assertEquals(0, vendorOptionsPresentList.size());
// Get the code coverage values up
testObj.populate(SelectedSymbol.getInstance());
PolygonSymbolizer polygon = null;
testObj.populate(polygon);
testObj.updateSymbol(polygon);
FeatureTypeStyle fts = null;
testObj.populate(fts);
testObj.updateSymbol(fts);
RasterSymbolizer raster = null;
testObj.populate(raster);
testObj.updateSymbol(raster);
testObj.preLoadSymbol();
assertTrue(testObj.isDataPresent());
}
use of com.sldeditor.common.vendoroption.minversion.VendorOptionPresent in project sldeditor by robward-scisys.
the class VOGeoServerFTSCompositeTest method testVOGeoServerFTSComposite.
/**
* Test method for
* {@link com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSComposite#VOGeoServerFTSComposite(java.lang.Class)}.
*/
@Test
public void testVOGeoServerFTSComposite() {
Class<FeatureTypeStyleDetails> panelId = FeatureTypeStyleDetails.class;
VOGeoServerFTSComposite obj = new VOGeoServerFTSComposite(panelId);
assertEquals(panelId, obj.getPanelId());
assertNotNull(obj.getFieldDataManager());
assertNotNull(obj.getPanel());
assertTrue(obj.isDataPresent());
assertNotNull(obj.getVendorOptionInfo());
// Check getVendorOptionVersion
VendorOptionVersion vendorOption = obj.getVendorOption();
assertEquals(GeoServerVendorOption.class, vendorOption.getClassType());
String actualVersionString = vendorOption.getEarliest().getVersionString();
String expectedVersionString = "2.7.0";
assertEquals(expectedVersionString, actualVersionString);
obj.setParentPanel(null);
assertNull(obj.getParentPanel());
obj.preLoadSymbol();
List<VendorOptionPresent> vendorOptionsPresentList = new ArrayList<VendorOptionPresent>();
String testString = "test";
obj.getMinimumVersion(null, testString, vendorOptionsPresentList);
assertTrue(vendorOptionsPresentList.isEmpty());
StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
obj.getMinimumVersion(null, fts, vendorOptionsPresentList);
assertEquals(0, vendorOptionsPresentList.size());
// Valid string
String expectedValue = "copy,0.42";
fts.getOptions().put(FeatureTypeStyle.COMPOSITE, expectedValue);
obj.getMinimumVersion(null, fts, vendorOptionsPresentList);
assertEquals(1, vendorOptionsPresentList.size());
obj.populate(fts);
obj.updateSymbol(fts);
String actualValue = fts.getOptions().get(FeatureTypeStyle.COMPOSITE);
assertEquals(actualValue, expectedValue);
// No opacity
expectedValue = "source-in";
fts.getOptions().put(FeatureTypeStyle.COMPOSITE, expectedValue);
obj.populate(fts);
obj.updateSymbol(fts);
actualValue = fts.getOptions().get(FeatureTypeStyle.COMPOSITE);
assertEquals(actualValue, expectedValue);
// Invalid string
expectedValue = "invalid";
fts.getOptions().put(FeatureTypeStyle.COMPOSITE, expectedValue);
obj.populate(fts);
obj.updateSymbol(fts);
actualValue = fts.getOptions().get(FeatureTypeStyle.COMPOSITE);
assertEquals(actualValue, "copy");
// Increase code coverage
obj.populate((PolygonSymbolizer) null);
obj.updateSymbol((PolygonSymbolizer) null);
obj.populate((RasterSymbolizer) null);
obj.updateSymbol((RasterSymbolizer) null);
obj.populate((TextSymbolizer) null);
obj.updateSymbol((TextSymbolizer) null);
obj.populate((SelectedSymbol) null);
obj.dataChanged(FieldIdEnum.VO_FTS_COMPOSITE_OPACITY);
}
Aggregations