Re: [josm-dev] Small patch for Lambert projection

2008-08-24 Thread Pieren
I created a patch to fix this issue.
First, it will not raise an exception anymore if the nodes are outside
the Lambert zones.
Second, it will display once an error message if someone tries to use
this Lambert projection beyond the latitudes it was designed for.
Third, I renamed the projection as Lambert Zone (France) to show
that this projection has limited coverage and is not for the whole
planet (I hope the new name is more clear).

If would be nice if someone with a write access could apply the patch
to the source Lambert.java.

I attach the patch with the extension .txt in this email but the patch
is also attached in the related Trac ticket 1441 :
http://josm.openstreetmap.de/ticket/1441

Thank you in advance,
Pieren

On Thu, Aug 21, 2008 at 10:07 PM, Dirk Stöcker
[EMAIL PROTECTED] wrote:
 Probably you introduced a new bug with this:

 http://josm.openstreetmap.de/ticket/1441

 Ciao
 --
 http://www.dstoecker.eu/ (PGP key available)
Index: Lambert.java
===
--- Lambert.java(revision 815)
+++ Lambert.java(working copy)
@@ -65,6 +65,10 @@
 
public static int layoutZone = -1;
 
+   private static int currentZone = 0;
+
+   private static boolean dontDisplayErrors = false;
+
/**
 * @param p  WGS84 lat/lon (ellipsoid GRS80) (in degree)
 * @return eastnorth projection in Lambert Zone (ellipsoid Clark)
@@ -76,7 +80,7 @@
double lg = geo.lon();
 
// check if longitude and latitude are inside the french 
Lambert zones
-   int currentZone = 0;
+   currentZone = 0;
boolean outOfLambertZones = false;
if (lt = zoneLimits[3]  lt = cMaxLatZone1  lg = 
cMinLonZones  lg = cMaxLonZones) {
// zone I
@@ -99,23 +103,36 @@
currentZone = 3;
} else {
outOfLambertZones = true; // possible when MAX_LAT is 
used
+   if (p.lat() != 0  Math.abs(p.lat()) != 
Projection.MAX_LAT
+p.lon() != 0  Math.abs(p.lon()) != 
Projection.MAX_LON
+dontDisplayErrors == false) {
+   JOptionPane.showMessageDialog(Main.parent, 
+   tr(The projection \ + 
this.toString() + \ is designed for\n 
+   + latitudes between 46.1° and 57° 
only.\n
+   + Use another projection system if you 
are not using\n
+   + a french WMS server.\n
+   + Do not upload any data after this 
message.));
+   dontDisplayErrors = true;
+   }
}
if (!outOfLambertZones) {
-   if (layoutZone == -1)
+   if (layoutZone == -1) {
layoutZone = currentZone;
-   else if (layoutZone != currentZone) {
+   dontDisplayErrors = false;
+   } else if (layoutZone != currentZone) {
if ((currentZone  layoutZone  
Math.abs(zoneLimits[currentZone] - lt)  cMaxOverlappingZones)
|| (currentZone  layoutZone  
Math.abs(zoneLimits[layoutZone] - lt)  cMaxOverlappingZones)) {

JOptionPane.showMessageDialog(Main.parent,

tr(IMPORTANT : data positionned far away from\n

+ the current Lambert zone limits.\n
+   
+ Do not upload any data after this message.\n

+ Undo your last action, Save your work \n

+ and Start a new layer on the new zone.));
layoutZone = -1;
+   dontDisplayErrors = true;
} else {
-   System.out.println(temporarily extends 
Lambert zone 
-   + layoutZone +  
projection at lat,lon: + lt + ,
-   + lg);
+   System.out.println(temporarily extends 
Lambert zone  + layoutZone +  projection at lat,lon:
+   + lt + , + lg);
}
}
}
@@ -126,15 +143,19 @@
}
 
  

Re: [josm-dev] Small patch for Lambert projection

2008-08-24 Thread Dirk Stöcker
On Sun, 24 Aug 2008, Pieren wrote:

 I created a patch to fix this issue.
 First, it will not raise an exception anymore if the nodes are outside
 the Lambert zones.
 Second, it will display once an error message if someone tries to use
 this Lambert projection beyond the latitudes it was designed for.
 Third, I renamed the projection as Lambert Zone (France) to show
 that this projection has limited coverage and is not for the whole
 planet (I hope the new name is more clear).

 If would be nice if someone with a write access could apply the patch
 to the source Lambert.java.

One note regarding translations (to you also Frederik! :-):

- Translations must be unmodifyable strings:
   tr(Text + variable + text) does never work.
   Use tr(Text{0}text, variable)

- EVERY user visible string should be translatable.

I'm going through JOSM code for some time now and fixed such stuff in so 
many places, don't make my life harder by introducing new problems of that 
style.

Ciao
-- 
http://www.dstoecker.eu/ (PGP key available)

___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev


Re: [josm-dev] Small patch for Lambert projection

2008-08-21 Thread Dirk Stöcker
On Wed, 20 Aug 2008, Pieren wrote:

 Dear Josm-dev,

 Could one of the Josm developers having write access to the repository
 submit the following small patch for the Lambert projection class ?

 It's to avoid an unnecessery warning message when MAX_LAT / MAX_LON are used.

 Note that this time, I renamed the patch with the extension .TXT
 hoping that it will not be filterer by the ML. Maybe you will be able
 to see it. In the case not, I also copy it below.

Probably you introduced a new bug with this:

http://josm.openstreetmap.de/ticket/1441

Ciao
-- 
http://www.dstoecker.eu/ (PGP key available)

___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev


Re: [josm-dev] Small patch for Lambert projection

2008-08-20 Thread Dirk Stöcker
On Wed, 20 Aug 2008, Pieren wrote:

 Note that this time, I renamed the patch with the extension .TXT
 hoping that it will not be filterer by the ML. Maybe you will be able
 to see it. In the case not, I also copy it below.

Seems .txt is a good idea. The attachement is encoded as TEXT/PLAIN 
and not stripped.

Ciao
-- 
http://www.dstoecker.eu/ (PGP key available)

___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev