Revision 579 org.gvsig.vectorediting.offset/trunk/org.gvsig.vectorediting.offset/org.gvsig.vectorediting.offset.lib/org.gvsig.vectorediting.offset.lib.prov/org.gvsig.vectorediting.offset.lib.prov.offset/src/main/java/org/gvsig/vectorediting/offset/lib/prov/offset/OffsetEditingProvider.java
OffsetEditingProvider.java | ||
---|---|---|
157 | 157 |
MutableDouble normalModule=new MutableDouble(); |
158 | 158 |
try { |
159 | 159 |
perpendicularPoint=getPerpendicularPoint(closestPoint, point,selected,normalModule); |
160 |
//normalModule=getNormalModule(closestPoint, point,selected); |
|
161 | 160 |
} catch (Exception e) { |
162 | 161 |
throw new DrawServiceException(e); |
163 | 162 |
} |
164 | 163 |
line.addVertex(closestPoint); |
165 |
//line.addVertex(point); |
|
166 | 164 |
line.addVertex(perpendicularPoint); |
167 | 165 |
|
168 | 166 |
drawingStatus.addStatus(line, auxiliaryLineSymbolEditing, ""); |
... | ... | |
313 | 311 |
} |
314 | 312 |
} |
315 | 313 |
|
316 |
private Double getNormalModule(Point closestPoint, Point distancePoint,FeatureSelection selected) |
|
317 |
throws DataException, CreateEnvelopeException, GeometryOperationNotSupportedException, GeometryOperationException, CreateGeometryException, LocatorException{ |
|
318 | 314 |
|
319 |
MutableDouble distance=null; |
|
320 |
getPerpendicularPoint(closestPoint, distancePoint, selected, distance); |
|
321 |
return distance.getValue(); |
|
322 |
} |
|
323 |
|
|
324 |
private Point getPerpendicularPoint(Point closestPoint, Point distancePoint,FeatureSelection selected) |
|
325 |
throws DataException, CreateEnvelopeException, GeometryOperationNotSupportedException, GeometryOperationException, CreateGeometryException, LocatorException{ |
|
326 |
return getPerpendicularPoint(closestPoint,distancePoint,selected,null); |
|
327 |
} |
|
328 |
|
|
329 |
|
|
330 | 315 |
private Point getPerpendicularPoint(Point closestPoint, Point distancePoint,FeatureSelection selected, MutableDouble normalModule) |
331 | 316 |
throws DataException, CreateEnvelopeException, GeometryOperationNotSupportedException, GeometryOperationException, CreateGeometryException, LocatorException{ |
332 | 317 |
|
... | ... | |
345 | 330 |
circumference.setPoints(circle.getCenter(), circle.getRadious()); |
346 | 331 |
containingGeometry=circumference; |
347 | 332 |
} |
348 |
if (containingGeometry instanceof Ellipse || containingGeometry instanceof Circumference){
|
|
333 |
if (containingGeometry instanceof Ellipse ){ |
|
349 | 334 |
Ellipse ellipse=(Ellipse)containingGeometry; |
350 | 335 |
PeriEllipse periellipse =(PeriEllipse)GeometryLocator. |
351 | 336 |
getGeometryManager().create(Geometry.TYPES.PERIELLIPSE, subType); |
352 | 337 |
periellipse.setPoints(ellipse.getAxis1Start(), ellipse.getAxis1End(), ellipse.getAxis2Dist()); |
353 | 338 |
containingGeometry=periellipse; |
354 | 339 |
} |
355 |
if (containingGeometry instanceof PeriEllipse){ |
|
340 |
if (containingGeometry instanceof PeriEllipse || containingGeometry instanceof Circumference){
|
|
356 | 341 |
Integer direction; |
357 | 342 |
if (containingGeometry.contains(distancePoint)){ |
358 | 343 |
direction=-1; |
... | ... | |
387 | 372 |
AffineTransform rotate = AffineTransform.getRotateInstance(perpendicularAngle); |
388 | 373 |
unitarianPoint.transform(rotate); |
389 | 374 |
|
390 |
Double distance=getDirectedDistance(closestPoint, distancePoint, containingLine);
|
|
375 |
double distance=getDirectedDistance(closestPoint, distancePoint, containingLine);
|
|
391 | 376 |
|
392 | 377 |
unitarianPoint.setX(unitarianPoint.getX()*distance); |
393 | 378 |
unitarianPoint.setY(unitarianPoint.getY()*distance); |
... | ... | |
401 | 386 |
normalModule.setValue(-unitarianPoint.distance(closestPoint)); |
402 | 387 |
} |
403 | 388 |
|
404 |
|
|
405 | 389 |
return unitarianPoint; |
406 | 390 |
} |
407 | 391 |
return null; |
Also available in: Unified diff