1 /*******************************************************************************
\r
2 * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.g3d.csg.wizard;
\r
14 import java.util.ArrayList;
\r
15 import java.util.List;
\r
17 import org.simantics.db.ReadGraph;
\r
18 import org.simantics.db.Resource;
\r
19 import org.simantics.db.common.NamedResource;
\r
20 import org.simantics.db.exception.DatabaseException;
\r
21 import org.simantics.g3d.csg.ontology.CSG;
\r
22 import org.simantics.g3d.wizard.ModelExportWizardPage;
\r
23 import org.simantics.layer0.Layer0;
\r
25 public class CSGExportPage extends ModelExportWizardPage<CSGExportModel> {
\r
29 public CSGExportPage(CSGExportModel model) {
\r
30 super("Export CSG Model","Define Export Location",null,model);
\r
34 public String[] getFilterExtensions() {
\r
35 return new String[]{"*.brep"};
\r
39 public String[] getFilterNames() {
\r
40 return new String[]{"OpenCASCADE Brep file"};
\r
45 protected List<NamedResource> getSupportedModels(ReadGraph graph, Resource project) throws DatabaseException {
\r
46 List<NamedResource> models = new ArrayList<NamedResource>();
\r
47 Layer0 L0 = Layer0.getInstance(graph);
\r
48 CSG csg = CSG.getInstance(graph);
\r
50 for (Resource r : graph.getObjects(project, L0.ConsistsOf)) {
\r
51 if (graph.isInstanceOf(r, csg.Model)) {
\r
52 models.add(new NamedResource((String)graph.getRelatedValue(r, L0.HasName), r));
\r