diff --git a/AdjustTime/master-application.jnlp b/AdjustTime/master-application.jnlp
new file mode 100644
index 0000000..1859df2
--- /dev/null
+++ b/AdjustTime/master-application.jnlp
@@ -0,0 +1,22 @@
+
+
+ ${APPLICATION.TITLE}
+ ${APPLICATION.VENDOR}
+
+ ${APPLICATION.DESC}
+ ${APPLICATION.DESC.SHORT}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AdjustTime/nbproject/build-impl.xml b/AdjustTime/nbproject/build-impl.xml
index 84defd8..6d48b0f 100644
--- a/AdjustTime/nbproject/build-impl.xml
+++ b/AdjustTime/nbproject/build-impl.xml
@@ -20,6 +20,7 @@
-->
+
@@ -1018,12 +1019,12 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+ javaws "${jnlp.file.resolved}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AdjustTime/nbproject/project.properties b/AdjustTime/nbproject/project.properties
index c69d20d..596f5c9 100644
--- a/AdjustTime/nbproject/project.properties
+++ b/AdjustTime/nbproject/project.properties
@@ -3,11 +3,12 @@
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+ant.customtasks.libs=JWSAntTasks
application.title=AdjustTime
application.vendor=yuu
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
build.classes.dir=${build.dir}/classes
-build.classes.excludes=**/*.java,**/*.form
+build.classes.excludes=**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
@@ -16,6 +17,7 @@
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
+copylibs.excludes=${javafx.classpath.extension}
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
@@ -28,7 +30,8 @@
dist.dir=dist
dist.jar=${dist.dir}/AdjustTime.jar
dist.javadoc.dir=${dist.dir}/javadoc
-endorsed.classpath=
+endorsed.classpath=\
+ ${java.home}/lib/javaws.jar
excludes=
file.reference.commons-imaging-1.0-SNAPSHOT.jar=../importPicture/commons-imaging-1.0-SNAPSHOT.jar
file.reference.importPicture-src=../importPicture/src
@@ -37,7 +40,8 @@
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
- ${file.reference.commons-imaging-1.0-SNAPSHOT.jar}
+ ${file.reference.commons-imaging-1.0-SNAPSHOT.jar}:\
+ ${javafx.classpath.extension}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
@@ -61,15 +65,20 @@
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
+javafx.classpath.extension=\
+ ${java.home}/lib/javaws.jar:\
+ ${java.home}/lib/deploy.jar:\
+ ${java.home}/lib/plugin.jar
jnlp.codebase.type=no.codebase
jnlp.descriptor=application
-jnlp.enabled=false
+jnlp.enabled=true
jnlp.mixed.code=default
-jnlp.offline-allowed=false
+jnlp.offline-allowed=true
jnlp.signed=false
jnlp.signing=
jnlp.signing.alias=
jnlp.signing.keystore=
+keep.javafx.runtime.on.classpath=true
main.class=osm.jp.gpx.matchtime.gui.AdjustTime
# \u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30b3\u30fc\u30c9\u30d9\u30fc\u30b9\u30fb\u30de\u30cb\u30d5\u30a7\u30b9\u30c8\u5c5e\u6027\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u306f\u3001RIA\u306e\u518d\u5229\u7528\u3092\u9632\u3050\u305f\u3081\u306b\u4f7f\u7528\u3057\u307e\u3059
manifest.custom.codebase=
@@ -79,6 +88,7 @@
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
+project.license=mit
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
diff --git a/AdjustTime/nbproject/project.xml b/AdjustTime/nbproject/project.xml
index 5ec4c20..566a685 100644
--- a/AdjustTime/nbproject/project.xml
+++ b/AdjustTime/nbproject/project.xml
@@ -2,6 +2,12 @@
org.netbeans.modules.java.j2seproject
+
+
+
+
+
+
AdjustTime
diff --git a/AdjustTime/preview-application.html b/AdjustTime/preview-application.html
new file mode 100644
index 0000000..4834dd8
--- /dev/null
+++ b/AdjustTime/preview-application.html
@@ -0,0 +1,17 @@
+
+
+
+ Test page for launching the application via JNLP
+
+
+ Test page for launching the application via JNLP
+
+
+
+
+
+
diff --git a/importPicture/src/osm/jp/gpx/ImportPicture.java b/importPicture/src/osm/jp/gpx/ImportPicture.java
index 5c14a62..63668a3 100644
--- a/importPicture/src/osm/jp/gpx/ImportPicture.java
+++ b/importPicture/src/osm/jp/gpx/ImportPicture.java
@@ -36,11 +36,9 @@
import org.apache.commons.imaging.formats.tiff.write.TiffOutputDirectory;
import org.apache.commons.imaging.formats.tiff.write.TiffOutputSet;
import org.w3c.dom.*;
+import org.xml.sax.SAXException;
-public class ImportPicture {
- public static File gpxDir = new File(".");
- public static File outDir = null;
-
+public class ImportPicture extends Thread {
/**
* ログ設定プロパティファイルのファイル内容
*/
@@ -103,10 +101,12 @@
public static void main(String[] argv) throws Exception
{
Date jptime;
- outDir = null;
+
+ ImportPicture obj = new ImportPicture();
+ obj.outDir = null;
if (argv.length > 0) {
- gpxDir = new File(argv[0]);
+ obj.gpxDir = new File(argv[0]);
}
if (argv.length < 4) {
@@ -119,35 +119,56 @@
}
// 基準時刻ファイルの「更新日時」を使って時刻合わせを行う。
- File baseFile = new File(gpxDir, argv[1]);
+ File baseFile = new File(obj.gpxDir, argv[1]);
jptime = new Date(baseFile.lastModified());
+ String timeStr = argv[2];
+ try {
+ dfjp.setTimeZone(TimeZone.getTimeZone("JST"));
+ Date t = dfjp.parse(timeStr);
+ obj.delta = t.getTime() - jptime.getTime();
+ }
+ catch (ParseException e) {
+ System.out.println("'"+ timeStr +"' の書式が違います("+ TIME_FORMAT_STRING +")");
+ }
//
- boolean exif = false;
if (argv[3].toUpperCase().equals("EXIF")) {
- exif = true;
+ obj.exif = true;
}
// 第6引数が指定されなければ、指定されたディレクトリ内のGPXファイルすべてを対象とする
- ArrayList gpxFiles = new ArrayList<>();
if (argv.length > 4) {
- gpxFiles.add(new File(gpxDir, argv[4]));
+ obj.gpxFiles.add(new File(obj.gpxDir, argv[4]));
}
else {
- File[] files = gpxDir.listFiles();
+ File[] files = obj.gpxDir.listFiles();
for (File file : files) {
if (file.isFile()) {
String filename = file.getName().toUpperCase();
if (filename.endsWith(".GPX")) {
if (!filename.endsWith("_.GPX")) {
- gpxFiles.add(file);
+ obj.gpxFiles.add(file);
}
}
}
}
}
-
-
+
+ obj.start();
+ try {
+ obj.join();
+ } catch(InterruptedException e) {}
+ }
+
+ public File gpxDir = new File(".");
+ public File outDir = null;
+ public long delta = 0;
+ public boolean exif = false;
+ public ArrayList gpxFiles = new ArrayList<>();
+
+ @Override
+ public void run() {
+
/**
*
@@ -166,59 +187,54 @@
DocumentBuilder builder;
Node gpx;
- for (File gpxFile : gpxFiles) {
- String fileName = gpxFile.getName();
- String iStr = fileName.substring(0, fileName.length() - 4);
+ try {
+ for (File gpxFile : this.gpxFiles) {
+ String fileName = gpxFile.getName();
+ String iStr = fileName.substring(0, fileName.length() - 4);
- File outputFile = new File(gpxFile.getParent(), iStr +"_.gpx");
- System.out.println(iStr + " => "+ outputFile.getName());
+ File outputFile = new File(gpxFile.getParent(), iStr +"_.gpx");
+ System.out.println(iStr + " => "+ outputFile.getName());
- factory = DocumentBuilderFactory.newInstance();
- builder = factory.newDocumentBuilder();
- factory.setIgnoringElementContentWhitespace(true);
- factory.setIgnoringComments(true);
- factory.setValidating(true);
+ factory = DocumentBuilderFactory.newInstance();
+ builder = factory.newDocumentBuilder();
+ factory.setIgnoringElementContentWhitespace(true);
+ factory.setIgnoringComments(true);
+ factory.setValidating(true);
- // GPX file --> Node root
- DOMImplementation domImpl = builder.getDOMImplementation();
- document = domImpl.createDocument("", "gpx", null);
+ // GPX file --> Node root
+ DOMImplementation domImpl = builder.getDOMImplementation();
+ document = domImpl.createDocument("", "gpx", null);
- /*
-
-
-
-
-
-
- 47.20000076293945
-
- 0.5
-
-
-
-
-
-
- */
- TreeMap map = new TreeMap<>();
- Element trk = null;
- gpx = builder.parse(gpxFile).getFirstChild();
- NodeList nodes = gpx.getChildNodes();
- for (int i=0; i < nodes.getLength(); i++) {
- Node node2 = nodes.item(i);
- if (node2.getNodeName().equals("trk")) {
- trk = (Element) node2;
- trkptMap(trk, map);
+ /*
+
+
+
+
+
+
+ 47.20000076293945
+
+ 0.5
+
+
+
+
+
+
+ */
+ TreeMap map = new TreeMap<>();
+ Element trk = null;
+ gpx = builder.parse(gpxFile).getFirstChild();
+ NodeList nodes = gpx.getChildNodes();
+ for (int i=0; i < nodes.getLength(); i++) {
+ Node node2 = nodes.item(i);
+ if (node2.getNodeName().equals("trk")) {
+ trk = (Element) node2;
+ trkptMap(trk, map);
+ }
}
- }
- if (trk != null) {
- dfjp.setTimeZone(TimeZone.getTimeZone("JST"));
- String timeStr = argv[2];
- try {
- Date t = dfjp.parse(timeStr);
- long delta = t.getTime() - jptime.getTime();
-
+ if (trk != null) {
/*
* GPXへ割りつける開始時刻と終了時刻を求める
*/
@@ -246,20 +262,20 @@
proc(gpxDir, delta, gpxStartTime, gpxEndTime, map, exif, gpx);
System.out.println("------------|--------------------|--------------------|------------|------------|--------|------|");
}
- catch (ParseException e) {
- System.out.println("'"+ timeStr +"' の書式が違います("+ TIME_FORMAT_STRING +")");
- }
- }
- // 出力
- DOMSource source = new DOMSource(gpx);
- FileOutputStream os = new FileOutputStream(outputFile);
- StreamResult result = new StreamResult(os);
- TransformerFactory transFactory = TransformerFactory.newInstance();
- Transformer transformer = transFactory.newTransformer();
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
- transformer.transform(source, result);
+ // 出力
+ DOMSource source = new DOMSource(gpx);
+ FileOutputStream os = new FileOutputStream(outputFile);
+ StreamResult result = new StreamResult(os);
+ TransformerFactory transFactory = TransformerFactory.newInstance();
+ Transformer transformer = transFactory.newTransformer();
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+ transformer.transform(source, result);
+ }
+ }
+ catch(Exception e) {
+ e.printStackTrace();
}
}
@@ -270,7 +286,7 @@
* @throws ImageReadException
* @throws ImageWriteException
*/
- static void proc(File dir, long delta, long gpxStartTime, long gpxEndTime, TreeMap map, boolean exifWrite, Node gpx) throws ParseException, ImageReadException, IOException, ImageWriteException {
+ void proc(File dir, long delta, long gpxStartTime, long gpxEndTime, TreeMap map, boolean exifWrite, Node gpx) throws ParseException, ImageReadException, IOException, ImageWriteException {
DecimalFormat yearFormatter = new DecimalFormat("0000");
DecimalFormat monthFormatter = new DecimalFormat("00");
DecimalFormat dayFormatter = new DecimalFormat("00");
@@ -317,6 +333,9 @@
}
}
System.out.println(String.format("%8s|%6s|", eleStr, magvarStr));
+ try {
+ Thread.sleep(1);
+ } catch(InterruptedException e) {}
if (exifWrite) {
TiffOutputSet outputSet = null;
@@ -654,7 +673,7 @@
* @param timestamp
* @param trkpt
*/
- public static Element createWptTag(File iFile, long timestamp, Element trkpt) {
+ public Element createWptTag(File iFile, long timestamp, Element trkpt) {
Element wpt = document.createElement("wpt");
NamedNodeMap nodeMap = trkpt.getAttributes();
diff --git a/importPicture/src/osm/jp/gpx/matchtime/gui/Command.java b/importPicture/src/osm/jp/gpx/matchtime/gui/Command.java
index 130af21..93f1e1e 100644
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/Command.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/Command.java
@@ -3,67 +3,67 @@
import java.text.SimpleDateFormat;
class Command extends Thread {
- String[] args; // コマンドパラメータ
- private String commandName = ""; // コマンド名
- @SuppressWarnings({ "rawtypes" })
- private Class cmd; // 実行対象インスタンス
+ String[] args; // コマンドパラメータ
+ private String commandName = ""; // コマンド名
+ @SuppressWarnings({ "rawtypes" })
+ private Class cmd; // 実行対象インスタンス
- /**
- * コンストラクタ:実行対象のインスタンスを得る
- * @param cmd
- */
- public Command(Class> cmd) {
- super();
- this.cmd = cmd;
- this.commandName = cmd.getName();
- this.args = new String[0];
- }
+ /**
+ * コンストラクタ:実行対象のインスタンスを得る
+ * @param cmd
+ */
+ public Command(Class> cmd) {
+ super();
+ this.cmd = cmd;
+ this.commandName = cmd.getName();
+ this.args = new String[0];
+ }
- /**
- * コマンドパラメータの設定
- * @param folder
- */
- public void setArgs(String[] args) {
- this.args = args;
- }
+ /**
+ * コマンドパラメータの設定
+ * @param folder
+ */
+ public void setArgs(String[] args) {
+ this.args = args;
+ }
- public void setCommandName(String name) {
- this.commandName = name;
- }
- public String getCommandName() {
- return this.commandName;
- }
+ public void setCommandName(String name) {
+ this.commandName = name;
+ }
+ public String getCommandName() {
+ return this.commandName;
+ }
- @SuppressWarnings("unchecked")
- public void run() {
- System.out.println("[START:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
- for (int i=0; i < args.length; i++) {
- System.out.println(" args["+ i +"]: "+ this.args[i]);
- }
- System.out.println();
+ @SuppressWarnings("unchecked")
+ public void run() {
+ System.out.println("[START:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
+ for (int i=0; i < args.length; i++) {
+ System.out.println(" args["+ i +"]: "+ this.args[i]);
+ }
+ System.out.println();
- try {
- try {
- java.lang.reflect.Method method = this.cmd.getMethod("main", new Class[] {String[].class});
- method.setAccessible(true);
- method.invoke(null, new Object[]{this.args});
+ try {
+ try {
+ java.lang.reflect.Method method = this.cmd.getMethod("main", new Class[] {String[].class});
+ method.setAccessible(true);
+ method.invoke(null, new Object[]{this.args});
- System.out.println();
- System.out.println("[END:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
- }
- catch (InvocationTargetException e) {
- System.out.println("[ERR!:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
- e.getCause().printStackTrace();
- throw e;
- }
- catch (Exception e) {
- System.out.println("[ERR!:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
- throw e;
- }
+ System.out.println();
+ System.out.println("[END:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
+ }
+ catch (InvocationTargetException e) {
+ System.out.println("[ERR!:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
+ e.getCause().printStackTrace();
+ throw e;
+ }
+ catch (Exception e) {
+ System.out.println("[ERR!:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
+ throw e;
+ }
}
catch(Exception e) {
e.printStackTrace();
}
- System.out.println();
+ System.out.println();
}
}
diff --git a/importPicture/src/osm/jp/gpx/matchtime/gui/DoDialog.java b/importPicture/src/osm/jp/gpx/matchtime/gui/DoDialog.java
index e82f3fa..6e6f634 100644
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/DoDialog.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/DoDialog.java
@@ -8,7 +8,7 @@
*/
@SuppressWarnings("serial")
public class DoDialog extends JDialog {
- public static final String TITLE = "Do Command";
+ public static final String TITLE = "Do Command";
// Used for addNotify check.
boolean fComponentsAdjusted = false;
@@ -61,7 +61,7 @@
this.getContentPane().add("South", buttonPanel);
- // 説明文
+ // 説明文
textArea = new JTextArea();
JScrollPane sc=new JScrollPane(textArea);
textArea.setFont(new Font(Font.MONOSPACED,Font.PLAIN,12));
@@ -129,27 +129,27 @@
ByteArrayOutputStream stdout = new ByteArrayOutputStream();
try {
- System.setOut(new PrintStream(stdout));
- System.setErr(new PrintStream(stdout));
+ System.setOut(new PrintStream(stdout));
+ System.setErr(new PrintStream(stdout));
- Command command = new Command(osm.jp.gpx.ImportPicture.class);
- command.setArgs(args);
- command.start(); // コマンドを実行
- while (command.isAlive()) {
- Thread.sleep(1000);
+ Command command = new Command(osm.jp.gpx.ImportPicture.class);
+ command.setArgs(args);
+ command.start(); // コマンドを実行
+ while (command.isAlive()) {
+ Thread.sleep(1000);
textArea.append(stdout.toString());
stdout.reset();
- }
- textArea.append(stdout.toString());
- JOptionPane.showMessageDialog(this, "'"+ TITLE +"'処理を完了しました。", "処理完了", JOptionPane.INFORMATION_MESSAGE);
+ }
+ textArea.append(stdout.toString());
+ JOptionPane.showMessageDialog(this, "'"+ TITLE +"'処理を完了しました。", "処理完了", JOptionPane.INFORMATION_MESSAGE);
}
catch(Exception e) {
e.printStackTrace();
JOptionPane.showMessageDialog(this, e.toString(), "Exception", JOptionPane.ERROR_MESSAGE);
}
finally {
- System.setOut(defOut);
- System.setErr(defErr);
+ System.setOut(defOut);
+ System.setErr(defErr);
doButton.setEnabled(true);
}
}