07-29-2016 04:52 AM - edited 07-29-2016 04:53 AM
Hi all,
I build the GMSC feature programatically in Java and I would like to let the user create the new symbology and assign this symbology to the feature, just size, color, opacity and type of line and the same for polygons. Is there a way how to create new symbology in Java?
Thanks for a help!
Regards,
Jakub
08-02-2016 04:58 AM
Hi Jakub,
you want to create the FeatureTypeStyle xml? Am I right?
Regards,
Steve
08-02-2016 05:19 AM - edited 08-02-2016 05:22 AM
Hi Steve,
well, I am not sure, probably yes. I need to achieve the same behavior as if you prepare the style in administration and then you can use it throught UUID in Java like
GPolyline line = new GPolyline(new GAction(UUID.randomUUID()), GFeatureTypeStyleManager.getInstance().getStyle(UUID.fromString("5680a000-f0a0-4299-987c-74da1334f7cc")), coordinatesList);
But I don't know how to create it on the client side without having prepared configuration in the administration.
Thanks,
Jakub
08-02-2016 05:28 AM
You can't add a style to GFeatureTypeStyleManager so that you cann call getStyle.
But you can create a IFeatureTypeStyle by using FeatureTypeStyleFactory.createFeatureTypeStyle(UUID, FeatureTypeStyleType, IResourceProvider)
Please keep in mind that the given UUID is only a property of the IFeatureTypeStyle. This method doesn't adds the style to your GFeatureTypeStyleManager. It only creates the necessary render class.
The net.opengis.se.v_1_1_0.FeatureTypeStyle is the wrapper class for the xml, so you can set all settings.
08-04-2016 09:23 PM
Hi Steve,
thanks for your answer, I have moved a bit forward. I can set the style to the geometry, but I don't understand the relation between FeatureTypeStyleType and IFeatureTypeStyle.
FeatureTypeStyleType ft = new FeatureTypeStyleType(); IFeatureTypeStyle style = FeatureTypeStyleFactory.createAreaStyle(Color.BLUE, 1.0D, GSymbolizer.Uom.PIXEL, true, new Color(0, 0, 255, 125), true); IFeatureTypeStyle featureStyle = FeatureTypeStyleFactory.createFeatureTypeStyle(UUID.randomUUID(), ft, null);
I need to use FeatureTypeStyleType as the input of
FeatureTypeStyleFactory.createFeatureTypeStyle(UUID.randomUUID(), ft, null)
But I have absolutely no idea what should be in FeatureTypeStyleType ft and last parameter is IResourceProvider - I can obtain IResourceProvider as style.getResourceProvider(), but it is null
Now I can use style this way and this renders my polygons with the style above (blue color)
GPolygonSet poly = new GPolygonSet(new GAction(UUID.randomUUID(),tooltip), style, coordinatesList, holePositions);
But I (probably) need to pass the parameter UUID to createTemporaryDataStorage() method - because this changes the legend icon and this is my issue
return storage = context.createTemporaryDataStorage(name + ".shp", featureStyle.getUniqueId());
Situation looks like on the picture below - map style interpretation is ok, but the legend icon is not related to the map style. Probably because featureStyle has not correct values.
Thanks for a help!
Regards,
Jakub
10-26-2016 01:32 AM
Hi all,
anything new regarding symbology in legend?
I did a little research and it seems that the legend icon is always generated from symbology saved in database. Is that correct? Or is there some way how to create a legend icon for temp layer created on client?
Thanks,
Tereza
10-27-2016 04:09 AM
Hi Jakub,
you dont't need FeatureTypeStyleFactory.createFeatureTypeStyle if FeatureTypeStyleFactory.createAreaStyle provides all necessary settings for you.
IFeatureTypeStyle is our internal class which will be used by the renderer to style a geometry. FeatureTypeStyle is the XML-wrapper class which provides all possible style-settings.
Jakbu's comment:
Situation looks like on the picture below - map style interpretation is ok, but the legend icon is not related to the map style. Probably because featureStyle has not correct values.
Yes that's correct because the legend always uses the Style-Id which was provided by the context.createTemporaryDataStorage method and gets it from the GFeatureTypeStyleManager.
Therefore this must be the id of a style which is available at the database and assigned to the feature. I've re-read your first comment
Jakbu's comment:
I build the GMSC feature programatically in Java and I would like to let the user create the new symbology and assign this symbology to the feature, just size, color, opacity and type of line and the same for polygons
Maybe the following solution is the best for you which is the same as we do in case of the Redline-Styling.
So please note that the legend icon only represents the default values. but that's the same as for our redline functionality.
Best Regards,
Steve
01-25-2017 02:05 AM
Hi Steve,
I am working on a similar solution. In GMSC client there is a styling GUI that is used when adding new redlining features. Can I use this GUI to change the style of the features in my temporary storage?
Regards,
Sven
01-26-2017 04:41 AM
Or as an alternative solution:
Can I somehow use the clientside style editor (in GMSC 2016) to set a custom styling for my temporary storage layer?
I can do it for the normal Redline-layer but the option (Edit user-defined style) is missing on my storage layer.
Is there a way to enable it? What are the requirements of my storage to enable it?
Thank you!
Regards,
Sven
01-30-2017 12:07 AM
Hi Sven,
I need more information about your StorageMetadata. Please post the part of your code where you create the temporary storage layer.
Best Regards,
Steve