org.opengis.filter.expression.Function.getName()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中org.opengis.filter.expression.Function.getName()方法的一些代码示例,展示了Function.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Function.getName()方法的具体详情如下:
包路径:org.opengis.filter.expression.Function
类名称:Function
方法名:getName

Function.getName介绍

[英]Returns the name of the function to be called. For example, this might be " cos" or " atan2".

You can use this name to look up the number of required parameters in a FilterCapabilities data structure. For the specific meaning of the required parameters you will need to consult the documentation.
[中]返回要调用的函数的名称。例如,这可能是“cos”或“atan2”。
您可以使用此名称在FilterCapabilities数据结构中查找所需参数的数量。有关所需参数的具体含义,您需要查阅文档。

代码示例

代码示例来源:origin: geotools/geotools

/**
 * Maps the function to the native database function name
 *
 * @param function
 * @return
 */
protected String getFunctionName(Function function) {
  return function.getName();
}

代码示例来源:origin: geotools/geotools

public String getName() {
  return delegate.getName();
}

代码示例来源:origin: geotools/geotools

public Object getProperty(Object object, QName name) throws Exception {
    Function function = (Function) object;

    // <xsd:element maxOccurs="unbounded" minOccurs="0" ref="ogc:expression"/>
    if ("expression".equals(name.getLocalPart())) {
      return function.getParameters();
    }

    // <xsd:attribute name="name" type="xsd:string" use="required"/>
    if ("name".equals(name.getLocalPart())) {
      return function.getName();
    }

    return null;
  }
}

代码示例来源:origin: geotools/geotools

Expression getParameter(Function function, int idx, boolean mandatory) {
  final List<Expression> params = function.getParameters();
  if (params == null || params.size() <= idx) {
    if (mandatory) {
      throw new IllegalArgumentException(
          "Missing parameter number "
              + (idx + 1)
              + "for function "
              + function.getName()
              + ", cannot encode in SQL");
    }
  }
  return params.get(idx);
}

代码示例来源:origin: geotools/geotools

public static Map loadFunctionNameMap() {
  functionNameMap = new HashMap();
  functionNameMap.put("", NO_OP_CAPS);
  Iterator<Function> functions = CommonFactoryFinder.getFunctions(null).iterator();
  while (functions.hasNext()) {
    Function exp = functions.next();
    functionNameMap.put(
        exp.getName().toLowerCase(), new FilterCapabilities(exp.getClass()));
  }
  return functionNameMap;
}

代码示例来源:origin: geotools/geotools

public FunctionBuilder reset(Function original) {
  name = original.getName();
  args.clear();
  args.addAll(original.getParameters());
  literal.reset(original.getFallbackValue());
  return this;
}

代码示例来源:origin: geotools/geotools

public Object visit(Function expression, Object extraData) {
  String type = (String) "Function";
  AttributesImpl atts = new AttributesImpl();
  atts.addAttribute("", "name", "name", "", expression.getName());
  start(type, atts);
  for (org.opengis.filter.expression.Expression parameter : expression.getParameters()) {
    parameter.accept(this, extraData);
  }
  end(type);
  return extraData;
}

代码示例来源:origin: geotools/geotools

public Object visit(Function function, Object extraData) {
  ScalarCapabilities scalar = capabilities.getScalarCapabilities();
  if (scalar == null) return false;
  ArithmeticOperators operators = scalar.getArithmeticOperators();
  if (operators == null) return false;
  Functions functions = operators.getFunctions();
  if (functions == null) return false;
  // Note that only function name is checked here
  FunctionName found = functions.getFunctionName(function.getName());
  // And that's enough to assess if the function is supported
  return found != null;
}

代码示例来源:origin: geotools/geotools

public Object visit(Function function, Object extraData) {
  ScalarCapabilities scalar = capabilities.getScalarCapabilities();
  if (scalar == null) return false;
  ArithmeticOperators operators = scalar.getArithmeticOperators();
  if (operators == null) return false;
  Functions functions = operators.getFunctions();
  if (functions == null) return false;
  // Note that only function name is checked here
  FunctionName found = functions.getFunctionName(function.getName());
  // And that's enough to assess if the function is supported
  return found != null;
}

代码示例来源:origin: geotools/geotools

@Test
public void testGetName() {
  assertEquals("getID", idExpr.getName());
}

代码示例来源:origin: geotools/geotools

