当前位置: 首页>>代码示例>>Java>>正文


Java CommonFactoryFinder类代码示例

本文整理汇总了Java中org.geotools.factory.CommonFactoryFinder的典型用法代码示例。如果您正苦于以下问题:Java CommonFactoryFinder类的具体用法?Java CommonFactoryFinder怎么用?Java CommonFactoryFinder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CommonFactoryFinder类属于org.geotools.factory包,在下文中一共展示了CommonFactoryFinder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testIsSameAnchorPointAnchorPoint

import org.geotools.factory.CommonFactoryFinder; //导入依赖的package包/类
/**
 * Test method for {@link com.sldeditor.ui.detail.DetailsUtilities#isSame(org.geotools.styling.AnchorPoint, org.geotools.styling.AnchorPoint)}.
 */
@Test
public void testIsSameAnchorPointAnchorPoint() {
    assertFalse(DetailsUtilities.isSame((AnchorPoint)null, (AnchorPoint)null));

    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    // Try values that are the same
    AnchorPoint anchorPoint1 = new AnchorPointImpl();
    anchorPoint1.setAnchorPointX(ff.literal(0.58));
    anchorPoint1.setAnchorPointY(ff.literal(0.1));

    AnchorPoint anchorPoint2 = new AnchorPointImpl();
    anchorPoint2.setAnchorPointX(ff.literal(0.58));
    anchorPoint2.setAnchorPointY(ff.literal("0.1"));

    assertTrue(DetailsUtilities.isSame(anchorPoint1, anchorPoint2));

    // Try values that are not the same
    AnchorPoint anchorPoint3 = new AnchorPointImpl();
    anchorPoint3.setAnchorPointX(ff.literal(1.0));
    anchorPoint3.setAnchorPointY(ff.literal(0.1));
    assertFalse(DetailsUtilities.isSame(anchorPoint1, anchorPoint3));
    assertFalse(DetailsUtilities.isSame(anchorPoint2, anchorPoint3));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:28,代码来源:DetailsUtilitiesTest.java

示例2: testExpressionUpdated

import org.geotools.factory.CommonFactoryFinder; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigBase#expressionUpdated(org.opengis.filter.expression.Expression)}.
 */
@Test
public void testExpressionUpdated() {
    FieldIdEnum expectedFieldId = FieldIdEnum.NAME;
    String expectedLabel = "test label";
    TestFieldConfigBase field = new TestFieldConfigBase(
            new FieldConfigCommonData(String.class, expectedFieldId, expectedLabel, false));

    TestUpdateSymbolInterface listener = new TestUpdateSymbolInterface();
    field.addDataChangedListener(listener);

    String expressionName = "test expression";
    assertFalse(listener.hasBeenCalled());
    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    Expression testExpression = ff.literal(expressionName);
    field.expressionUpdated(testExpression);
    assertTrue(listener.hasBeenCalled());

    assertEquals(ExpressionTypeEnum.E_EXPRESSION, field.getExpressionType());
    Expression expression = field.getExpression();
    assertTrue(expressionName.compareTo(expression.toString()) == 0);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:27,代码来源:FieldConfigBaseTest.java

示例3: testFunctionUpdated

import org.geotools.factory.CommonFactoryFinder; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigBase#functionUpdated(org.opengis.filter.expression.Expression)}.
 */
@Test
public void testFunctionUpdated() {
    FieldIdEnum expectedFieldId = FieldIdEnum.NAME;
    String expectedLabel = "test label";
    TestFieldConfigBase field = new TestFieldConfigBase(
            new FieldConfigCommonData(String.class, expectedFieldId, expectedLabel, false));

    TestUpdateSymbolInterface listener = new TestUpdateSymbolInterface();
    field.addDataChangedListener(listener);

    assertFalse(listener.hasBeenCalled());
    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    DefaultFunctionFactory functionFactory = new DefaultFunctionFactory();
    FunctionName functionName = functionFactory.getFunctionNames().get(0);

    Expression testExpression = ff.function(functionName.getFunctionName(), (Expression) null);
    field.functionUpdated(testExpression);
    assertTrue(listener.hasBeenCalled());

    assertEquals(ExpressionTypeEnum.E_FUNCTION, field.getExpressionType());
    Expression expression = field.getExpression();
    assertTrue(expression.toString().startsWith(functionName.getName()));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:29,代码来源:FieldConfigBaseTest.java

示例4: testUpdateExtent

import org.geotools.factory.CommonFactoryFinder; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.featuretypeconstraint.ExtentModel#updateExtent(org.geotools.styling.FeatureTypeConstraint)}.
 */
@Test
public void testUpdateExtent() {
    ExtentModel model = new ExtentModel(null);

    Extent[] extentArray = null;
    model.populate(extentArray);

    extentArray = new Extent[2];
    StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
    extentArray[0] = styleFactory.createExtent("extent 1", "1 1 1 1");
    extentArray[1] = styleFactory.createExtent("extent 2", "2 2 2 2");
    model.populate(extentArray);

    FeatureTypeConstraint ftc = styleFactory.createFeatureTypeConstraint("feature type name",
            Filter.INCLUDE, null);

    model.updateExtent(null);
    model.updateExtent(ftc);

    assertNotNull(ftc.getExtents());
    assertEquals(2, ftc.getExtents().length);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:27,代码来源:ExtentModelTest.java

示例5: testGetStringValue

import org.geotools.factory.CommonFactoryFinder; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#getStringValue()}.
 */
@Test
public void testGetStringValue() {

    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    ColorMapEntryImpl entry1 = new ColorMapEntryImpl();
    entry1.setColor(ff.literal("#001122"));
    entry1.setLabel("testlabel");
    entry1.setOpacity(ff.literal(0.42));
    entry1.setQuantity(ff.literal(42));
    ColorMap expectedValue = new ColorMapImpl();
    expectedValue.addColorMapEntry(entry1);
    ColorMapEntryImpl entry2 = new ColorMapEntryImpl();
    entry2.setColor(ff.literal("#551122"));
    entry2.setLabel("testlabel2");
    entry2.setOpacity(ff.literal(0.22));
    entry2.setQuantity(ff.literal(12));
    expectedValue.addColorMapEntry(entry2);

    FieldConfigColourMap field = new FieldConfigColourMap(
            new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
    field.populateField(expectedValue);

    assertTrue(field.getStringValue().compareTo(EncodeColourMap.encode(expectedValue)) == 0);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:30,代码来源:FieldConfigColourMapTest.java

示例6: createChannelSelection

import org.geotools.factory.CommonFactoryFinder; //导入依赖的package包/类
/**
 * Creates the channel selection object.
 *
 * @param styleFactory the style factory
 * @param contrastMethod the contrast method
 * @return the channel selection
 */
private ChannelSelection createChannelSelection(StyleFactoryImpl styleFactory,
        ContrastMethod contrastMethod) {
    ContrastEnhancement contrastEnhancement = (ContrastEnhancement) styleFactory
            .contrastEnhancement(null, contrastMethod.name());

    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    Map<String, Expression> options = contrastEnhancement.getOptions();
    options.put("algorithm", ff.literal("StretchToMinimumMaximum"));
    options.put("minValue", ff.literal("1"));
    options.put("maxValue", ff.literal("5"));

    SelectedChannelType channelType = styleFactory.createSelectedChannelType("channel name",
            contrastEnhancement);
    SelectedChannelType[] channels = new SelectedChannelType[3];
    channels[0] = channelType;
    channels[1] = channelType;
    channels[2] = channelType;
    ChannelSelection channelSelection = styleFactory.createChannelSelection(channels);
    return channelSelection;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:29,代码来源:VOGeoServerContrastEnhancementNormalizeGreyTest.java

示例7: createChannelSelectionError

import org.geotools.factory.CommonFactoryFinder; //导入依赖的package包/类
/**
 * Creates the channel selection error object.
 *
 * @param styleFactory the style factory
 * @param contrastMethod the contrast method
 * @return the channel selection
 */
private ChannelSelection createChannelSelectionError(StyleFactoryImpl styleFactory,
        ContrastMethod contrastMethod) {
    ContrastEnhancement contrastEnhancement = (ContrastEnhancement) styleFactory
            .contrastEnhancement(null, contrastMethod.name());

    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    Map<String, Expression> options = contrastEnhancement.getOptions();
    options.put("algorithm", ff.literal("TestStretchToMinimumMaximum"));
    options.put("minValue", ff.literal("1.0"));
    options.put("maxValue", ff.literal("5.0"));

    SelectedChannelType channelType = styleFactory.createSelectedChannelType("channel name",
            contrastEnhancement);
    SelectedChannelType[] channels = new SelectedChannelType[3];
    channels[0] = channelType;
    channels[1] = channelType;
    channels[2] = channelType;
    ChannelSelection channelSelection = styleFactory.createChannelSelection(channels);
    return channelSelection;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:29,代码来源:VOGeoServerContrastEnhancementNormalizeGreyTest.java

示例8: createChannelSelection

import org.geotools.factory.CommonFactoryFinder; //导入依赖的package包/类
/**
 * Creates the channel selection object.
 *
 * @param styleFactory the style factory
 * @param contrastMethod the contrast method
 * @return the channel selection
 */
private ChannelSelection createChannelSelection(StyleFactoryImpl styleFactory,
        ContrastMethod contrastMethod) {
    ContrastEnhancement contrastEnhancement =
            (ContrastEnhancement) styleFactory.contrastEnhancement(null, 
            contrastMethod.name());

    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    Map<String, Expression> options = contrastEnhancement.getOptions();
    options.put("algorithm", ff.literal("StretchToMinimumMaximum"));
    options.put("minValue", ff.literal("1"));
    options.put("maxValue", ff.literal("5"));

    SelectedChannelType channelType = styleFactory.createSelectedChannelType("channel name", 
            contrastEnhancement);
    SelectedChannelType[] channels = new SelectedChannelType[3];
    channels[0] = channelType;
    channels[1] = channelType;
    channels[2] = channelType;
    ChannelSelection channelSelection = styleFactory.createChannelSelection(channels);
    return channelSelection;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:30,代码来源:VOGeoServerContrastEnhancementNormalizeBlueTest.java

示例9: createChannelSelectionError

import org.geotools.factory.CommonFactoryFinder; //导入依赖的package包/类
/**
 * Creates the channel selection error object.
 *
 * @param styleFactory the style factory
 * @param contrastMethod the contrast method
 * @return the channel selection
 */
private ChannelSelection createChannelSelectionError(StyleFactoryImpl styleFactory,
        ContrastMethod contrastMethod) {
    ContrastEnhancement contrastEnhancement = 
            (ContrastEnhancement) styleFactory.contrastEnhancement(null, 
            contrastMethod.name());

    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    Map<String, Expression> options = contrastEnhancement.getOptions();
    options.put("algorithm", ff.literal("TestStretchToMinimumMaximum"));
    options.put("minValue", ff.literal("1.0"));
    options.put("maxValue", ff.literal("5.0"));

    SelectedChannelType channelType = styleFactory.createSelectedChannelType("channel name",
            contrastEnhancement);
    SelectedChannelType[] channels = new SelectedChannelType[3];
    channels[0] = channelType;
    channels[1] = channelType;
    channels[2] = channelType;
    ChannelSelection channelSelection = styleFactory.createChannelSelection(channels);
    return channelSelection;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:30,代码来源:VOGeoServerContrastEnhancementNormalizeBlueTest.java

示例10: testGetSymbolList

import org.geotools.factory.CommonFactoryFinder; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.common.data.SelectedSymbol#getSymbolList(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testGetSymbolList() {

    StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    Stroke stroke = null;
    Fill fill = styleFactory.createFill(ff.literal(DefaultSymbols.defaultColour()));
    GraphicalSymbol symbolToAdd = styleFactory.mark(ff.literal("circle"), fill, stroke);

    List<GraphicalSymbol> symbolList = SelectedSymbol.getInstance().getSymbolList(symbolToAdd);

    assertEquals(1, symbolList.size());

    assertEquals(symbolToAdd, symbolList.get(0));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:21,代码来源:SelectedSymbolTest.java

示例11: testExpressionPanelv2

import org.geotools.factory.CommonFactoryFinder; //导入依赖的package包/类
/**
 * Test method for {@link com.sldeditor.filter.v2.expression.ExpressionPanelv2#ExpressionPanelv2(java.util.List)}.
 */
@Test
public void testExpressionPanelv2() {

    TestExpressionPanelv2 testObj = new TestExpressionPanelv2(null);

    assertNull(testObj.getVendorOptionList());
    testObj.dataSourceAboutToUnloaded(null);
    testObj.populate((String) null);
    testObj.configure("title", String.class, false);

    testObj.testShowExpressionDialog(null, null);

    FilterFactory ff = CommonFactoryFinder.getFilterFactory();
    Expression expectedExpression = ff.add(ff.property("field"), ff.literal(42));
    testObj.populate(expectedExpression);
    testObj.testShowExpressionDialog(Integer.class, expectedExpression);

    assertEquals(testObj.getExpression().toString(), testObj.getExpressionString());

    testObj.dataApplied();
    testObj.testSelection();
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:26,代码来源:ExpressionPanelv2Test.java

示例12: addDeleteNewFeature

import org.geotools.factory.CommonFactoryFinder; //导入依赖的package包/类
public static void addDeleteNewFeature(SimpleFeatureType sft, FeatureStore producerFS)
        throws InterruptedException, IOException {
    SimpleFeatureBuilder builder = new SimpleFeatureBuilder(sft);
    DefaultFeatureCollection featureCollection = new DefaultFeatureCollection();
    final Random random = new Random();

    String id = "1000";

    builder.add("Antoninus"); // name
    builder.add((int) Math.round(random.nextDouble()*110)); // age
    builder.add(new Date()); // dtg
    builder.add(WKTUtils$.MODULE$.read("POINT(-1 -1)")); // geom
    SimpleFeature feature = builder.buildFeature(id);

    featureCollection.add(feature);
    producerFS.addFeatures(featureCollection);

    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
    Filter idFilter = ff.id(ff.featureId(id));
    producerFS.removeFeatures(idFilter);
}
 
开发者ID:geomesa,项目名称:geomesa-tutorials,代码行数:22,代码来源:KafkaQuickStart.java

示例13: findGeometry

import org.geotools.factory.CommonFactoryFinder; //导入依赖的package包/类
/** Finds the geometric attribute requested by the symbolizer.
 * Method copied from {@link org.geotools.renderer.lite.StreamingRenderer#findGeometry(Object, org.geotools.styling.Symbolizer)}
 *
 * @param drawMe the feature
 * @param s the symbolizer
 *
 * @return The geometry requested in the symbolizer, or the default geometry
 *         if none is specified
 */
private Geometry findGeometry(Object drawMe, AbstractSymbolizer s) {
    Expression geomExpr = s.getGeometry();

    // get the geometry
    Geometry geom;
    if(geomExpr == null) {
        if(drawMe instanceof SimpleFeature) {
            geom = (Geometry) ((SimpleFeature) drawMe).getDefaultGeometry();
        } else if (drawMe instanceof Feature) {
            geom = (Geometry) ((Feature) drawMe).getDefaultGeometryProperty().getValue();
        } else {
            geom = CommonFactoryFinder.getFilterFactory2().property("").evaluate(drawMe, Geometry.class);
        }
    } else {
        geom = geomExpr.evaluate(drawMe, Geometry.class);
    }

    return geom;
}
 
开发者ID:stefan0722,项目名称:gs-mvt,代码行数:29,代码来源:MVTWriter.java

示例14: clipToWorld

import org.geotools.factory.CommonFactoryFinder; //导入依赖的package包/类
protected Literal clipToWorld(Literal geometry) {
    if(geometry != null) {
        Geometry g = geometry.evaluate(null, Geometry.class);
        if(g != null) {
            g.apply(new GeometryComponentFilter() {
                @Override
                public void filter(Geometry geom) {
                    geom.apply(new CoordinateFilter() {
                        @Override
                        public void filter(Coordinate coord) {
                            coord.setCoordinate(new Coordinate(clipLon(coord.x),clipLat(coord.y)));
                        }
                    });
                }
            });
            geometry = CommonFactoryFinder.getFilterFactory(null).literal(g);

        }
    }

    return geometry;
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:23,代码来源:FilterToElasticHelper.java

示例15: createDefaultLineFeatureTypeStyle

import org.geotools.factory.CommonFactoryFinder; //导入依赖的package包/类
private FeatureTypeStyle createDefaultLineFeatureTypeStyle(String strokeWidth, String strokeColor, String opacity){		
	StyleFactory sf = CommonFactoryFinder.getStyleFactory(new Hints(Hints.KEY_RENDERING, Hints.VALUE_RENDER_SPEED));
	FilterFactory filterFactory = new FilterFactoryImpl();

	Stroke lineStroke = sf.getDefaultStroke();
       lineStroke.setWidth(filterFactory.literal(new Integer(strokeWidth)));
       lineStroke.setColor(filterFactory.literal(strokeColor));
       lineStroke.setOpacity(filterFactory.literal(opacity));
       
       LineSymbolizer lineSymbolizer = sf.createLineSymbolizer();
       lineSymbolizer.setStroke(lineStroke);
       
       Rule lineRule = sf.createRule();
       lineRule.symbolizers().add(lineSymbolizer);
       FeatureTypeStyle lineFeatureTypeStyle = sf.createFeatureTypeStyle(new Rule[]{lineRule});
       
       return lineFeatureTypeStyle;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:19,代码来源:LayerFactory.java


注:本文中的org.geotools.factory.CommonFactoryFinder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。