kiwi-postgis  Version 0.1.0.0
CompactnessRatio Class Reference
Inheritance diagram for CompactnessRatio:
Collaboration diagram for CompactnessRatio:

Public Member Functions

boolean isSupported (KiWiDialect dialect)
 
String getNative (KiWiDialect dialect, String... args)
 
ValueType getReturnType ()
 
ValueType getArgumentType (int arg)
 
int getMinArgs ()
 
int getMaxArgs ()
 
double attribute (Geometry geom)
 
String getURI ()
 
Value evaluate (ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException
 

Member Function Documentation

◆ attribute()

double attribute ( Geometry  geom)
inherited
12  {
13  if (geom instanceof Polygon) {
14  final double circleRadius = Math.sqrt(geom.getArea() / Math.PI);
15  final double circleCurcumference = 2 * Math.PI * circleRadius;
16  return circleCurcumference / geom.getLength();
17  }
18  return Double.NaN;
19  }

◆ evaluate()

Value evaluate ( ValueFactory  valueFactory,
Value...  args 
) throws ValueExprEvaluationException
inherited

References GeometricDoubleAttributeFunction.attribute(), and LiteralRegistry.getLiteral().

16  {
17  if (args.length != 1) {
18  throw new ValueExprEvaluationException(getURI() + " requires exactly 1 arguments, got " + args.length);
19  }
20 
21  LiteralType l=LiteralRegistry.getLiteral(((Literal)args[0]).getDatatype().toString());
22  if(l instanceof VectorLiteral) {
23  Geometry geom=((VectorLiteral)l).read(args[0].stringValue());
24  double result = attribute(geom);
25  return valueFactory.createLiteral(result);
26  }
27  throw new ValueExprEvaluationException("Argument given is not a geometry literal");
28 
29  }

◆ getArgumentType()

ValueType getArgumentType ( int  arg)
28  {
29  // TODO Auto-generated method stub
30  return null;
31  }

◆ getMaxArgs()

int getMaxArgs ( )
40  {
41  // TODO Auto-generated method stub
42  return 0;
43  }

◆ getMinArgs()

int getMinArgs ( )
34  {
35  // TODO Auto-generated method stub
36  return 0;
37  }

◆ getNative()

String getNative ( KiWiDialect  dialect,
String...  args 
)
16  {
17  // TODO Auto-generated method stub
18  return null;
19  }

◆ getReturnType()

ValueType getReturnType ( )
22  {
23  // TODO Auto-generated method stub
24  return null;
25  }

◆ getURI()

String getURI ( )
inherited

References POSTGIS.ST_COMPACTNESSRATIO.

22  {
23  return POSTGIS.ST_COMPACTNESSRATIO.stringValue();
24  }

◆ isSupported()

boolean isSupported ( KiWiDialect  dialect)
10  {
11  // TODO Auto-generated method stub
12  return false;
13  }