Added LaunchLug, Streamer and Parachute ComponentPresets.

This commit is contained in:
Kevin Ruland 2012-05-01 17:40:55 +00:00
parent 6f653199f2
commit 3792528e01
32 changed files with 2213 additions and 37 deletions

View File

@ -1672,5 +1672,50 @@
<AftShoulderLength Unit="m">0.035559999999999994</AftShoulderLength>
<Length Unit="m">0.0508</Length>
</Transition>
<LaunchLug>
<Manufacturer>BalsaMachining.com</Manufacturer>
<PartNumber>LL18-125</PartNumber>
<Description>1/8 x 1.25 inch LL</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.004064</InsideDiameter>
<OutsideDiameter Unit="m">0.0042926</OutsideDiameter>
<Length Unit="m">0.03175</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>BalsaMachining.com</Manufacturer>
<PartNumber>LL316-200</PartNumber>
<Description>3/16 x 2 inch LL</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0055626</InsideDiameter>
<OutsideDiameter Unit="m">0.006096</OutsideDiameter>
<Length Unit="m">0.0508</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>BalsaMachining.com</Manufacturer>
<PartNumber>LL316-1200</PartNumber>
<Description>3/16 x 12 inch LL</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0054356</InsideDiameter>
<OutsideDiameter Unit="m">0.006096</OutsideDiameter>
<Length Unit="m">0.0508</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>BalsaMachining.com</Manufacturer>
<PartNumber>LL14-300</PartNumber>
<Description>0.316x0.280x.018x34 1/4 inch Launch lug</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.007112</InsideDiameter>
<OutsideDiameter Unit="m">0.0080264</OutsideDiameter>
<Length Unit="m">0.07619999999999999</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>BalsaMachining.com</Manufacturer>
<PartNumber>LL14-3400</PartNumber>
<Description>0.316x0.280x.018x34 1/4 inch Launch lug</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.007112</InsideDiameter>
<OutsideDiameter Unit="m">0.0080264</OutsideDiameter>
<Length Unit="m">0.8635999999999999</Length>
</LaunchLug>
</Components>
</OpenRocketComponent>

View File

@ -642,5 +642,76 @@
<Length Unit="m">0.41910000000000003</Length>
<Thickness Unit="m">0.002032</Thickness>
</NoseCone>
<LaunchLug>
<Manufacturer>Giant Leap</Manufacturer>
<PartNumber>LL</PartNumber>
<Description>ACME Launch Lug</Description>
<InsideDiameter Unit="m">0.01016</InsideDiameter>
<OutsideDiameter Unit="m">0.012700000000000001</OutsideDiameter>
<Length Unit="m">0.025400000000000002</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>Giant Leap</Manufacturer>
<PartNumber>RG</PartNumber>
<Description>ACME Rail Guide</Description>
<InsideDiameter Unit="m">0.01016</InsideDiameter>
<OutsideDiameter Unit="m">0.012700000000000001</OutsideDiameter>
<Length Unit="m">0.025400000000000002</Length>
</LaunchLug>
<Parachute>
<Manufacturer>Giant Leap</Manufacturer>
<PartNumber>TAC-24</PartNumber>
<Description>TAC-1 24 in. Parachute</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.153087</Mass>
<Diameter Unit="m">0.6096</Diameter>
<Sides>6</Sides>
<LineCount>6</LineCount>
<LineLength Unit="m">0.0</LineLength>
</Parachute>
<Parachute>
<Manufacturer>Giant Leap</Manufacturer>
<PartNumber>TAC-36</PartNumber>
<Description>TAC-1 36 in. Parachute</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.229631</Mass>
<Diameter Unit="m">0.9144</Diameter>
<Sides>6</Sides>
<LineCount>6</LineCount>
<LineLength Unit="m">0.0</LineLength>
</Parachute>
<Parachute>
<Manufacturer>Giant Leap</Manufacturer>
<PartNumber>TAC-48</PartNumber>
<Description>TAC-1 48 in. Parachute</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.30617500000000003</Mass>
<Diameter Unit="m">1.2192</Diameter>
<Sides>6</Sides>
<LineCount>6</LineCount>
<LineLength Unit="m">0.0</LineLength>
</Parachute>
<Parachute>
<Manufacturer>Giant Leap</Manufacturer>
<PartNumber>TAC-60</PartNumber>
<Description>TAC-1 60 in. Parachute</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.40539800000000004</Mass>
<Diameter Unit="m">1.524</Diameter>
<Sides>6</Sides>
<LineCount>6</LineCount>
<LineLength Unit="m">0.0</LineLength>
</Parachute>
<Parachute>
<Manufacturer>Giant Leap</Manufacturer>
<PartNumber>TAC-72</PartNumber>
<Description>TAC-1 72 in. Parachute</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.510291</Mass>
<Diameter Unit="m">1.8288</Diameter>
<Sides>6</Sides>
<LineCount>6</LineCount>
<LineLength Unit="m">0.0</LineLength>
</Parachute>
</Components>
</OpenRocketComponent>

View File

@ -1283,5 +1283,239 @@
<Length Unit="m">0.30479999999999996</Length>
<Thickness Unit="m">0.0016002</Thickness>
</Transition>
<LaunchLug>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML LL-25</PartNumber>
<Description>1/4 brass launch lug</Description>
<Material Type="BULK">Brass</Material>
<InsideDiameter Unit="m">0.005715</InsideDiameter>
<OutsideDiameter Unit="m">0.00635</OutsideDiameter>
<Length Unit="m">0.30479999999999996</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML LL-38</PartNumber>
<Description>3/8 brass launch lug</Description>
<Material Type="BULK">Brass</Material>
<InsideDiameter Unit="m">0.0085725</InsideDiameter>
<OutsideDiameter Unit="m">0.009524999999999999</OutsideDiameter>
<Length Unit="m">0.30479999999999996</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML LL-50</PartNumber>
<Description>1/2 brass launch lug</Description>
<Material Type="BULK">Brass</Material>
<InsideDiameter Unit="m">0.01143</InsideDiameter>
<OutsideDiameter Unit="m">0.0127</OutsideDiameter>
<Length Unit="m">0.30479999999999996</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML LL-75</PartNumber>
<Description>3/4 copper launch lug</Description>
<Material Type="BULK">Copper (rolled)</Material>
<InsideDiameter Unit="m">0.017145</InsideDiameter>
<OutsideDiameter Unit="m">0.019049999999999997</OutsideDiameter>
<Length Unit="m">0.30479999999999996</Length>
</LaunchLug>
<Streamer>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML TBD123</PartNumber>
<Description>Streamer</Description>
<Material Type="SURFACE">Polyethylene LDPE</Material>
<Length Unit="m">3.048</Length>
<Width Unit="m">0.07619999999999999</Width>
<Thickness Unit="m">5.08E-5</Thickness>
</Streamer>
<Streamer>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>STREAMER</PartNumber>
<Description>F111 streamer</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Length Unit="m">3.6576</Length>
<Width Unit="m">0.1016</Width>
<Thickness Unit="m">1.27E-5</Thickness>
</Streamer>
<Parachute>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML Xform</PartNumber>
<Description>12 in. nylon</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.008504856929999999</Mass>
<Diameter Unit="m">0.30479999999999996</Diameter>
<Sides>4</Sides>
<LineCount>4</LineCount>
<LineLength Unit="m">0.30479999999999996</LineLength>
<LineMaterial Type="LINE">Thin poly</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML PAR-18-F111</PartNumber>
<Description>18 in. nylon</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.017009713859999998</Mass>
<Diameter Unit="m">0.4572</Diameter>
<Sides>8</Sides>
<LineCount>8</LineCount>
<LineLength Unit="m">0.3302</LineLength>
<LineMaterial Type="LINE">Thin poly</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML PAR-24R</PartNumber>
<Description>24 in. nylon</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.04535923696</Mass>
<Diameter Unit="m">0.6095999999999999</Diameter>
<Sides>8</Sides>
<LineCount>8</LineCount>
<LineLength Unit="m">0.508</LineLength>
<LineMaterial Type="LINE">Thin poly</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML PAR-30R</PartNumber>
<Description>30 in. nylon</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.06803885543999999</Mass>
<Diameter Unit="m">0.762</Diameter>
<Sides>8</Sides>
<LineCount>8</LineCount>
<LineLength Unit="m">0.6095999999999999</LineLength>
<LineMaterial Type="LINE">Thin poly</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML PAR-34R</PartNumber>
<Description>34 in. nylon</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.08221361699</Mass>
<Diameter Unit="m">0.8635999999999999</Diameter>
<Sides>8</Sides>
<LineCount>8</LineCount>
<LineLength Unit="m">0.635</LineLength>
<LineMaterial Type="LINE">Thin poly</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML PAR-36R</PartNumber>
<Description>36 in. nylon</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.08788352161</Mass>
<Diameter Unit="m">0.9144</Diameter>
<Sides>8</Sides>
<LineCount>8</LineCount>
<LineLength Unit="m">0.6858</LineLength>
<LineMaterial Type="LINE">Thin poly</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML PAR-44R</PartNumber>
<Description>44 in. nylon</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.11623304470999998</Mass>
<Diameter Unit="m">1.1176</Diameter>
<Sides>8</Sides>
<LineCount>8</LineCount>
<LineLength Unit="m">0.8128</LineLength>
<LineMaterial Type="LINE">Thin poly</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML PAR-48R</PartNumber>
<Description>48 in. nylon</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.12473790164000001</Mass>
<Diameter Unit="m">1.2191999999999998</Diameter>
<Sides>8</Sides>
<LineCount>8</LineCount>
<LineLength Unit="m">0.9144</LineLength>
<LineMaterial Type="LINE">Thin poly</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML PAR-54R</PartNumber>
<Description>54 in. nylon</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.13607771087999998</Mass>
<Diameter Unit="m">1.3716</Diameter>
<Sides>8</Sides>
<LineCount>8</LineCount>
<LineLength Unit="m">1.0413999999999999</LineLength>
<LineMaterial Type="LINE">Medium poly</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML PAR-60R</PartNumber>
<Description>60 in. nylon</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.22396123249</Mass>
<Diameter Unit="m">1.524</Diameter>
<Sides>8</Sides>
<LineCount>10</LineCount>
<LineLength Unit="m">1.0668</LineLength>
<LineMaterial Type="LINE">Heavy poly</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML PAR-62R</PartNumber>
<Description>62 in. nylon</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.23530104173000002</Mass>
<Diameter Unit="m">1.5748</Diameter>
<Sides>8</Sides>
<LineCount>10</LineCount>
<LineLength Unit="m">1.1176</LineLength>
<LineMaterial Type="LINE">Heavy poly</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML PAR-72R</PartNumber>
<Description>72 in. nylon</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.2551457079</Mass>
<Diameter Unit="m">1.8288</Diameter>
<Sides>8</Sides>
<LineCount>10</LineCount>
<LineLength Unit="m">1.143</LineLength>
<LineMaterial Type="LINE">Heavy poly</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML PAR-74R</PartNumber>
<Description>74 in. nylon</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.26932046945</Mass>
<Diameter Unit="m">1.8796</Diameter>
<Sides>8</Sides>
<LineCount>10</LineCount>
<LineLength Unit="m">1.1938</LineLength>
<LineMaterial Type="LINE">Heavy poly</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML PAR-84R</PartNumber>
<Description>84 in. nylon</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.33735932489</Mass>
<Diameter Unit="m">2.1336</Diameter>
<Sides>8</Sides>
<LineCount>10</LineCount>
<LineLength Unit="m">1.524</LineLength>
<LineMaterial Type="LINE">Heavy poly</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>Public Missiles</Manufacturer>
<PartNumber>PML PAR-96R</PartNumber>
<Description>96 in. nylon</Description>
<Material Type="SURFACE">Rip stop nylon</Material>
<Mass Unit="kg">0.72291283905</Mass>
<Diameter Unit="m">2.4383999999999997</Diameter>
<Sides>8</Sides>
<LineCount>10</LineCount>
<LineLength Unit="m">1.8288</LineLength>
<LineMaterial Type="LINE">Heavy poly</LineMaterial>
</Parachute>
</Components>
</OpenRocketComponent>

