Revision 57
org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.lib/org.gvsig.lrs.lib.impl/src/main/java/org/gvsig/lrs/lib/impl/LrsCalibrateRouteAlgorithm.java | ||
---|---|---|
152 | 152 |
throws VisitCanceledException, BaseException { |
153 | 153 |
Feature feature = (Feature) obj; |
154 | 154 |
String routeName = (String) feature.get(routeFieldName); |
155 |
RouteAndPoints routeAndPoints = new RouteAndPoints(feature.getDefaultGeometry(), new ArrayList<Point>());
|
|
155 |
RouteAndPoints routeAndPoints = new RouteAndPoints(feature.getDefaultGeometry()); |
|
156 | 156 |
|
157 | 157 |
featuresMap.put(routeName, routeAndPoints); |
158 | 158 |
} |
... | ... | |
170 | 170 |
if (geomPoint instanceof Point){ |
171 | 171 |
Point point=(Point) geomPoint; |
172 | 172 |
Object valueObject=featuresMap.get(routeName); |
173 |
if (valueObject!=null && valueObject instanceof RouteAndPoints){ |
|
174 |
RouteAndPoints routeAndPoints=(RouteAndPoints)valueObject; |
|
175 |
if (routeAndPoints.points instanceof List){ |
|
176 |
List<Point> points=routeAndPoints.points; |
|
177 |
if (feature.getDefaultGeometry() instanceof Point){ |
|
178 |
Geometry geometry=routeAndPoints.route; |
|
179 |
if (isValidPoint(point,geometry, convertedSearchRadius)){ |
|
180 |
try { |
|
181 |
Point mPoint= pointToMPoint(geometry,point, measure); |
|
182 |
points.add(mPoint); |
|
183 |
} catch (Exception e) { |
|
184 |
logger.debug("Error adding point",e); |
|
185 |
} |
|
173 |
if (valueObject != null && valueObject instanceof RouteAndPoints) { |
|
174 |
RouteAndPoints routeAndPoints = (RouteAndPoints) valueObject; |
|
175 |
List<Point> points = routeAndPoints.getPoints(); |
|
176 |
if (feature.getDefaultGeometry() instanceof Point) { |
|
177 |
Geometry route = routeAndPoints.getRoute(); |
|
178 |
if (isValidPoint(point, route, convertedSearchRadius)) { |
|
179 |
try { |
|
180 |
Point mPoint = getInRouteMPoint(route, point, measure); |
|
181 |
points.add(mPoint); |
|
182 |
} catch (Exception e) { |
|
183 |
logger.debug("Error adding point", e); |
|
186 | 184 |
} |
187 | 185 |
} |
188 | 186 |
} |
... | ... | |
233 | 231 |
} |
234 | 232 |
|
235 | 233 |
|
236 |
private Point pointToMPoint(Geometry geometry,Point point, Double measure) throws CreateGeometryException, GeometryOperationNotSupportedException, GeometryOperationException{
|
|
234 |
private Point getInRouteMPoint(Geometry geometry,Point point, Double measure) throws CreateGeometryException, GeometryOperationNotSupportedException, GeometryOperationException{
|
|
237 | 235 |
GeometryManager geomanager = GeometryLocator.getGeometryManager(); |
238 | 236 |
|
239 | 237 |
Point[] pointsInLine=(Point[])geometry.closestPoints(point); |
... | ... | |
755 | 753 |
/** |
756 | 754 |
* |
757 | 755 |
*/ |
758 |
public RouteAndPoints(Geometry route, List<Point> points) {
|
|
756 |
public RouteAndPoints(Geometry route) { |
|
759 | 757 |
this.setRoute(route); |
760 |
this.setPoints(points);
|
|
758 |
this.setPoints(new ArrayList<Point>());
|
|
761 | 759 |
} |
762 | 760 |
|
763 | 761 |
|
Also available in: Unified diff