Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Frequent Contributor
Posts: 90
Registered: ‎10-13-2015
Accepted Solution

How to recognize state of extended tooltip function in java plugin

Hi all,

 

I need very to know very simple information, but I haven't found a way how to get it ...

 

I need to know if the extended tooltip is in use or not - means if the user clicks in the map - he gets information to the extended tooltip panel (this means "active", otherwise "inactive".

 

I have tried something like below, where I can get my action

 

ApplicationContext.getPluginCurator().getActionsForLocation(ActionLocation.MENUBARFAVORITS).get(1)

but there is no method to obtain the information about active or inactive state or I look over it.

 

Thanks for a help,

 

Regards,

Jakub

Technical Evangelist
Posts: 148
Registered: ‎10-20-2015

Re: How to recognize state of extended tooltip function in java plugin

Hi Jakub,

sorry for the late response.

 

An action itself has no state. The ActionDispatcher executes it and a action like the ExtendedTooltip executes an asynchronous task.

 

Therefore it's impossible to get the "active" or "inactive" information.

 

What do you want to achieve with that information? 

 

Best Regards,

Steve

Highlighted
Frequent Contributor
Posts: 90
Registered: ‎10-13-2015

Re: How to recognize state of extended tooltip function in java plugin

Hi Steve,

 

I have a plugin and on click in the map in the certain place I invoke the dialog with the attribute information about elements in the map that are underneath each other. It works fine, but if I activate the extended tooltip I get the extended tooltip information, but my dialog as well and I need to ignore my dialog somehow if the extended tooltip is activated.

 

Thanks & regards,

Jakub

 

Technical Evangelist
Posts: 148
Registered: ‎10-20-2015

Re: How to recognize state of extended tooltip function in java plugin

Ok and your action will be started by the user or is it always available?

 

Do you also use the SpatialAnalysis for that? If yes, then you can call the following line before you start your action:

 

 

context.getMap().getMeasurementController().abortAll();

 

 

This call abort's all measurment actions.

 

Unfortunately I've found one issue which must be fixed before everything works. Because the ExtendedToolTip plugin doesn't close the dock when the SpatialAnalysis will be aborted.

 

Best Regards,

Steve

 

 

Frequent Contributor
Posts: 90
Registered: ‎10-13-2015

Re: How to recognize state of extended tooltip function in java plugin

Technical Evangelist
Posts: 148
Registered: ‎10-20-2015

Re: How to recognize state of extended tooltip function in java plugin

[ Edited ]

Ok I checked the code.

 

Your MouseListener does all it's stuff at every mouseClicked event. I would recommend that your code will be only executed at some specific map states.

 

The GMap has 8 different states. 

 

public enum MapState
{
	IDLE,
	ZOOMBOX,
	CONTEXTMENU,
	INTERACTIVE,
	CENTERVIEW,
	ZOOMINVIEW,
	ZOOMOUTVIEW,
	AUTOMATIC_SHIFTVIEW;
}

 

 

GMSC provides a GMapListener which can be added to your to your GMap. This interface provides 3 different methods:

 

 

    /**
	 *  notifies that the mouse cursor has moved over the map
	 *  @param src map where cursor moved over
	 *  @param coord current location of the mouse cursor
	 */
	public void cursorMoved(GMap src, GCoordinate coord);
	
	/**
	 *  notifies that the displayed region has changed
	 *  @param src map which viewed bounds has changed
	 *  @param bounds new viewed bounds
	 */
	public void boundsChanged(GMap src, GBounds bounds);
	
	/**
	 *  notifies that the state of a map has changed
	 *  @param src map which state has changed
	 *  @param state the new map state
	 */
	public void mapStateChanged(GMap src, MapState state);

 

So in your case you have to use the mapStateChanged method.

 

I would suggest that your code will be only executed if the Mapstate is IDLE.

The dock/dialog itself should be not visible if the state is INTERACTIVE. Because this state will be set if a measurement operation is running. e.g -> extended tooltip etc.

 

 

Best Regards,

Steve

 

 

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.