Changeset 27147 in osm for applications/editors/josm/plugins/piclayer/src
- Timestamp:
- 2011-11-25T11:58:22+01:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/actions/newlayer/NewLayerFromFileAction.java
r27120 r27147 62 62 63 63 if ("zip".equalsIgnoreCase(fileExtension)) return true; 64 // Unfortunately, getReaderFormatNames does not always return ALL extensions in 64 // Unfortunately, getReaderFormatNames does not always return ALL extensions in 65 65 // both lower and upper case, so we can not do a search in the array 66 66 for (String e: supportedExtensions) 67 if ( e. toLowerCase().equals(fileExtension) ) {67 if ( e.equalsIgnoreCase(fileExtension) ) { 68 68 return true; 69 69 } 70 70 71 71 return false; 72 72 } … … 75 75 @Override 76 76 public String getDescription() { 77 return tr("Supported image files ");77 return tr("Supported image files + *.zip"); 78 78 } 79 79 80 } 81 82 private class AllFilesFilter extends FileFilter { 83 @Override 84 public String getDescription() { 85 return tr("All Files"); 86 } 87 88 @Override 89 public boolean accept(File f) { 90 return true; 91 } 80 92 } 81 93 … … 90 102 * Action handler 91 103 */ 104 @Override 92 105 public void actionPerformed(ActionEvent arg0) { 93 106 … … 95 108 JFileChooser fc = new JFileChooser(Main.pref.get(m_lastdirprefname)); 96 109 fc.setAcceptAllFileFilterUsed( false ); 97 fc.setFileFilter( new ImageFileFilter() ); 98 fc.setMultiSelectionEnabled(true); 110 //fc.setFileFilter( new ImageFileFilter() ); 111 fc.addChoosableFileFilter(new ImageFileFilter()); 112 fc.addChoosableFileFilter(new AllFilesFilter()); 113 fc.setMultiSelectionEnabled(true); 99 114 int result = fc.showOpenDialog( Main.parent ); 100 115 … … 112 127 for(File file : fc.getSelectedFiles() ) { 113 128 // TODO: we need a progress bar here, it can take quite some time 114 129 115 130 // Create layer from file 116 131 PicLayerFromFile layer = new PicLayerFromFile( file ); … … 126 141 } 127 142 Main.pref.put(m_lastdirprefname, file.getParent()); 128 143 129 144 Main.main.addLayer( layer ); 130 145 Main.map.mapView.moveLayer(layer, newLayerPos++); 131 146 132 147 if ( fc.getSelectedFiles().length == 1 && Main.pref.getInteger("piclayer.zoom-on-load", 1) != 0 ) { 133 148 // if we are loading a single picture file, zoom on it, so that the user can see something -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerAbstract.java
r27144 r27147 384 384 AffineTransform transform; 385 385 386 double pos_x = Double.valueOf(props.getProperty(POSITION_X ));387 double pos_y = Double.valueOf(props.getProperty(POSITION_Y ));386 double pos_x = Double.valueOf(props.getProperty(POSITION_X, "0")); 387 double pos_y = Double.valueOf(props.getProperty(POSITION_Y, "0")); 388 388 389 389 imagePosition = new EastNorth(pos_x, pos_y); 390 initialImageScale = Double.valueOf(props.getProperty(INITIAL_SCALE )); //in_scale390 initialImageScale = Double.valueOf(props.getProperty(INITIAL_SCALE, "1")); //in_scale 391 391 if (props.containsKey(SCALEX)) {// old format 392 double in_pos_x = Double.valueOf( props.getProperty(INITIAL_POS_X));393 double in_pos_y = Double.valueOf( props.getProperty(INITIAL_POS_Y));394 double angle = Double.valueOf( props.getProperty(ANGLE));395 double scale_x = Double.valueOf( props.getProperty(SCALEX));396 double scale_y = Double.valueOf( props.getProperty(SCALEY));397 double shear_x = Double.valueOf( props.getProperty(SHEARX));398 double shear_y = Double.valueOf( props.getProperty(SHEARY));392 double in_pos_x = Double.valueOf(props.getProperty(INITIAL_POS_X, "0")); 393 double in_pos_y = Double.valueOf(props.getProperty(INITIAL_POS_Y, "0")); 394 double angle = Double.valueOf(props.getProperty(ANGLE, "0")); 395 double scale_x = Double.valueOf(props.getProperty(SCALEX, "1")); 396 double scale_y = Double.valueOf(props.getProperty(SCALEY, "1")); 397 double shear_x = Double.valueOf(props.getProperty(SHEARX, "0")); 398 double shear_y = Double.valueOf(props.getProperty(SHEARY, "0")); 399 399 400 400 initialImagePosition.setLocation(in_pos_x, in_pos_y); … … 407 407 // initialize matrix 408 408 double[] matrix = new double[6]; 409 matrix[0] = Double.parseDouble(props.getProperty(MATRIXm00 ));410 matrix[1] = Double.parseDouble(props.getProperty(MATRIXm01 ));411 matrix[2] = Double.parseDouble(props.getProperty(MATRIXm10 ));412 matrix[3] = Double.parseDouble(props.getProperty(MATRIXm11 ));413 matrix[4] = Double.parseDouble(props.getProperty(MATRIXm02 ));414 matrix[5] = Double.parseDouble(props.getProperty(MATRIXm12 ));409 matrix[0] = Double.parseDouble(props.getProperty(MATRIXm00, "0")); 410 matrix[1] = Double.parseDouble(props.getProperty(MATRIXm01, "0")); 411 matrix[2] = Double.parseDouble(props.getProperty(MATRIXm10, "0")); 412 matrix[3] = Double.parseDouble(props.getProperty(MATRIXm11, "0")); 413 matrix[4] = Double.parseDouble(props.getProperty(MATRIXm02, "0")); 414 matrix[5] = Double.parseDouble(props.getProperty(MATRIXm12, "0")); 415 415 416 416 transform = new AffineTransform(matrix);
Note:
See TracChangeset
for help on using the changeset viewer.