Преглед изворни кода

Berücksichtigung Nockpunktüberhöhung

master
gitsvn пре 12 година
родитељ
комит
2822d74dae

+ 69
- 1
res/layout/rbs_main.xml Прегледај датотеку

@@ -294,6 +294,74 @@
android:layout_gravity="center"
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/arrowBowParmsLbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:gravity="right"
android:lines="2"
android:text="@string/bowParamsLbl"
android:textColor="@color/black"
app:font="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.FontEditText
android:id="@+id/hNAFld"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginLeft="4dp"
android:layout_weight="1"
android:ems="10"
android:gravity="center_vertical"
android:inputType="numberDecimal"
android:paddingBottom="9dp"
android:paddingTop="9dp"
android:selectAllOnFocus="true"
android:textSize="18sp"
android:nextFocusDown="@+id/nockRaisingFld"
app:txtFont="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.FontEditText
android:id="@+id/nockRaisingFld"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginLeft="4dp"
android:layout_weight="1"
android:ems="10"
android:gravity="center_vertical"
android:inputType="numberDecimal"
android:paddingBottom="9dp"
android:paddingTop="9dp"
android:selectAllOnFocus="true"
android:textSize="18sp"
android:nextFocusDown="@+id/braceHeightFld"
app:txtFont="@string/TitilliumWeb_Regular" />
<ch.spherIC.recurvebowsight.components.FontEditText
android:id="@+id/braceHeightFld"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginLeft="4dp"
android:layout_weight="1"
android:ems="10"
android:gravity="center_vertical"
android:inputType="numberDecimal"
android:paddingBottom="9dp"
android:paddingTop="9dp"
android:selectAllOnFocus="true"
android:textSize="18sp"
android:nextFocusDown="@+id/airTemperatureTxtFld"
app:txtFont="@string/TitilliumWeb_Regular" />
</TableRow>
<TableRow
android:id="@+id/tableRow7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="4dp" >
<ch.spherIC.recurvebowsight.components.FontTextView
android:id="@+id/atmosphericalParams"
android:layout_width="fill_parent"
@@ -310,7 +378,7 @@
</TableRow>
<TableRow
android:id="@+id/tableRow7"
android:id="@+id/tableRow8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"

+ 1
- 0
res/values-de/strings.xml Прегледај датотеку

@@ -18,6 +18,7 @@
<string name="arrowV0Lbl">Pfeilanfangsgeschw. V0 [m/s]</string>
<string name="bowPulloutLbl">Auszug Bogen [cm]</string>
<string name="arrowWeightLbl">Gewicht Pfeil [g]</string>
<string name="bowParamsLbl">hNA / Überh. Nockpkt. /\nStandhöhe [mm]</string>
<!-- -->
<string name="titleAtmosphericalParams">Atmosphärische Parameter</string>
<string name="airTemperatureLbl">Lufttemperatur [°Celsius]</string>

+ 1
- 0
res/values/strings.xml Прегледај датотеку

@@ -18,6 +18,7 @@
<string name="arrowV0Lbl">Arrow initial velocity V0 [m/s]</string>
<string name="bowPulloutLbl">Bow Pullout [cm]</string>
<string name="arrowWeightLbl">Arrow Weight [g]</string>
<string name="bowParamsLbl">hNA / Nock Raising /\nBrace Height [mm]</string>
<!-- -->
<string name="titleAtmosphericalParams">Atmospherical Parameters</string>
<string name="airTemperatureLbl">Air Temperatur [°Celsius]</string>

+ 38
- 12
src/ch/spherIC/recurvebowsight/RBSMainActivity.java Прегледај датотеку

