Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo how to set color of search's feature result #4630

Merged
merged 1 commit into from
Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions contribs/gmf/apps/desktop_alt/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import ngeoProjEPSG2056 from 'ngeo/proj/EPSG2056.js';
import ngeoProjEPSG21781 from 'ngeo/proj/EPSG21781.js';
import ngeoStatemanagerWfsPermalink from 'ngeo/statemanager/WfsPermalink.js';
import * as olBase from 'ol/index.js';
import {Circle, Fill, Stroke, Style} from 'ol/style';
import Raven from 'raven-js/src/raven.js';
import RavenPluginsAngular from 'raven-js/plugins/angular.js';

Expand Down Expand Up @@ -121,6 +122,24 @@ const exports = function($scope, $injector, ngeoFile, gettext, $q) {
'Learning [merged]': ['information', 'bus_stop']
};

const radius = 5;
const fill = new Fill({color: [255, 255, 255, 0.6]});
const stroke = new Stroke({color: [255, 0, 0, 1], width: 2});
const image = new Circle({fill, radius, stroke});
const default_search_style = new Style({
fill,
image,
stroke
});

/**
* @type {Object.<string, ol.style.Style>} Map of styles for search overlay.
* @export
*/
this.searchStyles = {
'default': default_search_style
};

// Allow angular-gettext-tools to collect the strings to translate
/** @type {angularGettext.Catalog} */
const gettextCatalog = $injector.get('gettextCatalog');
Expand Down
3 changes: 2 additions & 1 deletion contribs/gmf/apps/desktop_alt/index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@
gmf-search-coordinatesprojections="::mainCtrl.searchCoordinatesProjections"
gmf-search-colorchooser="::true"
gmf-search-delay="mainCtrl.searchDelay"
gmf-search-clearbutton="::true">
gmf-search-clearbutton="::true"
gmf-search-styles="::mainCtrl.searchStyles">
</gmf-search>
<ngeo-displaywindow
content="mainCtrl.displaywindowContent"
Expand Down