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 

Client Storage

by Community Manager on ‎01-20-2016 02:41 AM (1,255 Views)

Abstract

The client storage sample shows different storage options on the client side. 

Bitbucket Link

https://bitbucket.org/HGDN/hgdn_gmsc/src/2eef0f0f7111d9de952d94e8f91052c2bc6946c7/Client/Storage/?at...

Description

GMSC Client offers several way to store information on the client side. In this sample the following storage options are shown:

  • Temporary Feature Storage
  • Session Warehouse
  • Settings Warehouse

Temporary Feature Storage

The FeatureWarehousePlugin offers one action (addGeometryToFeatureWarehouse) to add a polygon to a temporary storage. The primitive is captured using a GeometryCapture instance. 
The storage is created as TemporaryDataStorage and is only available during the current session.

 

@Action(actionLocation=ActionLocation.PLUGINTAB)
public void addGeometryToFeatureWarehouse()
{
	GeometryCapture capture = GeometryCaptureFactory.getCaptureInstance(GeometryCaptureType.Polygon, 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) {
		try
		{
			Storage storage = getStorage();
			storage.getFeature().setVisible(true);					
			storage.add(newPrimitives);
		} catch (StorageException e) 
		{				
			Log.getLogger().log(Level.SEVERE, "", e);
		}
	   }
        });		
	try
	{
		capture.setStyle(GFeatureTypeStyleManager.getInstance().getStyle(sStyleId));
	} catch (SymbologyConfigurationException | JAXBException | IOException e)
	{
		Log.getLogger().log(Level.SEVERE, "", e);
	}	
	capture.run();
}
	
private Storage getStorage() throws StorageException
{
	if (storage != null)
		return storage;
	else
		return storage = context.createTemporaryDataStorage("Temporary Feature Storage", sStyleId);
}

When the storage is created, a new feature wis added to the legend similar to the redlining or measurement features. 

 

SessionWarehouse

GMSC Client offers a SessionCache to temporarily add values in case they are needed several times during the current session. 

The SessionWarehousePlugin offers one action (addSelectedElementToSession) that adds the name of the active feature and the id of the selected element to the SessionCache so that it might be displayed if the user clicks on showSessionValue.

 

private static final String FEATURE = "LastSelectionFeature";
private static final String ELEMENTID = "LastSelection";

@Action(actionLocation=ActionLocation.PLUGINTAB, activeRequired = true, minimumSelection = 1, maximumSelection = 1) public void addSelectedElementToSession() { MapSelectionCurator mapSelectionCurator = ApplicationContext.getBrowser().getMapSelectionCurator(); SessionCache.put(FEATURE, mapSelectionCurator.getActiveFeature().getName()); SessionCache.put(ELEMENTID, mapSelectionCurator.getSelectedElements()[0].toString()); SessionValueDialog dialog = new SessionValueDialog(SessionCache.get(FEATURE), SessionCache.get(ELEMENTID)); dialog.setVisible(true); }

 

SettingsWarehouse

GMSC Client offers a SettingWarehouse to persist additional information on the client side so that the information does not get lost between different sessions. SettingWarehouse may only deal with simple datatypes.

The SettingsWarehousePlugin offers one action that lets the user decide whether to show some additional user information in a dock panel or not. By default it is deactivated. Whenever the user click on HandleUserInfo, the settings value ShowUserInfo is updated (true or false) so that the next time it will be displayed by default in case that the current value in the SettingWarehouse is set to true.

 

@Plugin(alias = "SettingsWarehouse", vendor = "Hexagon Geospatial")
public class SettingsWarehousePlugin extends AbstractPlugin 
{
	private Dock userDock;
	private JPanel dockContentPane;
	
	@Override
	public void loadOnStart() throws Exception 
	{
		if(SettingWarehouse.get("ShowUserInfo", false))
			SmartClientShortAccess.getMapDockManager().addDock(getUserDock(), DockConstraint.TOP);
	}	
	
	@Action(actionLocation=ActionLocation.PLUGINTAB)
	public void HandleUserInfo()
	{
		
		if(userDock == null)
		{
			SettingWarehouse.put("ShowUserInfo", true);
			SmartClientShortAccess.getMapDockManager().addDock(getUserDock(), DockConstraint.TOP);
		}
		else
		{
			SettingWarehouse.put("ShowUserInfo", false);
			SmartClientShortAccess.getMapDockManager().removeDock(userDock);
			userDock = null;
		}

	}
...
}

 

Comments
by
‎01-27-2017 12:51 AM - edited ‎01-27-2017 01:38 AM

Is there a way to access the clients styling GUI in order to change the style of my temporaryStorage features?

 

Edit:

Sorry, I set an illegal style UUID. That's why I couldn't edit it.

Overview
Contributors