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


Java Classifier类代码示例

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


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

示例1: setUpClass

import org.geotools.filter.function.Classifier; //导入依赖的package包/类
/**
 * Sets the up class.
 */
@BeforeClass
public static void setUpClass() {
    typeMap.put(Number.class, FieldConfigDouble.class);
    typeMap.put(Double.class, FieldConfigDouble.class);
    typeMap.put(Float.class, FieldConfigDouble.class);
    typeMap.put(Integer.class, FieldConfigInteger.class);
    typeMap.put(Long.class, FieldConfigInteger.class);
    typeMap.put(String.class, FieldConfigString.class);
    typeMap.put(Object.class, FieldConfigString.class);
    typeMap.put(Boolean.class, FieldConfigBoolean.class);
    typeMap.put(Geometry.class, FieldConfigGeometry.class);
    typeMap.put(org.opengis.geometry.Geometry.class, FieldConfigGeometry.class);
    typeMap.put(LineString.class, FieldConfigGeometry.class);
    typeMap.put(Date.class, FieldConfigDate.class);
    typeMap.put(Class.class, FieldConfigString.class);
    typeMap.put(Color.class, FieldConfigColour.class);
    typeMap.put(Classifier.class, FieldConfigString.class);
    typeMap.put(Unit.class, FieldConfigMapUnits.class);
    typeMap.put(Comparable.class, FieldConfigString.class);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:24,代码来源:FilterManagerTest.java

示例2: classiferExample

import org.geotools.filter.function.Classifier; //导入依赖的package包/类
public void classiferExample() {
    SimpleFeatureCollection collection = null;
    SimpleFeature feature = null;
    // classiferExample start
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
    Function classify = ff.function("Quantile", ff.property("name"), ff.literal(2));
    
    Classifier groups = (Classifier) classify.evaluate(collection);
    // classiferExample end
    // classiferExample2 start
    groups.setTitle(0, "Group A");
    groups.setTitle(1, "Group B");
    // classiferExample2 end
    
    // classiferExample3 start
    // groups is a classifier with "Group A" and "Group B"
    Function sort = ff.function("classify", ff.property("name"), ff.literal(groups));
    int slot = (Integer) sort.evaluate(feature);
    
    System.out.println(groups.getTitle(slot)); // ie. "Group A"
    // classiferExample3 end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:23,代码来源:BrewerExamples.java

示例3: explicitClassifierExample

import org.geotools.filter.function.Classifier; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public void explicitClassifierExample() {
    // explicitClassifierExample start
    Set[] zones = new Set[3];
    // urban commercial or residencial
    zones[0] = new HashSet(Arrays.asList(new String[] { "Zone 1", "Zone 2", }));
    // municipal or crown parkland
    zones[1] = new HashSet(Arrays.asList(new String[] { "Zone 4", "Crown 2", }));
    // industrial
    zones[2] = new HashSet(Arrays.asList(new String[] { "Zone 3" }));
    
    Classifier landuse = new ExplicitClassifier(zones);
    landuse.setTitle(0, "urban");
    landuse.setTitle(1, "park");
    landuse.setTitle(2, "industrial");
    // explicitClassifierExample end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:18,代码来源:BrewerExamples.java

示例4: classiferQuantile

import org.geotools.filter.function.Classifier; //导入依赖的package包/类
public void classiferQuantile() {
    SimpleFeatureCollection collection = null;
    SimpleFeature feature = null;
    // classiferQuantile start
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
    Function classify = ff.function("Quantile", ff.property("zone"), ff.literal(2));
    
    // Zones assigned by a municipal board do not have an intrinsic numerical
    // meaning making them suitable for display using:
    // - qualitative palette where each zone would have the same visual impact
    Classifier groups = (Classifier) classify.evaluate(collection);
    // classiferQuantile end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:14,代码来源:BrewerExamples.java

示例5: classiferEqualInterval

import org.geotools.filter.function.Classifier; //导入依赖的package包/类
public void classiferEqualInterval() {
    SimpleFeatureCollection collection = null;
    SimpleFeature feature = null;
    // classiferEqualInterval start
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
    Function classify = ff.function("EqualInterval", ff.property("height"), ff.literal(5));
    
    // this will create a nice smooth series of intervals suitable for presentation
    // with:
    // - sequential color palette to make each height blend smoothly into the next
    // - diverging color palettes if you want to make higher and lower areas stand out more
    Classifier height = (Classifier) classify.evaluate(collection);
    // classiferEqualInterval end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:15,代码来源:BrewerExamples.java

示例6: rangedClassifierExample

import org.geotools.filter.function.Classifier; //导入依赖的package包/类
public void rangedClassifierExample() {
    // rangedClassifierExample start
    Comparable min[] = new Comparable[25];
    Comparable max[] = new Comparable[25];
    for (int i = 0; i < 25; i++) {
        min[i] = (char) ('A' + i);
        max[i] = (char) ('B' + i);
    }
    Classifier alphabetical = new RangedClassifier(min, max);
    // rangedClassifierExample end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:12,代码来源:BrewerExamples.java

示例7: colorBrewerExample

import org.geotools.filter.function.Classifier; //导入依赖的package包/类
void colorBrewerExample(SimpleFeatureCollection featureCollection) {
    // colorBrewerExample start
    // STEP 0 Set up Color Brewer
    ColorBrewer brewer = ColorBrewer.instance();
    
    // STEP 1 - call a classifier function to summarise your content
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
    PropertyName propteryExpression = ff.property("height");
    
    // classify into five categories
    Function classify = ff.function("Quantile", propteryExpression, ff.literal(5));
    Classifier groups = (Classifier) classify.evaluate(featureCollection);
    
    // STEP 2 - look up a predefined palette from color brewer
    String paletteName = "GrBu";
    Color[] colors = brewer.getPalette(paletteName).getColors(5);
    
    // STEP 3 - ask StyleGenerator to make a set of rules for the Classifier
    // assigning features the correct color based on height
    FeatureTypeStyle style = StyleGenerator.createFeatureTypeStyle(
            groups,
            propteryExpression,
            colors,
            "Generated FeatureTypeStyle for GreeBlue",
            featureCollection.getSchema().getGeometryDescriptor(),
            StyleGenerator.ELSEMODE_IGNORE,
            0.95,
            null);
    // colorBrewerExample end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:31,代码来源:BrewerExamples.java

示例8: initialise

import org.geotools.filter.function.Classifier; //导入依赖的package包/类
/**
 * Initialise.
 */
private static void initialise() {
    List<Class<?>> doubleList = new ArrayList<Class<?>>(
            Arrays.asList(Integer.class, Long.class, Double.class, Float.class));
    List<Class<?>> integerList = new ArrayList<Class<?>>(
            Arrays.asList(Integer.class, Long.class));
    List<Class<?>> stringList = new ArrayList<Class<?>>(Arrays.asList(String.class));
    List<Class<?>> geometryList = new ArrayList<Class<?>>(
            Arrays.asList(Point.class, LineString.class, Polygon.class, MultiPolygon.class,
                    MultiPoint.class, MultiLineString.class, GridCoverage2D.class));
    List<Class<?>> lineStringList = new ArrayList<Class<?>>(
            Arrays.asList(LineString.class, MultiLineString.class));
    List<Class<?>> pointList = new ArrayList<Class<?>>(
            Arrays.asList(Point.class, MultiPoint.class));
    List<Class<?>> linearRingList = new ArrayList<Class<?>>(Arrays.asList(LinearRing.class));
    List<Class<?>> rangedClassifierList = new ArrayList<Class<?>>(
            Arrays.asList(RangedClassifier.class));
    List<Class<?>> classifierList = new ArrayList<Class<?>>(Arrays.asList(Classifier.class));
    List<Class<?>> rasterGeometryList = new ArrayList<Class<?>>(
            Arrays.asList(GridCoverage2D.class));
    List<Class<?>> referencedEnvelopeList = new ArrayList<Class<?>>(
            Arrays.asList(ReferencedEnvelope.class));

    allowedClassTypeMap.put(String.class, stringList);
    allowedClassTypeMap.put(Double.class, doubleList);
    allowedClassTypeMap.put(Float.class, doubleList);
    allowedClassTypeMap.put(Integer.class, integerList);
    allowedClassTypeMap.put(Long.class, integerList);
    allowedClassTypeMap.put(Geometry.class, geometryList);
    allowedClassTypeMap.put(LineString.class, lineStringList);
    allowedClassTypeMap.put(Point.class, pointList);
    allowedClassTypeMap.put(LinearRing.class, linearRingList);
    allowedClassTypeMap.put(RangedClassifier.class, rangedClassifierList);
    allowedClassTypeMap.put(Classifier.class, classifierList);
    allowedClassTypeMap.put(GridCoverage2D.class, rasterGeometryList);
    allowedClassTypeMap.put(ReferencedEnvelope.class, referencedEnvelopeList);

    List<Class<?>> objectList = new ArrayList<Class<?>>();
    objectList.addAll(doubleList);
    objectList.addAll(integerList);
    objectList.addAll(stringList);
    objectList.addAll(geometryList);
    objectList.addAll(lineStringList);
    objectList.addAll(rasterGeometryList);
    objectList.addAll(referencedEnvelopeList);
    allowedClassTypeMap.put(Object.class, objectList);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:50,代码来源:AllowedAttributeTypes.java

示例9: initialise

import org.geotools.filter.function.Classifier; //导入依赖的package包/类
/**
 * Initialise.
 */
private void initialise() {
    List<FilterConfigInterface> filterConfigList = getFilterConfigList();

    filterNameList = new ArrayList<FilterName>();

    for (FilterConfigInterface filterConfig : filterConfigList) {
        filterNameList.add(filterConfig.getFilterConfiguration());
        String key = filterConfig.getFilterConfiguration().getFilterName();
        filterMap.put(key, filterConfig);
        filterTypeMap.put(filterConfig.getFilterClass(), filterConfig);
    }

    List<Class<?>> classList = new ArrayList<Class<?>>();

    Logger logger = Logger.getLogger(getClass());

    for (FilterName function : filterNameList) {
        logger.debug(function.getFilterName());

        functionNameMap.put(function.getFilterName(), function);

        for (FilterNameParameter parameter : function.getParameterList()) {
            if (!classList.contains(parameter.getDataType())) {
                classList.add(parameter.getDataType());
            }
            logger.debug("\t" + parameter.getName() + "\t" + parameter.getDataType().getName());
        }

        if (!classList.contains(function.getReturnType())) {
            classList.add(function.getReturnType());
        }
        logger.debug("\tRet : " + function.getReturnType().getName());
    }

    logger.debug("\nClasses");
    for (Class<?> className : classList) {
        logger.debug(className.getName());
    }

    //CHECKSTYLE:OFF
    Class<?>[] allowedNumberTypes = { Number.class, Double.class, Float.class, Integer.class,
            Long.class };
    Class<?>[] allowedDoubleTypes = { Number.class, Double.class, Float.class, Integer.class,
            Long.class };
    Class<?>[] allowedFloatTypes = { Number.class, Double.class, Float.class, Integer.class,
            Long.class };
    Class<?>[] allowedIntegerTypes = { Number.class, Double.class, Float.class, Integer.class,
            Long.class };
    Class<?>[] allowedLongTypes = { Number.class, Double.class, Float.class, Integer.class,
            Long.class };
    Class<?>[] allowedBooleanTypes = { Boolean.class };
    Class<?>[] allowedStringTypes = { String.class };
    Class<?>[] allowedGeometryTypes = { Geometry.class, LineString.class, Point.class,
            MultiPoint.class, LinearRing.class };
    Class<?>[] allowedDateTypes = { Date.class };
    Class<?>[] allowedClassifierTypes = { RangedClassifier.class, Classifier.class };
    Class<?>[] allowedUnitTypes = { Unit.class };
    Class<?>[] allowedComparableTypes = { Number.class, Double.class, Float.class,
            Integer.class, Long.class, Date.class, String.class, Boolean.class };
    //CHECKSTYLE:ON

    populateAllowedTypes(Number.class, allowedNumberTypes);
    populateAllowedTypes(Double.class, allowedDoubleTypes);
    populateAllowedTypes(Float.class, allowedFloatTypes);
    populateAllowedTypes(Integer.class, allowedIntegerTypes);
    populateAllowedTypes(Long.class, allowedLongTypes);
    populateAllowedTypes(Boolean.class, allowedBooleanTypes);
    populateAllowedTypes(String.class, allowedStringTypes);
    populateAllowedTypes(Geometry.class, allowedGeometryTypes);
    populateAllowedTypes(org.opengis.geometry.Geometry.class, allowedGeometryTypes);
    populateAllowedTypes(Date.class, allowedDateTypes);
    populateAllowedTypes(Classifier.class, allowedClassifierTypes);
    populateAllowedTypes(Unit.class, allowedUnitTypes);
    populateAllowedTypes(Comparable.class, allowedComparableTypes);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:79,代码来源:FilterManager.java

示例10: initialise

import org.geotools.filter.function.Classifier; //导入依赖的package包/类
/**
 * Initialise.
 */
private void initialise() {
    functionNameList = functionFactory.getFunctionNames();
    List<Class<?>> classList = new ArrayList<Class<?>>();

    Logger logger = Logger.getLogger(getClass());

    for (FunctionName function : functionNameList) {
        logger.debug(function.getName());

        functionNameMap.put(function.getName(), function);

        for (int index = 0; index < function.getArgumentCount(); index++) {
            if (!classList.contains(function.getArguments().get(index).getType())) {
                classList.add(function.getArguments().get(index).getType());
            }
            logger.debug("\t" + function.getArgumentNames().get(index) + "\t"
                    + function.getArguments().get(index).getType().getName() + "\t"
                    + function.getArguments().get(index).getMinOccurs() + "\t"
                    + function.getArguments().get(index).getMaxOccurs());
        }

        if (!classList.contains(function.getReturn().getType())) {
            classList.add(function.getReturn().getType());
        }
        logger.debug("\tRet : " + function.getReturn().getType().getName());
    }

    logger.debug("\nClasses");
    for (Class<?> className : classList) {
        logger.debug(className.getName());
    }

    //CHECKSTYLE:OFF
    Class<?>[] allowedNumberTypes = { Number.class, Double.class, Float.class, Integer.class,
            Long.class, Object.class };
    Class<?>[] allowedDoubleTypes = { Number.class, Double.class, Float.class, Integer.class,
            Long.class, Object.class };
    Class<?>[] allowedFloatTypes = { Number.class, Double.class, Float.class, Integer.class,
            Long.class, Object.class };
    Class<?>[] allowedIntegerTypes = { Number.class, Double.class, Float.class, Integer.class,
            Long.class, Object.class };
    Class<?>[] allowedLongTypes = { Number.class, Double.class, Float.class, Integer.class,
            Long.class, Object.class };
    Class<?>[] allowedBooleanTypes = { Boolean.class, Object.class };
    Class<?>[] allowedStringTypes = { String.class, Object.class };
    Class<?>[] allowedGeometryTypes = { Geometry.class, LineString.class, Point.class,
            MultiPoint.class, LinearRing.class, Object.class };
    Class<?>[] allowedDateTypes = { Date.class, Object.class };
    Class<?>[] allowedClassifierTypes = { RangedClassifier.class, Classifier.class,
            Object.class };
    Class<?>[] allowedBBoxTypes = { ReferencedEnvelope.class, Geometry.class };
    Class<?>[] allowedObjectTypes = { Number.class, Double.class, Float.class, Integer.class,
            Long.class, Boolean.class, String.class, Date.class, Geometry.class,
            LineString.class, Point.class, MultiPoint.class, LinearRing.class,
            RangedClassifier.class, Classifier.class, ReferencedEnvelope.class, Object.class };
    //CHECKSTYLE:ON

    populateAllowedTypes(Number.class, allowedNumberTypes);
    populateAllowedTypes(Double.class, allowedDoubleTypes);
    populateAllowedTypes(Float.class, allowedFloatTypes);
    populateAllowedTypes(Integer.class, allowedIntegerTypes);
    populateAllowedTypes(Long.class, allowedLongTypes);
    populateAllowedTypes(Boolean.class, allowedBooleanTypes);
    populateAllowedTypes(String.class, allowedStringTypes);
    populateAllowedTypes(Geometry.class, allowedGeometryTypes);
    populateAllowedTypes(Date.class, allowedDateTypes);
    populateAllowedTypes(Classifier.class, allowedClassifierTypes);
    populateAllowedTypes(ReferencedEnvelope.class, allowedBBoxTypes);
    populateAllowedTypes(Object.class, allowedObjectTypes);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:74,代码来源:FunctionManager.java


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