Changeset 30573 in osm for applications/editors/josm/plugins/opendata/src
- Timestamp:
- 2014-08-07T02:09:00+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/AbstractImporter.java
r30563 r30573 2 2 package org.openstreetmap.josm.plugins.opendata.core.io; 3 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 4 6 import java.io.File; 7 import java.io.FileInputStream; 8 import java.io.FileNotFoundException; 5 9 import java.io.IOException; 10 import java.io.InputStream; 6 11 12 import org.openstreetmap.josm.Main; 7 13 import org.openstreetmap.josm.actions.ExtensionFileFilter; 8 14 import org.openstreetmap.josm.data.osm.DataSet; … … 45 51 this.handler = findDataSetHandler(file); 46 52 } 47 super.importData(file, progressMonitor); 53 // Do not call super.importData because Compression.getUncompressedFileInputStream skips the first entry 54 try (InputStream in = new FileInputStream(file)) { 55 importData(in, file, progressMonitor); 56 } catch (FileNotFoundException e) { 57 Main.error(e); 58 throw new IOException(tr("File ''{0}'' does not exist.", file.getName()), e); 59 } 48 60 } 49 61 -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/archive/ZipReader.java
r30568 r30573 18 18 import javax.xml.stream.XMLStreamException; 19 19 20 import org.openstreetmap.josm.Main; 20 21 import org.openstreetmap.josm.data.osm.DataSet; 21 22 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 45 46 protected void extractArchive(final File temp, final List<File> candidates) throws IOException, FileNotFoundException { 46 47 while ((entry = zis.getNextEntry()) != null) { 48 if (Main.isDebugEnabled()) { 49 Main.debug("Extracting "+entry.getName()); 50 } 47 51 File file = new File(temp + File.separator + entry.getName()); 48 52 File parent = file.getParentFile(); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/MifDatum.java
r30340 r30573 4 4 import static org.openstreetmap.josm.plugins.opendata.core.io.geographic.MifEllipsoid.*; 5 5 6 // TODO: finish 6 /** 7 * MapInfo Interchange File (MIF) datums, based on this specification:<ul> 8 * <li><a href="https://github.com/tricycle/electrodrive-market-analysis/blob/master/specifications/Mapinfo_Mif.pdf">Mapinfo_Mif.pdf</a></li> 9 * </ul> 10 * This file has been stored in reference directory to avoid future dead links. 11 */ 7 12 public enum MifDatum { 8 Adindan(1, Clarke_1880), 9 Afgooye(2, Krassovsky), 10 Ain_el_Abd_1970(3, International), 11 Anna_1_Astro_1965(4, Australian_National), 12 Arc_1950(5, Clarke_1880), 13 Arc_1960(6, Clarke_1880), 14 Ascension_Island_1958(7, International), 15 Astro_Beacon_E(8, International), 16 Astro_B4_Sorol_Atoll(9, International), 17 Astro_DOS_71_4(10, International), 18 Astronomic_Station_1952(11, International), 19 Australian_Geodetic_1966_AGD_66(12, Australian_National), 20 Australian_Geodetic_1984_AGD_84(13, Australian_National), 21 Belgium(110, International), 22 Bellevue_IGN(14, International), 23 Bermuda_1957(15, Clarke_1866), 24 Bogota_Observatory(16, International), 25 //17Campo_Inchauspe26 //18Canton_Astro_196627 //19 CapeSouth Africa Clarke_1880),28 //20 CapeCanaveral29 //21CarthageTunisiaClarke_1880),30 //22Chatham1971Chatham Island (New Zealand) International),31 //23 Chua AstroParaguay International),32 //24CorregoAlegre BrazilInternational),33 //1000Deutsches(DHDN)Germany Bessel),34 //25Djakarta(Batavia)Sumatra Island (Indonesia)Bessel1841),35 //26 DOS 1968Gizo Island (New Georgia Islands) International),36 //27Easter Island1967 Easter IslandInternational),37 European_1950_ED_50(28, International), 38 European_1979_ED_79(29, International), 39 European_1987_ED_87(108, International), 40 Gandajika_Base(30, International), 41 Geodetic_Datum_1949(31, International), 42 Geodetic_Reference_System_1967_GRS_67(32, GRS_67), 43 Geodetic_Reference_System_1980_GRS_80(33, GRS_80), 44 //34 Guam 1963Guam Island Clarke_1866),45 //35 GUX 1 AstroGuadalcanal Island International),46 //36 Hito XVIII 1963South Chile (near 53°S) International),47 //37Hjorsey1955Iceland International),48 //38Hong Kong1963 Hong KongInternational),49 //39 Hu–Tzu–Shan TaiwanInternational),50 //40 IndianThailand and Vietnam Everest),51 //41 IndianBangladesh, India, Nepal Everest),52 //42Ireland1965Ireland Modified53 //43 ISTS 073 Astro 1969Diego Garcia International),54 //44Johnston Island1961 Johnston IslandInternational),55 //45Kandawala56 //46Kerguelen IslandKerguelen IslandInternational),57 //47 Kertau 1948West Malaysia and Singapore Modified58 //48 L.C. 5 AstroCayman Brac Island Clarke_1866),59 //49Liberia1964Liberia Clarke_1880),60 //113 Lisboa (DLx)Portugal International),61 //50 LuzonPhilippines (excluding Mindanao Island) Clarke_1866),62 //51 LuzonMindanao Island Clarke_1866),63 //52 Mahe 1971Mahe Island Clarke_1880),64 //53 Marco AstroSalvage Islands International),65 //54MassawaBessel1841),66 //114Melrica1973 (D73)Portugal International),67 //55MerchichMoroccoClarke_1880),68 //56MidwayAstro 1961Midway Island International),69 //57 MinnaNigeria Clarke_1880),70 //58Nahrwan71 //59Nahrwan72 //60Nahrwan73 //61Naparima, BWITrinidad and Tobago International),74 //109Netherlands75 North_American_1927_NAD_27_CONTINENTAL(62, Clarke_1866), 76 North_American_1927_NAD_27_ALASKA(63, Clarke_1866), 77 North_American_1927_NAD_27_BAHAMAS(64, Clarke_1866), 78 North_American_1927_NAD_27_SAN_SALVADOR(65, Clarke_1866), 79 North_American_1927_NAD_27_CANADA(66, Clarke_1866), 80 North_American_1927_NAD_27_CANAL_ZONE(67, Clarke_1866), 81 North_American_1927_NAD_27_CARIBBEAN(68, Clarke_1866), 82 North_American_1927_NAD_27_CENTRAL_AMERICA(69, Clarke_1866), 83 North_American_1927_NAD_27_CUBA(70, Clarke_1866), 84 North_American_1927_NAD_27_GREENLAND(71, Clarke_1866), 85 North_American_1927_NAD_27_MEXICO(72, Clarke_1866), 86 North_American_1927_NAD_27_MICHIGAN(73, Modified_Clarke_1866), 87 North_American_1983_NAD_83(74, GRS_80), 88 Nouvelle_Triangulation_Francaise_NTF(107, Clarke_1880), 89 Nouvelle_Triangulation_Francaise_NTF_Greenwich_Prime_Meridian(1002, Clarke_1880), 90 NWGL_10(111, WGS_72), 91 //75Observatorio1966Corvo and Flores Islands (Azores) International),92 //76 OldEgyptianEgyptHelmert93 //77 OldHawaiianHawaiiClarke_1866),94 //78 Oman OmanClarke_1880),95 //79OrdnanceSurvey of GreatBritain1936England, Isle of Man, Scotland, Shetland Islands, Wales Airy),96 //80 Pico de las NievesCanary Islands International),97 //81PitcairnAstro 1967Pitcairn Island International),98 //1000PotsdamGermanyBessel),99 //36ProvisionalSouthChilean1963South Chile (near 53°S) International),100 //82ProvisionalSouthAmerican1956Bolivia, Chile, Colombia, Ecuador, Guyana, Peru, Venezuela International),101 //83PuertoRicoPuerto Rico and Virgin Islands Clarke_1866),102 //1001Pulkovo1942Germany Krassovsky),103 //84 QatarNationalQatarInternational),104 //85Qornoq105 //1000RauenbergGermanyBessel),106 //86Reunion107 //112Rikets1990 (RT 90) SwedenBessel),108 //87 Rome 1940Sardinia Island International),109 //88 Santo (DOS)Espirito Santo Island International),110 //89 São BrazSão Miguel, Santa Maria Islands (Azores) International),111 //90SapperHill 1943East Falkland Island International),112 //91SchwarzeckBessel1841),113 //92 SouthAmerican1969Argentina, Bolivia, Brazil, Chile, Colombia, Ecuador, Guyana, Paraguay, Peru, Venezuela, Trinidad, and TobagoSouthAmerican114 //93 South AsiaSingapore Modified115 //94SoutheastBasePorto Santo and Madeira Islands International),116 //95SouthwestBaseFaial, Graciosa, Pico, Sao Jorge, Terceira Islands (Azores) International),117 //1003Switzerland(CH 1903)Switzerland Bessel),118 //96Timbalai1948Brunei and East Malaysia (Sarawak and Sabah) Everest),119 //97 TokyoJapan, Korea, OkinawaBessel1841),120 //98TristanAstro 1968Tristan da Cunha International),121 //99 Viti Levu 1916Viti Levu Island (Fiji Islands) Clarke_1880),122 Wake_Eniwetok_1960(100, Hough), 123 World_Geodetic_System_1960_WGS_60(101, WGS_60), 124 World_Geodetic_System_1966_WGS_66(102, WGS_66), 125 World_Geodetic_System_1972_WGS_72(103, WGS_72), 126 World_Geodetic_System_1984_WGS_84(104, WGS_84), 127 Yacare(105, International), 128 Zanderij(106, International), 129 Custom(999, null); 13 Adindan(1, "Ethiopia, Mali, Senegal, Sudan", Clarke_1880), 14 Afgooye(2, "Somalia", Krassovsky), 15 Ain_el_Abd_1970(3, "Bahrain Island", International), 16 Anna_1_Astro_1965(4, "Cocos Islands", Australian_National), 17 Arc_1950(5, "Botswana, Lesotho, Malawi, Swaziland, Zaire, Zambia, Zimbabwe", Clarke_1880), 18 Arc_1960(6, "Kenya, Tanzania", Clarke_1880), 19 Ascension_Island_1958(7, "Ascension Island", International), 20 Astro_Beacon_E(8, "Iwo Jima Island", International), 21 Astro_B4_Sorol_Atoll(9, "Tern Island", International), 22 Astro_DOS_71_4(10, "St. Helena Island", International), 23 Astronomic_Station_1952(11, "Marcus Island", International), 24 Australian_Geodetic_1966_AGD_66(12, "Australia and Tasmania Island", Australian_National), 25 Australian_Geodetic_1984_AGD_84(13, "Australia and Tasmania Island", Australian_National), 26 Belgium(110, "Belgium", International), 27 Bellevue_IGN(14, "Efate and Erromango Islands", International), 28 Bermuda_1957(15, "Bermuda Islands", Clarke_1866), 29 Bogota_Observatory(16, "Colombia", International), 30 Campo_Inchauspe(17, "Argentina", International), 31 Canton_Astro_1966(18, "Phoenix Islands", International), 32 Cape(19, "South Africa", Clarke_1880), 33 Cape_Canaveral(20, "Florida and Bahama Islands", Clarke_1866), 34 Carthage(21, "Tunisia", Clarke_1880), 35 Chatham_1971(22, "Chatham Island (New Zealand)", International), 36 Chua_Astro(23, "Paraguay", International), 37 Corrego_Alegre(24, "Brazil", International), 38 Deutsches_Hauptdreicksnetz_DHDN(1000, "Germany", Bessel), 39 Djakarta_Batavia(25, "Sumatra Island (Indonesia)", Bessel_1841), 40 DOS_1968(26, "Gizo Island (New Georgia Islands)", International), 41 Easter_Island_1967(27, "Easter Island", International), 42 European_1950_ED_50(28, "Austria, Belgium, Denmark, Finland, France, Germany, Gibraltar, Greece, Italy, Luxembourg, Netherlands, Norway, Portugal, Spain, Sweden, Switzerland", International), 43 European_1979_ED_79(29, "Austria, Finland, Netherlands, Norway, Spain, Sweden, Switzerland", International), 44 European_1987_ED_87(108, "Europe", International), 45 Gandajika_Base(30, "Republic of Maldives", International), 46 Geodetic_Datum_1949(31, "New Zealand", International), 47 Geodetic_Reference_System_1967_GRS_67(32, "Worldwide", GRS_67), 48 Geodetic_Reference_System_1980_GRS_80(33, "Worldwide", GRS_80), 49 Guam_1963(34, "Guam Island", Clarke_1866), 50 GUX_1_Astro(35, "Guadalcanal Island", International), 51 Hito_XVIII_1963(36, "South Chile (near 53°S)", International), 52 Hjorsey_1955(37, "Iceland", International), 53 Hong_Kong_1963(38, "Hong Kong", International), 54 Hu_Tzu_Shan(39, "Taiwan", International), 55 Indian_40(40, "Thailand and Vietnam", Everest), 56 Indian_41(41, "Bangladesh, India, Nepal", Everest), 57 Ireland_1965(42, "Ireland", Modified_Airy), 58 ISTS_073_Astro_1969(43, "Diego Garcia", International), 59 Johnston_Island_1961(44, "Johnston Island", International), 60 Kandawala(45, "Sri Lanka", Everest), 61 Kerguelen_Island(46, "Kerguelen Island", International), 62 Kertau_1948(47, "West Malaysia and Singapore", Modified_Everest), 63 LC_5_Astro(48, "Cayman Brac Island", Clarke_1866), 64 Liberia_1964(49, "Liberia", Clarke_1880), 65 Lisboa_DLx(113, "Portugal", International), 66 Luzon_50(50, "Philippines (excluding Mindanao Island)", Clarke_1866), 67 Luzon_51(51, "Mindanao Island", Clarke_1866), 68 Mahe_1971(52, "Mahe Island", Clarke_1880), 69 Marco_Astro(53, "Salvage Islands", International), 70 Massawa(54, "Eritrea (Ethiopia)", Bessel_1841), 71 Melrica_1973_D73(114, "Portugal", International), 72 Merchich(55, "Morocco", Clarke_1880), 73 Midway_Astro_1961(56, "Midway Island", International), 74 Minna(57, "Nigeria", Clarke_1880), 75 Nahrwan_58(58, "Masirah Island (Oman)", Clarke_1880), 76 Nahrwan_59(59, "United Arab Emirates", Clarke_1880), 77 Nahrwan_60(60, "Saudi Arabia", Clarke_1880), 78 Naparima_BWI(61, "Trinidad and Tobago", International), 79 Netherlands(109, "Netherlands", Bessel), 80 North_American_1927_NAD_27_CONTINENTAL(62, "Continental US", Clarke_1866), 81 North_American_1927_NAD_27_ALASKA(63, "Alaska", Clarke_1866), 82 North_American_1927_NAD_27_BAHAMAS(64, "Bahamas (excluding San Salvador Island)", Clarke_1866), 83 North_American_1927_NAD_27_SAN_SALVADOR(65, "San Salvador Island", Clarke_1866), 84 North_American_1927_NAD_27_CANADA(66, "Canada (including Newfoundland Island)", Clarke_1866), 85 North_American_1927_NAD_27_CANAL_ZONE(67, "Canal Zone", Clarke_1866), 86 North_American_1927_NAD_27_CARIBBEAN(68, "Caribbean (Turks and Caicos Islands)", Clarke_1866), 87 North_American_1927_NAD_27_CENTRAL_AMERICA(69, "Central America (Belize, Costa Rica, El Salvador, Guatemala, Honduras, Nicaragua)", Clarke_1866), 88 North_American_1927_NAD_27_CUBA(70, "Cuba", Clarke_1866), 89 North_American_1927_NAD_27_GREENLAND(71, "Greenland (Hayes Peninsula)", Clarke_1866), 90 North_American_1927_NAD_27_MEXICO(72, "Mexico", Clarke_1866), 91 North_American_1927_NAD_27_MICHIGAN(73, "Michigan (used only for State Plane Coordinate System 1927)", Modified_Clarke_1866), 92 North_American_1983_NAD_83(74, "Alaska, Canada, Central America, Continental US, Mexico", GRS_80), 93 Nouvelle_Triangulation_Francaise_NTF(107, "France", Clarke_1880), 94 Nouvelle_Triangulation_Francaise_NTF_Greenwich_Prime_Meridian(1002, "France", Clarke_1880), 95 NWGL_10(111, "Worldwide", WGS_72), 96 Observatorio_1966(75, "Corvo and Flores Islands (Azores)", International), 97 Old_Egyptian(76, "Egypt", Helmert_1906), 98 Old_Hawaiian(77, "Hawaii", Clarke_1866), 99 Oman(78, "Oman", Clarke_1880), 100 Ordnance_Survey_of_Great_Britain_1936(79, "England, Isle of Man, Scotland, Shetland Islands, Wales", Airy), 101 Pico_de_las_Nieves(80, "Canary Islands", International), 102 Pitcairn_Astro_1967(81, "Pitcairn Island", International), 103 Potsdam(1000, "Germany", Bessel), 104 Provisional_South_Chilean_1963(36, "South Chile (near 53°S)", International), 105 Provisional_South_American_1956(82, "Bolivia, Chile, Colombia, Ecuador, Guyana, Peru, Venezuela", International), 106 Puerto_Rico(83, "Puerto Rico and Virgin Islands", Clarke_1866), 107 Pulkovo_1942(1001, "Germany", Krassovsky), 108 Qatar_National(84, "Qatar", International), 109 Qornoq(85, "South Greenland", International), 110 Rauenberg(1000, "Germany", Bessel), 111 Reunion(86, "Mascarene Island", International), 112 Rikets_Triangulering_1990_RT_90(112, "Sweden", Bessel), 113 Rome_1940(87, "Sardinia Island", International), 114 Santo_DOS(88, "Espirito Santo Island", International), 115 Sao_Braz(89, "São Miguel, Santa Maria Islands (Azores)", International), 116 Sapper_Hill_1943(90, "East Falkland Island", International), 117 Schwarzeck(91, "Namibia Modified", Bessel_1841), 118 South_American_1969(92, "Argentina, Bolivia, Brazil, Chile, Colombia, Ecuador, Guyana, Paraguay, Peru, Venezuela, Trinidad, and Tobago", MifEllipsoid.South_American_1969), 119 South_Asia(93, "Singapore", Modified_Fischer_1960), 120 Southeast_Base(94, "Porto Santo and Madeira Islands", International), 121 Southwest_Base(95, "Faial, Graciosa, Pico, Sao Jorge, Terceira Islands (Azores)", International), 122 Switzerland_CH_1903(1003, "Switzerland", Bessel), 123 Timbalai_1948(96, "Brunei and East Malaysia (Sarawak and Sabah)", Everest), 124 Tokyo(97, "Japan, Korea, Okinawa", Bessel_1841), 125 Tristan_Astro_1968(98, "Tristan da Cunha", International), 126 Viti_Levu_1916(99, "Viti Levu Island (Fiji Islands)", Clarke_1880), 127 Wake_Eniwetok_1960(100, "", Hough), 128 World_Geodetic_System_1960_WGS_60(101, "", WGS_60), 129 World_Geodetic_System_1966_WGS_66(102, "", WGS_66), 130 World_Geodetic_System_1972_WGS_72(103, "", WGS_72), 131 World_Geodetic_System_1984_WGS_84(104, "", WGS_84), 132 Yacare(105, "", International), 133 Zanderij(106, "", International), 134 Custom(999, null, null); 130 135 131 136 private final Integer code; 137 private final String area; 132 138 private final MifEllipsoid ellipsoid; 133 private MifDatum(Integer code, MifEllipsoid ellipsoid) { 139 private MifDatum(Integer code, String area, MifEllipsoid ellipsoid) { 134 140 this.code = code; 141 this.area = area; 135 142 this.ellipsoid = ellipsoid; 136 143 } … … 138 145 return code; 139 146 } 147 public final String getArea() { 148 return area; 149 } 140 150 public final MifEllipsoid getEllipsoid() { 141 151 return ellipsoid; -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/MifEllipsoid.java
r30340 r30573 2 2 package org.openstreetmap.josm.plugins.opendata.core.io.geographic; 3 3 4 /** 5 * MapInfo Interchange File (MIF) ellipsoids, based on this specification:<ul> 6 * <li><a href="https://github.com/tricycle/electrodrive-market-analysis/blob/master/specifications/Mapinfo_Mif.pdf">Mapinfo_Mif.pdf</a></li> 7 * </ul> 8 * This file has been stored in reference directory to avoid future dead links. 9 */ 4 10 public enum MifEllipsoid { 5 11 Airy, -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/MifProjection.java
r30340 r30573 2 2 package org.openstreetmap.josm.plugins.opendata.core.io.geographic; 3 3 4 /** 5 * MapInfo Interchange File (MIF) projections, based on this specification:<ul> 6 * <li><a href="https://github.com/tricycle/electrodrive-market-analysis/blob/master/specifications/Mapinfo_Mif.pdf">Mapinfo_Mif.pdf</a></li> 7 * </ul> 8 * This file has been stored in reference directory to avoid future dead links. 9 */ 4 10 public enum MifProjection { 5 Albers_Equal_Area_Conic(9), 6 Azimuthal_Equidistant_polar_aspect_only(5), 7 Cylindrical_Equal_Area(2), 8 Eckert_IV(14), 9 Eckert_VI(15), 10 Equidistant_Conic_also_known_as_Simple_Conic(6), 11 Gall(17), 12 Hotine_Oblique_Mercator(7), 13 Lambert_Azimuthal_Equal_Area_polar_aspect_only(4), 14 Lambert_Conformal_Conic(3), 15 Lambert_Conformal_Conic_modified_for_Belgium_1972(19), 16 Longitude_Latitude(1), 17 Mercator(10), 18 Miller_Cylindrical(11), 19 New_Zealand_Map_Grid(18), 20 Mollweide(13), 21 Polyconic(27), 22 Regional_Mercator(26), 23 Robinson(12), 24 Sinusoidal(16), 25 Stereographic(20), 26 Swiss_Oblique_Mercator(25), 27 Transverse_Mercator_also_known_as_Gauss_Kruger(8), 28 Transverse_Mercator_modified_for_Danish_System_34_Jylland_Fyn(21), 29 Transverse_Mercator_modified_for_Sjaelland(22), 30 Transverse_Mercator_modified_for_Danish_System_45_Bornholm(23), 31 Transverse_Mercator_modified_for_Finnish_KKJ(24); 11 Albers_Equal_Area_Conic(9, "aea"), 12 Azimuthal_Equidistant_polar_aspect_only(5, "aeqd"), 13 Cylindrical_Equal_Area(2, "cea"), 14 Eckert_IV(14, "eck4"), 15 Eckert_VI(15, "eck6"), 16 Equidistant_Conic_also_known_as_Simple_Conic(6, "eqdc"), 17 Gall(17, "gall"), 18 Hotine_Oblique_Mercator(7, "omerc"), 19 Lambert_Azimuthal_Equal_Area_polar_aspect_only(4, "laea"), 20 Lambert_Conformal_Conic(3, "lcc"), 21 Lambert_Conformal_Conic_modified_for_Belgium_1972(19, "lcca"), 22 Longitude_Latitude(1, "lonlat"), 23 Mercator(10, "merc"), 24 Miller_Cylindrical(11, "mill"), 25 New_Zealand_Map_Grid(18, "nzmg"), 26 Mollweide(13, "moll"), 27 Polyconic(27, "poly"), 28 Regional_Mercator(26, "merc"), 29 Robinson(12, "robin"), 30 Sinusoidal(16, "sinu"), 31 Stereographic(20, "stere"), 32 Swiss_Oblique_Mercator(25, "somerc"), 33 Transverse_Mercator_also_known_as_Gauss_Kruger(8, "tmerc"), 34 Transverse_Mercator_modified_for_Danish_System_34_Jylland_Fyn(21, "tmerc"), 35 Transverse_Mercator_modified_for_Sjaelland(22, "tmerc"), 36 Transverse_Mercator_modified_for_Danish_System_45_Bornholm(23, "tmerc"), 37 Transverse_Mercator_modified_for_Finnish_KKJ(24, "tmerc"); 32 38 33 39 private final Integer code; 34 private MifProjection(Integer code) { 40 private final String proj4id; 41 42 private MifProjection(Integer code, String proj4id) { 35 43 this.code = code; 44 this.proj4id = proj4id; 36 45 } 46 37 47 public final Integer getCode() { 38 48 return code; 39 49 } 50 51 /** 52 * Replies the Proj.4 identifier. 53 * 54 * @return The Proj.4 identifier (as reported by cs2cs -lp). 55 * If no id exists, return {@code null}. 56 */ 57 public final String getProj4Id() { 58 return proj4id; 59 } 60 40 61 public static MifProjection forCode(Integer code) { 41 62 for (MifProjection p : values()) { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/MifReader.java
r30563 r30573 24 24 import org.openstreetmap.josm.data.osm.RelationMember; 25 25 import org.openstreetmap.josm.data.osm.Way; 26 import org.openstreetmap.josm.data.projection.CustomProjection; 27 import org.openstreetmap.josm.data.projection.CustomProjection.Param; 26 28 import org.openstreetmap.josm.data.projection.Projection; 27 29 import org.openstreetmap.josm.data.projection.Projections; … … 33 35 /** 34 36 * MapInfo Interchange File (MIF) reader, based on these specifications:<ul> 35 * <li><a href="http ://www.gissky.com/Download/Download/DataFormat/Mapinfo_Mif.pdf">Mapinfo_Mif.pdf(dead link)</a></li>37 * <li><a href="https://github.com/tricycle/electrodrive-market-analysis/blob/master/specifications/Mapinfo_Mif.pdf">Mapinfo_Mif.pdf</a></li> 36 38 * <li><a href="http://resource.mapinfo.com/static/files/document/1074660800077/interchange_file.pdf">interchange_file.pdf</a></li> 37 39 * </ul> 40 * These files have been stored in reference directory to avoid future dead links. 38 41 */ 39 42 public class MifReader extends AbstractMapInfoReader { … … 102 105 Main.warn("TODO Index: "+line); 103 106 } 107 108 private static String param(Param p, Object value) { 109 return " +"+p.key+"="+value; 110 } 104 111 105 112 private void parseCoordSysSyntax1(String[] words) { … … 115 122 } 116 123 124 // Initialize proj4-like parameters 125 String params = param(Param.proj, proj.getProj4Id()); 126 117 127 // Units 118 128 units = words[5+offset]; 129 params += param(Param.units, units); 119 130 120 131 // Origin, longitude 121 132 originLon = Double.parseDouble(words[6+offset]); 133 params += param(Param.lon_0, originLon); 122 134 123 135 // Origin, latitude … … 140 152 case Polyconic: 141 153 originLat = Double.parseDouble(words[7+offset]); 154 params += param(Param.lat_0, originLat); 142 155 break; 143 156 } … … 148 161 case Regional_Mercator: 149 162 stdP1 = Double.parseDouble(words[7+offset]); 163 params += param(Param.lat_1, stdP1); 150 164 break; 151 165 case Albers_Equal_Area_Conic: … … 154 168 case Lambert_Conformal_Conic_modified_for_Belgium_1972: 155 169 stdP1 = Double.parseDouble(words[8+offset]); 170 params += param(Param.lat_1, stdP1); 156 171 break; 157 172 } … … 164 179 case Lambert_Conformal_Conic_modified_for_Belgium_1972: 165 180 stdP2 = Double.parseDouble(words[9+offset]); 181 params += param(Param.lat_2, stdP2); 166 182 break; 167 183 } … … 170 186 if (proj == Hotine_Oblique_Mercator) { 171 187 azimuth = Double.parseDouble(words[8+offset]); 188 // TODO: what's proj4 parameter ? 172 189 } 173 190 … … 176 193 case Hotine_Oblique_Mercator: 177 194 scaleFactor = Double.parseDouble(words[9+offset]); 195 params += param(Param.k_0, scaleFactor); 178 196 break; 179 197 case Stereographic: … … 184 202 case Transverse_Mercator_modified_for_Sjaelland: 185 203 scaleFactor = Double.parseDouble(words[8+offset]); 204 params += param(Param.k_0, scaleFactor); 186 205 break; 187 206 } … … 196 215 falseEasting = Double.parseDouble(words[10+offset]); 197 216 falseNorthing = Double.parseDouble(words[11+offset]); 217 params += param(Param.x_0, falseEasting); 218 params += param(Param.y_0, falseNorthing); 198 219 break; 199 220 case Stereographic: … … 205 226 falseEasting = Double.parseDouble(words[9+offset]); 206 227 falseNorthing = Double.parseDouble(words[10+offset]); 228 params += param(Param.x_0, falseEasting); 229 params += param(Param.y_0, falseNorthing); 207 230 break; 208 231 case New_Zealand_Map_Grid: … … 211 234 falseEasting = Double.parseDouble(words[8+offset]); 212 235 falseNorthing = Double.parseDouble(words[9+offset]); 236 params += param(Param.x_0, falseEasting); 237 params += param(Param.y_0, falseNorthing); 213 238 break; 214 239 } … … 219 244 case Lambert_Azimuthal_Equal_Area_polar_aspect_only: 220 245 range = Double.parseDouble(words[8+offset]); 246 // TODO: what's proj4 parameter ? 221 247 } 222 248 … … 236 262 } 237 263 break; 238 default:239 // TODO240 Main.warn("TODO proj: "+line);241 264 } 242 265 … … 246 269 // handle cases with Bounds declaration 247 270 parseBounds(words, index); 271 272 if (josmProj == null) { 273 Main.info(line); 274 Main.info(params); 275 josmProj = new CustomProjection(params); 276 } 248 277 } 249 278 … … 344 373 345 374 private void parseRegion(String[] words) throws IOException { 346 region = new Relation();347 region.put("type", "multipolygon");348 ds.addPrimitive(region);349 readAttributes(region);350 375 numpolygons = Integer.parseInt(words[1]); 376 if (numpolygons > 1) { 377 region = new Relation(); 378 region.put("type", "multipolygon"); 379 ds.addPrimitive(region); 380 readAttributes(region); 381 } else { 382 region = null; 383 } 351 384 state = State.START_POLYGON; 352 385 } … … 416 449 polygon = new Way(); 417 450 ds.addPrimitive(polygon); 418 region.addMember(new RelationMember("outer", polygon)); 451 if (region != null) { 452 region.addMember(new RelationMember("outer", polygon)); 453 } else { 454 readAttributes(polygon); 455 } 419 456 state = State.READING_POINTS; 420 457 … … 437 474 if (--numpts == 0) { 438 475 if (numpolygons > -1) { 476 if (!polygon.isClosed()) { 477 polygon.addNode(polygon.firstNode()); 478 } 439 479 if (--numpolygons > 0) { 440 480 state = State.START_POLYGON; -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/MifUnit.java
r30340 r30573 2 2 package org.openstreetmap.josm.plugins.opendata.core.io.geographic; 3 3 4 /** 5 * MapInfo Interchange File (MIF) units, based on this specification:<ul> 6 * <li><a href="https://github.com/tricycle/electrodrive-market-analysis/blob/master/specifications/Mapinfo_Mif.pdf">Mapinfo_Mif.pdf</a></li> 7 * </ul> 8 * This file has been stored in reference directory to avoid future dead links. 9 */ 4 10 public enum MifUnit { 5 11 Centimeters(6),
Note:
See TracChangeset
for help on using the changeset viewer.