import java.io.File;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.TreeMap;

import javax.swing.tree.DefaultMutableTreeNode;

import ifc2x3javatoolbox.demo.IfcSpatialStructure;
import ifc2x3javatoolbox.ifc2x3tc1.IfcBuildingStorey;
import ifc2x3javatoolbox.ifc2x3tc1.IfcWall;
import ifc2x3javatoolbox.ifcmodel.IfcModel;

public class Test {
public static void main(String[] args) throws Exception{
IfcModel ifcModel = new IfcModel();
//File file = new File("C:\\Users\\new\\Desktop\\项目1.ifc");
File file  = new File("C:\\Users\\new\\Desktop\\项目2016-0002.ifc");
ifcModel.readStepFile(file);

DefaultMutableTreeNode rootTreeNode = new DefaultMutableTreeNode("no model loaded");

Enumeration<?> enumeration;
enumeration=rootTreeNode.depthFirstEnumeration();//以深度遍历节点
//enumeration=rootTreeNode.preorderEnumeration();//按前序遍历根节点
//enumeration=rootTreeNode.breadthFirstEnumeration();//以广度遍历节点
//enumeration=rootTreeNode.postorderEnumeration();//按后序遍历节点
//enumeration=rootTreeNode.children();//遍历该节点的所有子节点.

//知道了遍历方式,开始遍历.
  while(enumeration.hasMoreElements()){ 
  //遍历枚举对象.
  //先定义一个节点变量.
  DefaultMutableTreeNode node;
  node=(DefaultMutableTreeNode) enumeration.nextElement();//将节点名称给node.
  //根据级别输出占位符.
  for(int l=0;l<node.getLevel();l++){
  System.out.print("---");
  }
  //System.out.println(node.getUserObject()+"       "+node.getUserObject().getClass().getName()+"    "+node.getUserObject().getClass().getSimpleName());//输入节点标签.
  System.out.println(node.getUserObject());
}

}

}

使用java开源包解析ifc并获取数据(树形结构)的更多相关文章

  1. java jar包解析:打包文件,引入文件

    java jar包解析:打包文件,引入文件 cmd下: jar命令:package包打包 javac命令:普通类文件打包 Hello.java: package org.lxh.demo; publi ...

  2. (笔记)Mysql命令desc:获取数据表结构

    desc命令用于获取数据表结构. desc命令格式:    desc 表名;同样    show columns from 表名;也能获取数据表结构. 举例如下:mysql> desc MyCl ...

  3. 在java项目中怎样利用Dom4j解析XML文件获取数据

    在曾经的学习.net时常常会遇到利用配置文件来解决项目中一些须要常常变换的数据.比方数据库的连接字符串儿等.这个时候在读取配置文件的时候.我们一般会用到一个雷configuration,通过这个类来进 ...

  4. java 根据包名、目录名获取所有定义的类

    /** * Scans all classes accessible from the context class loader which belong to the given package a ...

  5. Json--Android中数据文件解析(Json解析--从服务器端获取数据并且解析,显示在客户端上面)

    前面学习过了使用SAX解析XML数据(点击进入:SAX解析XML数据),今天学习Json解析: 首先说一下Json数据的最基本的特点,Json数据是一系列的键值对的集合,和XML数据来比,Json数据 ...

  6. java工作流系统表单自动 获取数据

    关键词:工作流快速开发平台  工作流流设计  业务流程管理   asp.net 开源工作流  bpm工作流系统  java工作流主流框架  自定义工作流引擎 表单设计器  流程设计器 什么是数据自动获 ...

  7. java之初识服务器跨域获取数据

    当一个项目膨大到无法进行整理时,而作为新负责维护的团队是非常苦恼的.对于想实现两个系统的数据访问,使用Ajax数据请求方式获取jsonp格式的数据 需要有前端jquery库文件. 前端代码通过jque ...

  8. java下载excel,excel从数据库获取数据

    <!-- poi --> <dependency> <groupId>org.apache.poi</groupId> <artifactId&g ...

  9. java中JSON串转换并获取数据

    String strAllImp= " [{"id":2,"name":"还不错","count":3}]&q ...

随机推荐

  1. OpenStack H版与 Ceph 整合的现状

    转自:https://www.ustack.com/blog/openstack_and_ceph/ Contents 1 Ceph与Nova整合 2 Ceph与Cinder整合 3 相关Patch ...

  2. vue中的懒加载和按需加载

    懒加载 (1)定义:懒加载也叫延迟加载,即在需要的时候进行加载,随用随载. (2)异步加载的三种表示方法: 1. resolve => require([URL], resolve),支持性好 ...

  3. js抛物线

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  4. mysql_异常_01_Access denied for user 'root'@'192.168.1.13' (using password: YES)

    一.异常现象 使用navicat premuim 连接 虚拟机mysql数据库时 ,抛出如下错误: Access denied for user 'root'@'192.168.1.13' (usin ...

  5. Struts2(1)

    一.struts概述 1.struts2框架应用在javaee三层结构中web层框架 2.struts2框架在struts1和webwork基础之上发展全新的框架 二.struts2环境搭建 1.导包 ...

  6. 2018.7.9 AVR-BAT program

    I had some problems programming the produced . Here is what worked well for me: -------------------- ...

  7. uva11991(二分查找或map的应用)

    11991 - Easy Problem from Rujia Liu? Time limit: 1.000 seconds Easy Problem from Rujia Liu? Though R ...

  8. Python 3.5 socket OSError: [Errno 101] Network is unreachable

    /******************************************************************************** * Python 3.5 socke ...

  9. 在Windows 7上安装ACE 6.1.0

    主机环境    操作系统:Windows 7 专业版准备ACE    用浏览器打开http://download.dre.vanderbilt.edu/,下载ACE-6.1.0和ACE-html-6. ...

  10. 【LeetCode】002 Add Two Numbers

    题目: You are given two non-empty linked lists representing two non-negative integers. The digits are ...