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 / STEndPointFunction.java @ 43518
History | View | Annotate | Download (822 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 | import org.gvsig.fmap.geom.primitive.Point; |
||
8 | 43512 | jjdelcerro | |
9 | 43518 | jjdelcerro | public class STEndPointFunction extends AbstractFunction { |
10 | 43512 | jjdelcerro | |
11 | 43518 | jjdelcerro | public STEndPointFunction() {
|
12 | super("OGC", "ST_EndPoint", Range.is(1)); |
||
13 | 43512 | jjdelcerro | } |
14 | |||
15 | @Override
|
||
16 | public Object call(Object[] args) throws Exception { |
||
17 | 43518 | jjdelcerro | Geometry geom = getGeom(args, 0);
|
18 | if ( geom instanceof OrientablePrimitive ) { |
||
19 | int n = ((OrientablePrimitive) geom).getNumVertices();
|
||
20 | Point p = ((OrientablePrimitive) geom).getVertex(n-1); |
||
21 | return p;
|
||
22 | } |
||
23 | return null; |
||
24 | 43512 | jjdelcerro | } |
25 | |||
26 | } |