Changeset 34310 in osm
- Timestamp:
- 2018-06-17T17:57:30+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/indoorhelper/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/indoorhelper/src/model/IndoorHelperModel.java
r34135 r34310 181 181 * @author rebsc 182 182 * @param role The Multipolygon Role as String 183 * @param innerRelation inner relation 183 184 */ 184 185 public void editRelation(String role, Collection<OsmPrimitive> innerRelation) { … … 267 268 * @author rebsc 268 269 * @param ds active dataset 270 * @param relations relations 269 271 * @return true if selected object is a relation 270 272 */ -
applications/editors/josm/plugins/indoorhelper/src/org/openstreetmap/josm/plugins/indoorhelper/IndoorHelperPlugin.java
r34013 r34310 22 22 import java.io.File; 23 23 import java.io.FileOutputStream; 24 import java.io.IOException; 24 25 import java.io.InputStream; 25 26 import java.io.OutputStream; … … 45 46 * @author egru 46 47 * @author rebsc 47 *48 48 */ 49 49 public class IndoorHelperPlugin extends Plugin implements PaintableInvalidationListener, ActiveLayerChangeListener { 50 50 51 @SuppressWarnings("unused")52 51 private IndoorHelperController controller; 53 52 String sep = System.getProperty("file.separator"); … … 59 58 * 60 59 * @param info general information about the plug-in 61 */ 62 public IndoorHelperPlugin(PluginInformation info) throws Exception { 60 * @throws IOException if any I/O error occurs 61 */ 62 public IndoorHelperPlugin(PluginInformation info) throws IOException { 63 63 super(info); 64 64 MainApplication.getLayerManager().addAndFireActiveLayerChangeListener(this); … … 68 68 this.exportStyleFile("entrance_icon.png"); 69 69 this.exportStyleFile("elevator_icon.png"); 70 71 //this.setIndoorValidator(); 72 } 73 74 75 /** 76 * Secures that the plug-in is only loaded, if a new MapFrame is created. 77 */ 70 } 71 78 72 @Override 79 73 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { … … 81 75 82 76 if (oldFrame == null && newFrame != null) { 77 // Secures that the plug-in is only loaded, if a new MapFrame is created. 83 78 controller = new IndoorHelperController(); 84 79 } 85 80 } 86 81 87 88 82 /** 89 83 * Exports the mapcss validator file to the preferences directory. 90 */ 91 private void exportValidator(String resourceName) throws Exception { 92 InputStream stream = null; 84 * @param resourceName resource name 85 * @throws IOException if any I/O error occurs 86 */ 87 private void exportValidator(String resourceName) throws IOException { 93 88 OutputStream resStreamOut = null; 94 89 95 try { 96 stream = IndoorHelperPlugin.class.getResourceAsStream(resourceName); 90 try (InputStream stream = IndoorHelperPlugin.class.getResourceAsStream(resourceName)) { 97 91 if (stream == null) { 98 92 System.out.println("Validator: stream is null"); 99 throw new Exception("Cannot get resource \"" + resourceName + "\" from Jar file."); 100 } 101 102 String outPath; 93 throw new IOException("Cannot get resource \"" + resourceName + "\" from Jar file."); 94 } 95 103 96 int readBytes; 104 97 byte[] buffer = new byte[4096]; … … 107 100 File valDir = new File(valDirPath); 108 101 valDir.mkdirs(); 109 outPath = valDir.getAbsolutePath() +sep+ "indoorhelper.validator.mapcss"; 110 System.out.println("Validator:"+outPath); 102 String outPath = valDir.getAbsolutePath() +sep+ "indoorhelper.validator.mapcss"; 111 103 112 104 resStreamOut = new FileOutputStream(outPath); … … 115 107 } 116 108 resStreamOut.close(); 117 } catch (Exception ex) {118 throw ex;119 } finally {120 stream.close();121 109 } 122 110 } … … 124 112 /** 125 113 * Exports the mapCSS file to the preferences directory. 126 */ 127 private void exportStyleFile(String resourceName) throws Exception { 114 * @param resourceName resource name 115 * @throws IOException if any I/O error occurs 116 */ 117 private void exportStyleFile(String resourceName) throws IOException { 128 118 try (InputStream stream = IndoorHelperPlugin.class.getResourceAsStream("/data/" + resourceName)) { 129 119 if (stream == null) { 130 120 System.out.println("MapPaint: stream is null"); 131 throw new Exception("Cannot get resource \"" + resourceName + "\" from Jar file.");121 throw new IOException("Cannot get resource \"" + resourceName + "\" from Jar file."); 132 122 } 133 123 … … 146 136 } 147 137 } 148 } catch (Exception ex) {149 throw ex;150 138 } 151 139 }
Note:
See TracChangeset
for help on using the changeset viewer.