2 * AttachedPartsHandler.java
4 package net.sf.openrocket.file.rocksim.importt;
6 import net.sf.openrocket.aerodynamics.WarningSet;
7 import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
8 import net.sf.openrocket.file.simplesax.ElementHandler;
9 import net.sf.openrocket.rocketcomponent.RocketComponent;
11 import java.util.HashMap;
14 * A SAX handler for the Rocksim AttachedParts XML type.
16 class AttachedPartsHandler extends ElementHandler {
17 /** The parent component. */
18 private final RocketComponent component;
25 * @throws IllegalArgumentException thrown if <code>c</code> is null
27 public AttachedPartsHandler(RocketComponent c) throws IllegalArgumentException {
29 throw new IllegalArgumentException("The parent component of any attached part may not be null.");
35 public ElementHandler openElement(String element, HashMap<String, String> attributes, WarningSet warnings) {
36 if (RocksimCommonConstants.FIN_SET.equals(element)) {
37 return new FinSetHandler(component);
39 if (RocksimCommonConstants.CUSTOM_FIN_SET.equals(element)) {
40 return new FinSetHandler(component);
42 if (RocksimCommonConstants.LAUNCH_LUG.equals(element)) {
43 return new LaunchLugHandler(component, warnings);
45 if (RocksimCommonConstants.PARACHUTE.equals(element)) {
46 return new ParachuteHandler(component, warnings);
48 if (RocksimCommonConstants.STREAMER.equals(element)) {
49 return new StreamerHandler(component, warnings);
51 if (RocksimCommonConstants.MASS_OBJECT.equals(element)) {
52 return new MassObjectHandler(component, warnings);
54 if (RocksimCommonConstants.RING.equals(element)) {
55 return new RingHandler(component, warnings);
57 if (RocksimCommonConstants.BODY_TUBE.equals(element)) {
58 return new InnerBodyTubeHandler(component, warnings);
60 if (RocksimCommonConstants.TRANSITION.equals(element)) {
61 return new TransitionHandler(component, warnings);
63 if (RocksimCommonConstants.TUBE_FIN_SET.equals(element)) {
64 warnings.add("Tube fins are not currently supported. Ignoring.");
66 if (RocksimCommonConstants.RING_TAIL.equals(element)) {
67 warnings.add("Ring tails are not currently supported. Ignoring.");
69 if (RocksimCommonConstants.EXTERNAL_POD.equals(element)) {
70 warnings.add("Pods are not currently supported. Ignoring.");