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
Regular Contributor
Posts: 248
Registered: ‎05-01-2016

Re: $GP.dynamicStyles.register example

this is my hexagon feature/instance using code....

 

$GP.dynamicStyles.register({
featureClassId: "USSample|States",
default: function (feature) {
return {
"style": {
"color": "#f0a",
"name": "StateBoundary",
"size": 4,
"translucency": 0.8
},
defaultStyleName: "none",
styleType: "Intergraph.WebSolutions.Core.WebClient.Platform.Style.SimpleLineStyle"

};
}
}, function () {
$GP.legend.add({
url: "http://demo.hexagongeospatial.com/wmps/mapService.svc",
definitionName: "MapPublisher",
ids: ["USSample|States"],
applicationId: "DEMO_USA",

});
});

Technical Evangelist
Posts: 1,045
Registered: ‎09-11-2015

Re: $GP.dynamicStyles.register example

[ Edited ]

You are right, the code does not work for WMPS for some reason. I have fixed the styling because you tried to apply SimpleLineStyle to area feature but still the style is not applied to WMPS.

 

$GP.dynamicStyles.register({
	featureClassId : "USSample|Rivers",
	"default" : function (feature) {
		return {
			"style" : {
				"color" : "#f0a",
				"name" : "Rivers",
				"size" : 4,
				"translucency" : 0.8
			},
			defaultStyleName : "none",
			styleType : "Intergraph.WebSolutions.Core.WebClient.Platform.Style.SimpleLineStyle"
		};
	}
},
	function () {
	$GP.legend.add({
		url : "http://demo.hexagongeospatial.com/wmps/mapService.svc",
		definitionName : "MapPublisher",
		ids : ["USSample|Rivers"],
		applicationId : "DEMO_USA",
	});
});

This could be a bug which needs to be investigated but there is a workaround - change the StyleDefinition object before adding a new legend entry or analysis and then revert it to original values. The temporary style will be assigned to the just-added feature class (or analysis query).

 

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Highlighted
Regular Contributor
Posts: 248
Registered: ‎05-01-2016

Re: $GP.dynamicStyles.register example - STILL TRYING

[ Edited ]

************Thanks very much for answering.  Have been trying many ways to do this using both techinques  for a WMPS service and have not yet had success.  Do you possibly have the example you used that was sucessful?  

update: Still haven't been able to get it - have tried a lot of different combinations...I need to be able to add programatically one feature  out of the 400+ that i have in a sqlserver warehouse in a consistent style which is not the default one.   I can add the feature, give it the name i want in the legend and set its transparency using 

 

$GP.legend.find(function (ret) {
ret.legendItems[13].set_name("Pipeline FIPS: " + fips);

});
$GP.legend.find(function (ret) {
ret.legendItems[13].set_opacity(20);

});

 

but i can't set the color or line width using $GP.dynamicStyles.register

Jane

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