* Enables the user to select vehicle types for the current traffic layer
*
*/
protected void SelectRandomTrafficLayerVehicleTypes() {
if (currentTrafficLayer instanceof RandomTrafficDefinitionLayer) {
RandomTrafficDefinitionLayer rdl = (RandomTrafficDefinitionLayer) currentTrafficLayer;
// Create a type selection that contains all the vehicle types of
// the
// project, each with a 0 probability
TypeSelection<VehicleType> projectVehicleTypes = new TypeSelection<VehicleType>(Project.getCurrentlyLoadedProject().getVehicleTypes());
// Get a copy of the layer's vehicle types (so that if the user
// cancels,
// the changes won't be permanent)
TypeSelection<VehicleType> layerVehicleTypes = new TypeSelection<VehicleType>(rdl.getVehicleSelection());
// Show the vehicle selection dialog
layerVehicleTypes.addTypesNotInSelection(projectVehicleTypes);
DlgSelectTypes<VehicleType> dlg = new DlgSelectTypes<VehicleType>(layerVehicleTypes);
dlg.setVisible(true);
if (dlg.getAnswer() == JOptionPane.OK_OPTION) {
// Remove any types that have 0 probability
layerVehicleTypes.removeTypesWithZeroPercentage();
// Set the selected types to the layer
rdl.setVehicleSelection(layerVehicleTypes);
}
}
}