Hexagon Geospatial

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 
Frequent Contributor
Posts: 115
Registered: ‎04-05-2016

Re: Create the feature symbology in Java GMSC

[ Edited ]

Hi Steve,


thank you for your answer. In the meantime I got a little closer to the solution I want:


I am creating a TemporaryStorage like so:


public Storage getStorage() {
		if (ShapeImport.storage == null) {
			PluginContext pc = new PluginContext();
			ShapeImport.storage = pc.createTemporaryDataStorage("Storage", sStyleId);
		return ShapeImport.storage;

I am then filling this storage with GPrimitive geometries.


Now I want to change the style of these geometries. I am planning to do so, by using the StyleQuickPicker GUI to create a customized RedlineStyle and applying the style values as CustomValues to each of my primitives.


I am doing this like so:

public static void applyStyle() throws StorageException {
		StyleQuickPicker styleQuickPicker = new StyleQuickPicker();
		RedlineStyle redlineStyle = styleQuickPicker.showStyleSelector(
				Utils.asModifyableList(new GeometryTypes[] { GeometryTypes.GEOMETRY_COLLECTION }),
		if (redlineStyle == null) {
		HashMap<String, CustomValue> styleValues = new HashMap<String, CustomValue>();
		GPrimitive[] primitives = storage.getAllPrimitives();
		for (GDOAttribute attribute : GDOAttribute.values()) {
			((Map<String, CustomValue>) styleValues).put(attribute.getName(),
		for (GPrimitive current : primitives) {
			current = current.copy(0.0D, 0.0D);
			storage.update(new GPrimitive[] { current });

Right now I am calling this method as a RPAction in the plugintab but later on I want to call it when the external geometry is loaded so that it is styled right away.


I am struggeling now to make the new CustomValues apply to the drawn geometries in the map. They don't change even thou the Redline Style is read correctly and applied to each of my primitives.


Do you have an idea what I am missing here?




Frequent Contributor
Posts: 115
Registered: ‎04-05-2016

Re: Create the feature symbology in Java GMSC

Okay nevermind. Forget all this.

I found out that it is actually much easier to select a style by using the StyleQuickPicker before the geometry is drawn and use it in the constructor of each geometry:

IFeatureTypeStyle style = FeatureTypeStyleFactory.createAreaStyle(
			GPrimitive primitive = new GPolygonSet(new GAction(UUID.randomUUID()), style, coordinates, indicator);

rls is my RedlineStyle that I received from using the StyleQuickPicker.

Super Contributor
Posts: 301
Registered: ‎02-09-2016

Re: Create the feature symbology in Java GMSC

Hi smoeller,


I am working on this topic at the moment and still have no idea how to create my own style or call the style created from the style editor and then apply it onto my feature. Would you mind showing me more detail of your process and solution, please?



Appreciate your help


Kind regards,

Super Contributor
Posts: 301
Registered: ‎02-09-2016

Re: Create the feature symbology in Java GMSC

Hi team,


Steve mentions that if in Administrator, I create a style in a Symbology library that I am currently use, then on the client side, I could retrieve it by using GFeatureTypeStyleManager with the style id.


 UUID addressstyleID = UUID.fromString("4ab39c01-2d01-43e0-8501-c04238deec4d"); 

  SymbologyLibrary lib = GFeatureTypeStyleManager.getInstance().getLibraryForStyle(addressstyleID, true);

However, I observe that if the style is not used in any legend, then this statement above fails because  it doesn't get included in the symbology library on the client side. Is there any way that we can get around that?


I look at decomplied code for these class and it only loads symbologies from symbology constraints which I have no idea. 


Appreciate all suggestions and ideas to work around the issue


Kind regards,



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