svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.expressionevaluator / org.gvsig.expressionevaluator.lib / org.gvsig.expressionevaluator.lib.impl / src / main / java / org / gvsig / expressionevaluator / impl / function / spatial / STNumPointsFunction.java @ 43518
History | View | Annotate | Download (714 Bytes)
1 | 43512 | jjdelcerro | package org.gvsig.expressionevaluator.impl.function.spatial; |
---|---|---|---|
2 | |||
3 | import org.apache.commons.lang3.Range; |
||
4 | import org.gvsig.expressionevaluator.spi.AbstractFunction; |
||
5 | 43518 | jjdelcerro | import org.gvsig.fmap.geom.Geometry; |
6 | import org.gvsig.fmap.geom.primitive.OrientablePrimitive; |
||
7 | 43512 | jjdelcerro | |
8 | 43518 | jjdelcerro | public class STNumPointsFunction extends AbstractFunction { |
9 | 43512 | jjdelcerro | |
10 | 43518 | jjdelcerro | public STNumPointsFunction() {
|
11 | super("OGC", "ST_NumPoints", Range.is(1)); |
||
12 | 43512 | jjdelcerro | } |
13 | |||
14 | @Override
|
||
15 | public Object call(Object[] args) throws Exception { |
||
16 | 43518 | jjdelcerro | Geometry geom = getGeom(args, 0);
|
17 | if ( geom instanceof OrientablePrimitive ) { |
||
18 | int n = ((OrientablePrimitive) geom).getNumVertices();
|
||
19 | return n;
|
||
20 | } |
||
21 | return null; |
||
22 | 43512 | jjdelcerro | } |
23 | |||
24 | } |