作者:
Flyingis
ArcEngine开发文档中提供了另外一个开发简例HelloGlobe,它是基于JFrame窗体的一个简单应用,从窗体设计代码中我们可以看到,ArcEngine已经以JavaBean的形式封装了一些常用的窗体控件,可以直接的应用到窗体设计的开发中,并且支持跨平台,给开发者提供了另一种选择。
引用的包:
import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import javax.swing.JFrame;
import com.esri.arcgis.beans.TOC.TOCBean;
import com.esri.arcgis.beans.globe.GlobeBean;
import com.esri.arcgis.beans.toolbar.ToolbarBean;
import com.esri.arcgis.controls.ControlsGlobeFullExtentCommand;
import com.esri.arcgis.controls.ControlsGlobeNavigateTool;
import com.esri.arcgis.controls.ControlsGlobeOpenDocCommand;
import com.esri.arcgis.system.AoInitialize;
import com.esri.arcgis.system.EngineInitializer;
import com.esri.arcgis.system.esriLicenseExtensionCode;
import com.esri.arcgis.system.esriLicenseProductCode;
关于AWT和Swing的使用可以参考相关的书籍,从引用的包中,可以看到TOC、toolbar、globe显示窗都已经封装到JavaBean中,可以直接调用,为开发者省了不少事,也帮助开发人员可以像在Visual Studio下设计UI一样来设计Java的窗体。
看看它的窗体设计代码:
//
// Create and display the frame
//
private void display() throws IOException {
setSize(500, 400);
//
// Create the globe, toolbar, and table of contents beans.
//
GlobeBean globeBean = new GlobeBean();
ToolbarBean toolbarBean = new ToolbarBean();
TOCBean tocBean = new TOCBean();
//
// Add beans to the content pane.
//
getContentPane().add(toolbarBean, BorderLayout.NORTH);
getContentPane().add(globeBean, BorderLayout.CENTER);
getContentPane().add(tocBean, BorderLayout.WEST);
//
// Add commands and tool to the toolbar.
//
toolbarBean.addItem(new ControlsGlobeOpenDocCommand(), 0, -1, false, 0, 1);
toolbarBean.addItem(new ControlsGlobeNavigateTool(), 0, -1, false, 0, 1);
toolbarBean.addItem(new ControlsGlobeFullExtentCommand(), 0, -1, false, 0, 1);
//
// Buddy up the globe with the toolbar and table of contents.
//
toolbarBean.setBuddyControl(globeBean);
tocBean.setBuddyControl(globeBean);
//
// Shutdown ArcObjects when the window closes.
//
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
try {
new AoInitialize().shutdown();
System.exit(0);
}
catch (IOException ex) {
System.out.println(ex.getMessage());
System.exit(1);
}
}
});
setVisible(true);
}
纯粹的Java窗体设计风格,简单易用。再看看main方法中的内容,和前面一篇《
AE92 SDK for Java 最小示例学习》稍有区别。
main方法:
public static void main(String args[]) {
try {
EngineInitializer.initializeVisualBeans();
AoInitialize aoInitializer = new AoInitialize();
aoInitializer.initialize(esriLicenseProductCode.esriLicenseProductCodeEngine);
aoInitializer.checkOutExtension(esriLicenseExtensionCode.esriLicenseExtensionCode3DAnalyst);
HelloGlobe thisApp = new HelloGlobe();
thisApp.setTitle("Hello, Globe!");
thisApp.display();
}
catch (IOException ex) {
System.out.println(ex.getMessage());
}
}
由于应用程序使用了窗体,因此在原始AO组建和Java Class建立关联时,需要initializeVisualBeans方法来初始化,initializeVisualBeans和initializeEngine两者选其一,使用可视化Beans选择前者,否则选择后者。这里aoInitializer对象除了指定相应的license授权,还检查相应的应用扩展。
AE92 SDK for Java 已经集成到Eclipse3.2中,通过ArcEngine模板建立一个HelloGlobe工程,看看运行显示的结果:
基于这个模板框架,可以方便我们深入扩展Globe二次开发的功能。
分享到:
相关推荐
ArcGIS_Engine_SDK_for_Java_最小示例学习
使用JAVA对AE10.4进行二次开发的小demo,功能有空间查询、距离量算、数据库连接等。包含详细源代码。运行需要安装ArcGIS套件切拥有许可。
ArcEngine for java开发demo源码(个人开发),本人使用的eclipse环境开发的AE demo。提供下载学习
ArcObjects SDK(AE)10.1安装时提示需要VS2010错误提示的方法
AE Linux 配置 ArcGIS Engine for Linux 环境配置说明
Trapcode Particular插件是最火爆的一款三维粒子插件,每位AE软件使用者都装有此插件。Trapcode Particular是视频处理必备的一款后期插件,用于制作真实的3D特效,非常强大专业。此版Trapcode Particular插件支持AE ...
最近学习Java进行AE的二次开发,自己写了一个鹰眼的小程序(用的是Eclipse),拿来与大家分享!
adobe-sdk.zip,adobe的sdk开发包adobe-sdk.zip
所谓的鹰眼,就是一个缩略地图,上面有一个矩形框,矩形框区域就是当前显示的地图区域,拖动矩形框可以改变当前地图显示的位置,改变矩形框的大小,可以改变当前地图的显示区域大小,从起到导航的作用。...
red giant for AE 3.0
Red Giant Trapcode 合集 For AE CS5!用AE的都懂~
RED GIANT TRAPCODE 3D STROKE V2.5 FOR AE CS3 RED GIANT TRAPCODE ECHOSPACE V1.01 FOR AE CS3 RED GIANT TRAPCODE LUX V1.01 FOR AE CS3 RED GIANT TRAPCODE PARTICULAR V1.5 FOR AE CS3 RED GIANT TRAPCODE ...
AE2018 For Mac破解补丁,完美好用,安装完成之后直接替换就可以了,如果有不知道怎么替换的,请留言
AE光工厂FOR mac 适合5.5 6.0
新版E3D V2.2.3插件具有多帧渲染功能,可以让AE同时渲染多帧,加速渲染!在4K显示器上使用UI时,增加了对更大缩放的支持! MFR多帧渲染性能优势:由于AE可以开始在您的所有处理器内核上渲染多个帧,因此依赖于您的...
SHA256 checksum d7ed2466ee01ffc51681088298ff9432dbd642f4928ac3b39a4ae8b5d854a35e
ae(ArcEngine) java swing开发入门系列附属代码,真的,凑够字数
trapcode for AE 全套插件(包含 form lux particular shine soundkeys starglow)+注册
这是一套videocopiot为AE定制的屏幕闪烁噪波专场的插件,此文件包中包含了插件和大量工程预制还有破解方法。