/******************************************************************************* * Copyright (c) 2012, 2013 Association for Decentralized Information Management in * Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.g3d.csg.wizard; import java.util.ArrayList; import java.util.List; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.NamedResource; import org.simantics.db.exception.DatabaseException; import org.simantics.g3d.csg.ontology.CSG; import org.simantics.g3d.wizard.ModelExportWizardPage; import org.simantics.layer0.Layer0; public class CSGExportPage extends ModelExportWizardPage { public CSGExportPage(CSGExportModel model) { super("Export CSG Model","Define Export Location",null,model); } @Override public String[] getFilterExtensions() { return new String[]{"*.brep"}; } @Override public String[] getFilterNames() { return new String[]{"OpenCASCADE Brep file"}; } @Override protected List getSupportedModels(ReadGraph graph, Resource project) throws DatabaseException { List models = new ArrayList(); Layer0 L0 = Layer0.getInstance(graph); CSG csg = CSG.getInstance(graph); for (Resource r : graph.getObjects(project, L0.ConsistsOf)) { if (graph.isInstanceOf(r, csg.Model)) { models.add(new NamedResource((String)graph.getRelatedValue(r, L0.HasName), r)); } } return models; } }