View File

@ -10219,5 +10219,349 @@
<AftShoulderLength Unit="m">0.0</AftShoulderLength>
<Length Unit="m">0.13208</Length>
</Transition>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-2A</PartNumber>
<Description>Launch Lug 1/8 x 1.25</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0038099999999999996</InsideDiameter>
<OutsideDiameter Unit="m">0.004470399999999999</OutsideDiameter>
<Length Unit="m">0.03175</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-2AM</PartNumber>
<Description>Launch Lug 1/8 x .375</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0038099999999999996</InsideDiameter>
<OutsideDiameter Unit="m">0.004470399999999999</OutsideDiameter>
<Length Unit="m">0.009524999999999999</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-2B</PartNumber>
<Description>Launch Lug 1/8 x 2.375</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0038099999999999996</InsideDiameter>
<OutsideDiameter Unit="m">0.004470399999999999</OutsideDiameter>
<Length Unit="m">0.060325</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-2C</PartNumber>
<Description>Launch Lug 1/8 x 5</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0038099999999999996</InsideDiameter>
<OutsideDiameter Unit="m">0.004470399999999999</OutsideDiameter>
<Length Unit="m">0.127</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-2D</PartNumber>
<Description>Launch Lug 1/8 x 8</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0038099999999999996</InsideDiameter>
<OutsideDiameter Unit="m">0.004470399999999999</OutsideDiameter>
<Length Unit="m">0.2032</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-2E</PartNumber>
<Description>Launch Lug 1/8 x 9.5</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0038099999999999996</InsideDiameter>
<OutsideDiameter Unit="m">0.004470399999999999</OutsideDiameter>
<Length Unit="m">0.2413</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-3B</PartNumber>
<Description>Launch Lug 3/16 x 2</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0054356</InsideDiameter>
<OutsideDiameter Unit="m">0.006096</OutsideDiameter>
<Length Unit="m">0.0508</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-103</PartNumber>
<Description>Launch Lug 1/8 x .375</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0038099999999999996</InsideDiameter>
<OutsideDiameter Unit="m">0.004470399999999999</OutsideDiameter>
<Length Unit="m">0.009524999999999999</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-110</PartNumber>
<Description>Launch Lug 1/8 x 1</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0038099999999999996</InsideDiameter>
<OutsideDiameter Unit="m">0.004470399999999999</OutsideDiameter>
<Length Unit="m">0.0254</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-115</PartNumber>
<Description>Launch Lug 1/8 x 1.5</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0038099999999999996</InsideDiameter>
<OutsideDiameter Unit="m">0.004470399999999999</OutsideDiameter>
<Length Unit="m">0.038099999999999995</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-117</PartNumber>
<Description>Launch Lug 1/8 x 1.75</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0038099999999999996</InsideDiameter>
<OutsideDiameter Unit="m">0.004470399999999999</OutsideDiameter>
<Length Unit="m">0.044449999999999996</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-122</PartNumber>
<Description>Launch Lug 1/8 x 2.25</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0038099999999999996</InsideDiameter>
<OutsideDiameter Unit="m">0.004470399999999999</OutsideDiameter>
<Length Unit="m">0.05715</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-130</PartNumber>
<Description>Launch Lug 1/8 x 3</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0038099999999999996</InsideDiameter>
<OutsideDiameter Unit="m">0.004470399999999999</OutsideDiameter>
<Length Unit="m">0.07619999999999999</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-180</PartNumber>
<Description>Launch Lug 1/8 x 8</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0038099999999999996</InsideDiameter>
<OutsideDiameter Unit="m">0.004470399999999999</OutsideDiameter>
<Length Unit="m">0.2032</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-195</PartNumber>
<Description>Launch Lug 1/8 x 9.5</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0038099999999999996</InsideDiameter>
<OutsideDiameter Unit="m">0.004470399999999999</OutsideDiameter>
<Length Unit="m">0.2413</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-310</PartNumber>
<Description>Launch Lug 3/16 x 1</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0054356</InsideDiameter>
<OutsideDiameter Unit="m">0.006096</OutsideDiameter>
<Length Unit="m">0.0254</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-320</PartNumber>
<Description>Launch Lug 3/16 x 2</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0054356</InsideDiameter>
<OutsideDiameter Unit="m">0.006096</OutsideDiameter>
<Length Unit="m">0.0508</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-330</PartNumber>
<Description>Launch Lug 3/16 x 3</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0054356</InsideDiameter>
<OutsideDiameter Unit="m">0.006096</OutsideDiameter>
<Length Unit="m">0.07619999999999999</Length>
</LaunchLug>
<LaunchLug>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>LL-423</PartNumber>
<Description>Launch Lug 1/4 x 2.25</Description>
<Material Type="BULK">Paper</Material>
<InsideDiameter Unit="m">0.0070104</InsideDiameter>
<OutsideDiameter Unit="m">0.007670799999999999</OutsideDiameter>
<Length Unit="m">0.05715</Length>
</LaunchLug>
<Streamer>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>SM-1A</PartNumber>
<Description>Streamer 1 x 8</Description>
<Material Type="SURFACE">Paper</Material>
<Length Unit="m">0.2032</Length>
<Width Unit="m">0.0254</Width>
<Thickness Unit="m">5.08E-5</Thickness>
</Streamer>
<Streamer>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>RS-118</PartNumber>
<Description>Streamer 1 x 18</Description>
<Material Type="SURFACE">Paper</Material>
<Length Unit="m">0.4572</Length>
<Width Unit="m">0.0254</Width>
<Thickness Unit="m">5.08E-5</Thickness>
</Streamer>
<Streamer>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>RS-124</PartNumber>
<Description>Streamer 1 x 24</Description>
<Material Type="SURFACE">Paper</Material>
<Length Unit="m">0.6095999999999999</Length>
<Width Unit="m">0.0254</Width>
<Thickness Unit="m">5.08E-5</Thickness>
</Streamer>
<Streamer>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>RS-136</PartNumber>
<Description>Streamer 1 x 36</Description>
<Material Type="SURFACE">Paper</Material>
<Length Unit="m">0.9144</Length>
<Width Unit="m">0.0254</Width>
<Thickness Unit="m">5.08E-5</Thickness>
</Streamer>
<Streamer>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>RS-224</PartNumber>
<Description>Streamer 1.75 x 24</Description>
<Material Type="SURFACE">Paper</Material>
<Length Unit="m">0.6095999999999999</Length>
<Width Unit="m">0.044449999999999996</Width>
<Thickness Unit="m">5.08E-5</Thickness>
</Streamer>
<Streamer>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>RS-236</PartNumber>
<Description>Streamer 1.75 x 36</Description>
<Material Type="SURFACE">Paper</Material>
<Length Unit="m">0.9144</Length>
<Width Unit="m">0.044449999999999996</Width>
<Thickness Unit="m">5.08E-5</Thickness>
</Streamer>
<Streamer>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>RSW-36</PartNumber>
<Description>Streamer 3 x 36</Description>
<Material Type="SURFACE">Paper</Material>
<Length Unit="m">0.9144</Length>
<Width Unit="m">0.07619999999999999</Width>
<Thickness Unit="m">5.08E-5</Thickness>
</Streamer>
<Parachute>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>CP-12</PartNumber>
<Description>12 in. Plastic Chute</Description>
<Material Type="SURFACE">Polyethylene LDPE</Material>
<Diameter Unit="m">0.30479999999999996</Diameter>
<Sides>6</Sides>
<LineCount>6</LineCount>
<LineLength Unit="m">0.30479999999999996</LineLength>
<LineMaterial Type="LINE">30 Lb. kevlar</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>CP-16</PartNumber>
<Description>16 in. Plastic Chute</Description>
<Material Type="SURFACE">Polyethylene LDPE</Material>
<Diameter Unit="m">0.4064</Diameter>
<Sides>8</Sides>
<LineCount>8</LineCount>
<LineLength Unit="m">0.4064</LineLength>
<LineMaterial Type="LINE">30 Lb. kevlar</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>CP-20</PartNumber>
<Description>20 in. Plastic Chute</Description>
<Material Type="SURFACE">Polyethylene LDPE</Material>
<Diameter Unit="m">0.508</Diameter>
<Sides>8</Sides>
<LineCount>8</LineCount>
<LineLength Unit="m">0.508</LineLength>
<LineMaterial Type="LINE">30 Lb. kevlar</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>CP-24</PartNumber>
<Description>24 in. Plastic Chute</Description>
<Material Type="SURFACE">Polyethylene LDPE</Material>
<Diameter Unit="m">0.6095999999999999</Diameter>
<Sides>8</Sides>
<LineCount>8</LineCount>
<LineLength Unit="m">0.6095999999999999</LineLength>
<LineMaterial Type="LINE">30 Lb. kevlar</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>CP-32</PartNumber>
<Description>32 in. Plastic Chute</Description>
<Material Type="SURFACE">Polyethylene LDPE</Material>
<Diameter Unit="m">0.8128</Diameter>
<Sides>8</Sides>
<LineCount>8</LineCount>
<LineLength Unit="m">0.8128</LineLength>
<LineMaterial Type="LINE">30 Lb. kevlar</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>PN-14</PartNumber>
<Description>14 in. Nylon Chute</Description>
<Material Type="SURFACE">Rip Stop Nylon</Material>
<Diameter Unit="m">0.35559999999999997</Diameter>
<Sides>6</Sides>
<LineCount>6</LineCount>
<LineLength Unit="m">0.4064</LineLength>
<LineMaterial Type="LINE">1/16 In. braided nylon</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>PN-18</PartNumber>
<Description>18 In. Nylon Chute</Description>
<Material Type="SURFACE">Rip Stop Nylon</Material>
<Diameter Unit="m">0.4572</Diameter>
<Sides>8</Sides>
<LineCount>8</LineCount>
<LineLength Unit="m">0.508</LineLength>
<LineMaterial Type="LINE">1/16 In. braided nylon</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>PN-24</PartNumber>
<Description>24 In. Nylon Chute</Description>
<Material Type="SURFACE">Rip Stop Nylon</Material>
<Diameter Unit="m">0.6095999999999999</Diameter>
<Sides>0</Sides>
<LineCount>10</LineCount>
<LineLength Unit="m">0.6095999999999999</LineLength>
<LineMaterial Type="LINE">1/16 In. braided nylon</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>PN-30</PartNumber>
<Description>30 In. Nylon Chute</Description>
<Material Type="SURFACE">Rip Stop Nylon</Material>
<Diameter Unit="m">0.762</Diameter>
<Sides>0</Sides>
<LineCount>10</LineCount>
<LineLength Unit="m">0.762</LineLength>
<LineMaterial Type="LINE">1/16 In. braided nylon</LineMaterial>
</Parachute>
<Parachute>
<Manufacturer>SEMROC Astronautics</Manufacturer>
<PartNumber>PN-36</PartNumber>
<Description>36 In. Nylon Chute</Description>
<Material Type="SURFACE">Rip Stop Nylon</Material>
<Diameter Unit="m">0.9144</Diameter>
<Sides>0</Sides>
<LineCount>10</LineCount>
<LineLength Unit="m">0.9144</LineLength>
<LineMaterial Type="LINE">1/16 In. braided nylon</LineMaterial>
</Parachute>
</Components>
</OpenRocketComponent>

