Revision 35 org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.lib/org.gvsig.lrs.lib.impl/src/main/java/org/gvsig/lrs/lib/impl/LrsAlgorithmUtils.java
LrsAlgorithmUtils.java | ||
---|---|---|
447 | 447 |
if (geometry instanceof MultiLine){ |
448 | 448 |
List<Line> lines=extractLines(geometry); |
449 | 449 |
for(Line line:lines){ |
450 |
if (index>line.getNumVertices()){
|
|
450 |
if (index<=line.getNumVertices()){
|
|
451 | 451 |
line.insertVertex(index, vertex); |
452 |
return; |
|
452 | 453 |
}else{ |
453 | 454 |
index-=line.getNumVertices(); |
454 | 455 |
} |
... | ... | |
457 | 458 |
} |
458 | 459 |
} |
459 | 460 |
|
461 |
static protected Double calculateM(Double maxValue, Double minValue, |
|
462 |
Double relativeDistance, Double totalLength) { |
|
463 |
// mValue=((newMax-newMin)*(mCoordinate-oldMin)/(oldMax-oldMin))+newMin; |
|
464 |
if (totalLength.equals(Double.valueOf(0))) |
|
465 |
return Double.POSITIVE_INFINITY; |
|
466 |
return ((maxValue - minValue) * (relativeDistance) / (totalLength)) |
|
467 |
+ minValue; |
|
468 |
} |
|
460 | 469 |
|
470 |
static protected double calculateNewM(double oldMax, double oldMin, double newMax, double newMin, double mCoordinate){ |
|
471 |
double result; |
|
472 |
if (oldMax==oldMin){ |
|
473 |
return Double.POSITIVE_INFINITY; |
|
474 |
} |
|
475 |
result=((newMax-newMin)*(mCoordinate-oldMin)/(oldMax-oldMin))+newMin; |
|
476 |
|
|
477 |
return result; |
|
478 |
} |
|
479 |
|
|
461 | 480 |
} |
Also available in: Unified diff