Ignore:
Timestamp:
2011-07-01T00:44:06+02:00 (14 years ago)
Author:
pieren
Message:

For v2.2

  • replace deprecated Main.proj by newest Main.getProjection()
  • fix list of raster images (Feuilles) parsing failing after a Cadastre server change/maintenance
Location:
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java

    r24934 r26228  
    210210    private String WMSFileExtension() {
    211211        String ext = String.valueOf((wmsLayer.getLambertZone() + 1));
    212         if (Main.proj instanceof LambertCC9Zones)
     212        if (Main.getProjection() instanceof LambertCC9Zones)
    213213            ext = cLambertCC9Z + ext;
    214         else if (Main.proj instanceof UTM_France_DOM)
     214        else if (Main.getProjection() instanceof UTM_France_DOM)
    215215            ext = cUTM20N + ext;
    216216        return ext;
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreInterface.java

    r24954 r26228  
    5858    final String cInterfaceRasterTA = "afficherCarteTa.do";
    5959    final String cInterfaceRasterFeuille = "afficherCarteFeuille.do";
    60     final String cImageLinkStart = "title=\"image\"><a href=\"#\" onClick=\"popup('afficherCarteFeuille.do?f=";
    61     final String cTAImageLinkStart = "title=\"image\"><a href=\"#\" onClick=\"popup('afficherCarteTa.do?f=";
     60    final String cImageLinkStart = "<a href=\"#\" class=\"raster\" onClick=\"popup('afficherCarteFeuille.do?f=";
     61    final String cTAImageLinkStart = "<a href=\"#\" class=\"raster\" onClick=\"popup('afficherCarteTa.do?f=";
    6262    final String cImageNameStart = ">Feuille ";
    6363    final String cTAImageNameStart = "Tableau d'assemblage <strong>";
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java

    r25046 r26228  
    122122 *                 - move the grabber from CadastrPlugin singleton to each wmsLayer instance to allow grabbing
    123123 *                   of multiple municipalities in parallel.
     124 * 2.2 01-Jul-2011 - replace deprecated Main.proj by newest Main.getProjection()
     125 *                 - fix list of raster images (Feuilles) parsing failing after a Cadastre server change/maintenance
    124126 */
    125127public class CadastrePlugin extends Plugin {
     
    350352
    351353    public static boolean isCadastreProjection() {
    352         return Main.proj.toString().equals(new Lambert().toString())
    353             || Main.proj.toString().equals(new UTM_France_DOM().toString())
    354             || Main.proj.toString().equals(new LambertCC9Zones().toString());
     354        return Main.getProjection().toString().equals(new Lambert().toString())
     355            || Main.getProjection().toString().equals(new UTM_France_DOM().toString())
     356            || Main.getProjection().toString().equals(new LambertCC9Zones().toString());
    355357    }
    356358
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGBuilding.java

    r25045 r26228  
    114114            Way wayToAdd = new Way();
    115115            for (EastNorth eastNorth : path) {
    116                 Node nodeToAdd = new Node(Main.proj.eastNorth2latlon(eastNorth));
     116                Node nodeToAdd = new Node(Main.getProjection().eastNorth2latlon(eastNorth));
    117117                // check if new node is not already created by another new path
    118118                Node nearestNewNode = checkNearestNode(nodeToAdd, svgDataSet.getNodes());
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGTask.java

    r25045 r26228  
    116116        List<Node> nodeList = new ArrayList<Node>();
    117117        for (EastNorth eastNorth : eastNorths.get(bestPath)) {
    118             nodeList.add(new Node(Main.proj.eastNorth2latlon(eastNorth)));
     118            nodeList.add(new Node(Main.getProjection().eastNorth2latlon(eastNorth)));
    119119        }
    120120        Way wayToAdd = new Way();
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/EastNorthBound.java

    r23190 r26228  
    3333
    3434    public Bounds toBounds() {
    35         return new Bounds(Main.proj.eastNorth2latlon(min), Main.proj.eastNorth2latlon(max));
     35        return new Bounds(Main.getProjection().eastNorth2latlon(min), Main.getProjection().eastNorth2latlon(max));
    3636    }
    3737
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java

    r24934 r26228  
    141141            return;
    142142        if (ignoreMouseClick) return; // In case we are currently just allowing zooming to read lambert coordinates
    143         EastNorth ea = Main.proj.latlon2eastNorth(Main.map.mapView.getLatLon(e.getX(), e.getY()));
     143        EastNorth ea = Main.getProjection().latlon2eastNorth(Main.map.mapView.getLatLon(e.getX(), e.getY()));
    144144        System.out.println("clic:"+countMouseClicked+" ,"+ea+", mode:"+mode);
    145145        if (clickOnTheMap) {
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionLoadFromCache.java

    r24934 r26228  
    3838                String ext = (filename.lastIndexOf(".")==-1)?"":filename.substring(filename.lastIndexOf(".")+1,filename.length());
    3939                if ((ext.length() == 3 && ext.substring(0, CacheControl.cLambertCC9Z.length()).equals(CacheControl.cLambertCC9Z) &&
    40                     !(Main.proj instanceof LambertCC9Zones))
     40                    !(Main.getProjection() instanceof LambertCC9Zones))
    4141                    || (ext.length() == 4 && ext.substring(0, CacheControl.cUTM20N.length()).equals(CacheControl.cUTM20N) &&
    42                             !(Main.proj instanceof UTM_France_DOM))
    43                     || (ext.length() == 1) && !(Main.proj instanceof Lambert)) {
     42                            !(Main.getProjection() instanceof UTM_France_DOM))
     43                    || (ext.length() == 1) && !(Main.getProjection() instanceof Lambert)) {
    4444                        JOptionPane.showMessageDialog(Main.parent, tr("{0} not allowed with the current projection", filename), tr("Error"), JOptionPane.ERROR_MESSAGE);
    4545                        continue;
     
    8989        int layoutZone = new MenuActionLoadFromCache().getCurrentProjZone();
    9090        if (layoutZone != -1) {
    91             if (Main.proj instanceof Lambert)
     91            if (Main.getProjection() instanceof Lambert)
    9292                fc.addChoosableFileFilter(CacheFileLambert4ZoneFilter.filters[layoutZone]);
    93             else if (Main.proj instanceof LambertCC9Zones)
     93            else if (Main.getProjection() instanceof LambertCC9Zones)
    9494                fc.addChoosableFileFilter(CacheFileLambert9ZoneFilter.filters[layoutZone]);
    95             else if (Main.proj instanceof UTM_France_DOM)
     95            else if (Main.getProjection() instanceof UTM_France_DOM)
    9696                fc.addChoosableFileFilter(CacheFileUTM20NFilter.filters[layoutZone]);
    9797        }
     
    107107    private int getCurrentProjZone() {
    108108        int zone = -1;
    109         if (Main.proj instanceof LambertCC9Zones)
    110             zone = ((LambertCC9Zones)Main.proj).getLayoutZone();
    111         else if (Main.proj instanceof Lambert)
    112             zone = ((Lambert)Main.proj).getLayoutZone();
    113         else if (Main.proj instanceof UTM_France_DOM)
    114             zone = ((UTM_France_DOM)Main.proj).getCurrentGeodesic();
     109        if (Main.getProjection() instanceof LambertCC9Zones)
     110            zone = ((LambertCC9Zones)Main.getProjection()).getLayoutZone();
     111        else if (Main.getProjection() instanceof Lambert)
     112            zone = ((Lambert)Main.getProjection()).getLayoutZone();
     113        else if (Main.getProjection() instanceof UTM_France_DOM)
     114            zone = ((UTM_France_DOM)Main.getProjection()).getCurrentGeodesic();
    115115        return zone;
    116116    }
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionNewLocation.java

    r25045 r26228  
    116116            // add the layer if it doesn't exist
    117117            int zone = -1;
    118             if (Main.proj instanceof LambertCC9Zones)
    119                 zone = ((LambertCC9Zones)Main.proj).getLayoutZone();
    120             else if (Main.proj instanceof Lambert)
    121                 zone = ((Lambert)Main.proj).getLayoutZone();
    122             else if (Main.proj instanceof UTM_France_DOM)
    123                 zone = ((UTM_France_DOM)Main.proj).getCurrentGeodesic();
     118            if (Main.getProjection() instanceof LambertCC9Zones)
     119                zone = ((LambertCC9Zones)Main.getProjection()).getLayoutZone();
     120            else if (Main.getProjection() instanceof Lambert)
     121                zone = ((Lambert)Main.getProjection()).getLayoutZone();
     122            else if (Main.getProjection() instanceof UTM_France_DOM)
     123                zone = ((UTM_France_DOM)Main.getProjection()).getCurrentGeodesic();
    124124            wmsLayer = new WMSLayer(location, codeCommune, zone);
    125125            wmsLayer.setDepartement(codeDepartement);
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java

    r25889 r26228  
    138138        } else {
    139139            if (isRaster) {
    140                 b = new Bounds(Main.proj.eastNorth2latlon(rasterMin), Main.proj.eastNorth2latlon(rasterMax));
     140                b = new Bounds(Main.getProjection().eastNorth2latlon(rasterMin), Main.getProjection().eastNorth2latlon(rasterMax));
    141141                divideBbox(b, Integer.parseInt(Main.pref.get("cadastrewms.rasterDivider",
    142142                        CadastrePreferenceSetting.DEFAULT_RASTER_DIVIDER)));
     
    158158     */
    159159    private void divideBbox(Bounds b, int factor) {
    160         EastNorth lambertMin = Main.proj.latlon2eastNorth(b.getMin());
    161         EastNorth lambertMax = Main.proj.latlon2eastNorth(b.getMax());
     160        EastNorth lambertMin = Main.getProjection().latlon2eastNorth(b.getMin());
     161        EastNorth lambertMax = Main.getProjection().latlon2eastNorth(b.getMax());
    162162        double minEast = lambertMin.east();
    163163        double minNorth = lambertMin.north();
     
    322322        GeorefImage georefImage =
    323323            new GeorefImage(null,
    324             Main.proj.latlon2eastNorth(bounds.getMin()),
    325             Main.proj.latlon2eastNorth(bounds.getMax()));
     324            Main.getProjection().latlon2eastNorth(bounds.getMin()),
     325            Main.getProjection().latlon2eastNorth(bounds.getMax()));
    326326        for (GeorefImage img : images) {
    327327            if (img.overlap(georefImage))
     
    399399     */
    400400    public void setRasterBounds(Bounds bounds) {
    401         EastNorth rasterCenter = Main.proj.latlon2eastNorth(bounds.getCenter());
    402         EastNorth eaMin = Main.proj.latlon2eastNorth(bounds.getMin());
    403         EastNorth eaMax = Main.proj.latlon2eastNorth(bounds.getMax());
     401        EastNorth rasterCenter = Main.getProjection().latlon2eastNorth(bounds.getCenter());
     402        EastNorth eaMin = Main.getProjection().latlon2eastNorth(bounds.getMin());
     403        EastNorth eaMax = Main.getProjection().latlon2eastNorth(bounds.getMax());
    404404        double rasterSizeX = communeBBox.max.getX() - communeBBox.min.getX();
    405405        double rasterSizeY = communeBBox.max.getY() - communeBBox.min.getY();
Note: See TracChangeset for help on using the changeset viewer.