Revision 35625 branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ViewPort.java
ViewPort.java | ||
---|---|---|
56 | 56 |
import org.slf4j.LoggerFactory; |
57 | 57 |
|
58 | 58 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
59 |
import org.gvsig.fmap.geom.Geometry; |
|
59 | 60 |
import org.gvsig.fmap.geom.GeometryLocator; |
60 | 61 |
import org.gvsig.fmap.geom.GeometryManager; |
61 | 62 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
63 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
62 | 64 |
import org.gvsig.fmap.geom.primitive.Envelope; |
65 |
import org.gvsig.fmap.geom.primitive.Point; |
|
63 | 66 |
import org.gvsig.fmap.mapcontext.events.ColorEvent; |
64 | 67 |
import org.gvsig.fmap.mapcontext.events.ExtentEvent; |
65 | 68 |
import org.gvsig.fmap.mapcontext.events.ProjectionEvent; |
... | ... | |
583 | 586 |
* |
584 | 587 |
* @see #toMapPoint(Point2D) |
585 | 588 |
* @see #fromMapPoint(double, double) |
589 |
* @deprecated use {@link #convertToMapPoint(int, int)} |
|
586 | 590 |
*/ |
587 | 591 |
public Point2D toMapPoint(int x, int y) { |
588 | 592 |
Point2D pScreen = new Point2D.Double(x, y); |
... | ... | |
649 | 653 |
* @see #toMapPoint(int, int) |
650 | 654 |
* @see AffineTransform#createInverse() |
651 | 655 |
* @see AffineTransform#transform(Point2D, Point2D) |
656 |
* @deprecated use {@link #convertToMapPoint(Point2D)} |
|
652 | 657 |
*/ |
653 | 658 |
public Point2D toMapPoint(Point2D pScreen) { |
654 | 659 |
Point2D.Double pWorld = new Point2D.Double(); |
... | ... | |
664 | 669 |
return pWorld; |
665 | 670 |
} |
666 | 671 |
|
672 |
public Point convertToMapPoint(Point2D pScreen) { |
|
673 |
Point2D p = toMapPoint(pScreen); |
|
674 |
try { |
|
675 |
return geomManager.createPoint( |
|
676 |
p.getX(), |
|
677 |
p.getY(), |
|
678 |
Geometry.SUBTYPES.GEOM2D |
|
679 |
); |
|
680 |
} catch (CreateGeometryException e) { |
|
681 |
// FIXME: Use a most especific exception. |
|
682 |
throw new RuntimeException(e); |
|
683 |
} |
|
684 |
} |
|
685 |
|
|
686 |
public Point convertToMapPoint(int x, int y) { |
|
687 |
Point2D pScreen = new Point2D.Double(x, y); |
|
688 |
|
|
689 |
return convertToMapPoint(pScreen); |
|
690 |
} |
|
691 |
|
|
692 |
|
|
667 | 693 |
/** |
668 | 694 |
* <p> |
669 | 695 |
* Returns the real distance (in <i>world coordinates</i>) at the graphic |
Also available in: Unified diff