Shared Samples

Build, modify and run workflows on geospatial data using Spatial Modeler SDK. Build complex algorithms or run routine tasks, and build add-ons to ERDAS IMAGINE and GeoMedia.
Showing results for 
Search instead for 
Do you mean 

Third Party Integration

by Technical Evangelist ‎09-30-2019 06:09 AM - edited ‎09-30-2019 06:10 AM (47 Views)

Abstract

The third party integration sample shows how to communicate with the client using external tools. 

Bitbucket Link

https://bitbucket.org/HGDN/hgdn_mae/src/master/Desktop/ThirdPartyIntegration/

Description

JavascriptInterface

Whenever an extension to the default javascript interface is needed, a new object must be created extending the AbstractScriptingObject or implementing the IScriptingObject interface.

In this sample there is a simple method getHalloWorldString() that might be called using javascript using window.MyJavascriptInterface.getHalloWorldString(): 

public class JavascriptInterface extends AbstractScriptingObject {

  ...

  /**
   * This method can be called by window.MyJavascriptInterface.getHalloWorldString() in your
   * Javascript
   * 
   * @return
   */
  public String getHalloWorldString() {
    return "Hallo World String!";
  }

}

 

RestPlugin

This plugin demonstrates how to control the MAE client via a simple RESTful API. It starts HTTP server at port 7001 and registers three simple methods that can be called with a HTTP client e.g. a browser:

  • showConfirmDialogAsynchron: shows a confirmation dialog with the given message and immediately returns without waiting for user response.
  • showConfirmDialogSynchron: shows a confirmation dialog with the given message and waits for user response before finishing the request.
  • startConstructionAid: starts the given construction aid action. Allowed values for the action parameter are: ACM_POINT, ACM_DISTANCE, ACM_LENGTHENING, ACM_CURVE, ACM_CURVEWITHRELATION, ACM_DELETE_SINGLE, ACM_DELETE_ALL, ACM_SEGMENT_BUFFER, ACM_AREA_BUFFER, ACM_SEGMENT_RELATION.

WebSocketsPlugin

The plugin demonstrates how to control the MAE client via a websockets connection. It opens a web page in the browser which shows the current mouse position of the map in the top and below a copy of the legend. If you move the mouse over the map the position is shown in the browser. If you show or hide a layer in the MAE client then the legend entry in browser also shows the state of the layer (grey font means hidden, black font means visible). If you click on a layer in the browser legend then its visibility state changes also in the MAE client.

 

To test the javascript, rest and websockets interfaces, please have a look at the ThirdPartyIntergrationTest project: https://bitbucket.org/HGDN/hgdn_mae/src/master/Desktop/ThirdPartyIntegrationTest/  To properly run the ThirdPartyIntergrationTest project you first have to build and publish to maven local the ThirdPartyIntergration project. The screenshot below shows the Gradle task configuration to run in the Eclipse IDE:

Gradle task configuration

Overview
Contributors