]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.g3d.csg/src/org/simantics/g3d/csg/scenegraph2/SchemaBuilder.java
Some api and build changes
[simantics/3d.git] / org.simantics.g3d.csg / src / org / simantics / g3d / csg / scenegraph2 / SchemaBuilder.java
index b44a7693c97e89f3a4072ea0ec373fc5273c19ca..0534a314d913c99b049d92dd8b048bfee447d2e4 100644 (file)
@@ -1,59 +1,59 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.g3d.csg.scenegraph2;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.request.Read;\r
-import org.simantics.objmap.graph.schema.IMappingSchema;\r
-import org.simantics.objmap.graph.schema.MappingSchemas;\r
-import org.simantics.objmap.graph.schema.SimpleSchema;\r
-import org.simantics.Simantics;\r
-\r
-public class SchemaBuilder {\r
-       \r
-       public static IMappingSchema<Resource,Object> getSchema() throws DatabaseException{\r
-               return Simantics.getSession().syncRequest(new Read<IMappingSchema<Resource,Object>>() {\r
-                       @Override\r
-                       public IMappingSchema<Resource,Object> perform(ReadGraph g)\r
-                                       throws DatabaseException {\r
-                               return getSchema(g);\r
-                       }\r
-               });\r
-       }\r
-       \r
-       public static IMappingSchema<Resource,Object> getSchema(ReadGraph g) throws DatabaseException{\r
-               try {\r
-                       SimpleSchema schema = new SimpleSchema();\r
-                       schema.addLinkType(MappingSchemas.fromAnnotations(g, BarrelNode.class));\r
-                       schema.addLinkType(MappingSchemas.fromAnnotations(g, BoxNode.class));\r
-                       schema.addLinkType(MappingSchemas.fromAnnotations(g, ConeNode.class));\r
-                       schema.addLinkType(MappingSchemas.fromAnnotations(g, CylinderNode.class));\r
-                       schema.addLinkType(MappingSchemas.fromAnnotations(g, DifferenceNode.class));\r
-                       schema.addLinkType(MappingSchemas.fromAnnotations(g, EllipticCylinderNode.class));\r
-                       schema.addLinkType(MappingSchemas.fromAnnotations(g, IntersectionNode.class));\r
-                       schema.addLinkType(MappingSchemas.fromAnnotations(g, RectangularSolidNode.class));\r
-                       schema.addLinkType(MappingSchemas.fromAnnotations(g, RegularPrismNode.class));\r
-                       schema.addLinkType(MappingSchemas.fromAnnotations(g, SphereNode.class));\r
-                       schema.addLinkType(MappingSchemas.fromAnnotations(g, TorusNode.class));\r
-                       schema.addLinkType(MappingSchemas.fromAnnotations(g, UnionNode.class));\r
-                       schema.addLinkType(MappingSchemas.fromAnnotations(g, CSGrootNode.class));\r
-                       return schema;\r
-               } catch (IllegalAccessException e) {\r
-                       throw new DatabaseException(e);\r
-               } catch (InstantiationException e) {\r
-                       throw new DatabaseException(e);\r
-               }\r
-       }\r
-\r
-}\r
+/*******************************************************************************
+ * 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.scenegraph2;
+
+import org.simantics.Simantics;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.request.Read;
+import org.simantics.objmap.graph.schema.IMappingSchema;
+import org.simantics.objmap.graph.schema.MappingSchemas;
+import org.simantics.objmap.graph.schema.SimpleSchema;
+
+public class SchemaBuilder {
+       
+       public static IMappingSchema<Resource,Object> getSchema() throws DatabaseException{
+               return Simantics.getSession().syncRequest(new Read<IMappingSchema<Resource,Object>>() {
+                       @Override
+                       public IMappingSchema<Resource,Object> perform(ReadGraph g)
+                                       throws DatabaseException {
+                               return getSchema(g);
+                       }
+               });
+       }
+       
+       public static IMappingSchema<Resource,Object> getSchema(ReadGraph g) throws DatabaseException{
+               try {
+                       SimpleSchema schema = new SimpleSchema();
+                       schema.addLinkType(MappingSchemas.fromAnnotations(g, BarrelNode.class));
+                       schema.addLinkType(MappingSchemas.fromAnnotations(g, BoxNode.class));
+                       schema.addLinkType(MappingSchemas.fromAnnotations(g, ConeNode.class));
+                       schema.addLinkType(MappingSchemas.fromAnnotations(g, CylinderNode.class));
+                       schema.addLinkType(MappingSchemas.fromAnnotations(g, DifferenceNode.class));
+                       schema.addLinkType(MappingSchemas.fromAnnotations(g, EllipticCylinderNode.class));
+                       schema.addLinkType(MappingSchemas.fromAnnotations(g, IntersectionNode.class));
+                       schema.addLinkType(MappingSchemas.fromAnnotations(g, RectangularSolidNode.class));
+                       schema.addLinkType(MappingSchemas.fromAnnotations(g, RegularPrismNode.class));
+                       schema.addLinkType(MappingSchemas.fromAnnotations(g, SphereNode.class));
+                       schema.addLinkType(MappingSchemas.fromAnnotations(g, TorusNode.class));
+                       schema.addLinkType(MappingSchemas.fromAnnotations(g, UnionNode.class));
+                       schema.addLinkType(MappingSchemas.fromAnnotations(g, CSGrootNode.class));
+                       return schema;
+               } catch (IllegalAccessException e) {
+                       throw new DatabaseException(e);
+               } catch (InstantiationException e) {
+                       throw new DatabaseException(e);
+               }
+       }
+
+}