From 4b6b24477200d87dbe6f9d67ba9d0b8b47a5b4ec Mon Sep 17 00:00:00 2001
From: Sampo Niskanen
" +
"Kevin Ruland (Android version)
" +
"Boris du Reau (internationalization, translation lead)
" +
- "Richard Graham (geodetic computations)
" +
+ "Richard Graham (geodetic computations)
" +
+ "Jason Blood (finset import)
" +
"Translations by:
" +
"Tripoli France (French)
" +
"Stefan Lobas / ERIG e.V. (German)
" +
diff --git a/core/src/net/sf/openrocket/gui/util/CustomFinImporter.java b/core/src/net/sf/openrocket/gui/util/CustomFinImporter.java
index 09eac8fb4..1d29b2163 100644
--- a/core/src/net/sf/openrocket/gui/util/CustomFinImporter.java
+++ b/core/src/net/sf/openrocket/gui/util/CustomFinImporter.java
@@ -33,13 +33,12 @@ public class CustomFinImporter {
startX = -1;
facing = FacingDirections.UP;
- if (validateImage(pic)) {
- points.add(Coordinate.NUL);
- loadFin(pic, points);
- } else {
+ if (!validateImage(pic)) {
throw new LocalizedIOException("CustomFinImport.error.badimage");
}
+ points.add(Coordinate.NUL);
+ loadFin(pic, points);
optimizePoints(points);
return points;
}
@@ -48,7 +47,7 @@ public class CustomFinImporter {
private boolean validateImage(BufferedImage pic) {
int height = pic.getHeight();
int width = pic.getWidth();
- Boolean bottomEdgeFound = false;
+ boolean bottomEdgeFound = false;
for (int x = 0; x < width; ++x) {
for (int y = 0; y < height; ++y) {
@@ -83,18 +82,18 @@ public class CustomFinImporter {
currentY = pic.getHeight() - 1;
do {
- if (CheckLeftIsFin(pic, currentX, currentY))
- RotateLeft();
- else if (CheckForwardIsFin(pic, currentX, currentY)) {
+ if (checkLeftIsFin(pic, currentX, currentY))
+ rotateLeft();
+ else if (checkForwardIsFin(pic, currentX, currentY)) {
// Do nothing
- } else if (CheckRightIsFin(pic, currentX, currentY))
- RotateRight();
+ } else if (checkRightIsFin(pic, currentX, currentY))
+ rotateRight();
else {
- TurnAround();
+ turnAround();
calledTurnedAround = true;
}
- MoveForward(pic);
+ moveForward(pic);
if (pixelIsFin(pic, currentX, currentY)) {
if (!calledTurnedAround) {
double x = (currentX - startX) * 0.001;
@@ -119,7 +118,7 @@ public class CustomFinImporter {
return false;
}
- private boolean CheckLeftIsFin(BufferedImage pic, int x, int y) {
+ private boolean checkLeftIsFin(BufferedImage pic, int x, int y) {
if (facing == FacingDirections.DOWN)
return pixelIsFin(pic, x + 1, y);
else if (facing == FacingDirections.UP)
@@ -132,7 +131,7 @@ public class CustomFinImporter {
return false;
}
- private Boolean CheckRightIsFin(BufferedImage pic, int x, int y) {
+ private boolean checkRightIsFin(BufferedImage pic, int x, int y) {
if (facing == FacingDirections.DOWN)
return pixelIsFin(pic, x - 1, y);
else if (facing == FacingDirections.UP)
@@ -145,7 +144,7 @@ public class CustomFinImporter {
return false;
}
- private boolean CheckForwardIsFin(BufferedImage pic, int x, int y) {
+ private boolean checkForwardIsFin(BufferedImage pic, int x, int y) {
if (facing == FacingDirections.DOWN)
return pixelIsFin(pic, x, y + 1);
else if (facing == FacingDirections.UP)
@@ -158,7 +157,7 @@ public class CustomFinImporter {
return false;
}
- private void RotateLeft() {
+ private void rotateLeft() {
if (facing == FacingDirections.UP)
facing = FacingDirections.LEFT;
else if (facing == FacingDirections.RIGHT)
@@ -169,7 +168,7 @@ public class CustomFinImporter {
facing = FacingDirections.DOWN;
}
- private void RotateRight() {
+ private void rotateRight() {
if (facing == FacingDirections.UP)
facing = FacingDirections.RIGHT;
else if (facing == FacingDirections.RIGHT)
@@ -180,7 +179,7 @@ public class CustomFinImporter {
facing = FacingDirections.UP;
}
- private void MoveForward(BufferedImage pic) {
+ private void moveForward(BufferedImage pic) {
if (facing == FacingDirections.UP) {
if (currentY > 0)
currentY--;
@@ -196,7 +195,7 @@ public class CustomFinImporter {
}
}
- private void TurnAround() {
+ private void turnAround() {
if (facing == FacingDirections.UP)
facing = FacingDirections.DOWN;
else if (facing == FacingDirections.DOWN)
diff --git a/core/src/net/sf/openrocket/gui/util/FileHelper.java b/core/src/net/sf/openrocket/gui/util/FileHelper.java
index 2edbb362e..860379ed4 100644
--- a/core/src/net/sf/openrocket/gui/util/FileHelper.java
+++ b/core/src/net/sf/openrocket/gui/util/FileHelper.java
@@ -3,7 +3,9 @@ package net.sf.openrocket.gui.util;
import java.awt.Component;
import java.io.File;
import java.io.IOException;
+import java.util.Arrays;
+import javax.imageio.ImageIO;
import javax.swing.JOptionPane;
import javax.swing.filechooser.FileFilter;
@@ -47,11 +49,6 @@ public final class FileHelper {
public static final FileFilter CSV_FILE_FILTER =
new SimpleFileFilter(trans.get("SimExpPan.desc"), ".csv");
- /** File filter for BMP files (*.bmp) */
- public static final FileFilter BMP_FILE_FILTER =
- new SimpleFileFilter(trans.get("CustomFinImport.filter"), ".bmp");
-
-
@@ -60,10 +57,26 @@ public final class FileHelper {
}
- // public FileFilter getImageFileFilter() {
- // String[] extensions = ImageIO.getReaderFileSuffixes();
- //
- // }
+ public static FileFilter getImageFileFilter() {
+ String[] extensions = ImageIO.getReaderFileSuffixes();
+ for (int i = 0; i < extensions.length; i++) {
+ extensions[i] = extensions[i].toLowerCase();
+ }
+ Arrays.sort(extensions);
+
+ StringBuilder sb = new StringBuilder();
+ sb.append(trans.get("filetypes.images"));
+ sb.append(" (");
+ for (int i = 0; i < extensions.length; i++) {
+ sb.append("*.").append(extensions[i]);
+ if (i < extensions.length - 1) {
+ sb.append("; ");
+ }
+ }
+ sb.append(")");
+
+ return new SimpleFileFilter(sb.toString(), extensions);
+ }
/**
diff --git a/core/web/html/download.html b/core/web/html/download.html
index 4284bbdbe..4418d3c5b 100644
--- a/core/web/html/download.html
+++ b/core/web/html/download.html
@@ -59,7 +59,8 @@
stability data and motor files. The Android port is thanks to
work by Kevin Ruland.
Enhancements in the desktop version include saving designs in RKT - format thanks to Doug Pedrick, configurable stage separation + format thanks to Doug Pedrick, freeform fin set import form images + by Jason Blood, configurable stage separation events, guided help tours and displaying the computed motor designation class. The application has also been translated to Italian by Mauro Biasutti and Russian by the Sky Dart Team.
diff --git a/core/web/html/index.html b/core/web/html/index.html index 0489dd604..c42a1b1bf 100644 --- a/core/web/html/index.html +++ b/core/web/html/index.html @@ -107,7 +107,8 @@ stability data and motor files. The Android port is thanks to work by Kevin Ruland.Enhancements in the desktop version include saving designs in RKT - format thanks to Doug Pedrick, configurable stage separation + format thanks to Doug Pedrick, freeform fin set import form images + by Jason Blood, configurable stage separation events, guided help tours and displaying the computed motor designation class. The application has also been translated to Italian by Mauro Biasutti and Russian by the Sky Dart Team.
diff --git a/core/web/htp/htp.rsp b/core/web/htp/htp.rsp index a53a702fe..81f6beb0f 100644 --- a/core/web/htp/htp.rsp +++ b/core/web/htp/htp.rsp @@ -5,5 +5,4 @@ download.htp ../html/download.html documentation.htp ../html/documentation.html license.htp ../html/license.html contact.htp ../html/contact.html -report.htp ../html/report.html getinvolved.htp ../html/getinvolved.html diff --git a/core/web/htp/news.htp b/core/web/htp/news.htp index 675482b35..be4153e21 100644 --- a/core/web/htp/news.htp +++ b/core/web/htp/news.htp @@ -23,7 +23,8 @@ work by Kevin Ruland.Enhancements in the desktop version include saving designs in RKT - format thanks to Doug Pedrick, configurable stage separation + format thanks to Doug Pedrick, freeform fin set import form images + by Jason Blood, configurable stage separation events, guided help tours and displaying the computed motor designation class. The application has also been translated to Italian by Mauro Biasutti and Russian by the Sky Dart Team.