Changeset 30573 in osm for applications
- Timestamp:
- 2014-08-07T02:09:00+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/opendata
- Files:
-
- 3 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/build.xml
r30564 r30573 1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 <project name="opendata" default="dist" basedir="."> 3 <property name="plugin.main.version" value="7 291"/>3 <property name="plugin.main.version" value="7371"/> 4 4 <property name="plugin.author" value="Don-vip"/> 5 5 <property name="plugin.class" value="org.openstreetmap.josm.plugins.opendata.OdPlugin"/> -
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 //17 Campo_Inchauspe ArgentinaInternational),26 //18 Canton_Astro_1966 Phoenix IslandsInternational),27 //19 Cape South AfricaClarke_1880),28 //20 Cape Canaveral Florida and Bahama IslandsClarke_1866),29 //21 Carthage TunisiaClarke_1880),30 //22 Chatham 1971 Chatham Island (New Zealand)International),31 //23 Chua Astro ParaguayInternational),32 //24 Corrego Alegre BrazilInternational),33 //1000 Deutsches Hauptdreicksnetz (DHDN) GermanyBessel),34 //25 Djakarta (Batavia) Sumatra Island (Indonesia) Bessel1841),35 //26 DOS 1968 Gizo Island (New Georgia Islands)International),36 //27 Easter Island 1967 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 1963 Guam IslandClarke_1866),45 //35 GUX 1 Astro Guadalcanal IslandInternational),46 //36 Hito XVIII 1963 South Chile (near 53°S)International),47 //37 Hjorsey 1955 IcelandInternational),48 //38 Hong Kong 1963 Hong KongInternational),49 //39 Hu–Tzu–Shan TaiwanInternational),50 //40 Indian Thailand and VietnamEverest),51 //41 Indian Bangladesh, India, NepalEverest),52 //42 Ireland 1965 Ireland ModifiedAiry),53 //43 ISTS 073 Astro 1969 Diego GarciaInternational),54 //44 Johnston Island 1961 Johnston IslandInternational),55 //45 Kandawala Sri LankaEverest),56 //46 Kerguelen Island Kerguelen IslandInternational),57 //47 Kertau 1948 West Malaysia and Singapore ModifiedEverest),58 //48 L.C. 5 Astro Cayman Brac IslandClarke_1866),59 //49 Liberia 1964 LiberiaClarke_1880),60 //113 Lisboa (DLx) PortugalInternational),61 //50 Luzon Philippines (excluding Mindanao Island)Clarke_1866),62 //51 Luzon Mindanao IslandClarke_1866),63 //52 Mahe 1971 Mahe IslandClarke_1880),64 //53 Marco Astro Salvage IslandsInternational),65 //54 Massawa Eritrea (Ethiopia) Bessel1841),66 //114 Melrica 1973 (D73) PortugalInternational),67 //55 Merchich MoroccoClarke_1880),68 //56 Midway Astro 1961 Midway IslandInternational),69 //57 Minna NigeriaClarke_1880),70 //58 Nahrwan Masirah Island (Oman)Clarke_1880),71 //59 Nahrwan United Arab EmiratesClarke_1880),72 //60 Nahrwan Saudi ArabiaClarke_1880),73 //61 Naparima, BWI Trinidad and TobagoInternational),74 //109 Netherlands NetherlandsBessel),75 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 //75 Observatorio 1966 Corvo and Flores Islands (Azores)International),92 //76 Old Egyptian Egypt Helmert1906),93 //77 Old Hawaiian HawaiiClarke_1866),94 //78 Oman OmanClarke_1880),95 //79 Ordnance Survey of Great Britain 1936 England, Isle of Man, Scotland, Shetland Islands, WalesAiry),96 //80 Pico de las Nieves Canary IslandsInternational),97 //81 Pitcairn Astro 1967 Pitcairn IslandInternational),98 //1000 Potsdam GermanyBessel),99 //36 Provisional South Chilean 1963 South Chile (near 53°S)International),100 //82 Provisional South American 1956 Bolivia, Chile, Colombia, Ecuador, Guyana, Peru, VenezuelaInternational),101 //83 Puerto Rico Puerto Rico and Virgin IslandsClarke_1866),102 //1001 Pulkovo 1942 GermanyKrassovsky),103 //84 Qatar National QatarInternational),104 //85 Qornoq South GreenlandInternational),105 //1000 Rauenberg GermanyBessel),106 //86 Reunion Mascarene IslandInternational),107 //112 Rikets Triangulering 1990 (RT 90) SwedenBessel),108 //87 Rome 1940 Sardinia IslandInternational),109 //88 Santo (DOS) Espirito Santo IslandInternational),110 //89 São Braz São Miguel, Santa Maria Islands (Azores)International),111 //90 Sapper Hill 1943 East Falkland IslandInternational),112 //91 Schwarzeck Namibia Modified Bessel1841),113 //92 South American 1969 Argentina, Bolivia, Brazil, Chile, Colombia, Ecuador, Guyana, Paraguay, Peru, Venezuela, Trinidad, and Tobago South American1969),114 //93 South Asia Singapore Modified Fischer1960),115 //94 Southeast Base Porto Santo and Madeira IslandsInternational),116 //95 Southwest Base Faial, Graciosa, Pico, Sao Jorge, Terceira Islands (Azores)International),117 //1003 Switzerland (CH 1903) SwitzerlandBessel),118 //96 Timbalai 1948 Brunei and East Malaysia (Sarawak and Sabah)Everest),119 //97 Tokyo Japan, Korea, Okinawa Bessel1841),120 //98 Tristan Astro 1968 Tristan da CunhaInternational),121 //99 Viti Levu 1916 Viti 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), -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/NonRegFunctionalTests.java
r30568 r30573 18 18 import org.openstreetmap.josm.data.osm.DataSet; 19 19 import org.openstreetmap.josm.data.osm.Node; 20 import org.openstreetmap.josm.data.osm.OsmPrimitive; 20 import org.openstreetmap.josm.data.osm.Relation; 21 import org.openstreetmap.josm.data.osm.Way; 21 22 import org.openstreetmap.josm.tools.CheckParameterUtil; 22 23 … … 26 27 * Non-regression generic test. 27 28 */ 28 public static void testGeneric( DataSet ds) {29 public static void testGeneric(String context, DataSet ds) { 29 30 CheckParameterUtil.ensureParameterNotNull(ds, "ds"); 30 Collection<OsmPrimitive> prims = ds.allPrimitives(); 31 assertFalse(prims.isEmpty()); 31 // Every dataset should at least contain a node 32 Collection<Node> nodes = ds.getNodes(); 33 assertFalse("No nodes in dataset for "+context, nodes.isEmpty()); 34 // Nodes should all have coordinates 35 for (Node n : nodes) { 36 assertTrue("Node without coordinate found for "+context, n.getCoor() != null); 37 } 38 // and no empty ways 39 for (Way w : ds.getWays()) { 40 assertTrue("Empty way found for "+context, w.getNodesCount() > 0); 41 } 42 // neither empty relations 43 for (Relation r : ds.getRelations()) { 44 assertTrue("Empty relation found for "+context, r.getMembersCount() > 0); 45 } 32 46 } 33 47 … … 36 50 */ 37 51 public static void testTicket10214(DataSet ds) { 38 testGeneric( ds);52 testGeneric("#10214", ds); 39 53 boolean found = false; 40 54 for (Node n : ds.getNodes()) { -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/archive/ZipReaderTest.java
r30568 r30573 40 40 public void testReadZipFiles() throws IOException, XMLStreamException, FactoryConfigurationError, JAXBException { 41 41 for (Path p : NonRegFunctionalTests.listDataFiles("zip")) { 42 File file = p.toFile();43 Main.info("Testing reading file "+ file.getPath());44 try (InputStream is = new FileInputStream( file)) {42 File zipfile = p.toFile(); 43 Main.info("Testing reading file "+zipfile.getPath()); 44 try (InputStream is = new FileInputStream(zipfile)) { 45 45 for (Entry<File, DataSet> entry : ZipReader.parseDataSets(is, null, null, false).entrySet()) { 46 Main.info("Checking dataset for entry "+entry.getKey().getName()); 47 NonRegFunctionalTests.testGeneric(entry.getValue()); 46 String name = entry.getKey().getName(); 47 Main.info("Checking dataset for entry "+name); 48 NonRegFunctionalTests.testGeneric(zipfile.getName()+"/"+name, entry.getValue()); 48 49 } 49 50 } -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/KmlReaderTest.java
r30563 r30573 49 49 File file = new File(TestUtils.getRegressionDataFile(7714, "doc.kml")); 50 50 try (InputStream is = new FileInputStream(file)) { 51 NonRegFunctionalTests.testGeneric( KmlReader.parseDataSet(is, null));51 NonRegFunctionalTests.testGeneric("#7714", KmlReader.parseDataSet(is, null)); 52 52 } 53 53 } -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/MifReaderTest.java
r30568 r30573 34 34 File file = new File(TestUtils.getRegressionDataFile(9592, "bg.mif")); 35 35 try (InputStream is = new FileInputStream(file)) { 36 NonRegFunctionalTests.testGeneric( MifReader.parseDataSet(is, file, null, null));36 NonRegFunctionalTests.testGeneric("#9592", MifReader.parseDataSet(is, file, null, null)); 37 37 } 38 38 } -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReaderTest.java
r30563 r30573 49 49 File file = new File(TestUtils.getRegressionDataFile(8309, "new_ti_declarada.shp")); 50 50 try (InputStream is = new FileInputStream(file)) { 51 NonRegFunctionalTests.testGeneric( ShpReader.parseDataSet(is, file, null, null));51 NonRegFunctionalTests.testGeneric("#8309", ShpReader.parseDataSet(is, file, null, null)); 52 52 } 53 53 } -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/tabular/CsvReaderTest.java
r30563 r30573 77 77 File file = new File(TestUtils.getRegressionDataFile(8805, "XXX.csv")); 78 78 try (InputStream is = new FileInputStream(file)) { 79 NonRegFunctionalTests.testGeneric( CsvReader.parseDataSet(is, newHandler("EPSG:4326"), null));79 NonRegFunctionalTests.testGeneric("#8805", CsvReader.parseDataSet(is, newHandler("EPSG:4326"), null)); 80 80 } 81 81 }
Note:
See TracChangeset
for help on using the changeset viewer.