View File

@ -1,4 +1,3 @@
#
# English base translation file
#
@ -1605,6 +1604,7 @@ table.column.PartNo = Part Number
table.column.Description = Description
table.column.Type = Type
table.column.Length = Length
table.column.Width = Width
table.column.InnerDiameter = Inner Diameter
table.column.OuterDiameter = Outer Diameter
table.column.AftOuterDiameter = Aft Outer Diameter
@ -1619,5 +1619,10 @@ table.column.Finish = Finish
table.column.Thickness = Thickness
table.column.Filled = Filled
table.column.Mass = Mass
table.column.Diameter = Diameter
table.column.Sides = Sides
table.column.LineCount = Line Count
table.column.LineLength = Line Length
table.column.LineMaterial = Line Material

View File

@ -96,7 +96,35 @@ public class ComponentPreset implements Comparable<ComponentPreset> {
ComponentPreset.DESCRIPTION,
ComponentPreset.INNER_DIAMETER,
ComponentPreset.OUTER_DIAMETER,
ComponentPreset.LENGTH} );
ComponentPreset.LENGTH} ),
LAUNCH_LUG( new TypedKey<?>[] {
ComponentPreset.MANUFACTURER,
ComponentPreset.PARTNO,
ComponentPreset.DESCRIPTION,
ComponentPreset.INNER_DIAMETER,
ComponentPreset.OUTER_DIAMETER,
ComponentPreset.LENGTH} ),
STREAMER( new TypedKey<?>[] {
ComponentPreset.MANUFACTURER,
ComponentPreset.PARTNO,
ComponentPreset.DESCRIPTION,
ComponentPreset.LENGTH,
ComponentPreset.WIDTH,
ComponentPreset.THICKNESS,
ComponentPreset.MATERIAL} ),
PARACHUTE( new TypedKey<?>[] {
ComponentPreset.MANUFACTURER,
ComponentPreset.PARTNO,
ComponentPreset.DESCRIPTION,
ComponentPreset.DIAMETER,
ComponentPreset.SIDES,
ComponentPreset.LINE_COUNT,
ComponentPreset.LINE_LENGTH,
ComponentPreset.LINE_MATERIAL,
ComponentPreset.MATERIAL} );
TypedKey<?>[] displayedColumns;
@ -115,8 +143,9 @@ public class ComponentPreset implements Comparable<ComponentPreset> {
private static Map<Type,List<Type>> compatibleTypeMap = new HashMap<Type,List<Type>>();
static {
compatibleTypeMap.put( BODY_TUBE, Arrays.asList( BODY_TUBE, TUBE_COUPLER) );
compatibleTypeMap.put( TUBE_COUPLER, Arrays.asList( BODY_TUBE,TUBE_COUPLER) );
compatibleTypeMap.put( BODY_TUBE, Arrays.asList( BODY_TUBE, TUBE_COUPLER, LAUNCH_LUG ) );
compatibleTypeMap.put( TUBE_COUPLER, Arrays.asList( BODY_TUBE,TUBE_COUPLER, LAUNCH_LUG ) );
compatibleTypeMap.put( LAUNCH_LUG, Arrays.asList( BODY_TUBE,TUBE_COUPLER, LAUNCH_LUG ) );
compatibleTypeMap.put( CENTERING_RING, Arrays.asList( CENTERING_RING, ENGINE_BLOCK ) );
compatibleTypeMap.put( NOSE_CONE, Arrays.asList( NOSE_CONE, TRANSITION));
}
@ -128,6 +157,7 @@ public class ComponentPreset implements Comparable<ComponentPreset> {
public final static TypedKey<String> DESCRIPTION = new TypedKey<String>("Description", String.class);
public final static TypedKey<Type> TYPE = new TypedKey<Type>("Type",Type.class);
public final static TypedKey<Double> LENGTH = new TypedKey<Double>("Length", Double.class, UnitGroup.UNITS_LENGTH);
public final static TypedKey<Double> WIDTH = new TypedKey<Double>("Width", Double.class, UnitGroup.UNITS_LENGTH);
public final static TypedKey<Double> INNER_DIAMETER = new TypedKey<Double>("InnerDiameter", Double.class, UnitGroup.UNITS_LENGTH);
public final static TypedKey<Double> OUTER_DIAMETER = new TypedKey<Double>("OuterDiameter", Double.class, UnitGroup.UNITS_LENGTH);
public final static TypedKey<Double> FORE_SHOULDER_LENGTH = new TypedKey<Double>("ForeShoulderLength",Double.class, UnitGroup.UNITS_LENGTH);
@ -142,29 +172,12 @@ public class ComponentPreset implements Comparable<ComponentPreset> {
public final static TypedKey<Double> THICKNESS = new TypedKey<Double>("Thickness", Double.class, UnitGroup.UNITS_LENGTH);
public final static TypedKey<Boolean> FILLED = new TypedKey<Boolean>("Filled", Boolean.class);
public final static TypedKey<Double> MASS = new TypedKey<Double>("Mass", Double.class, UnitGroup.UNITS_MASS);
public final static TypedKey<Double> DIAMETER = new TypedKey<Double>("Diameter", Double.class, UnitGroup.UNITS_LENGTH);
public final static TypedKey<Integer> SIDES = new TypedKey<Integer>("Sides", Integer.class);
public final static TypedKey<Integer> LINE_COUNT = new TypedKey<Integer>("LineCount", Integer.class);
public final static TypedKey<Double> LINE_LENGTH = new TypedKey<Double>("LineLength", Double.class, UnitGroup.UNITS_LENGTH);
public final static TypedKey<Material> LINE_MATERIAL = new TypedKey<Material>("LineMaterial", Material.class);
public final static Map<String, TypedKey<?>> keyMap = new HashMap<String, TypedKey<?>>();
static {
keyMap.put(MANUFACTURER.getName(), MANUFACTURER);
keyMap.put(PARTNO.getName(), PARTNO);
keyMap.put(TYPE.getName(), TYPE);
keyMap.put(DESCRIPTION.getName(), DESCRIPTION);
keyMap.put(LENGTH.getName(), LENGTH);
keyMap.put(INNER_DIAMETER.getName(), INNER_DIAMETER);
keyMap.put(OUTER_DIAMETER.getName(), OUTER_DIAMETER);
keyMap.put(FORE_SHOULDER_LENGTH.getName(), FORE_SHOULDER_LENGTH);
keyMap.put(FORE_SHOULDER_DIAMETER.getName(), FORE_SHOULDER_DIAMETER);
keyMap.put(FORE_OUTER_DIAMETER.getName(), FORE_OUTER_DIAMETER);
keyMap.put(AFT_SHOULDER_LENGTH.getName(), AFT_SHOULDER_LENGTH);
keyMap.put(AFT_SHOULDER_DIAMETER.getName(), AFT_SHOULDER_DIAMETER);
keyMap.put(AFT_OUTER_DIAMETER.getName(), AFT_OUTER_DIAMETER);
keyMap.put(SHAPE.getName(), SHAPE);
keyMap.put(MATERIAL.getName(), MATERIAL);
keyMap.put(FINISH.getName(), FINISH);
keyMap.put(THICKNESS.getName(), THICKNESS);
keyMap.put(FILLED.getName(), FILLED);
keyMap.put(MASS.getName(), MASS);
}
public final static List<TypedKey<?>> orderedKeyList = Arrays.<TypedKey<?>>asList(
MANUFACTURER,
@ -175,6 +188,7 @@ public class ComponentPreset implements Comparable<ComponentPreset> {
AFT_OUTER_DIAMETER,
INNER_DIAMETER,
LENGTH,
WIDTH,
AFT_SHOULDER_DIAMETER,
AFT_SHOULDER_LENGTH,
FORE_SHOULDER_DIAMETER,
@ -182,6 +196,11 @@ public class ComponentPreset implements Comparable<ComponentPreset> {
SHAPE,
THICKNESS,
FILLED,
DIAMETER,
SIDES,
LINE_COUNT,
LINE_LENGTH,
LINE_MATERIAL,
MASS,
FINISH,
MATERIAL

View File

@ -58,6 +58,19 @@ public abstract class ComponentPresetFactory {
makeEngineBlock(preset);
break;
}
case LAUNCH_LUG: {
// Same processing as BODY_TUBE
makeBodyTube(preset);
break;
}
case STREAMER: {
makeStreamer(preset);
break;
}
case PARACHUTE: {
makeParachute(preset);
break;
}
}
preset.computeDigest();
@ -192,6 +205,15 @@ public abstract class ComponentPresetFactory {
}
private static void makeStreamer( ComponentPreset preset ) throws InvalidComponentPresetException {
checkRequiredFields( preset, LENGTH, WIDTH );
}
private static void makeParachute( ComponentPreset preset ) throws InvalidComponentPresetException {
checkRequiredFields( preset, DIAMETER, LINE_COUNT, LINE_LENGTH );
}
private static void checkRequiredFields( ComponentPreset preset, TypedKey<?> ... keys ) throws InvalidComponentPresetException {
for( TypedKey<?> key: keys ) {
if (! preset.has(key) ) {

View File

@ -0,0 +1,21 @@
package net.sf.openrocket.preset.loader;
import net.sf.openrocket.preset.TypedKey;
import net.sf.openrocket.preset.TypedPropertyMap;
public class IntegerColumnParser extends BaseColumnParser {
private TypedKey<Integer> propKey;
public IntegerColumnParser(String columnHeader, TypedKey<Integer> propKey) {
super(columnHeader);
this.propKey = propKey;
}
@Override
protected void doParse(String columnData, String[] data, TypedPropertyMap props) {
int value = Integer.valueOf(columnData);
props.put(propKey, value);
}
}

View File

@ -0,0 +1,31 @@
package net.sf.openrocket.preset.loader;
import java.util.Map;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.ComponentPreset.Type;
public class LaunchLugLoader extends BaseComponentLoader {
public LaunchLugLoader(Map<String, Material> materials) {
super(materials);
fileColumns.add(new DoubleUnitColumnParser("ID","Units",ComponentPreset.INNER_DIAMETER));
fileColumns.add(new DoubleUnitColumnParser("OD","Units",ComponentPreset.OUTER_DIAMETER));
fileColumns.add(new DoubleUnitColumnParser("Length","Units",ComponentPreset.LENGTH));
}
@Override
protected Type getComponentPresetType() {
return ComponentPreset.Type.LAUNCH_LUG;
}
@Override
protected RocksimComponentFileType getFileType() {
return RocksimComponentFileType.LAUNCH_LUG;
}
}

View File

@ -0,0 +1,44 @@
package net.sf.openrocket.preset.loader;
import java.util.Collections;
import java.util.Map;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.preset.TypedKey;
import net.sf.openrocket.preset.TypedPropertyMap;
public class LineMaterialColumnParser extends BaseColumnParser {
private Map<String,Material> materialMap = Collections.<String,Material>emptyMap();
private final TypedKey<Material> param;
public LineMaterialColumnParser(Map<String,Material> materialMap, String columnName, TypedKey<Material> param) {
super(columnName);
this.param = param;
this.materialMap = materialMap;
}
@Override
protected void doParse(String columnData, String[] data, TypedPropertyMap props) {
if ( columnData == null || "".equals(columnData.trim())) {
return;
}
Material.Line myMaterial;
Material m = materialMap.get(columnData);
if ( m == null || m.getType() != Material.Type.LINE ) {
myMaterial = new Material.Line(columnData, 0.0, true);
} else {
myMaterial =(Material.Line) m;
}
props.put(param, myMaterial);
}
}

View File

@ -5,26 +5,38 @@ import java.util.Map;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.TypedKey;
import net.sf.openrocket.preset.TypedPropertyMap;
public class MaterialColumnParser extends BaseColumnParser {
private Map<String,Material> materialMap = Collections.<String,Material>emptyMap();
// FIXME - BULK vs other types.
private final TypedKey<Material> param;
public MaterialColumnParser(Map<String,Material> materialMap, String columnName, TypedKey<Material> param) {
super(columnName);
this.param = param;
this.materialMap = materialMap;
}
public MaterialColumnParser(Map<String,Material> materialMap) {
super("Material");
this(materialMap, "Material", ComponentPreset.MATERIAL);
}
@Override
protected void doParse(String columnData, String[] data, TypedPropertyMap props) {
if ( columnData == null || "".equals(columnData.trim())) {
return;
}
Material m = materialMap.get(columnData);
if ( m == null ) {
m = new Material.Bulk(columnData, 0.0, true);
}
props.put(ComponentPreset.MATERIAL, m);
props.put(param, m);
}

View File

@ -0,0 +1,37 @@
package net.sf.openrocket.preset.loader;
import java.util.Map;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.ComponentPreset.Type;
public class ParachuteLoader extends BaseComponentLoader {
Map<String,Material> materialMap;
public ParachuteLoader(Map<String, Material> materials) {
super(materials);
this.materialMap = materials;
fileColumns.add(new IntegerColumnParser("n sides", ComponentPreset.SIDES));
fileColumns.add(new DoubleUnitColumnParser("OD","Units",ComponentPreset.DIAMETER));
fileColumns.add(new IntegerColumnParser("Shroud Count", ComponentPreset.LINE_COUNT));
fileColumns.add(new DoubleUnitColumnParser("Shroud Len", "Units", ComponentPreset.LINE_LENGTH));
fileColumns.add(new LineMaterialColumnParser(materials,"Shroud Material",ComponentPreset.LINE_MATERIAL));
fileColumns.add(new DoubleUnitColumnParser("Chute Thickness", "Units", ComponentPreset.THICKNESS));
fileColumns.add( new SurfaceMaterialColumnParser(materials,"Chute Material", ComponentPreset.MATERIAL));
}
@Override
protected Type getComponentPresetType() {
return ComponentPreset.Type.PARACHUTE;
}
@Override
protected RocksimComponentFileType getFileType() {
return RocksimComponentFileType.PARACHUTE;
}
}

View File

@ -11,6 +11,7 @@ import net.sf.openrocket.material.Material;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.xml.OpenRocketComponentSaver;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.startup.Startup;
import net.sf.openrocket.util.ArrayList;
public class RocksimComponentFileTranslator {
@ -36,6 +37,7 @@ public class RocksimComponentFileTranslator {
System.err.println("Loading csv files from directory " + args[0]);
Startup.initializeLogging();
Application.setPreferences(new SwingPreferences());
MaterialLoader mats = new MaterialLoader();
@ -54,7 +56,7 @@ public class RocksimComponentFileTranslator {
BulkHeadLoader bhs = new BulkHeadLoader(materialMap);
bhs.load();
allPresets.addAll(bhs.getPresets());
System.err.println("\tBody Tubes loaded: " + bhs.getPresets().size());
System.err.println("\tBulkheads loaded: " + bhs.getPresets().size());
}
{
CenteringRingLoader crs = new CenteringRingLoader(materialMap);
@ -86,6 +88,24 @@ public class RocksimComponentFileTranslator {
allPresets.addAll(trs.getPresets());
System.err.println("\tTransitions loaded: " + trs.getPresets().size());
}
{
LaunchLugLoader lls = new LaunchLugLoader(materialMap);
lls.load();
allPresets.addAll(lls.getPresets());
System.err.println("\tLaunch Lugs loaded: " + lls.getPresets().size());
}
{
StreamerLoader sts = new StreamerLoader(materialMap);
sts.load();
allPresets.addAll(sts.getPresets());
System.err.println("\tStreamers loaded: " + sts.getPresets().size());
}
{
ParachuteLoader pcs = new ParachuteLoader(materialMap);
pcs.load();
allPresets.addAll(pcs.getPresets());
System.err.println("Parachutes loaded: " + pcs.getPresets().size());
}
System.err.println("\tMarshalling to XML");
String xml = new OpenRocketComponentSaver().marshalToOpenRocketComponent(new ArrayList<Material>(materialMap.values()), allPresets);

View File

@ -13,7 +13,7 @@ public enum RocksimComponentFileType {
CUSTOM_FIN("CSDATA.CSV"),
ENGINE_BLOCK("EBDATA.CSV", "Mfg.", "Part No.", "Desc.", "Units", "ID", "OD", "Length", "Material", "CG", "Mass Units", "Mass", "AutoSize"),
FIN("FSDATA.CSV"),
LAUNCH_LUG("LLDATA.CSV"),
LAUNCH_LUG("LLDATA.CSV", "Mfg.", "Part No.", "Desc.", "Units", "ID", "OD", "Length", "Material"),
MASS_OBJECT("MODATA.CSV", "Mfg.", "Part no", "Desc", "Units", "Name", "Type", "Length", "Material", "Mass units", "Mass"),
MATERIAL("MATERIAL.CSV", "Material Name", "Units", "Density", "Low", "High", "Class", "Rocketry Use", "Body Tubes",
"Fin Sets", "Launch Lugs", "Cords", "Nose", "Chute", "Stream", "Trans", "Ring", "Bulkhead", "Engine Block", "Sleeve",
@ -22,7 +22,7 @@ public enum RocksimComponentFileType {
"Thickness","Shape","Config","Material","CG Loc","Mass Units","Mass","Base Ext. Len"),
PARACHUTE("PCDATA.CSV"),
SLEEVE("SLDATA.CSV"),
STREAMER("STDATA.CSV"),
STREAMER("STDATA.CSV", "Mfg.", "Part No.", "Desc.", "Units", "Length", "Width", "Thickness", "Count", "Material"),
TUBE_COUPLER("TCDATA.CSV", "Mfg.", "Part No.", "Desc.", "Units", "ID", "OD", "Length", "Material", "Mass Units", "CG", "Mass", "AutoSize"),
TRANSITION("TRDATA.CSV", "Mfg.", "Part No.", "Desc.", "Units", "Front Insert Len", "Front Insert OD", "Front OD", "Length",
"Rear OD", "Core Dia.", "Rear Insert Len", "Rear Insert OD", "Thickness", "Config", "Material", "CG Loc",

View File

@ -0,0 +1,34 @@
package net.sf.openrocket.preset.loader;
import java.util.Map;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.ComponentPreset.Type;
public class StreamerLoader extends BaseComponentLoader {
Map<String,Material> materialMap;
public StreamerLoader(Map<String, Material> materials) {
super(materials);
this.materialMap = materials;
fileColumns.add(new SurfaceMaterialColumnParser(materials,"Material",ComponentPreset.MATERIAL));
fileColumns.add(new DoubleUnitColumnParser("Length","Units",ComponentPreset.LENGTH));
fileColumns.add(new DoubleUnitColumnParser("Width","Units",ComponentPreset.WIDTH));
fileColumns.add(new DoubleUnitColumnParser("Thickness","Units",ComponentPreset.THICKNESS));
}
@Override
protected Type getComponentPresetType() {
return ComponentPreset.Type.STREAMER;
}
@Override
protected RocksimComponentFileType getFileType() {
return RocksimComponentFileType.STREAMER;
}
}

View File

@ -0,0 +1,44 @@
package net.sf.openrocket.preset.loader;
import java.util.Collections;
import java.util.Map;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.preset.TypedKey;
import net.sf.openrocket.preset.TypedPropertyMap;
public class SurfaceMaterialColumnParser extends BaseColumnParser {
private Map<String,Material> materialMap = Collections.<String,Material>emptyMap();
private final TypedKey<Material> param;
public SurfaceMaterialColumnParser(Map<String,Material> materialMap, String columnName, TypedKey<Material> param) {
super(columnName);
this.param = param;
this.materialMap = materialMap;
}
@Override
protected void doParse(String columnData, String[] data, TypedPropertyMap props) {
if ( columnData == null || "".equals(columnData.trim())) {
return;
}
Material.Surface myMaterial;
Material m = materialMap.get(columnData);
if ( m == null || m.getType() != Material.Type.SURFACE ) {
myMaterial = new Material.Surface(columnData, 0.0, true);
} else {
myMaterial =(Material.Surface) m;
}
props.put(param, myMaterial);
}
}

View File

@ -173,15 +173,33 @@ public abstract class BaseComponentDTO {
}
}
private Material find(List<MaterialDTO> materialList, AnnotatedMaterialDTO dto) {
protected Material find(List<MaterialDTO> materialList, AnnotatedMaterialDTO dto) {
if ( dto == null ) {
return null;
}
for (int i = 0; i < materialList.size(); i++) {
MaterialDTO materialDTO = materialList.get(i);
if (materialDTO.getType().name().equals(dto.type) && materialDTO.getName().equals(dto.material)) {
return materialDTO.asMaterial();
}
}
//Otherwise fallback and look at factory default materials.
return Databases.findMaterial(Material.Type.valueOf(material.type), material.material);
// Check for the material in the default database.
Material defaultMaterial = Databases.findMaterial(Material.Type.valueOf(material.type), material.material);
if ( defaultMaterial != null ) {
return defaultMaterial;
}
// Don't have one, build one.
if ( "BULK".equals( dto.type ) ) {
return new Material.Bulk(dto.material, 0.0, true);
} else if ( "SURFACE".equals( dto.type ) ) {
return new Material.Surface(dto.material, 0.0, true);
} else if ( "LINE".equals( dto.type ) ) {
return new Material.Line(dto.material, 0.0, true);
} else {
return null;
}
}
static class AnnotatedMaterialDTO {

View File

@ -0,0 +1,100 @@
package net.sf.openrocket.preset.xml;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.ComponentPresetFactory;
import net.sf.openrocket.preset.InvalidComponentPresetException;
import net.sf.openrocket.preset.TypedPropertyMap;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
/**
* Body tube preset XML handler.
*/
@XmlRootElement(name = "LaunchLug")
@XmlAccessorType(XmlAccessType.FIELD)
public class LaunchLugDTO extends BaseComponentDTO {
@XmlElement(name = "InsideDiameter")
private AnnotatedLengthDTO insideDiameter;
@XmlElement(name = "OutsideDiameter")
private AnnotatedLengthDTO outsideDiameter;
@XmlElement(name = "Length")
private AnnotatedLengthDTO length;
/**
* Default constructor.
*/
public LaunchLugDTO() {
}
/**
* Most-useful constructor that maps a LaunchLug preset to a LaunchLugDTO.
*
* @param preset the preset
*
* @throws net.sf.openrocket.util.BugException thrown if the expected body tube keys are not in the preset
*/
public LaunchLugDTO(final ComponentPreset preset) {
super(preset);
setInsideDiameter(preset.get(ComponentPreset.INNER_DIAMETER));
setOutsideDiameter(preset.get(ComponentPreset.OUTER_DIAMETER));
setLength(preset.get(ComponentPreset.LENGTH));
}
public double getInsideDiameter() {
return insideDiameter.getValue();
}
public void setInsideDiameter( final AnnotatedLengthDTO theLength ) {
insideDiameter = theLength;
}
public void setInsideDiameter(final double theId) {
insideDiameter = new AnnotatedLengthDTO(theId);
}
public double getOutsideDiameter() {
return outsideDiameter.getValue();
}
public void setOutsideDiameter(final AnnotatedLengthDTO theOd) {
outsideDiameter = theOd;
}
public void setOutsideDiameter(final double theOd) {
outsideDiameter = new AnnotatedLengthDTO(theOd);
}
public double getLength() {
return length.getValue();
}
public void setLength(final AnnotatedLengthDTO theLength) {
length = theLength;
}
public void setLength(final double theLength) {
length = new AnnotatedLengthDTO(theLength);
}
@Override
public ComponentPreset asComponentPreset(java.util.List<MaterialDTO> materials) throws InvalidComponentPresetException {
return asComponentPreset(ComponentPreset.Type.LAUNCH_LUG, materials);
}
public ComponentPreset asComponentPreset(ComponentPreset.Type type, List<MaterialDTO> materials) throws InvalidComponentPresetException {
TypedPropertyMap props = new TypedPropertyMap();
addProps(props, materials);
props.put(ComponentPreset.INNER_DIAMETER, this.getInsideDiameter());
props.put(ComponentPreset.OUTER_DIAMETER, this.getOutsideDiameter());
props.put(ComponentPreset.LENGTH, this.getLength());
props.put(ComponentPreset.TYPE, type);
return ComponentPresetFactory.create(props);
}
}

View File

@ -35,7 +35,10 @@ public class OpenRocketComponentDTO {
@XmlElementRef(name = "Transitions", type = TransitionDTO.class),
@XmlElementRef(name = "BulkHeads", type = BulkHeadDTO.class),
@XmlElementRef(name = "CenteringRings", type = CenteringRingDTO.class),
@XmlElementRef(name = "EngineBlocks", type = EngineBlockDTO.class)})
@XmlElementRef(name = "EngineBlocks", type = EngineBlockDTO.class),
@XmlElementRef(name = "LaunchLugs", type = LaunchLugDTO.class),
@XmlElementRef(name = "Streamers", type = StreamerDTO.class),
@XmlElementRef(name = "Parachutes", type = ParachuteDTO.class)})
private List<BaseComponentDTO> components = new ArrayList<BaseComponentDTO>();
public OpenRocketComponentDTO() {

View File

@ -153,6 +153,12 @@ public class OpenRocketComponentSaver {
return new CenteringRingDTO(thePreset);
case ENGINE_BLOCK:
return new EngineBlockDTO(thePreset);
case LAUNCH_LUG:
return new LaunchLugDTO(thePreset);
case STREAMER:
return new StreamerDTO(thePreset);
case PARACHUTE:
return new ParachuteDTO(thePreset);
}
return null;

View File

@ -0,0 +1,140 @@
package net.sf.openrocket.preset.xml;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.ComponentPresetFactory;
import net.sf.openrocket.preset.InvalidComponentPresetException;
import net.sf.openrocket.preset.TypedPropertyMap;
import net.sf.openrocket.preset.xml.BaseComponentDTO.AnnotatedMaterialDTO;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
/**
* Streamer preset XML handler.
*/
@XmlRootElement(name = "Parachute")
@XmlAccessorType(XmlAccessType.FIELD)
public class ParachuteDTO extends BaseComponentDTO {
@XmlElement(name = "Diameter")
private AnnotatedLengthDTO diameter;
@XmlElement(name = "Sides")
private Integer sides;
@XmlElement(name = "LineCount")
private Integer lineCount;
@XmlElement(name = "LineLength")
private AnnotatedLengthDTO lineLength;
@XmlElement(name = "LineMaterial")
private AnnotatedMaterialDTO lineMaterial;
/**
* Default constructor.
*/
public ParachuteDTO() {
}
public double getDiameter() {
return diameter.getValue();
}
public void setDiameter(AnnotatedLengthDTO diameter) {
this.diameter = diameter;
}
public void setDiameter(double diameter) {
this.diameter = new AnnotatedLengthDTO(diameter);
}
public Integer getSides() {
return sides;
}
public void setSides(Integer sides) {
this.sides = sides;
}
public Integer getLineCount() {
return lineCount;
}
public void setLineCount(Integer lineCount) {
this.lineCount = lineCount;
}
public double getLineLength() {
return lineLength.getValue();
}
public void setLineLength(AnnotatedLengthDTO lineLength) {
this.lineLength = lineLength;
}
public void setLineLength(double lineLength) {
this.lineLength = new AnnotatedLengthDTO(lineLength);
}
public AnnotatedMaterialDTO getLineMaterial() {
return lineMaterial;
}
public void setLineMaterial(AnnotatedMaterialDTO lineMaterial) {
this.lineMaterial = lineMaterial;
}
/**
* Most-useful constructor that maps a BodyTube preset to a BodyTubeDTO.
*
* @param preset the preset
*
* @throws net.sf.openrocket.util.BugException thrown if the expected body tube keys are not in the preset
*/
public ParachuteDTO(final ComponentPreset preset) {
super(preset);
setDiameter(preset.get(ComponentPreset.DIAMETER));
setLineCount(preset.get(ComponentPreset.LINE_COUNT));
if ( preset.has(ComponentPreset.LINE_LENGTH)) {
setLineLength(preset.get(ComponentPreset.LINE_LENGTH));
}
if ( preset.has(ComponentPreset.SIDES)) {
setSides(preset.get(ComponentPreset.SIDES));
}
if ( preset.has(ComponentPreset.LINE_MATERIAL)) {
setLineMaterial(new AnnotatedMaterialDTO(preset.get(ComponentPreset.LINE_MATERIAL)));
}
}
@Override
public ComponentPreset asComponentPreset(java.util.List<MaterialDTO> materials) throws InvalidComponentPresetException {
return asComponentPreset(ComponentPreset.Type.PARACHUTE, materials);
}
public ComponentPreset asComponentPreset(ComponentPreset.Type type, List<MaterialDTO> materials) throws InvalidComponentPresetException {
TypedPropertyMap props = new TypedPropertyMap();
addProps(props, materials);
// FIXME - seems some vendors use a bulk material for the sheet along with a Thickness.
// need to fix the MATERIAL packed into the componentpreset.
props.put(ComponentPreset.TYPE, type);
props.put(ComponentPreset.DIAMETER, this.getDiameter());
props.put(ComponentPreset.LINE_COUNT, this.getLineCount());
if ( this.lineLength != null ) {
props.put(ComponentPreset.LINE_LENGTH, this.getLineLength());
}
if ( this.sides != null ) {
props.put(ComponentPreset.SIDES, this.getSides());
}
if ( this.lineMaterial != null ) {
Material m = find(materials, this.lineMaterial);
if ( m != null ) {
props.put(ComponentPreset.LINE_MATERIAL, m);
}
}
return ComponentPresetFactory.create(props);
}
}

View File

@ -0,0 +1,102 @@
package net.sf.openrocket.preset.xml;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.ComponentPresetFactory;
import net.sf.openrocket.preset.InvalidComponentPresetException;
import net.sf.openrocket.preset.TypedPropertyMap;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
/**
* Streamer preset XML handler.
*/
@XmlRootElement(name = "Streamer")
@XmlAccessorType(XmlAccessType.FIELD)
public class StreamerDTO extends BaseComponentDTO {
@XmlElement(name = "Length")
private AnnotatedLengthDTO length;
@XmlElement(name = "Width")
private AnnotatedLengthDTO width;
@XmlElement(name = "Thickness")
private AnnotatedLengthDTO thickness;
/**
* Default constructor.
*/
public StreamerDTO() {
}
/**
* Most-useful constructor that maps a BodyTube preset to a BodyTubeDTO.
*
* @param preset the preset
*
* @throws net.sf.openrocket.util.BugException thrown if the expected body tube keys are not in the preset
*/
public StreamerDTO(final ComponentPreset preset) {
super(preset);
setWidth(preset.get(ComponentPreset.WIDTH));
setThickness(preset.get(ComponentPreset.THICKNESS));
setLength(preset.get(ComponentPreset.LENGTH));
}
public double getWidth() {
return width.getValue();
}
public void setWidth( final AnnotatedLengthDTO theWidth ) {
width = theWidth;
}
public void setWidth(final double theId) {
width = new AnnotatedLengthDTO(theId);
}
public double getThickness() {
return thickness.getValue();
}
public void setThickness(final AnnotatedLengthDTO theThickness) {
thickness = theThickness;
}
public void setThickness(final double theThickness) {
thickness = new AnnotatedLengthDTO(theThickness);
}
public double getLength() {
return length.getValue();
}
public void setLength(final AnnotatedLengthDTO theLength) {
length = theLength;
}
public void setLength(final double theLength) {
length = new AnnotatedLengthDTO(theLength);
}
@Override
public ComponentPreset asComponentPreset(java.util.List<MaterialDTO> materials) throws InvalidComponentPresetException {
return asComponentPreset(ComponentPreset.Type.STREAMER, materials);
}
public ComponentPreset asComponentPreset(ComponentPreset.Type type, List<MaterialDTO> materials) throws InvalidComponentPresetException {
TypedPropertyMap props = new TypedPropertyMap();
addProps(props, materials);
// FIXME - seems some vendors use a bulk material for the sheet along with a Thickness.
// need to fix the MATERIAL packed into the componentpreset.
props.put(ComponentPreset.WIDTH, this.getWidth());
props.put(ComponentPreset.THICKNESS, this.getThickness());
props.put(ComponentPreset.LENGTH, this.getLength());
props.put(ComponentPreset.TYPE, type);
return ComponentPresetFactory.create(props);
}
}

View File

@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.Collection;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.ComponentPreset.Type;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.Coordinate;
import net.sf.openrocket.util.MathUtil;
@ -43,6 +45,7 @@ public class LaunchLug extends ExternalComponent implements Coaxial {
return;
this.radius = radius;
this.thickness = Math.min(this.thickness, this.radius);
clearPreset();
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
@ -65,6 +68,7 @@ public class LaunchLug extends ExternalComponent implements Coaxial {
if (MathUtil.equals(this.thickness, thickness))
return;
this.thickness = MathUtil.clamp(thickness, 0, radius);
clearPreset();
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
@ -109,6 +113,29 @@ public class LaunchLug extends ExternalComponent implements Coaxial {
@Override
protected void loadFromPreset(ComponentPreset preset) {
if ( preset.has(ComponentPreset.OUTER_DIAMETER) ) {
double outerDiameter = preset.get(ComponentPreset.OUTER_DIAMETER);
this.radius = outerDiameter/2.0;
if ( preset.has(ComponentPreset.INNER_DIAMETER) ) {
double innerDiameter = preset.get(ComponentPreset.INNER_DIAMETER);
this.thickness = (outerDiameter-innerDiameter) / 2.0;
}
}
super.loadFromPreset(preset);
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
@Override
public Type getPresetType() {
return ComponentPreset.Type.LAUNCH_LUG;
}
@Override
public Coordinate[] shiftCoordinates(Coordinate[] array) {
array = super.shiftCoordinates(array);

View File

@ -2,6 +2,8 @@ package net.sf.openrocket.rocketcomponent;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.ComponentPreset.Type;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.MathUtil;
@ -32,6 +34,7 @@ public class Parachute extends RecoveryDevice {
if (MathUtil.equals(this.diameter, d))
return;
this.diameter = d;
clearPreset();
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
@ -62,6 +65,7 @@ public class Parachute extends RecoveryDevice {
if (this.lineCount == n)
return;
this.lineCount = n;
clearPreset();
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
}
@ -94,6 +98,7 @@ public class Parachute extends RecoveryDevice {
if (MathUtil.equals(getArea(), area))
return;
diameter = MathUtil.safeSqrt(area / Math.PI) * 2;
clearPreset();
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
@ -119,4 +124,28 @@ public class Parachute extends RecoveryDevice {
return false;
}
@Override
protected void loadFromPreset(ComponentPreset preset) {
if( preset.has( ComponentPreset.DIAMETER )) {
this.diameter = preset.get( ComponentPreset.DIAMETER );
}
if( preset.has( ComponentPreset.LINE_COUNT )) {
this.lineCount = preset.get( ComponentPreset.LINE_COUNT );
}
if( preset.has( ComponentPreset.LINE_LENGTH )) {
this.lineLength = preset.get( ComponentPreset.LINE_LENGTH );
}
if( preset.has( ComponentPreset.LINE_MATERIAL )) {
this.lineMaterial = preset.get( ComponentPreset.LINE_MATERIAL );
}
super.loadFromPreset(preset);
}
@Override
public Type getPresetType() {
return ComponentPreset.Type.PARACHUTE;
}
}

View File

@ -2,6 +2,7 @@ package net.sf.openrocket.rocketcomponent;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.simulation.FlightEvent;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.MathUtil;
@ -169,6 +170,7 @@ public abstract class RecoveryDevice extends MassObject {
if (mat.equals(material))
return;
this.material = (Material.Surface) mat;
clearPreset();
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
}
@ -221,4 +223,15 @@ public abstract class RecoveryDevice extends MassObject {
return getArea() * getMaterial().getDensity();
}
@Override
protected void loadFromPreset(ComponentPreset preset) {
if ( preset.has(ComponentPreset.MATERIAL)) {
Material m = preset.get(ComponentPreset.MATERIAL);
this.material = (Material.Surface)m;
}
super.loadFromPreset(preset);
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
}

View File

@ -1,5 +1,7 @@
package net.sf.openrocket.rocketcomponent;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.ComponentPreset.Type;
import net.sf.openrocket.util.MathUtil;
public class Streamer extends RecoveryDevice {
@ -27,6 +29,7 @@ public class Streamer extends RecoveryDevice {
if (MathUtil.equals(this.stripLength, stripLength))
return;
this.stripLength = stripLength;
clearPreset();
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
@ -39,6 +42,7 @@ public class Streamer extends RecoveryDevice {
return;
this.stripWidth = stripWidth;
this.length = stripWidth;
clearPreset();
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
@ -83,6 +87,27 @@ public class Streamer extends RecoveryDevice {
@Override
public Type getPresetType() {
return ComponentPreset.Type.STREAMER;
}
@Override
protected void loadFromPreset(ComponentPreset preset) {
if ( preset.has(ComponentPreset.LENGTH)) {
this.stripLength = preset.get(ComponentPreset.LENGTH);
}
if ( preset.has(ComponentPreset.WIDTH)) {
this.stripWidth = preset.get(ComponentPreset.WIDTH);
}
super.loadFromPreset(preset);
// Fix the length to the stripWidth since RocketComponent assigns ComponentPreset.LENGTH to length.
this.length = this.stripWidth;
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
}
@Override
public double getComponentCD(double mach) {
double density = this.getMaterial().getDensity();

View File

@ -0,0 +1,126 @@
package net.sf.openrocket.preset;
import static org.junit.Assert.*;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.motor.Manufacturer;
import net.sf.openrocket.rocketcomponent.LaunchLug;
import net.sf.openrocket.rocketcomponent.ExternalComponent.Finish;
import net.sf.openrocket.util.BaseTestCase.BaseTestCase;
import org.junit.Before;
import org.junit.Test;
/**
* Test application of ComponentPresets to LaunchLug RocketComponents through
* the LaunchLug.loadFromPreset mechanism.
*
* Test LaunchLug is well defined.
*
* Test calling setters on LaunchLug will clear the ComponentPreset.
*
*/
public class LaunchLugComponentTests extends BaseTestCase {
ComponentPreset preset;
@Before
public void createPreset() throws Exception {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.LAUNCH_LUG);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
presetspec.put( ComponentPreset.LENGTH, 2.0);
presetspec.put( ComponentPreset.OUTER_DIAMETER, 2.0);
presetspec.put( ComponentPreset.INNER_DIAMETER, 1.0);
presetspec.put( ComponentPreset.MASS, 100.0);
preset = ComponentPresetFactory.create(presetspec);
}
@Test
public void testComponentType() {
LaunchLug bt = new LaunchLug();
assertSame( ComponentPreset.Type.LAUNCH_LUG, bt.getPresetType() );
}
@Test
public void testLoadFromPresetIsSane() {
LaunchLug bt = new LaunchLug();
bt.loadPreset(preset);
assertEquals( 2.0, bt.getLength(), 0.0 );
assertEquals( 1.0, bt.getOuterRadius(), 0.0 );
assertEquals( 0.5, bt.getInnerRadius(), 0.0 );
assertSame( preset.get( ComponentPreset.MATERIAL), bt.getMaterial() );
assertEquals( 100.0, bt.getMass(), 0.05);
}
@Test
public void changeLengthLeavesPreset() {
LaunchLug bt = new LaunchLug();
bt.loadPreset(preset);
bt.setLength(1.0);
assertSame( preset, bt.getPresetComponent() );
}
@Test
public void changeODClearsPreset() {
LaunchLug bt = new LaunchLug();
bt.loadPreset(preset);
bt.setOuterRadius(2.0);
assertNull( bt.getPresetComponent() );
}
@Test
public void changeIDClearsPreset() {
LaunchLug bt = new LaunchLug();
bt.loadPreset(preset);
bt.setInnerRadius(0.75);
assertNull( bt.getPresetComponent() );
}
@Test
public void changeThicknessClearsPreset() {
LaunchLug bt = new LaunchLug();
bt.loadPreset(preset);
bt.setThickness(0.1);
assertNull( bt.getPresetComponent() );
}
@Test
public void changeMaterialClearsPreset() {
LaunchLug bt = new LaunchLug();
bt.loadPreset(preset);
bt.setMaterial( new Material.Bulk("new", 1.0, true));
assertNull( bt.getPresetComponent() );
}
@Test
public void changeFinishLeavesPreset() {
LaunchLug bt = new LaunchLug();
bt.loadPreset(preset);
bt.setFinish( Finish.POLISHED );
assertSame( preset, bt.getPresetComponent() );
}
}

View File

@ -0,0 +1,227 @@
package net.sf.openrocket.preset;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.motor.Manufacturer;
import org.junit.Test;
/**
* Test construction of LAUNCH_LUG type ComponentPresets based on TypedPropertyMap through the
* ComponentPresetFactory.create() method.
*
* Ensure required properties are populated
*
* Ensure any computed values are correctly computed.
*
*/
public class LaunchLugPresetTests {
@Test
public void testManufacturerRequired() {
try {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.LAUNCH_LUG);
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No Manufacturer specified"));
}
}
@Test
public void testPartNoRequired() {
try {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.LAUNCH_LUG);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No PartNo specified"));
}
}
@Test
public void testLengthRequired() {
try {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.LAUNCH_LUG);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No Length specified"));
}
}
@Test
public void testOnlyOuterDiameter() {
try {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.LAUNCH_LUG);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
presetspec.put( ComponentPreset.LENGTH, 2.0);
presetspec.put( ComponentPreset.OUTER_DIAMETER, 2.0);
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
assertTrue("Wrong Exception Thrown", ex.getMessage().contains("Preset underspecified"));
}
}
@Test
public void testOnlyInnerDiameter() {
try {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.LAUNCH_LUG);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
presetspec.put( ComponentPreset.LENGTH, 2.0);
presetspec.put( ComponentPreset.INNER_DIAMETER, 2.0);
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
assertTrue("Wrong Exception Thrown", ex.getMessage().contains("Preset underspecified"));
}
}
@Test
public void testOnlyThicknessDiameter() {
try {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.LAUNCH_LUG);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
presetspec.put( ComponentPreset.LENGTH, 2.0);
presetspec.put( ComponentPreset.THICKNESS, 2.0);
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
assertTrue("Wrong Exception Thrown", ex.getMessage().contains("Preset underspecified"));
}
}
@Test
public void testComputeInnerDiameter() throws Exception {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.LAUNCH_LUG);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
presetspec.put( ComponentPreset.LENGTH, 2.0);
presetspec.put( ComponentPreset.OUTER_DIAMETER, 2.0);
presetspec.put( ComponentPreset.THICKNESS, 0.5);
ComponentPreset preset = ComponentPresetFactory.create(presetspec);
assertEquals(1.0,preset.get(ComponentPreset.INNER_DIAMETER).doubleValue(),0.0);
}
@Test
public void testComputeOuterDiameter() throws Exception {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.LAUNCH_LUG);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
presetspec.put( ComponentPreset.LENGTH, 2.0);
presetspec.put( ComponentPreset.INNER_DIAMETER, 1.0);
presetspec.put( ComponentPreset.THICKNESS, 0.5);
ComponentPreset preset = ComponentPresetFactory.create(presetspec);
assertEquals(2.0,preset.get(ComponentPreset.OUTER_DIAMETER).doubleValue(),0.0);
}
@Test
public void testComputeThickness() throws Exception {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.LAUNCH_LUG);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
presetspec.put( ComponentPreset.LENGTH, 2.0);
presetspec.put( ComponentPreset.OUTER_DIAMETER, 2.0);
presetspec.put( ComponentPreset.INNER_DIAMETER, 1.0);
ComponentPreset preset = ComponentPresetFactory.create(presetspec);
assertEquals(0.5,preset.get(ComponentPreset.THICKNESS).doubleValue(),0.0);
}
@Test
public void testComputeThicknessLooses() throws Exception {
// If all OUTER_DIAMETER, INNER_DIAMETER and THICKNESS are
// specified, THICKNESS is recomputed.
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.LAUNCH_LUG);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
presetspec.put( ComponentPreset.LENGTH, 2.0);
presetspec.put( ComponentPreset.OUTER_DIAMETER, 2.0);
presetspec.put( ComponentPreset.INNER_DIAMETER, 1.0);
presetspec.put( ComponentPreset.THICKNESS, 15.0);
ComponentPreset preset = ComponentPresetFactory.create(presetspec);
assertEquals(0.5,preset.get(ComponentPreset.THICKNESS).doubleValue(),0.0);
}
@Test
public void testComputeDensityNoMaterial() throws Exception {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.LAUNCH_LUG);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
presetspec.put( ComponentPreset.LENGTH, 2.0);
presetspec.put( ComponentPreset.OUTER_DIAMETER, 2.0);
presetspec.put( ComponentPreset.INNER_DIAMETER, 1.0);
presetspec.put( ComponentPreset.MASS, 100.0);
ComponentPreset preset = ComponentPresetFactory.create(presetspec);
// Compute the volume by hand here using a slightly different formula from
// the real implementation. The magic numbers are based on the
// constants put into the presetspec above.
double volume = /*outer area*/ (Math.PI * 1.0) - /* inner area */ (Math.PI * .25);
volume *= 2.0; /* times length */
double density = 100.0 / volume;
assertEquals("TubeCustom",preset.get(ComponentPreset.MATERIAL).getName());
assertEquals(density,preset.get(ComponentPreset.MATERIAL).getDensity(),0.0005);
}
@Test
public void testMaterial() throws Exception {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.LAUNCH_LUG);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
presetspec.put( ComponentPreset.LENGTH, 2.0);
presetspec.put( ComponentPreset.OUTER_DIAMETER, 2.0);
presetspec.put( ComponentPreset.INNER_DIAMETER, 1.0);
presetspec.put( ComponentPreset.MATERIAL, new Material.Bulk("test", 2.0, true));
ComponentPreset preset = ComponentPresetFactory.create(presetspec);
assertEquals("test",preset.get(ComponentPreset.MATERIAL).getName());
assertEquals(2.0,preset.get(ComponentPreset.MATERIAL).getDensity(),0.0005);
}
@Test
public void testComputeDensityWithMaterial() throws Exception {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.LAUNCH_LUG);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
presetspec.put( ComponentPreset.LENGTH, 2.0);
presetspec.put( ComponentPreset.OUTER_DIAMETER, 2.0);
presetspec.put( ComponentPreset.INNER_DIAMETER, 1.0);
presetspec.put( ComponentPreset.MASS, 100.0);
presetspec.put( ComponentPreset.MATERIAL, new Material.Bulk("test", 2.0, true));
ComponentPreset preset = ComponentPresetFactory.create(presetspec);
// Compute the volume by hand here using a slightly different formula from
// the real implementation. The magic numbers are based on the
// constants put into the presetspec above.
double volume = /*outer area*/ (Math.PI * 1.0) - /* inner area */ (Math.PI * .25);
volume *= 2.0; /* times length */
double density = 100.0 / volume;
assertEquals("test",preset.get(ComponentPreset.MATERIAL).getName());
assertEquals(density,preset.get(ComponentPreset.MATERIAL).getDensity(),0.0005);
}
}

View File

@ -0,0 +1,84 @@
package net.sf.openrocket.preset;
import static org.junit.Assert.assertTrue;
import net.sf.openrocket.motor.Manufacturer;
import org.junit.Test;
/**
* Test construction of PARACHUTE type ComponentPresets based on TypedPropertyMap through the
* ComponentPresetFactory.create() method.
*
* Ensure required properties are populated
*
* Ensure any computed values are correctly computed.
*
*/
public class ParachutePresetTests {
@Test
public void testManufacturerRequired() {
try {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.PARACHUTE);
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No Manufacturer specified"));
}
}
@Test
public void testPartNoRequired() {
try {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.PARACHUTE);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No PartNo specified"));
}
}
@Test
public void testDiameterRequired() {
try {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.PARACHUTE);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No Diameter specified"));
}
}
@Test
public void testLineCountRequired() {
try {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.PARACHUTE);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
presetspec.put( ComponentPreset.DIAMETER, 2.0);
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No LineCount specified"));
}
}
@Test
public void testLineLengthRequired() {
try {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.PARACHUTE);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
presetspec.put( ComponentPreset.DIAMETER, 2.0);
presetspec.put( ComponentPreset.LINE_COUNT, 6);
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No LineLength specified"));
}
}
}

View File

@ -0,0 +1,130 @@
package net.sf.openrocket.preset;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.motor.Manufacturer;
import net.sf.openrocket.rocketcomponent.Parachute;
import net.sf.openrocket.util.BaseTestCase.BaseTestCase;
import org.junit.Before;
import org.junit.Test;
/**
* Test application of ComponentPresets to Parachute RocketComponents through
* the Parachute.loadFromPreset mechanism.
*
* Test Parachute is well defined.
*
* Test calling setters on Parachute will clear the ComponentPreset.
*
*/
public class ParachuterComponentTests extends BaseTestCase {
ComponentPreset preset;
@Before
public void createPreset() throws Exception {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.PARACHUTE);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
presetspec.put( ComponentPreset.DIAMETER, 20.0);
presetspec.put( ComponentPreset.LINE_COUNT, 8);
presetspec.put( ComponentPreset.LINE_LENGTH, 12.0);
Material m = new Material.Surface("testMaterial", 2.0, true);
presetspec.put( ComponentPreset.MATERIAL, m);
m = new Material.Line("testLineMaterial", 3, true);
presetspec.put( ComponentPreset.LINE_MATERIAL, m);
preset = ComponentPresetFactory.create(presetspec);
}
@Test
public void testComponentType() {
Parachute cr = new Parachute();
assertSame( ComponentPreset.Type.PARACHUTE, cr.getPresetType() );
}
@Test
public void testLoadFromPresetIsSane() {
Parachute cr = new Parachute();
cr.loadPreset(preset);
assertEquals( 20.0, cr.getDiameter(), 0.0 );
assertEquals( 8, cr.getLineCount(), 0.0 );
assertEquals( 12.0, cr.getLineLength(), 0.0 );
assertSame( preset.get( ComponentPreset.MATERIAL), cr.getMaterial() );
assertSame( preset.get( ComponentPreset.LINE_MATERIAL), cr.getLineMaterial() );
}
@Test
public void changeDiameterClearsPreset() {
Parachute cr = new Parachute();
cr.loadPreset(preset);
cr.setDiameter(1.0);
assertNull( cr.getPresetComponent() );
}
@Test
public void changeAreaClearsPreset() {
Parachute cr = new Parachute();
cr.loadPreset(preset);
cr.setArea(1.0);
assertNull( cr.getPresetComponent() );
}
@Test
public void changeLineCountClearsPreset() {
Parachute cr = new Parachute();
cr.loadPreset(preset);
cr.setLineCount(12);
assertNull( cr.getPresetComponent() );
}
@Test
public void changeLineLengthLeavesPreset() {
Parachute cr = new Parachute();
cr.loadPreset(preset);
cr.setLineLength(24);
assertSame( preset, cr.getPresetComponent() );
}
@Test
public void changeMaterialClearsPreset() {
Parachute cr = new Parachute();
cr.loadPreset(preset);
cr.setMaterial( new Material.Surface("new", 1.0, true));
assertNull( cr.getPresetComponent() );
}
@Test
public void changeLineMaterialLeavesPreset() {
Parachute cr = new Parachute();
cr.loadPreset(preset);
cr.setLineMaterial( new Material.Line("new", 1.0, true));
assertSame( preset, cr.getPresetComponent() );
}
}

View File

@ -0,0 +1,94 @@
package net.sf.openrocket.preset;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.motor.Manufacturer;
import net.sf.openrocket.rocketcomponent.Streamer;
import net.sf.openrocket.util.BaseTestCase.BaseTestCase;
import org.junit.Before;
import org.junit.Test;
/**
* Test application of ComponentPresets to Streamer RocketComponents through
* the Streamer.loadFromPreset mechanism.
*
* Test Streamer is well defined.
*
* Test calling setters on Streamer will clear the ComponentPreset.
*
*/
public class StreamerComponentTests extends BaseTestCase {
ComponentPreset preset;
@Before
public void createPreset() throws Exception {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.STREAMER);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
presetspec.put( ComponentPreset.LENGTH, 20.0);
presetspec.put( ComponentPreset.WIDTH, 2.0);
Material m = new Material.Surface("testMaterial", 2.0, true);
presetspec.put( ComponentPreset.MATERIAL, m);
preset = ComponentPresetFactory.create(presetspec);
}
@Test
public void testComponentType() {
Streamer cr = new Streamer();
assertSame( ComponentPreset.Type.STREAMER, cr.getPresetType() );
}
@Test
public void testLoadFromPresetIsSane() {
Streamer cr = new Streamer();
cr.loadPreset(preset);
assertEquals( 20.0, cr.getStripLength(), 0.0 );
assertEquals( 2.0, cr.getStripWidth(), 0.0 );
assertEquals( 2.0, cr.getLength(), 0.0 );
assertSame( preset.get( ComponentPreset.MATERIAL), cr.getMaterial() );
assertEquals( 80.0, cr.getMass(), 0.05);
}
@Test
public void changeLengthClearsPreset() {
Streamer cr = new Streamer();
cr.loadPreset(preset);
cr.setStripLength(1.0);
assertNull( cr.getPresetComponent() );
}
@Test
public void changeWidthClearsPreset() {
Streamer cr = new Streamer();
cr.loadPreset(preset);
cr.setStripWidth(1.0);
assertNull( cr.getPresetComponent() );
}
@Test
public void changeMaterialClearsPreset() {
Streamer cr = new Streamer();
cr.loadPreset(preset);
cr.setMaterial( new Material.Surface("new", 1.0, true));
assertNull( cr.getPresetComponent() );
}
}

View File

@ -0,0 +1,69 @@
package net.sf.openrocket.preset;
import static org.junit.Assert.assertTrue;
import net.sf.openrocket.motor.Manufacturer;
import org.junit.Test;
/**
* Test construction of STREAMER type ComponentPresets based on TypedPropertyMap through the
* ComponentPresetFactory.create() method.
*
* Ensure required properties are populated
*
* Ensure any computed values are correctly computed.
*
*/
public class StreamerPresetTests {
@Test
public void testManufacturerRequired() {
try {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.STREAMER);
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No Manufacturer specified"));
}
}
@Test
public void testPartNoRequired() {
try {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.STREAMER);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No PartNo specified"));
}
}
@Test
public void testLengthRequired() {
try {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.STREAMER);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No Length specified"));
}
}
@Test
public void testWidthRequired() {
try {
TypedPropertyMap presetspec = new TypedPropertyMap();
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.STREAMER);
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
presetspec.put( ComponentPreset.PARTNO, "partno");
presetspec.put( ComponentPreset.LENGTH, 2.0);
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No Width specified"));
}
}
}