10-28-2015 02:41 AM
Is it possible to style query results using Portal SDK?
Below is how new query is added. Results are displayed using default colours/syles. What I would like is to change this default behaviour.
Any help is appreciated.
$GP.ready(function () {
$GP.ui.toolbar.add({
categoryIndex: 0,
xtype: "tbbutton",
text: "WMPSQuery",
handler: function (b) {
$GP.map.draw({
"type": "Polygon" //user will be promped to draw geometry (polygon) on map
}, function (r) {
createAnalysis(r.feature.get_geoJSON().geometry);
});
}
});
});
function createAnalysis(geometry) {
//$GP.crs.setCurrent("EPSG:4326", function () {
$GP.queries.add({
featureClassId: "USSample|States",
url: "http://swi-sgiv-gm19.ingrnet.com/USAWMPS/MapService.svc",
definitionName: "MapPublisher",
queryName: "Query with drawing",
applicationId: "USDemoWMPS",
addToLegend: true,
filters: [{
type: "spatial",
operator: "0",
complement: false,
operands: [geometry]
}]
},
function (result) {
$GP.map.draw.clear();
});
//});
};
Solved! Go to Solution.
10-29-2015 07:53 AM
Hi Denis,
There are two options as far as I can think up (I did not test them though):
So for each query:
1) Try to modify the StyleConfig.definitions object and change the default "analysis" styles
2) Add the Query into Portal
3) (Optionally) revert the default styles to their original values after the Query is loaded in the application window.
$GP.dynamicStyles.register({ featureClassId: "someId", default: function (feature) { return { "style": { "color": "#f00", "name": "Red Line", "width": 10, "translucency": 0.2 }, defaultStyleName: "none", styleType: "Intergraph.WebSolutions.Core.WebClient.Platform.Style.SimpleLineStyle" } } }, function () { $GP.queries.add({ featureClassId: "someId", url: "http://web.address", definitionName: "WFS", queryName: queryName, addToLegend: false }, function(result) { // do something }); });http://demo.hexagongeospatial.com/communityportal/docs/index.html#!/api/$GP.dynamicStyles
10-29-2015 09:12 AM
Some update:
11-09-2015 03:29 AM
Hi Jan,
do you remember the SR number for this issue?
Thanks,
Denis
11-10-2015 11:36 PM
If I remember correctly the CR # is 1-FFF80M.