• Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing: Scale, translate

 
sdfsdf sdfsdfsdfsdf
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to revert this transformation:
g2.scale(scale, -scale);
g2.translate(-minLon, -(minLat + (float) bounds.getHeight()));
g2.setStroke(new BasicStroke(1.0f / scale)); // thin lines

I tried this, which did not work:
g2.scale(1/scale, -1/scale);
g2.translate(+minLon, +(minLat + (float) bounds.getHeight()));
g2.setStroke(new BasicStroke(1.0f * scale));

Help please!

 
Miklos Szeles
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Welcome to Javaranch. Please read the how to ask question FAQ. Please use real name, choose proper forum, and use code tags.
I haven't checked what your code exactly do, but what is obviously wrong, is the order of your calls. You have to call them in reverse order to revert the operation.
 
Campbell Ritchie
Marshal
Posts: 52558
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Miklos Szeles wrote: . . . Please use real name, choose proper forum, and use code tags. . . .
Thank you for noticing.
 
Rob Spoor
Sheriff
Posts: 20819
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Swing. And yes, the name should be fixed. Thanks again Miklos.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!