Ignore:
Timestamp:
2011-02-28T12:17:19+01:00 (14 years ago)
Author:
upliner
Message:

Fix Mercator scale factor in buildings_tools and importvec

Location:
applications/editors/josm/plugins
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/buildings_tools/build.xml

    r25192 r25469  
    3333        <property name="commit.message" value="update (23630 was committed together with the code which is not right)" />
    3434        <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    35         <property name="plugin.main.version" value="3835" />
     35        <property name="plugin.main.version" value="3922" />
    3636
    3737
  • applications/editors/josm/plugins/buildings_tools/src/buildings_tools/Building.java

    r23190 r25469  
    2828
    2929class Building {
    30     private static final double eqlen = 40075004; // length of equator in metres
    3130    private final EastNorth[] en = new EastNorth[4];
    3231
     
    8382
    8483    private void updMetrics() {
    85         meter = 2 * Math.PI / (Math.cos(Math.toRadians(eastNorth2latlon(en[0]).lat())) * eqlen);
     84        meter = 1 / Math.cos(Math.toRadians(eastNorth2latlon(en[0]).lat()));
    8685        len = 0;
    8786    }
  • applications/editors/josm/plugins/importvec/build.xml

    r25191 r25469  
    3333    <property name="commit.message" value="Commit message" />
    3434    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    35     <property name="plugin.main.version" value="3835" />
     35    <property name="plugin.main.version" value="3922" />
    3636
    3737
  • applications/editors/josm/plugins/importvec/src/org/openstreetmap/josm/plugins/importvec/ImportVectorAction.java

    r24995 r25469  
    149149        }
    150150
    151         private static final double eqlen = 40075004; // length of equator in metres
    152151        Mercator projection = new Mercator();
    153152        EastNorth center;
     
    218217                        break;
    219218                    case PathIterator.SEG_CLOSE:
    220                         if (currentway.firstNode().getCoor().equals(nodes.getLast().getCoor())) {
     219                        if (currentway.firstNode().getCoor().equalsEpsilon(nodes.getLast().getCoor())) {
    221220                            currentway.removeNode(nodes.removeLast());
    222221                        }
     
    247246        protected void realRun() throws SAXException, IOException, OsmTransferException {
    248247            LatLon center = Main.proj.eastNorth2latlon(Main.map.mapView.getCenter());
    249             scale = 2 * Math.PI / (Math.cos(Math.toRadians(center.lat())) * eqlen)
    250                     * Settings.getScaleNumerator() / Settings.getScaleDivisor();
     248            scale = Settings.getScaleNumerator() / Settings.getScaleDivisor() / Math.cos(Math.toRadians(center.lat()));
    251249            this.center = projection.latlon2eastNorth(center);
    252250            try {
     
    257255                    rdr.setContentHandler(loader);
    258256                    rdr.setEntityResolver(new EntityResolver() {
     257                                @Override
    259258                                public InputSource resolveEntity(String publicId, String systemId) {
    260259                                    //Ignore all DTDs
Note: See TracChangeset for help on using the changeset viewer.