/** Test of getName method, of class org.geotools.filter.functions.EqualIntervalFunction. */
public void testInstance() {
  Function equInt =
      ff.function("EqualInterval", org.opengis.filter.expression.Expression.NIL);
  assertNotNull(equInt);
  assertEquals("test get name", "EqualInterval", equInt.getName());
}

代码示例来源:origin: geotools/geotools

public void testGetName() {
  Function equInt =
      ff.function("StandardDeviation", ff.literal(FeatureCollections.newCollection()));
  LOGGER.finer("testGetName");
  assertEquals("StandardDeviation", equInt.getName());
}

代码示例来源:origin: geotools/geotools

/** Test of getName method, of class org.geotools.filter.functions.UniqueIntervalFunction. */
public void testGetName() {
  Function equInt = ff.function("UniqueInterval", ff.literal(featureCollection));
  assertEquals("UniqueInterval", equInt.getName());
}

代码示例来源:origin: geotools/geotools

public void testParse() throws Exception {
  FilterMockData.function(document, document);
  Function function = (Function) parse();
  assertEquals("min", function.getName());
  assertEquals(2, function.getParameters().size());
}

代码示例来源:origin: geotools/geotools

public void testGetName() {
  Function qInt = ff.function("Jenks", ff.literal(FeatureCollections.newCollection()));
  assertEquals("Jenks", qInt.getName());
}

代码示例来源:origin: geotools/geotools

public void testCatenateTwo() {
  Literal l = ff.literal("http://test?param=");
  PropertyName pn = ff.property("intAttribute");
  Expression cat = ExpressionExtractor.catenateExpressions(Arrays.asList(l, pn));
  assertTrue(cat instanceof Function);
  Function f = (Function) cat;
  assertEquals("Concatenate", f.getName());
  assertEquals(l, f.getParameters().get(0));
  assertEquals(pn, f.getParameters().get(1));
}

代码示例来源:origin: geotools/geotools

public void testGetName() {
  Function qInt = ff.function("Quantile", ff.literal(new DefaultFeatureCollection()));
  assertEquals("Quantile", qInt.getName());
}

代码示例来源:origin: geotools/geotools

public void testCatenateThree() {
    Literal l1 = ff.literal("http://test?param=");
    PropertyName pn = ff.property("intAttribute");
    Literal l2 = ff.literal("&param2=foo");
    Expression cat = ExpressionExtractor.catenateExpressions(Arrays.asList(l1, pn, l2));
    assertTrue(cat instanceof Function);
    Function f = (Function) cat;
    assertEquals("Concatenate", f.getName());
    assertEquals(l1, f.getParameters().get(0));
    assertEquals(pn, f.getParameters().get(1));
    assertEquals(l2, f.getParameters().get(2));
  }
}

代码示例来源:origin: geotools/geotools

@Test
public void testFilterFunctionNoMarker() throws Exception {
  String yaml = "rules: \n" + "- filter: strEndsWith(foo,'bar') = true\n";
  StyledLayerDescriptor sld = Ysld.parse(yaml);
  Rule r = SLD.defaultStyle(sld).featureTypeStyles().get(0).rules().get(0);
  PropertyIsEqualTo f = (PropertyIsEqualTo) r.getFilter();
  Function func = (Function) f.getExpression1();
  assertEquals("strEndsWith", func.getName());
  assertTrue(func.getParameters().get(0) instanceof PropertyName);
  assertTrue(func.getParameters().get(1) instanceof Literal);
  Literal lit = (Literal) f.getExpression2();
}

代码示例来源:origin: geotools/geotools

@Test
public void testFilterFunctionWithMarker() throws Exception {
  String yaml = "rules: \n" + "- filter: ${strEndsWith(foo,'bar') = true}\n";
  StyledLayerDescriptor sld = Ysld.parse(yaml);
  Rule r = SLD.defaultStyle(sld).featureTypeStyles().get(0).rules().get(0);
  PropertyIsEqualTo f = (PropertyIsEqualTo) r.getFilter();
  Function func = (Function) f.getExpression1();
  assertEquals("strEndsWith", func.getName());
  assertTrue(func.getParameters().get(0) instanceof PropertyName);
  assertTrue(func.getParameters().get(1) instanceof Literal);
  Literal lit = (Literal) f.getExpression2();
}

相关文章

微信公众号

最新文章

更多