Shared Samples

GeoMedia Smart Client Workflow Manager provides tools for building and delivering highly-constrained, map-based workflows for the office or the field.
Showing results for 
Search instead for 
Do you mean 

Coordinate Transformation

by Community Manager on ‎01-19-2016 02:09 AM - edited on ‎10-09-2019 04:05 AM by Technical Evangelist (957 Views)


The coordinate transformation sample is intended to make beginners familiar with GMSC Client programming. A simple plugin is created to show the WGS84 representation of a captured point in a simple dialog. 


Bitbucket Link



The CoordinateTransformationPlugin extends the AbstractPlugin and offers an action to start the geometry capture process: 

@Plugin(alias = "CoordinateTransformation", vendor = "MyCompany")
public class CoordinateTransformationPlugin extends AbstractPlugin 
{ @Action(actionLocation = ActionLocation.PLUGINTAB) public void startWSG84Converter()
{ ...

Whenever an extension is needed that should capture a geometry without actually manipulating an item of an existing layer, a GeometryCapture instance is needed: 

GeometryCapture geometryCapture = GeometryCaptureFactory.getCaptureInstance(GeometryCaptureType.Point,	ApplicationContext.getBrowser().getMap(), new IGeometryCaptureListener() {
   public void addCapturePrimitive(GeometryCapture source, GPrimitive... newPrimitives) {
	TransformationResultDialog dialog = new TransformationResultDialog(newPrimitives[0].getBounds().getCenter());

In this case, the only event we are interested in is the AddCapturePrimitive event. So whenever a user captures a point, a new TransformationResultDialog is shown, displaying the coordinates of the captured point in WGS84 representation.  


The TransformationResultDialog itself is a simple dialog that extends the DefaultDialog containing a JPanel to show the point coordinates in the project coordinate system and the WGS84 representation.  

public class TransformationResultDialog extends DefaultDialog 
    protected JComponent getDisplayView() 
	JPanel panel = new JPanel(new MigLayout("ins 0", "[grow]", "[][grow]"));
	panel.add(new JLabel("hor: " + coordinateToTransform.getX()), "grow, wrap");
	panel.add(new JLabel("vert: " + coordinateToTransform.getY()), "grow, wrap");
	panel.add(new JLabel("<html><br><strong>Result:</strong></html>"), "grow, wrap");
	//transform coordinate
	GCoordinate transformedCoordinate = transformCoordinate(coordinateToTransform);
	panel.add(new JLabel("Latitude :" + transformedCoordinate.getX()), "grow, wrap");
	panel.add(new JLabel("Longitude :" + transformedCoordinate.getY()), "grow, wrap");
	return panel;