Search in sources :

Example 11 with VendorOptionPresent

use of com.sldeditor.common.vendoroption.minversion.VendorOptionPresent in project sldeditor by robward-scisys.

the class FieldConfigMarkerShape 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);
}
Also used : VendorOptionPresent(com.sldeditor.common.vendoroption.minversion.VendorOptionPresent)

Example 12 with VendorOptionPresent

use of com.sldeditor.common.vendoroption.minversion.VendorOptionPresent in project sldeditor by robward-scisys.

the class FieldConfigWindBarbs 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);
}
Also used : VendorOptionPresent(com.sldeditor.common.vendoroption.minversion.VendorOptionPresent)

Example 13 with VendorOptionPresent

use of com.sldeditor.common.vendoroption.minversion.VendorOptionPresent in project sldeditor by robward-scisys.

the class VendorOptionManagerTest method testLoadSLDFile.

/**
 * Test method for {@link com.sldeditor.common.vendoroption.VendorOptionManager#getVendorOptionVersion()}.
 */
@Test
public void testLoadSLDFile() {
    VendorOptionManager.destroyInstance();
    PrefData prefData = PrefManager.getInstance().getPrefData();
    List<VersionData> vendorOptionList = new ArrayList<VersionData>();
    VersionData actualPrefVO = VersionData.decode(GeoServerVendorOption.class, "2.4.2");
    vendorOptionList.add(actualPrefVO);
    prefData.setVendorOptionVersionList(vendorOptionList);
    PrefManager.getInstance().setPrefData(prefData);
    SLDData sldData = new SLDData(null, null);
    StyledLayerDescriptor sld = null;
    VendorOptionManager.getInstance().addVendorOptionListener(obj);
    obj.vendorOptionVersionsList.clear();
    // No SLD Editor file, SLD is empty so it should you PrefManager default set above
    VendorOptionManager.getInstance().loadSLDFile(null, sld, sldData);
    assertEquals(1, obj.vendorOptionVersionsList.size());
    assertEquals(actualPrefVO, obj.vendorOptionVersionsList.get(0));
    // No SLD Editor file, SLD contains PointSymboliser with vendor
    // option so it should use the SLD vendor option
    obj.vendorOptionVersionsList.clear();
    sld = DefaultSymbols.createNewSLD();
    SelectedSymbol.getInstance().createNewSLD(sld);
    NamedLayer namedLayer = DefaultSymbols.createNewNamedLayer();
    String expectedNameLayerValue = "named layer test value";
    namedLayer.setName(expectedNameLayerValue);
    Style style = DefaultSymbols.createNewStyle();
    String expectedNameStyleValue = "style test value";
    style.setName(expectedNameStyleValue);
    namedLayer.addStyle(style);
    FeatureTypeStyle fts = DefaultSymbols.createNewFeatureTypeStyle();
    String expectedNameFTSValue = "feature type style test value";
    fts.setName(expectedNameFTSValue);
    style.featureTypeStyles().add(fts);
    Rule rule = DefaultSymbols.createNewRule();
    String expectedNameValue = "rule test value";
    rule.setName(expectedNameValue);
    PointSymbolizer symbolizer = DefaultSymbols.createDefaultPointSymbolizer();
    rule.symbolizers().add(symbolizer);
    fts.rules().add(rule);
    sld.layers().add(namedLayer);
    VersionData testVersionData = VersionData.decode(GeoServerVendorOption.class, "2.8.0");
    VendorOptionManager.getInstance().loadSLDFile(new GetMinimumVersionInterface() {

        @Override
        public void getMinimumVersion(Object parentObj, Object sldObj, List<VendorOptionPresent> vendorOptionsPresentList) {
            VendorOptionInfo vendorOptionInfo = new VendorOptionInfo("qgis://", new VendorOptionVersion(testVersionData.getVendorOptionType(), testVersionData), "");
            VendorOptionPresent voPresent = new VendorOptionPresent(sldObj, vendorOptionInfo);
            vendorOptionsPresentList.add(voPresent);
        }
    }, sld, sldData);
    assertEquals(1, obj.vendorOptionVersionsList.size());
    assertEquals(testVersionData, obj.vendorOptionVersionsList.get(0));
    // Now set the SLD Editor file vendor option
    obj.vendorOptionVersionsList.clear();
    List<VersionData> sldEditorVendorOptionList = new ArrayList<VersionData>();
    VersionData testVersionData2 = VersionData.decode(GeoServerVendorOption.class, "2.10.0");
    sldEditorVendorOptionList.add(testVersionData2);
    sldEditorVendorOptionList.add(VendorOptionManager.getInstance().getDefaultVendorOptionVersionData());
    sldData.setVendorOptionList(sldEditorVendorOptionList);
    sldData.setSldEditorFile(new File("."));
    VendorOptionManager.getInstance().loadSLDFile(new GetMinimumVersionInterface() {

        @Override
        public void getMinimumVersion(Object parentObj, Object sldObj, List<VendorOptionPresent> vendorOptionsPresentList) {
            VendorOptionInfo vendorOptionInfo = new VendorOptionInfo("qgis://", new VendorOptionVersion(testVersionData.getVendorOptionType(), testVersionData), "");
            VendorOptionPresent voPresent = new VendorOptionPresent(sldObj, vendorOptionInfo);
            vendorOptionsPresentList.add(voPresent);
        }
    }, sld, sldData);
    Collections.sort(obj.vendorOptionVersionsList);
    assertEquals(2, obj.vendorOptionVersionsList.size());
    assertEquals(testVersionData2, obj.vendorOptionVersionsList.get(obj.vendorOptionVersionsList.size() - 1));
    // Increase code coverage
    VendorOptionManager.getInstance().loadSLDFile(null, null, null);
}
Also used : SLDData(com.sldeditor.common.data.SLDData) PointSymbolizer(org.geotools.styling.PointSymbolizer) VendorOptionPresent(com.sldeditor.common.vendoroption.minversion.VendorOptionPresent) ArrayList(java.util.ArrayList) StyledLayerDescriptor(org.geotools.styling.StyledLayerDescriptor) PrefData(com.sldeditor.common.preferences.PrefData) VersionData(com.sldeditor.common.vendoroption.VersionData) VendorOptionVersion(com.sldeditor.common.vendoroption.VendorOptionVersion) GetMinimumVersionInterface(com.sldeditor.ui.panels.GetMinimumVersionInterface) Style(org.geotools.styling.Style) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) Rule(org.geotools.styling.Rule) NamedLayer(org.geotools.styling.NamedLayer) VendorOptionInfo(com.sldeditor.common.vendoroption.info.VendorOptionInfo) File(java.io.File) Test(org.junit.Test)