@@ -113,6 +113,9 @@ public class RBSMainActivity extends Activity implements ChooseArcherySetupDlgDi
private TextView arrowWeightTxtFld;
private TextView bowPulloutTxtFld;
private TextView arrowV0TxtFld;
private TextView hNATxtFld;
private TextView nockRaisingTxtFld;
private TextView braceHeightTxtFld;
private TextView airTemperatureTxtFld;
private TextView airRelativeHumidityTxtFld;
private TextView shootingDistanzTxtFld;
@@ -266,6 +269,9 @@ public class RBSMainActivity extends Activity implements ChooseArcherySetupDlgDi
this.arrowWeightTxtFld = (TextView) findViewById(R.id.arrowWeightTxtFld);
this.bowPulloutTxtFld = (TextView) findViewById(R.id.bowPulloutTxtFld);
this.arrowV0TxtFld = (TextView) findViewById(R.id.arrowV0TxtFld);
this.hNATxtFld = (TextView) findViewById(R.id.hNAFld);
this.nockRaisingTxtFld = (TextView) findViewById(R.id.nockRaisingFld);
this.braceHeightTxtFld = (TextView) findViewById(R.id.braceHeightFld);
this.airTemperatureTxtFld = (TextView) findViewById(R.id.airTemperatureTxtFld);
this.airRelativeHumidityTxtFld = (TextView) findViewById(R.id.airRelativeHumidityTxtFld);
this.shootingDistanzTxtFld = (TextView) findViewById(R.id.shootingDistanzTxtFld);
@@ -732,6 +738,9 @@ public class RBSMainActivity extends Activity implements ChooseArcherySetupDlgDi
this.arrowWeightTxtFld.setText(DF.format(archerySetup.getArrowWeight()));
this.bowPulloutTxtFld.setText(DF.format(archerySetup.getBowPullout()));
this.arrowV0TxtFld.setText(DF.format(archerySetup.getArrowV0()));
this.hNATxtFld.setText(DF.format(archerySetup.getHNA()));
this.nockRaisingTxtFld.setText(DF.format(archerySetup.getNockRaising()));
this.braceHeightTxtFld.setText(DF.format(archerySetup.getBraceHeight()));
this.arrowNockHeightTxtFld.setText(DF_1.format(archerySetup.getArrowNockHeight()));
this.targetCenterHeightTxtFld.setText(DF_1.format(archerySetup.getArrowCenterHeight()));
this.calcTimeIntervalCboBox.setSelectionByVal(archerySetup.getDeltaTime().toString());
@@ -753,6 +762,9 @@ public class RBSMainActivity extends Activity implements ChooseArcherySetupDlgDi
this.arrowWeightTxtFld.setText("");
this.bowPulloutTxtFld.setText("");
this.arrowV0TxtFld.setText("");
this.hNATxtFld.setText("");
this.nockRaisingTxtFld.setText("");
this.braceHeightTxtFld.setText("");
this.arrowNockHeightTxtFld.setText("");
this.targetCenterHeightTxtFld.setText("");
this.calcTimeIntervalCboBox.setSelectionByVal("");
@@ -772,6 +784,9 @@ public class RBSMainActivity extends Activity implements ChooseArcherySetupDlgDi
&& !this.arrowWeightTxtFld.getText().toString().isEmpty()
&& !this.bowPulloutTxtFld.getText().toString().isEmpty()
&& !this.arrowV0TxtFld.getText().toString().isEmpty()
&& !this.hNATxtFld.getText().toString().isEmpty()
&& !this.nockRaisingTxtFld.getText().toString().isEmpty()
&& !this.braceHeightTxtFld.getText().toString().isEmpty()
&& !this.airTemperatureTxtFld.getText().toString().isEmpty()
&& !this.airRelativeHumidityTxtFld.getText().toString().isEmpty()
&& !this.shootingDistanzTxtFld.getText().toString().isEmpty()
@@ -931,7 +946,7 @@ public class RBSMainActivity extends Activity implements ChooseArcherySetupDlgDi
Double a = Double.valueOf(this.bowPulloutTxtFld.getText().toString()) * 10;
Double heVs = this.scHeVSSpinner.getVisibility() == View.VISIBLE ? Double.valueOf(this.scHeVSSpinner.getSelectedItem().toString())
: Double.valueOf(this.scHeVSTxtFld.getText().toString());
Double lhNA = this.selectedArcherySetup.getHNA() * 10;
Double lhNA = this.selectedArcherySetup.getHNA();
Double dltH = (Double.valueOf(this.targetCenterHeightTxtFld.getText().toString())
- Double.valueOf(this.arrowNockHeightTxtFld.getText().toString())) * Math.pow(10, 3);
Double ldistH = Double.valueOf(this.shootingDistanzTxtFld.getText().toString()) * Math.pow(10, 3);
@@ -944,18 +959,29 @@ public class RBSMainActivity extends Activity implements ChooseArcherySetupDlgDi
.indexOf('-') + 1,
this.scVertScaleRngTxtFld.getText().toString()
.length())) : 0d;
Double nockRaising = Double.valueOf(this.nockRaisingTxtFld.getText().toString())
- Double.valueOf(this.arrowDiameterTxtFld.getText().toString());
Double braceHeight = Double.valueOf(this.braceHeightTxtFld.getText().toString());
Double phi = -Math.atan(nockRaising / braceHeight); // Winkel des Pfeils zur Auflage infolge Nockpunktüberhöhung
// PIN auf Höhe UK Vertikalskala Visier, gedreht um den Abschusswinkel...
Double x01 = a * Math.cos(phi) + vVh + heVs;
Double y01 = a * Math.sin(phi) + vVv - maxSkala / 2;
x0 = Math.cos(Math.toRadians(this.startAngle)) * x01 - Math.sin(Math.toRadians(this.startAngle)) * y01;
y0 = Math.sin(Math.toRadians(this.startAngle)) * x01 + Math.cos(Math.toRadians(this.startAngle)) * y01;
// PIN auf Höhe Horizontalschlitten Visier, gedreht um den Abschusswinkel...
Double x02 = a * Math.cos(phi) + vVh + heVs;
Double y02 = a * Math.sin(phi) + vVv;
x2 = Math.cos(Math.toRadians(this.startAngle)) * x02 - Math.sin(Math.toRadians(this.startAngle)) * y02;
y2 = Math.sin(Math.toRadians(this.startAngle)) * x02 + Math.cos(Math.toRadians(this.startAngle)) * y02;
// Schnittpunkt der Achse Horizontalschlitten Visier mit Achse Befestigungslöcher Visier, gedreht um den Abschusswinkel...
Double x03 = a * Math.cos(phi) + vVh;
Double y03 = a * Math.sin(phi) + vVv;
x3 = Math.cos(Math.toRadians(this.startAngle)) * x03 - Math.sin(Math.toRadians(this.startAngle)) * y03;
y3 = Math.sin(Math.toRadians(this.startAngle)) * x03 + Math.cos(Math.toRadians(this.startAngle)) * y03;
// PIN auf Höhe Pfeil
x0 = (a + vVh + heVs) * Math.cos(Math.toRadians(this.startAngle));
y0 = (a + vVh + heVs) * Math.sin(Math.toRadians(this.startAngle));
// PIN auf Höhe Horizontalschlitten Visier
x2 = x0 + vVv * Math.cos(Math.toRadians(ANGLE_90 + this.startAngle));
y2 = y0 + vVv * Math.sin(Math.toRadians(ANGLE_90 + this.startAngle));
// Schnittpunkt der Achse Horizontalschlitten Visier mit Achse Befestigungslöcher Visier
x3 = (a + vVh) * Math.cos(Math.toRadians(this.startAngle)) + vVv * Math.cos(Math.toRadians(ANGLE_90 + this.startAngle));
y3 = (a + vVh) * Math.sin(Math.toRadians(this.startAngle)) + vVv * Math.sin(Math.toRadians(ANGLE_90 + this.startAngle));
// Unbekannte der Vektorgeradengleichung
r = (lhNA * (x0 - x2) - x0 * y2 + x2 * y0) / (ldistH * (y0 - y2) + (dltH - lhNA) * (x2 - x0));

