Added method to list all the decals currently used by the components in the document.

This commit is contained in:
Kevin Ruland 2012-07-25 14:42:45 +00:00 committed by U-WINDOWS-C28163E\Administrator
parent 82679233f9
commit bdca67fb7a

View File

@ -2,12 +2,14 @@ package net.sf.openrocket.document;
import java.io.File;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import net.sf.openrocket.appearance.Appearance;
import net.sf.openrocket.appearance.Decal;
import net.sf.openrocket.document.events.DocumentChangeEvent;
import net.sf.openrocket.document.events.DocumentChangeListener;
import net.sf.openrocket.document.events.SimulationChangeEvent;
@ -17,9 +19,9 @@ import net.sf.openrocket.rocketcomponent.ComponentChangeEvent;
import net.sf.openrocket.rocketcomponent.ComponentChangeListener;
import net.sf.openrocket.rocketcomponent.Configuration;
import net.sf.openrocket.rocketcomponent.Rocket;
import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.simulation.FlightDataType;
import net.sf.openrocket.simulation.customexpression.CustomExpression;
import net.sf.openrocket.simulation.exception.SimulationListenerException;
import net.sf.openrocket.simulation.listeners.SimulationListener;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.util.ArrayList;
@ -184,6 +186,28 @@ public class OpenRocketDocument implements ComponentChangeListener {
this.decalRegistry = decalRegistry;
}
public Set<String> getDecalList( ) {
Set<String> decals = new TreeSet<String>();
// Look for all decals used in the rocket.
for( RocketComponent c : this.getRocket() ) {
if ( c.getAppearance() == null ) {
continue;
}
Appearance ap = c.getAppearance();
if ( ap.getTexture() == null ) {
continue;
}
Decal decal = ap.getTexture();
String decalName = decal.getImage();
decals.add(decalName);
}
return decals;
}
public File getFile() {
return file;
}