Hexagon Geospatial
MENU

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 

Weather Plugin

by Community Manager on ‎01-21-2016 09:32 AM - edited 2 weeks ago by Technical Evangelist (2,366 Views)

Abstract

The weather plugin sample is intended to show how to connect to external services.

The plugin calls a restful web service to retrieve weather information of the current location and displays the result in a dock panel.

Bitbucket Link

https://bitbucket.org/HGDN/hgdn_gmsc/src/master/Client/WeatherPlugin/

Description

The weather plugin sample contains one plugin to communicate with the World Weather Online restful web services. To successfully execute the sample please obtain a free license and add the key to the environment properties:

WeatherPluginEnvProperties.JPG

 

The plugin contains one action to display the forecast panel:

 

@Action(actionLocation = ActionLocation.PLUGINTAB)
	public void showWheaterForecast()
	{
		
		// check if the weatherDock must be stopped
		if(weatherDock!=null)
		{
			SmartClientShortAccess.getMapDockManager().removeDock(weatherDock);
			captureInstance.abort();
		}
		
		captureInstance = GeometryCaptureFactory.getCaptureInstance(GeometryCaptureType.Point,
				ApplicationContext.getBrowser().getMap(),
				new IGeometryCaptureListener() {
					@Override
					public void captureFinished(GeometryCapture source) {}

					@Override
					public void captureAborted(GeometryCapture source) {}

					@Override
					public void addCapturePrimitive(GeometryCapture source,	GPrimitive... newPrimitives) 
					{
						if (!Assertion.isValid(newPrimitives)) 
							return;
						Data weatherData = getWeatherInformation(newPrimitives[0].getBounds().getCenter());
						refreshWeatherDock(weatherData);
					}
				});		
		captureInstance.run();		
		SmartClientShortAccess.getMapDockManager().addDock(getWeatherDock(), DockConstraint.TOP);
	}

To get the location information, a GeometryCaptureInstance is started and as soon as the user captures a point on the map, this location is used to call the service. The result is shown as a dock panel on the right top of the map. 

 

 

Comments
by Benjamin_S
on ‎06-06-2016 06:55 AM
Hi, when trying to open the Bitbucket Link I reciew an "Access denied" Error. Is this intended not beeing public?
by Community Manager
on ‎06-09-2016 01:22 AM

 Hi Benjamin,

while the articles are public, access to the source code of the samples is restricted. Please sign up for a HGDN Subscription to get access to these samples.

 

Regards

 

Overview
Contributors