+ 5
- 9
src/ch/spherIC/recurvebowsight/configuration/ArcherySetupConfigurationActivity.java Прегледај датотеку

@@ -94,17 +94,14 @@ public class ArcherySetupConfigurationActivity extends Activity {
List<ISight> sights = SightDao.getInstance().loadAll();
List<IRiser> risers = RiserDao.getInstance().loadAll();
this.asSightSpinner.setAdapter(new FontArrayAdapter<ISight>(this, R.layout.rbs_spinner, sights,
this.asSightSpinner));
this.asRiserSpinner.setAdapter(new FontArrayAdapter<IRiser>(this, R.layout.rbs_spinner, risers,
this.asRiserSpinner));
this.asSightSpinner.setAdapter(new FontArrayAdapter<ISight>(this, R.layout.rbs_spinner, sights, this.asSightSpinner));
this.asRiserSpinner.setAdapter(new FontArrayAdapter<IRiser>(this, R.layout.rbs_spinner, risers, this.asRiserSpinner));
}
private void loadArcherySetupSpinner() {
List<IArcherySetup> archerySetups = ArcherySetupDao.getInstance().loadAll();
this.asArcherySetupSpinner.setAdapter(new FontArrayAdapter<IArcherySetup>(this, R.layout.rbs_spinner,
archerySetups,
this.asArcherySetupSpinner.setAdapter(new FontArrayAdapter<IArcherySetup>(this, R.layout.rbs_spinner, archerySetups,
this.asArcherySetupSpinner));
}
@@ -282,8 +279,8 @@ public class ArcherySetupConfigurationActivity extends Activity {
*/
@SuppressWarnings("unchecked")
protected void onNewArcherySetup() {
IArcherySetup newArcherySetup = new ArcherySetup(0, "*", null, null, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d,
0d);
IArcherySetup newArcherySetup = new ArcherySetup(0, "*", null, null, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d);
this.selectedArcherySetup = newArcherySetup;
((FontArrayAdapter<IArcherySetup>) this.asArcherySetupSpinner.getAdapter()).add(newArcherySetup);
this.asArcherySetupSpinner.setSelectionByVal(newArcherySetup.getName());
@@ -299,7 +296,6 @@ public class ArcherySetupConfigurationActivity extends Activity {
this.asCalcPrecisionTxtFld.setText("");
this.asSightVertScaleMiddleTxtFld.setText("");
this.asSightHorzSettingTxtFld.setText("");
}
@Override

+ 2
- 2
src/ch/spherIC/recurvebowsight/database/RBSDatabaseHelper.java Прегледај датотеку

@@ -147,12 +147,12 @@ public final class RBSDatabaseHelper extends SQLiteOpenHelper {
List<ISight> sights = new ArrayList<ISight>();
sights.add(new Sight(0, "Avalon", "Tec One", 17.5, -12d, "260,250,240,230,220,210,200,190,180,170,160", 0d, 110d));
sights.add(new Sight(0, "Avalon", "Tec One", 17.5, -12d, "260,250,240,230,220,210,200,190,180,170,160", 5d, 105d));
return sights;
}
private IArcherySetup getArcherySetupMasterData() {
return new ArcherySetup(0, "FITA Indoor FS", null, null, 5.8, 3.10, 21d, 57.60, 1.30, 71d, 1.57, 14.5, 0.001, 0.1, 55d, 260d);
return new ArcherySetup(0, "FITA Indoor FS", null, null, 5.8, 3.10, 21d, 57.60, 1.30, 71d, 1.57, 135d, 0.001, 0.1, 55d, 260d, 11d, 195d);
}
}

+ 4
- 1
src/ch/spherIC/recurvebowsight/database/dao/ArcherySetupDao.java Прегледај датотеку

@@ -43,7 +43,8 @@ public final class ArcherySetupDao extends DAO<IArcherySetup> {
IArcherySetup archerySetup = new ArcherySetup(cursor.getLong(0), cursor.getString(1), sight, riser, cursor.getDouble(4), //
cursor.getDouble(5), cursor.getDouble(6), cursor.getDouble(7), cursor.getDouble(8),
cursor.getDouble(9), cursor.getDouble(10), cursor.getDouble(11), cursor.getDouble(12),
cursor.getDouble(13), cursor.getDouble(14), cursor.getDouble(15));
cursor.getDouble(13), cursor.getDouble(14), cursor.getDouble(15), cursor.getDouble(16),
cursor.getDouble(17));
return archerySetup;
}
@@ -70,6 +71,8 @@ public final class ArcherySetupDao extends DAO<IArcherySetup> {
values.put(TblRBSArcherySetup.COL_CALCPRECISION, entity.getCalcPrecision() != null ? entity.getCalcPrecision() : 0d);
values.put(TblRBSArcherySetup.COL_SIGHTVERTSKALAMIDDLE, entity.getSightVertSkalaMiddle() != null ? entity.getSightVertSkalaMiddle() : 0d);
values.put(TblRBSArcherySetup.COL_SIGHTHORSETTING, entity.getSightHorzSetting() != null ? entity.getSightHorzSetting() : 0d);
values.put(TblRBSArcherySetup.COL_NOCKRAISING, entity.getNockRaising() != null ? entity.getNockRaising() : 0d);
values.put(TblRBSArcherySetup.COL_BRACEHEIGHT, entity.getBraceHeight() != null ? entity.getBraceHeight() : 0d);
return values;
}

+ 4
- 0
src/ch/spherIC/recurvebowsight/database/scheme/data/TblRBSArcherySetup.java Прегледај датотеку

@@ -27,6 +27,8 @@ public final class TblRBSArcherySetup {
public static final String COL_CALCPRECISION = "ARCHERYSETUP_CALCPRECISION";
public static final String COL_SIGHTVERTSKALAMIDDLE = "ARCHERYSETUP_SIGHTVERTSKALAMIDDLE";
public static final String COL_SIGHTHORSETTING = "ARCHERYSETUP_SIGHTHORSETTING";
public static final String COL_NOCKRAISING = "ARCHERYSETUP_NOCKRAISING";
public static final String COL_BRACEHEIGHT = "ARCHERYSETUP_BRACEHEIGHT";
private TblRBSArcherySetup() { }
@@ -49,6 +51,8 @@ public final class TblRBSArcherySetup {
+ COL_CALCPRECISION + " Real NOT NULL, "
+ COL_SIGHTVERTSKALAMIDDLE + " Real NOT NULL, "
+ COL_SIGHTHORSETTING + " Real NOT NULL, "
+ COL_NOCKRAISING + " Real NOT NULL, "
+ COL_BRACEHEIGHT + " Real NOT NULL, "
+ "constraint UNIQUE_ARCHERYSETUP_NAME UNIQUE (" + COL_NAME + "), "
+ "constraint UNIQUE_ARCHERYSETUP_SIGHT_RISER UNIQUE (" + COL_SIGHT + "," + COL_RISER + "),"
+ "FOREIGN KEY(" + COL_SIGHT + ") REFERENCES RBS_SIGHT (" + TblRBSSight.COL_ID + "), "

+ 1
- 1
src/ch/spherIC/recurvebowsight/dialog/ChooseArcherySetupDlg.java Прегледај датотеку

@@ -68,7 +68,7 @@ public class ChooseArcherySetupDlg extends Dialog {
List<IArcherySetup> setups = new ArrayList<IArcherySetup>();
this.archerySetup = null;
setups.add(new ArcherySetup(-999, "", null, null, null, null, null, null, null, null, null, null, null, null, null, null));
setups.add(new ArcherySetup(-999, "", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null));
setups.addAll(ArcherySetupDao.getInstance().loadAll());
listView.setAdapter(new ArcerySetupArrayAdapter(getContext(), R.layout.rbs_archerysetup_item, setups));

+ 31
- 5
src/ch/spherIC/recurvebowsight/model/ArcherySetup.java Прегледај датотеку

@@ -23,7 +23,9 @@ public class ArcherySetup implements IArcherySetup {
private Double deltaTime;
private Double calcPrecision;
private Double sightVertSkalaMiddle;
private Double sightHorSetting;
private Double sightHorzSetting;
private Double nockRaising;
private Double braceHeight;
/**
* Konstruktor.
@@ -43,13 +45,15 @@ public class ArcherySetup implements IArcherySetup {
* @param calcPrecision
* @param sightVertSkalaMiddle
* @param sightHorSetting
* @param nockRaising
* @param braceHeight
*/
public ArcherySetup(final long id, final String name, final ISight sight, final IRiser riser,
final Double arrowDiameter, final Double arrowCw, final Double arrowWeight,
final Double arrowV0, final Double arrowCenterHeight, final Double bowPullout,
final Double arrowNockHeight, final Double hNA, final Double deltaTime,
final Double calcPrecision, final Double sightVertSkalaMiddle,
final Double sightHorSetting) {
final Double sightHorSetting, final Double nockRaising, final Double braceHeight) {
super();
this.id = id;
this.name = name;
@@ -66,7 +70,9 @@ public class ArcherySetup implements IArcherySetup {
this.deltaTime = deltaTime;
this.calcPrecision = calcPrecision;
this.sightVertSkalaMiddle = sightVertSkalaMiddle;
this.sightHorSetting = sightHorSetting;
this.sightHorzSetting = sightHorSetting;
this.nockRaising = nockRaising;
this.braceHeight = braceHeight;
}
/**
@@ -315,7 +321,7 @@ public class ArcherySetup implements IArcherySetup {
*/
@Override
public Double getSightHorzSetting() {
return this.sightHorSetting;
return this.sightHorzSetting;
}
/**
@@ -323,11 +329,31 @@ public class ArcherySetup implements IArcherySetup {
*/
@Override
public void setSightHorzSetting(final Double sightHorSetting) {
this.sightHorSetting = sightHorSetting;
this.sightHorzSetting = sightHorSetting;
}
@Override
public String toString() {
return getName();
}
@Override
public Double getNockRaising() {
return this.nockRaising;
}
@Override
public void setNockRaising(final Double nockRaising) {
this.nockRaising = nockRaising;
}
@Override
public Double getBraceHeight() {
return this.braceHeight;
}
@Override
public void setBraceHeight(final Double braceHeight) {
this.braceHeight = braceHeight;
}
}

+ 8
- 0
src/ch/spherIC/recurvebowsight/model/IArcherySetup.java Прегледај датотеку

@@ -68,4 +68,12 @@ public interface IArcherySetup extends IEntity {
String getName();
void setName(String name);
Double getNockRaising();
void setNockRaising(Double nockRaising);
Double getBraceHeight();
void setBraceHeight(Double braceHeight);
}

Loading…
Откажи
Сачувај