# GeoSpaceX **Repository Path**: zhenwenhe/geospacex ## Basic Information - **Project Name**: GeoSpaceX - **Description**: No description available - **Primary Language**: Java - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 11 - **Created**: 2023-11-03 - **Last Updated**: 2025-12-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # GeoSpaceX #### 介绍 #### 软件架构 软件架构说明 #### 编译教程 1. 安装JDK11, Maven, openInventor10.12.x 2. 下载源代码 3. cd ~\geospacex\plugins\render4oi\src\main\resources\lib 4. .\openinventor-maven-install.sh 5. mvn clean install -DskipTests 6. 首次编译,将settings.xml放置到目录下,如:C:\Users\user\.m2 #### 插件教程 1. 在geospacex-plugins下,新建一个空模块hello-plugin,父项为geospacex-plugins。 2) 在hello-plugin工程中,修改pom.xml文件,修改后内容见hello-plugin工程的pom.xml文件。 在 ...中添加如下内容: 11 11UTF-8hello-plugincn.edu.cug.cs.gtl.plugins.hello.HTSFilePlugin1.0-SNAPSHOTZhenwen He...中添加如下内容: ​ cn.edu.cug.cs.gtlapi1.0-SNAPSHOTprovidedcn.edu.cug.cs.gtlbase1.0-SNAPSHOTprovidedcn.edu.cug.cs.gtlwrapper1.0-SNAPSHOTprovidedcn.edu.cug.cs.gtlcga1.0-SNAPSHOTprovidedcn.edu.cug.cs.gtlui-api1.0-SNAPSHOT...中添加如下内容: ​ maven-assembly-plugin2.3 ​ src/main/resources/assembly.xml ​ falsemake-assemblypackageattachedorg.apache.maven.pluginsmaven-jar-plugin2.4${plugin.id}${plugin.class}${plugin.version}${plugin.provider}${plugin.dependencies}org.apache.maven.pluginsmaven-compiler-plugin11 ​ 11 在hello-plugin工程resources中,新建assembly.xml文件,添加如下内容: plugin zip false falseruntimelib*:jar:*org.slf4j:*cn.edu.cug.cs.gtl:* target/classesclassessrc/main/resourcesplugin.properties 3) 在hello-plugin工程resources中,新建plugin.properties,添加如下内容见: plugin.id=hello-plugin plugin.class=cn.edu.cug.cs.gtl.plugins.hello.HTSFilePlugin plugin.version=1.0-SNAPSHOT plugin.provider=Zhenwen He plugin.dependencies= 4) 在hello-plugin工程resources中,新建资源包hello-resource。在这个里面实现UI的国际化处理,一般要求提供中文和英文两种语言的资源包。 在hello-resource中新建资源包hello-resource,会生成两个文件:hello-resource_zh_CN.properties和hello-resource.properties。 建议采用Resource Bundle Editor编辑资源包,这样可以方便的添加新的资源。在Help菜单中添加一个菜单项,名称为hello,这个菜单项的名称在资源包中定义。 在hello-resource_zh_CN.properties中添加如下内容: menu.help.hello=哈喽... 在hello-resource.properties中添加如下内容: menu.help.hello=Hello... 5) 在geospacex-apis -> ui-api工程中cn.edu.cug.cs.gtl.apis.ui.actions中定义接口HelloActions public interface HelloActions extends Actions{ } 6) 在hello-plugin工程cn.edu.cug.cs.gtl.plugins.hello.actions包中,新建HelloMessageAction类,从AbstractAction继承。 实现initialize方法,在这个方法里面生成相关UI: @Override public void initialize(AbstractApplication theApp) { ResourceBundle resourceBundle = ResourceBundle.getBundle("hello-resource", Locale.getDefault()); name=resourceBundle.getString("menu.help.hello"); menuItem.setText(name); this.theApp = theApp; menuItem.addActionListener(this); theApp.getMainFrame().getHelpMenu().add(menuItem); } 实现actionPerformed方法,在这个方法里面添加功能: @Override public void actionPerformed(ActionEvent e) { JDialog dialog = new JDialog(theApp.getMainFrame(), "Hello", true); dialog.setSize(200, 100); dialog.setLocationRelativeTo(theApp.getMainFrame()); dialog.setVisible(true); } 7) 在hello-plugin工程cn.edu.cug.cs.gtl.plugins.hello包中,新建HelloPlugin类,该类从Plugin类继承。 public class HelloPlugin extends Plugin { } 8) 在hello-plugin工程cn.edu.cug.cs.gtl.plugins.hello.HelloPlugin类中,新建HelloActionsImpl类,该类从AbstractActions继承,并实现HelloActions接口继承。需要添加@Extension注解。并实现initialize方法,在这个方法添加功能类到插件中。 @Extension public class HelloActionsImpl extends AbstractActions implements HelloActions { public HelloActionsImpl() { super(); } @Override public void initialize(AbstractApplication theApp) { HelloMessageAction helloMessageAction = new HelloMessageAction(); helloMessageAction.initialize(theApp); addAction(helloMessageAction);//将功能类添加到插件中 } } 9) 将插件加载到主程序中。geospace-apps下的geospacex-app的MainApp类的main函数末尾添加如下代码: manager.loadPlugin(new File("D:/gitee/geospacex/plugins/hello-plugin/target/hello-plugin-1.0-SNAPSHOT.zip").toPath()); manager.startPlugin("hello-plugin"); List helloActions = manager.getExtensions(HelloActions.class); for(HelloActions h : helloActions){ h.initialize(theApp); } 上述代码实现了将插件加载到主程序中。 10) mvn clean install -DskipTests ,然后执行程序或调试程序,插件会加载到主程序中。Help菜单中会出现hello菜单项,点击hello菜单项,会弹出一个对话框,显示Hello。 #### 安装教程 1. 设置环境变量GEOSPACEX_HOME指向GEOSPACEX的安装目录 其下默认的目录结构是: plugins bin lib data 2. 设置环境变量GEOSPACEX_PLUGINGS指向插件存放的目录 如果这个环境变量不存在,则默认的位置是%GEOSPACEX_HOME%\plugins 3. 设置环境变量GEOSPACEX_DATA指向数据存放的目录 如果这个环境变量不存在,则默认的位置是%GEOSPACEX_HOME%\data #### 使用说明 1. xxxx 2. xxxx 3. xxxx #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)