Exemplo n.º 1
0
 /*
  * This will list all projects, select the first project with at least one
  * revision and dump the names of all walls within the last revision of that
  * project
  */
 @Test
 public void testDump() {
   try {
     ServiceMap serviceMap = bimServer.getServiceFactory().get(AccessMethod.INTERNAL);
     ServiceInterface service = serviceMap.get(ServiceInterface.class);
     String token = serviceMap.get(AuthInterface.class).login(username, password);
     service =
         bimServer
             .getServiceFactory()
             .get(token, AccessMethod.INTERNAL)
             .get(ServiceInterface.class);
     BimDatabase database = bimServer.getDatabase();
     DatabaseSession session = database.createSession();
     SProject firstProjectWithRevisions = null;
     for (SProject project : serviceMap.getServiceInterface().getAllProjects(false, true)) {
       System.out.println(project.getName());
       if (!project.getRevisions().isEmpty() && firstProjectWithRevisions == null) {
         firstProjectWithRevisions = project;
       }
     }
     if (firstProjectWithRevisions != null) {
       long roid = firstProjectWithRevisions.getLastRevisionId();
       DownloadDatabaseAction downloadDatabaseAction =
           new DownloadDatabaseAction(
               bimServer,
               session,
               AccessMethod.INTERNAL,
               roid,
               -1,
               -1,
               ((ServiceImpl) service).getAuthorization(),
               null);
       IfcModelInterface ifcModelInterface = downloadDatabaseAction.execute();
       for (IfcWall ifcWall : ifcModelInterface.getAllWithSubTypes(IfcWall.class)) {
         System.out.println(ifcWall.getName());
       }
     }
   } catch (ServiceException e) {
     e.printStackTrace();
   } catch (BimserverDatabaseException e) {
     e.printStackTrace();
   } catch (PublicInterfaceNotFoundException e) {
     e.printStackTrace();
   }
 }
Exemplo n.º 2
0
 private void processBoundary(
     Building building, Room room, IfcProduct ifcElement, IfcInternalOrExternalEnum boundayType)
     throws SerializerException {
   if (ifcElement instanceof IfcWall) {
     IfcWall ifcWall = (IfcWall) ifcElement;
     if (!convertedObjects.containsKey(ifcWall)) {
       AbstractBoundarySurface boundarySurface = null;
       if (boundayType == null || boundayType == IfcInternalOrExternalEnum.INTERNAL) {
         boundarySurface = new InteriorWallSurface();
       } else {
         boundarySurface = new WallSurface();
       }
       setName(boundarySurface.getName(), ifcWall.getName());
       setGlobalId(boundarySurface, ifcWall);
       convertedObjects.put(ifcWall, boundarySurface);
       BoundarySurfaceProperty boundarySurfaceProperty = new BoundarySurfaceProperty();
       boundarySurfaceProperty.setObject(boundarySurface);
       MultiSurface wallMs = new MultiSurface();
       MultiSurfaceProperty wallMSP = new MultiSurfaceProperty();
       wallMSP.setMultiSurface(wallMs);
       boundarySurface.setLod4MultiSurface(wallMSP);
       setGeometry(wallMs, ifcWall);
       building.addBoundedBySurface(boundarySurfaceProperty);
       for (IfcRelVoidsElement ifcRelVoidsElement : ifcWall.getHasOpenings()) {
         IfcOpeningElement ifcOpeningElement =
             (IfcOpeningElement) ifcRelVoidsElement.getRelatedOpeningElement();
         for (IfcRelFillsElement filling : ifcOpeningElement.getHasFillings()) {
           IfcElement ifcRelatedBuildingElement = filling.getRelatedBuildingElement();
           if (ifcRelatedBuildingElement instanceof IfcWindow) {
             if (!convertedObjects.containsKey(ifcRelatedBuildingElement)) {
               Window window = createWindow((IfcWindow) ifcRelatedBuildingElement);
               OpeningProperty openingProperty = new OpeningProperty();
               openingProperty.setObject(window);
               boundarySurface.addOpening(openingProperty);
               convertedObjects.put(ifcRelatedBuildingElement, window);
             }
           } else if (ifcRelatedBuildingElement instanceof IfcDoor) {
             if (!convertedObjects.containsKey(ifcRelatedBuildingElement)) {
               Door door = createDoor(ifcRelatedBuildingElement);
               OpeningProperty openingProperty = new OpeningProperty();
               openingProperty.setObject(door);
               boundarySurface.addOpening(openingProperty);
               convertedObjects.put(ifcRelatedBuildingElement, door);
             }
           }
         }
       }
     }
   } else if (ifcElement instanceof IfcSlab) {
     convertSlab(building, room, (IfcSlab) ifcElement);
   } else if (ifcElement instanceof IfcRoof) {
     if (!convertedObjects.containsKey(ifcElement)) {
       RoofSurface roofSurface = createRoof(building, ifcElement);
       convertedObjects.put(ifcElement, roofSurface);
     }
   } else if (ifcElement instanceof IfcOpeningElement) {
     List<Element> processProduct = processProduct(ifcElement);
     if (processProduct != null) {
       for (Element element : processProduct) {
         room.addGenericADEComponent(new ADEComponent(element));
       }
     }
   } else if (ifcElement instanceof IfcColumn) {
     // List<Element> processProduct = processProduct(ifcElement);
     // if (processProduct != null) {
     // room.addGenericApplicationPropertyOfRoom(processProduct);
     // }
   } else if (ifcElement == null
       || ifcElement instanceof IfcWindow
       || ifcElement instanceof IfcDoor
       || ifcElement instanceof IfcVirtualElement) {
     // ignore
   } else if (ifcElement instanceof IfcFurnishingElement) {
     // BuildingFurniture buildingFurniture =
     // citygml.createBuildingFurniture();
     // GeometryProperty createGeometryProperty =
     // gml.createGeometryProperty();
     // MultiSurface createMultiSurface = gml.createMultiSurface();
     // setGeometry(createMultiSurface, ifcElement);
     // createGeometryProperty.setGeometry(createMultiSurface);
     // buildingFurniture.setLod4Geometry(createGeometryProperty);
     // InteriorFurnitureProperty ifp =
     // citygml.createInteriorFurnitureProperty();
     // ifp.setObject(buildingFurniture);
     // setName(buildingFurniture.getName(), ifcElement.getName());
     // setGlobalId(buildingFurniture, ifcElement);
     // room.addInteriorFurniture(ifp);
     // convertedObjects.put(ifcElement, buildingFurniture);
   } else if (ifcElement instanceof IfcFlowTerminal) {
     // FlowTerminal flowTerminal = new FlowTerminal();
     // setName(flowTerminal.getName(), ifcElement.getName());
     // MultiSurfaceProperty createGeometryProperty =
     // gml.createMultiSurfaceProperty();
     // MultiSurface createMultiSurface = gml.createMultiSurface();
     // setGeometry(createMultiSurface, ifcElement);
     // createGeometryProperty.setMultiSurface(createMultiSurface);
     // flowTerminal.setLod4MultiSurface(createGeometryProperty);
     // room.getGenericApplicationPropertyOfRoom().add(flowTerminal);
     // setName(flowTerminal.getName(), ifcElement.getName());
     // setGlobalId(flowTerminal, ifcElement);
     // flowTerminal.setGlobalId(ifcElement.getGlobalId());
     // convertedObjects.put(ifcElement, flowTerminal);
   }
 }