Example 14 with VendorOptionPresent

use of com.sldeditor.common.vendoroption.minversion.VendorOptionPresent in project sldeditor by robward-scisys.

the class VendorOptionUITest method testVendorOptionUI.

@Test
public void testVendorOptionUI() {
    VendorOptionUI testObj = new VendorOptionUI(new GetMinimumVersionInterface() {

        @Override
        public void getMinimumVersion(Object parentObj, Object sldObj, List<VendorOptionPresent> vendorOptionsPresentList) {
        }
    });
    testObj.createUI();
    testObj.updatedSLD(null, null);
    testObj.vendorOptionsUpdated(null);
    testObj.populate(null);
}
Also used : VendorOptionPresent(com.sldeditor.common.vendoroption.minversion.VendorOptionPresent) VendorOptionUI(com.sldeditor.common.vendoroption.minversion.VendorOptionUI) GetMinimumVersionInterface(com.sldeditor.ui.panels.GetMinimumVersionInterface) Test(org.junit.Test)

Example 15 with VendorOptionPresent

use of com.sldeditor.common.vendoroption.minversion.VendorOptionPresent in project sldeditor by robward-scisys.

the class VOGeoServerLabelling 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 TextSymbolizer) {
        TextSymbolizer textSymbolizer = (TextSymbolizer) sldObj;
        Map<String, String> options = textSymbolizer.getOptions();
        for (FieldIdEnum key : fieldMap.keySet()) {
            String vendorOptionAttributeKey = fieldMap.get(key);
            if (options.containsKey(vendorOptionAttributeKey)) {
                VendorOptionPresent voPresent = new VendorOptionPresent(sldObj, getVendorOptionInfo());
                if (!vendorOptionsPresentList.contains(voPresent)) {
                    vendorOptionsPresentList.add(voPresent);
                }
            }
        }
    }
}
Also used : VendorOptionPresent(com.sldeditor.common.vendoroption.minversion.VendorOptionPresent) TextSymbolizer(org.geotools.styling.TextSymbolizer) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum)

Aggregations

VendorOptionPresent (com.sldeditor.common.vendoroption.minversion.VendorOptionPresent)22 FeatureTypeStyle (org.geotools.styling.FeatureTypeStyle)10 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)7 StyleFactoryImpl (org.geotools.styling.StyleFactoryImpl)6 VendorOptionVersion (com.sldeditor.common.vendoroption.VendorOptionVersion)4 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)4 FeatureTypeStyleDetails (com.sldeditor.ui.detail.FeatureTypeStyleDetails)3 File (java.io.File)3 PolygonSymbolizer (org.geotools.styling.PolygonSymbolizer)3 TextSymbolizer (org.geotools.styling.TextSymbolizer)3 TextSymbolizerDetails (com.sldeditor.ui.detail.TextSymbolizerDetails)2 VOGeoServerFTSComposite (com.sldeditor.ui.detail.vendor.geoserver.featuretypestyle.VOGeoServerFTSComposite)2 GetMinimumVersionInterface (com.sldeditor.ui.panels.GetMinimumVersionInterface)2 MalformedURLException (java.net.MalformedURLException)2 Graphic (org.geotools.styling.Graphic)2 OtherText (org.geotools.styling.OtherText)2 OtherTextImpl (org.geotools.styling.OtherTextImpl)2 RasterSymbolizer (org.geotools.styling.RasterSymbolizer)2 TextSymbolizer2 (org.geotools.styling.TextSymbolizer2)2