From f4d64b483462bf5905b0bae69f8baabafa585b3a Mon Sep 17 00:00:00 2001 From: haya4 Date: Sun, 20 Oct 2019 12:13:31 +0900 Subject: [PATCH] =?utf8?q?refactor:=20=E4=B8=8D=E8=A6=81=E3=81=AA=E3=82=B3?= =?utf8?q?=E3=83=A1=E3=83=B3=E3=83=88=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/osm/jp/gpx/matchtime/gui/AdjustTime.java | 211 --------------------- .../jp/gpx/matchtime/gui/ParameterPanelTime.java | 4 +- .../gpx/matchtime/gui/restamp/CardImageFile.java | 9 +- .../matchtime/gui/restamp/DialogCorectTime.java | 27 --- 4 files changed, 2 insertions(+), 249 deletions(-) diff --git a/src/osm/jp/gpx/matchtime/gui/AdjustTime.java b/src/osm/jp/gpx/matchtime/gui/AdjustTime.java index a5fa756..db5f45d 100644 --- a/src/osm/jp/gpx/matchtime/gui/AdjustTime.java +++ b/src/osm/jp/gpx/matchtime/gui/AdjustTime.java @@ -39,9 +39,6 @@ public class AdjustTime extends JFrame JPanel argsPanel; // パラメータ設定パネル (上部) JScrollPane imageSPane; // スクロールパネル JLabel imageLabel; // 基準時刻画像表示 - //ButtonGroup baseTimeGroup; // 基準時刻の指定グループ - //JRadioButton exifBase; // EXIF日時を基準にする/ !(ファイル更新日時を基準にする) - //JRadioButton fupdateBase; // File更新日時を基準にする/ !(EXIF日時を基準にする) JCheckBox noFirstNode; // GPX: セグメントの最初の1ノードは無視する。 {ON | OFF} JCheckBox gpxReuse; // 生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も対象にする。 {ON | OFF} JTextArea textArea; // 実行結果表示領域 @@ -57,9 +54,6 @@ public class AdjustTime extends JFrame ParameterPanelGpx arg4_gpxFolder; // GPXファイル・フォルダ JPanel buttonPanel; // ボタンパネル (下部) - //JButton openButton; // [Fit]ボタン - //JButton zoomInButton; // [Zoom in]ボタン - //JButton zoomOutButton; // [Zoom out]ボタン JButton doButton; // [処理実行]ボタン //}} @@ -113,24 +107,6 @@ public class AdjustTime extends JFrame else if (object == miExit) { miExit_Action(event); } - /* - else if (object == openButton) { - imageView_Action(event); - } - else if (object == zoomInButton) { - zoomin_Action(event); - } - else if (object == zoomOutButton) { - zoomout_Action(event); - } - else if (object == arg2_baseTimeImg.argField) { - imageView_Action(event); - } - else if (object == arg2_baseTimeImg.openButton) { - selectImage_Action(event); - imageView_Action(event); - } - */ else if (object == outputIMG) { outputIMG_Action(event); } @@ -248,30 +224,9 @@ public class AdjustTime extends JFrame // EXIFの日時を基準にする arg2_basetime.addExifBase(i18n.getString("label.220"), params); - //exifBase = new JRadioButton(i18n.getString("label.220")); // ファイル更新日時を基準にする arg2_basetime.addFileUpdate(i18n.getString("label.230"), params); - //fupdateBase = new JRadioButton(i18n.getString("label.230")); - - //baseTimeGroup = new ButtonGroup(); - //baseTimeGroup.add(exifBase); - //baseTimeGroup.add(fupdateBase); - //argsPanel.add(exifBase); - //argsPanel.add(fupdateBase); - //if (params.getProperty(AppParameters.GPX_BASETIME).equals("EXIF_TIME")) { - // fupdateBase.setSelected(false); - // exifBase.setSelected(true); - //} - //else { - // fupdateBase.setSelected(true); - // exifBase.setSelected(false); - //} - - //JLabel label2 = new JLabel(); - //label2.setText(i18n.getString("label.200")); - //card.mainPanel.add(label2, BorderLayout.NORTH); - //card.mainPanel.add(argsPanel, BorderLayout.CENTER); CardImageFile card = new CardImageFile( cardPanel, arg2_basetime, (Window)this, @@ -283,57 +238,6 @@ public class AdjustTime extends JFrame } //--------------------------------------------------------------------- - // 2a.基準時刻の入力画面 - { - Card card = new Card(cardPanel, i18n.getString("tab.300"), 1, 3); - cardPanel.addTab(card.getTitle(), card); - cards[cardNo] = card; - - argsPanel = new JPanel(); - argsPanel.setLayout(new GridLayout(2, 1)); - - // 3. 正確な撮影時刻を入力してください。 - // カメラの時計が正確ならば、設定を変更する必要はありません。 - /* - JLabel label3 = new JLabel(); - label3.setText(i18n.getString("label.300")); - argsPanel.add(label3); - */ - - // 基準時刻: - /* - String str310 = String.format("  %s: ", i18n.getString("label.310")); - arg3_basetime = new ParameterPanelTime( - str310, - ImportPicture.TIME_FORMAT_STRING, - arg2_baseTimeImg - ); - argsPanel.add(arg3_basetime); - card.mainPanel.add(argsPanel, BorderLayout.NORTH); - */ - - // 参考画像 - /* - imageLabel = new JLabel(); - imageSPane = new JScrollPane(imageLabel); - card.mainPanel.add(imageSPane, BorderLayout.CENTER); - */ - - // 画像ファイル選択ダイアログを起動するボタン - /* - buttonPanel = new JPanel(); - buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); - openButton = new JButton(createImageIcon("images/Fit16.gif")); - buttonPanel.add(openButton); - zoomInButton = new JButton(createImageIcon("images/ZoomIn16.gif")); - buttonPanel.add(zoomInButton); - zoomOutButton = new JButton(createImageIcon("images/ZoomOut16.gif")); - buttonPanel.add(zoomOutButton); - card.mainPanel.add(buttonPanel, BorderLayout.SOUTH); - */ - } - - //--------------------------------------------------------------------- // 3.GPXファイル設定画面 { // 3. GPXファイルを選択 @@ -497,12 +401,6 @@ public class AdjustTime extends JFrame miAbout.addActionListener(lSymAction); miRestamp.addActionListener(lSymAction); miExit.addActionListener(lSymAction); - /* - openButton.addActionListener(lSymAction); - zoomOutButton.addActionListener(lSymAction); - zoomInButton.addActionListener(lSymAction); - */ - //arg2_baseTimeImg.argField.addActionListener(lSymAction); arg2_baseTimeImg.openButton.addActionListener(lSymAction); doButton.addActionListener(lSymAction); outputIMG_all.addActionListener(lSymAction); @@ -604,76 +502,6 @@ public class AdjustTime extends JFrame ImageIcon refImage; /** - * 選択された画像ファイルを表示する - * 基準画像ボタンがクリックされた時に、基準時刻フィールドに基準画像の作成日時を設定する。 - * @param ev - */ - /* - @SuppressWarnings("UseSpecificCatch") - public void imageView_Action(ActionEvent ev) { - String path = (new File(arg1_srcFolder.getText(), arg2_baseTimeImg.getText())).getPath(); - - File timeFile = new File(path); - if (exifBase.isSelected()) { - try { - ImageMetadata meta = Imaging.getMetadata(timeFile); - JpegImageMetadata jpegMetadata = (JpegImageMetadata)meta; - if (jpegMetadata != null) { - TiffImageMetadata exif = jpegMetadata.getExif(); - if (exif != null) { - String dateTimeOriginal = exif.getFieldValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL)[0]; - long lastModifyTime = (new SimpleDateFormat("yyyy:MM:dd HH:mm:ss")).parse(dateTimeOriginal).getTime(); - arg3_basetime.argField.setText(dfjp.format(new Date(lastModifyTime))); - } - else { - arg3_basetime.argField.setText("exif == null"); - } - } - } - catch (Exception e) {} - } - else { - long lastModifyTime = timeFile.lastModified(); - arg3_basetime.argField.setText(dfjp.format(new Date(lastModifyTime))); - } - - int size_x = imageSPane.getWidth() - 8; - ImageIcon tmpIcon = new ImageIcon(path); - refImage = tmpIcon; - if (tmpIcon.getIconWidth() > size_x) { - refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x, -1, Image.SCALE_DEFAULT)); - } - imageLabel.setIcon(refImage); - repaint(); - } - */ - - /* - public void zoomin_Action(ActionEvent ev) { - if (refImage != null) { - int size_x = imageLabel.getWidth(); - String path = (new File(arg1_srcFolder.getText(), arg2_baseTimeImg.getText())).getPath(); - ImageIcon tmpIcon = new ImageIcon(path); - refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x * 2, -1, Image.SCALE_DEFAULT)); - imageLabel.setIcon(refImage); - repaint(); - } - } - */ - - /* - public void zoomout_Action(ActionEvent ev) { - if (refImage != null) { - int size_x = imageLabel.getWidth(); - ImageIcon tmpIcon = refImage; - refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x / 2, -1, Image.SCALE_DEFAULT)); - imageLabel.setIcon(refImage); - repaint(); - } - } - */ - - /** * ソースディレクトリが選択された時のアクション * → AdjustTime.ini に書き込む * @param ev @@ -681,45 +509,6 @@ public class AdjustTime extends JFrame public void selectSource_Action(ActionEvent ev) { } - /* - public void selectImage_Action(ActionEvent ev) { - JFileChooser fc; - - //Set up the file chooser. - File sdir = new File(arg1_srcFolder.getText()); - System.out.println(sdir.getPath()); - if (sdir.isDirectory()) { - fc = new JFileChooser(sdir); - } - else { - fc = new JFileChooser(); - } - - //Add a custom file filter and disable the default - //(Accept All) file filter. - fc.addChoosableFileFilter(new ImageFilter()); - fc.setAcceptAllFileFilterUsed(false); - - //Add custom icons for file types. - fc.setFileView(new ImageFileView()); - - //Add the preview pane. - fc.setAccessory(new ImagePreview(fc)); - - //Show it. "選択" - int returnVal = fc.showDialog(this, i18n.getString("dialog.select")); - - //Process the results. - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - arg2_baseTimeImg.argField.setText(file.getName()); - } - - //Reset the file chooser for the next time it's shown. - fc.setSelectedFile(null); - } - */ - /** Returns an ImageIcon, or null if the path was invalid. * @param path * @return */ diff --git a/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java b/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java index 8b21ccb..45171ef 100644 --- a/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java +++ b/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java @@ -160,9 +160,7 @@ public class ParameterPanelTime extends ParameterPanel { } } } - catch (Exception ex) { - while(true); - } + catch (Exception ex) {} } else { long lastModified = timeFile.lastModified(); diff --git a/src/osm/jp/gpx/matchtime/gui/restamp/CardImageFile.java b/src/osm/jp/gpx/matchtime/gui/restamp/CardImageFile.java index 836ed9e..9d8826d 100644 --- a/src/osm/jp/gpx/matchtime/gui/restamp/CardImageFile.java +++ b/src/osm/jp/gpx/matchtime/gui/restamp/CardImageFile.java @@ -18,7 +18,6 @@ import osm.jp.gpx.matchtime.gui.ParameterPanelTime; * @author yuu */ public class CardImageFile extends Card implements PanelAction { - //JPanel argsPanel; // パラメータ設定パネル (上部) ParameterPanelImageFile arg_baseTimeImg; ParameterPanelTime arg_basetime; @@ -38,13 +37,7 @@ public class CardImageFile extends Card implements PanelAction { String text, int pre, int next ) { - super( - tabbe, - //AdjustTime.i18n.getString(first ? "tab.restamp.200" : "tab.restamp.250"), - text, pre, next - //(first ? 0 : 1), - //(first ? 2 : 3) - ); + super(tabbe, text, pre, next); arg_basetime.setOwner(owner); this.arg_baseTimeImg = arg_basetime.getImageFile(); this.arg_basetime = arg_basetime; diff --git a/src/osm/jp/gpx/matchtime/gui/restamp/DialogCorectTime.java b/src/osm/jp/gpx/matchtime/gui/restamp/DialogCorectTime.java index 175a2f1..67fe187 100644 --- a/src/osm/jp/gpx/matchtime/gui/restamp/DialogCorectTime.java +++ b/src/osm/jp/gpx/matchtime/gui/restamp/DialogCorectTime.java @@ -156,33 +156,6 @@ public class DialogCorectTime extends JDialog implements PanelAction { public void imageView_Action() { String path = basetime.getImageFile().getImageFile().getAbsolutePath(); - // Radio Selecter - /* - File timeFile = new File(path); - if ((arg_basetime.exifBase != null) && arg_basetime.exifBase.isSelected()) { - try { - ImageMetadata meta = Imaging.getMetadata(timeFile); - JpegImageMetadata jpegMetadata = (JpegImageMetadata)meta; - if (jpegMetadata != null) { - TiffImageMetadata exif = jpegMetadata.getExif(); - if (exif != null) { - String dateTimeOriginal = exif.getFieldValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL)[0]; - long lastModifyTime = (new SimpleDateFormat("yyyy:MM:dd HH:mm:ss")).parse(dateTimeOriginal).getTime(); - arg_basetime.argField.setText(dfjp.format(new Date(lastModifyTime))); - } - else { - arg_basetime.argField.setText("exif == null"); - } - } - } - catch (Exception e) {} - } - else { - long lastModifyTime = timeFile.lastModified(); - arg_basetime.argField.setText(dfjp.format(new Date(lastModifyTime))); - } - */ - // View Image File int size_x = imageSPane.getWidth() - 8; ImageIcon tmpIcon = new ImageIcon(path); -- 2.11.0