Hi Gui,
I have done this for one of my projects (though I don't use JMapPane to display
my map). The best way I found was to create a rotated projection system and to
update the coordinates of the data accordingly.
Hope this helps
Benoît
// Copy the current projection system used
CoordinateReferenceSystem transformedCRS = currentCRS;
if (getAngleRadians() != 0.0) {
// Create the rotation transform
AffineTransform rotation = new AffineTransform();
rotation.rotate(getAngleRadians(),
getRotationProjCenter().x, getRotationProjCenter().y);
// Creates the math transform
MathTransform transform =
ProjectiveTransform.create(rotation);
// Sets the new CRS name
String crsName = selectedCRS.getName().toString();
if (getAngleRadians() != 0) {
DecimalFormat formatter = new
DecimalFormat("#.##");
String rotationText =
formatter.format(Math.toDegrees(getAngleRadians()));
crsName += " / Rotation: " + rotationText + "°";
}
// Rotates the CRS
transformedCRS = new DefaultDerivedCRS(crsName,
currentCRS, transform, currentCRS.getCoordinateSystem());
}
Le 24 mars 2010 à 16:37, GuiCheBZH a écrit :
>
> Hi,
> I want to rotate a MapContext which is displayed in a JMapPane, but the
> different methods I used were not good. And I'd like a fluid rotation. If
> someone has an example to show me, I will be gratefull.
>
> The perfect solution would be to rotate the JMapPane entirely, but I don't
> think it is possible :(
>
> Does the transform method of MapContext working? Because I tried to use it
> but nothing occurs.
>
> Thanks
> --
> View this message in context:
> http://n2.nabble.com/Context-rotation-tp4791782p4791782.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
----
Benoît Thiébault
Société Artenum
24 rue Louis Blanc, 75010 Paris
tel: +33 (0)1 46 94 67 54
Artenum - Science & Groupware - http://www.artenum.com
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users