In order to facilitate the user's Secondary Development, SuperMap iDesktopX provides the Extension Development instance template project SampleCode. After installing the development tool and JDK1.8 in the computer, Extension Development can be implemented with simple UI configuration in Config File.
The environment configuration steps are as follows:
2. Development engineering configuration
Detailed description of the environment configuration is as follows:
1. Software installation
Step1: Install IDEA
IDEA is recommended for development tools. It is recommended to install version 2020.2.2 or later of IDEA. Download the Community Edition from the IDEA official website , and double-click the *.exe file in the installation package to install it.
Step2: Install JDK
You need to download OpenJDK8, extract it to the specified directory, and set the Path Settings as a system variable.
- Create a new JAVA _ HOME variable and add the% JDK path%. For example, if the folder where the JDK is downloaded and decompressed is "D: \ JDK \ jdk8u302-b08", the setting is as shown in the following figure:
- Add the% JAVA _ HOME% \ bin after Path.
- Set the JDK environment of Project to 1.8. The setting method is: File-> Project Structure-> Project-> Project SDK-> Select 1.8 in the drop-down list.
2. Development engineering configuration
SuperMap iDesktopX provides two ways to configure Extension Development projects:
- Recommended method: Build Secondary Development Project directly through the Create Secondary Development Project function in the view tab. This method is efficient and convenient. It does not need to manually add desktop dependencies. You can select the development project storage path and customize project parameters. You can also Import Secondary Development Sample Code, which is convenient for users to quickly perform Extension Development.
- Create Secondary Development Project: Click View Tab-& gt Custom Group-& gt Click the Create Secondary Development Project button, and in the pop-up dialog box, set the custom project name, package name, version, author, and Description according to the prompts, and select the Extension Development template type. Fill in the storage path of the project. The template type provides CtrlAction and GPA. The CtrlAction template is used to extend the basic functions of the desktop, and the GPA template is used to extend the tools in the toolbox.
Note: Select Import Secondary Development Sample Code to import the Secondary Development Sample Code provided by the software package into the new project. The Sample Code tab is also loaded on the desktop when you start the project.
- Open the project to IDEA: After the Create Secondary Development Project succeeds, click "Open the project" in the Output Window to open it directly in IntelliJ IDEA. As shown in the following figure, SampleCode The directory is new project. If Import Secondary Development Sample Code is checked, the directory of Secondary Development Sample Template SampleCodeTemplates will also be loaded in the project.
- Compile: Click the Run or Debug button in the toolbar to automatically start SuperMap iDesktopX after compiling. After starting, the Secondary Development tab will be added to the Ribbon, which corresponds to the CtrlAction according to the type of template created. Group and GPA tool sample group; if GPA template is selected during creation, GPA tool sample directory will be added to the toolbox, including two sample tools, Delete Duplicate Points and Set Coordinate System. If "Import Secondary Development Sample Code" is checked when creating a project, the Ribbon A sample code tab will also be added, which contains some common functions such as Swing control group, desktop basic operation group, Map operation group, Scene operation group, Layout operation group and so on. At this point, the environment is configured successfully, and the user is ready to base on the SuperMap iDesktopX Perform Extension Development. Note: If SuperMap iDesktopX is not started automatically, it is recommended to update the IDEA version to 2020.2.2 or later.
- Create Secondary Development Project: Click View Tab-& gt Custom Group-& gt Click the Create Secondary Development Project button, and in the pop-up dialog box, set the custom project name, package name, version, author, and Description according to the prompts, and select the Extension Development template type. Fill in the storage path of the project. The template type provides CtrlAction and GPA. The CtrlAction template is used to extend the basic functions of the desktop, and the GPA template is used to extend the tools in the toolbox.
- Other methods: You need to manually add dependencies by opening the Extension Development sample template.
- Open Template Project: IDEA-& gt; File-& gt; Open-& gt; Select the SuperMap iDesktopX package \ templates \ SampleCode directory to open the Extension Development sample template project.
- Add Desktop Dependency: File-Project Structure-Libraries-Add- JAVA, in the pop-up Select Library Files dialog box, select the following four directories at the same time, click the OK button, and select SampleCode to add the desktop dependency to the Secondary Development plug-in.
- % iDesktopX Packages%/bin/
- % iDesktopX packages%/bundles/idesktop _ bundles/
- % iDesktopX bundles%/bundles/require _ bundles/
- % iDesktopX Packages%/lib/
- Compile: Click the Run or Debug button in the toolbar to automatically start SuperMap iDesktopX after compiling. After starting, a Secondary Development tab will be added to the Ribbon. It contains Check Result storage, Delete Duplicate Points and two Function Buttons. In this case, the environment is configured successfully, and the user can perform Extension Development based on SuperMap iDesktopX. Note: If SuperMap iDesktopX is not started automatically, it is recommended to update the IDEA version to 2020.2.2 or later.
- Open Template Project: IDEA-& gt; File-& gt; Open-& gt; Select the SuperMap iDesktopX package \ templates \ SampleCode directory to open the Extension Development sample template project.
Related content
Plug-in configuration overview