geotools-gt2-users

 [Geotools-gt2-users] Context rotation From: GuiCheBZH - 2010-03-24 15:37:36 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.
 Re: [Geotools-gt2-users] Context rotation From: Benoît Thiébault - 2010-03-24 16:03:41 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 > Geotools-gt2-users@... > 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
 Re: [Geotools-gt2-users] Context rotation From: GuiCheBZH - 2010-03-25 09:18:46 I have already done that but the result is not the one that I expected. I would like to realize a rotation like the one in the gps, so the map rotates and the coordinates of the points rotate too. But with your solution the map rotates on the screen but the coordinates are constant, so for example, the top of the screen will have the same coordinates with the original map and with a map rotated of 180°. But perhaps I forgot an operation in the transformation. -- View this message in context: http://n2.nabble.com/Context-rotation-tp4791782p4796515.html Sent from the geotools-gt2-users mailing list archive at Nabble.com.