{getOtherCategoryLabel()}}
+ color="grey"
+ isLinesOnly={isLinesOnly}
+ isPointsOnly={isPointsOnly}
+ symbolId={fallback}
+ />
+ );
+ }
+
+ return (
+
+
+
+ {categories}
+
+
+
+
+
+
+ {fieldLabel}
+
+
+
+
+
+
+ );
+ }
+}
diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_size_property.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_size_property.js
index 5a4da1a80c918..dfc5c530cc90f 100644
--- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_size_property.js
+++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_size_property.js
@@ -67,15 +67,15 @@ export class DynamicSizeProperty extends DynamicStyleProperty {
mbMap.setPaintProperty(mbLayerId, 'icon-halo-width', haloWidth);
}
- syncIconImageAndSizeWithMb(symbolLayerId, mbMap, symbolId) {
- if (this._isSizeDynamicConfigComplete(this._options)) {
- const iconPixels =
- this._options.maxSize >= HALF_LARGE_MAKI_ICON_SIZE
- ? LARGE_MAKI_ICON_SIZE
- : SMALL_MAKI_ICON_SIZE;
- mbMap.setLayoutProperty(symbolLayerId, 'icon-image', `${symbolId}-${iconPixels}`);
+ getIconPixelSize() {
+ return this._options.maxSize >= HALF_LARGE_MAKI_ICON_SIZE
+ ? LARGE_MAKI_ICON_SIZE
+ : SMALL_MAKI_ICON_SIZE;
+ }
- const halfIconPixels = iconPixels / 2;
+ syncIconSizeWithMb(symbolLayerId, mbMap) {
+ if (this._isSizeDynamicConfigComplete(this._options)) {
+ const halfIconPixels = this.getIconPixelSize() / 2;
const targetName = this.getComputedFieldName();
// Using property state instead of feature-state because layout properties do not support feature-state
mbMap.setLayoutProperty(symbolLayerId, 'icon-size', [
@@ -88,7 +88,6 @@ export class DynamicSizeProperty extends DynamicStyleProperty {
this._options.maxSize / halfIconPixels,
]);
} else {
- mbMap.setLayoutProperty(symbolLayerId, 'icon-image', null);
mbMap.setLayoutProperty(symbolLayerId, 'icon-size', null);
}
}
diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/static_icon_property.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/static_icon_property.js
new file mode 100644
index 0000000000000..3b5be083dd3c9
--- /dev/null
+++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/static_icon_property.js
@@ -0,0 +1,16 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { StaticStyleProperty } from './static_style_property';
+import { getMakiSymbolAnchor, getMakiIconId } from '../symbol_utils';
+
+export class StaticIconProperty extends StaticStyleProperty {
+ syncIconWithMb(symbolLayerId, mbMap, iconPixelSize) {
+ const symbolId = this._options.value;
+ mbMap.setLayoutProperty(symbolLayerId, 'icon-anchor', getMakiSymbolAnchor(symbolId));
+ mbMap.setLayoutProperty(symbolLayerId, 'icon-image', getMakiIconId(symbolId, iconPixelSize));
+ }
+}
diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/static_size_property.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/static_size_property.js
index 024b446369851..2383a5932cb9b 100644
--- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/static_size_property.js
+++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/static_size_property.js
@@ -24,12 +24,14 @@ export class StaticSizeProperty extends StaticStyleProperty {
mbMap.setPaintProperty(mbLayerId, 'icon-halo-width', this._options.size);
}
- syncIconImageAndSizeWithMb(symbolLayerId, mbMap, symbolId) {
- const iconPixels =
- this._options.size >= HALF_LARGE_MAKI_ICON_SIZE ? LARGE_MAKI_ICON_SIZE : SMALL_MAKI_ICON_SIZE;
+ getIconPixelSize() {
+ return this._options.size >= HALF_LARGE_MAKI_ICON_SIZE
+ ? LARGE_MAKI_ICON_SIZE
+ : SMALL_MAKI_ICON_SIZE;
+ }
- mbMap.setLayoutProperty(symbolLayerId, 'icon-image', `${symbolId}-${iconPixels}`);
- const halfIconPixels = iconPixels / 2;
+ syncIconSizeWithMb(symbolLayerId, mbMap) {
+ const halfIconPixels = this.getIconPixelSize() / 2;
mbMap.setLayoutProperty(symbolLayerId, 'icon-size', this._options.size / halfIconPixels);
}
diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/symbolize_as_property.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/symbolize_as_property.js
new file mode 100644
index 0000000000000..9ae1ef5054e30
--- /dev/null
+++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/symbolize_as_property.js
@@ -0,0 +1,18 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+
+import { AbstractStyleProperty } from './style_property';
+import { SYMBOLIZE_AS_TYPES } from '../../../../../common/constants';
+
+export class SymbolizeAsProperty extends AbstractStyleProperty {
+ constructor(options, styleName) {
+ super(options, styleName);
+ }
+
+ isSymbolizedAsIcon = () => {
+ return this.getOptions().value === SYMBOLIZE_AS_TYPES.ICON;
+ };
+}
diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/style_util.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/style_util.js
index 7bd60ea6502bc..2859b8c0e5a56 100644
--- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/style_util.js
+++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/style_util.js
@@ -4,6 +4,14 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import { i18n } from '@kbn/i18n';
+
+export function getOtherCategoryLabel() {
+ return i18n.translate('xpack.maps.styles.categorical.otherCategoryLabel', {
+ defaultMessage: 'Other',
+ });
+}
+
export function getComputedFieldName(styleName, fieldName) {
return `${getComputedFieldNamePrefix(fieldName)}__${styleName}`;
}
@@ -41,3 +49,24 @@ export function scaleValue(value, range) {
return (value - range.min) / range.delta;
}
+
+export function assignCategoriesToPalette({ categories, paletteValues }) {
+ const stops = [];
+ let fallback = null;
+
+ if (categories && categories.length && paletteValues && paletteValues.length) {
+ const maxLength = Math.min(paletteValues.length, categories.length + 1);
+ fallback = paletteValues[maxLength - 1];
+ for (let i = 0; i < maxLength - 1; i++) {
+ stops.push({
+ stop: categories[i].key,
+ style: paletteValues[i],
+ });
+ }
+ }
+
+ return {
+ stops,
+ fallback,
+ };
+}
diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/style_util.test.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/style_util.test.js
index e4df2f2bc0f58..2be31c0107193 100644
--- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/style_util.test.js
+++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/style_util.test.js
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { isOnlySingleFeatureType, scaleValue } from './style_util';
+import { isOnlySingleFeatureType, scaleValue, assignCategoriesToPalette } from './style_util';
import { VECTOR_SHAPE_TYPES } from '../../sources/vector_feature_types';
describe('isOnlySingleFeatureType', () => {
@@ -87,3 +87,42 @@ describe('scaleValue', () => {
expect(scaleValue(5, undefined)).toBe(-1);
});
});
+
+describe('assignCategoriesToPalette', () => {
+ test('Categories and palette values have same length', () => {
+ const categories = [{ key: 'alpah' }, { key: 'bravo' }, { key: 'charlie' }, { key: 'delta' }];
+ const paletteValues = ['red', 'orange', 'yellow', 'green'];
+ expect(assignCategoriesToPalette({ categories, paletteValues })).toEqual({
+ stops: [
+ { stop: 'alpah', style: 'red' },
+ { stop: 'bravo', style: 'orange' },
+ { stop: 'charlie', style: 'yellow' },
+ ],
+ fallback: 'green',
+ });
+ });
+
+ test('Should More categories than palette values', () => {
+ const categories = [{ key: 'alpah' }, { key: 'bravo' }, { key: 'charlie' }, { key: 'delta' }];
+ const paletteValues = ['red', 'orange', 'yellow'];
+ expect(assignCategoriesToPalette({ categories, paletteValues })).toEqual({
+ stops: [
+ { stop: 'alpah', style: 'red' },
+ { stop: 'bravo', style: 'orange' },
+ ],
+ fallback: 'yellow',
+ });
+ });
+
+ test('Less categories than palette values', () => {
+ const categories = [{ key: 'alpah' }, { key: 'bravo' }];
+ const paletteValues = ['red', 'orange', 'yellow', 'green', 'blue'];
+ expect(assignCategoriesToPalette({ categories, paletteValues })).toEqual({
+ stops: [
+ { stop: 'alpah', style: 'red' },
+ { stop: 'bravo', style: 'orange' },
+ ],
+ fallback: 'yellow',
+ });
+ });
+});
diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/symbol_utils.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/symbol_utils.js
index 162b22319e6ef..b577d4080b879 100644
--- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/symbol_utils.js
+++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/symbol_utils.js
@@ -4,9 +4,11 @@
* you may not use this file except in compliance with the Elastic License.
*/
+import React from 'react';
import maki from '@elastic/maki';
import xml2js from 'xml2js';
import { parseXmlString } from '../../../../common/parse_xml_string';
+import { SymbolIcon } from './components/legend/symbol_icon';
export const LARGE_MAKI_ICON_SIZE = 15;
const LARGE_MAKI_ICON_SIZE_AS_STRING = LARGE_MAKI_ICON_SIZE.toString();
@@ -55,6 +57,12 @@ export function getMakiSymbolAnchor(symbolId) {
}
}
+// Style descriptor stores symbolId, for example 'aircraft'
+// Icons are registered in Mapbox with full maki ids, for example 'aircraft-11'
+export function getMakiIconId(symbolId, iconPixelSize) {
+ return `${symbolId}-${iconPixelSize}`;
+}
+
export function buildSrcUrl(svgString) {
const domUrl = window.URL || window.webkitURL || window;
const svg = new Blob([svgString], { type: 'image/svg+xml' });
@@ -77,3 +85,54 @@ export async function styleSvg(svgString, fill, stroke, strokeWidth) {
const builder = new xml2js.Builder();
return builder.buildObject(svgXml);
}
+
+const ICON_PALETTES = [
+ {
+ id: 'filledShapes',
+ icons: ['circle', 'marker', 'square', 'star', 'triangle', 'hospital'],
+ },
+ {
+ id: 'hollowShapes',
+ icons: [
+ 'circle-stroked',
+ 'marker-stroked',
+ 'square-stroked',
+ 'star-stroked',
+ 'triangle-stroked',
+ ],
+ },
+];
+
+export function getIconPaletteOptions(isDarkMode) {
+ return ICON_PALETTES.map(({ id, icons }) => {
+ const iconsDisplay = icons.map(iconId => {
+ const style = {
+ width: '10%',
+ position: 'relative',
+ height: '100%',
+ display: 'inline-block',
+ paddingTop: '4px',
+ };
+ return (
+
+
+
+ );
+ });
+ return {
+ value: id,
+ inputDisplay: {iconsDisplay}
,
+ };
+ });
+}
+
+export function getIconPalette(paletteId) {
+ const palette = ICON_PALETTES.find(({ id }) => id === paletteId);
+ return palette ? [...palette.icons] : null;
+}
diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_constants.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_constants.js
deleted file mode 100644
index 027d558d3c033..0000000000000
--- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_constants.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
- */
-
-export const SYMBOLIZE_AS_CIRCLE = 'circle';
-export const SYMBOLIZE_AS_ICON = 'icon';
-
-export const DEFAULT_ICON_SIZE = 6;
diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.js
index 558df73f74595..97259a908f1e4 100644
--- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.js
+++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.js
@@ -21,12 +21,11 @@ import {
SOURCE_META_ID_ORIGIN,
SOURCE_FORMATTERS_ID_ORIGIN,
LAYER_STYLE_TYPE,
+ DEFAULT_ICON,
} from '../../../../common/constants';
import { VectorIcon } from './components/legend/vector_icon';
import { VectorStyleLegend } from './components/legend/vector_style_legend';
import { VECTOR_SHAPE_TYPES } from '../../sources/vector_feature_types';
-import { SYMBOLIZE_AS_CIRCLE, SYMBOLIZE_AS_ICON } from './vector_constants';
-import { getMakiSymbolAnchor } from './symbol_utils';
import { getComputedFieldName, isOnlySingleFeatureType } from './style_util';
import { StaticStyleProperty } from './properties/static_style_property';
import { DynamicStyleProperty } from './properties/dynamic_style_property';
@@ -40,6 +39,9 @@ import { StaticTextProperty } from './properties/static_text_property';
import { DynamicTextProperty } from './properties/dynamic_text_property';
import { LabelBorderSizeProperty } from './properties/label_border_size_property';
import { extractColorFromStyleProperty } from './components/legend/extract_color_from_style_property';
+import { SymbolizeAsProperty } from './properties/symbolize_as_property';
+import { StaticIconProperty } from './properties/static_icon_property';
+import { DynamicIconProperty } from './properties/dynamic_icon_property';
const POINTS = [GEO_JSON_TYPE.POINT, GEO_JSON_TYPE.MULTI_POINT];
const LINES = [GEO_JSON_TYPE.LINE_STRING, GEO_JSON_TYPE.MULTI_LINE_STRING];
@@ -69,6 +71,10 @@ export class VectorStyle extends AbstractStyle {
...VectorStyle.createDescriptor(descriptor.properties, descriptor.isTimeAware),
};
+ this._symbolizeAsStyleProperty = new SymbolizeAsProperty(
+ this._descriptor.properties[VECTOR_STYLES.SYMBOLIZE_AS].options,
+ VECTOR_STYLES.SYMBOLIZE_AS
+ );
this._lineColorStyleProperty = this._makeColorProperty(
this._descriptor.properties[VECTOR_STYLES.LINE_COLOR],
VECTOR_STYLES.LINE_COLOR
@@ -81,10 +87,13 @@ export class VectorStyle extends AbstractStyle {
this._descriptor.properties[VECTOR_STYLES.LINE_WIDTH],
VECTOR_STYLES.LINE_WIDTH
);
+ this._iconStyleProperty = this._makeIconProperty(
+ this._descriptor.properties[VECTOR_STYLES.ICON]
+ );
this._iconSizeStyleProperty = this._makeSizeProperty(
this._descriptor.properties[VECTOR_STYLES.ICON_SIZE],
VECTOR_STYLES.ICON_SIZE,
- this._descriptor.properties[VECTOR_STYLES.SYMBOL].options.symbolizeAs === SYMBOLIZE_AS_ICON
+ this._symbolizeAsStyleProperty.isSymbolizedAsIcon()
);
this._iconOrientationProperty = this._makeOrientationProperty(
this._descriptor.properties[VECTOR_STYLES.ICON_ORIENTATION],
@@ -114,6 +123,8 @@ export class VectorStyle extends AbstractStyle {
_getAllStyleProperties() {
return [
+ this._symbolizeAsStyleProperty,
+ this._iconStyleProperty,
this._lineColorStyleProperty,
this._fillColorStyleProperty,
this._lineWidthStyleProperty,
@@ -153,7 +164,6 @@ export class VectorStyle extends AbstractStyle {
{
@@ -527,7 +537,7 @@ export class VectorStyle extends AbstractStyle {
}
arePointsSymbolizedAsCircles() {
- return this._descriptor.properties.symbol.options.symbolizeAs === SYMBOLIZE_AS_CIRCLE;
+ return !this._symbolizeAsStyleProperty.isSymbolizedAsIcon();
}
setMBPaintProperties({ alpha, mbMap, fillLayerId, lineLayerId }) {
@@ -554,23 +564,22 @@ export class VectorStyle extends AbstractStyle {
}
setMBSymbolPropertiesForPoints({ mbMap, symbolLayerId, alpha }) {
- const symbolId = this._descriptor.properties.symbol.options.symbolId;
mbMap.setLayoutProperty(symbolLayerId, 'icon-ignore-placement', true);
- mbMap.setLayoutProperty(symbolLayerId, 'icon-anchor', getMakiSymbolAnchor(symbolId));
mbMap.setPaintProperty(symbolLayerId, 'icon-opacity', alpha);
+ this._iconStyleProperty.syncIconWithMb(
+ symbolLayerId,
+ mbMap,
+ this._iconSizeStyleProperty.getIconPixelSize()
+ );
// icon-color is only supported on SDF icons.
this._fillColorStyleProperty.syncIconColorWithMb(symbolLayerId, mbMap);
this._lineColorStyleProperty.syncHaloBorderColorWithMb(symbolLayerId, mbMap);
this._lineWidthStyleProperty.syncHaloWidthWithMb(symbolLayerId, mbMap);
- this._iconSizeStyleProperty.syncIconImageAndSizeWithMb(symbolLayerId, mbMap, symbolId);
+ this._iconSizeStyleProperty.syncIconSizeWithMb(symbolLayerId, mbMap);
this._iconOrientationProperty.syncIconRotationWithMb(symbolLayerId, mbMap);
}
- arePointsSymbolizedAsCircles() {
- return this._descriptor.properties.symbol.options.symbolizeAs === SYMBOLIZE_AS_CIRCLE;
- }
-
_makeField(fieldDescriptor) {
if (!fieldDescriptor || !fieldDescriptor.name) {
return null;
@@ -660,4 +669,23 @@ export class VectorStyle extends AbstractStyle {
throw new Error(`${descriptor} not implemented`);
}
}
+
+ _makeIconProperty(descriptor) {
+ if (!descriptor || !descriptor.options) {
+ return new StaticIconProperty({ value: DEFAULT_ICON }, VECTOR_STYLES.ICON);
+ } else if (descriptor.type === StaticStyleProperty.type) {
+ return new StaticIconProperty(descriptor.options, VECTOR_STYLES.ICON);
+ } else if (descriptor.type === DynamicStyleProperty.type) {
+ const field = this._makeField(descriptor.options.field);
+ return new DynamicIconProperty(
+ descriptor.options,
+ VECTOR_STYLES.ICON,
+ field,
+ this._getFieldMeta,
+ this._getFieldFormatter
+ );
+ } else {
+ throw new Error(`${descriptor} not implemented`);
+ }
+ }
}
diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.test.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.test.js
index 84e539794b150..cc52d44aed8d3 100644
--- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.test.js
+++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.test.js
@@ -87,6 +87,12 @@ describe('getDescriptorWithMissingStylePropsRemoved', () => {
options: {},
type: 'STATIC',
},
+ icon: {
+ options: {
+ value: 'airfield',
+ },
+ type: 'STATIC',
+ },
iconOrientation: {
options: {
orientation: 0,
@@ -138,10 +144,9 @@ describe('getDescriptorWithMissingStylePropsRemoved', () => {
},
type: 'STATIC',
},
- symbol: {
+ symbolizeAs: {
options: {
- symbolId: 'airfield',
- symbolizeAs: 'circle',
+ value: 'circle',
},
},
});
diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style_defaults.js b/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style_defaults.js
index 54af55b61ab2e..952f8766a6156 100644
--- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style_defaults.js
+++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style_defaults.js
@@ -5,7 +5,7 @@
*/
import { VectorStyle } from './vector_style';
-import { SYMBOLIZE_AS_CIRCLE, DEFAULT_ICON_SIZE } from './vector_constants';
+import { DEFAULT_ICON, SYMBOLIZE_AS_TYPES } from '../../../../common/constants';
import {
COLOR_GRADIENTS,
COLOR_PALETTES,
@@ -14,14 +14,13 @@ import {
} from '../color_utils';
import chrome from 'ui/chrome';
-const DEFAULT_ICON = 'airfield';
-
export const MIN_SIZE = 1;
export const MAX_SIZE = 64;
export const DEFAULT_MIN_SIZE = 4;
export const DEFAULT_MAX_SIZE = 32;
export const DEFAULT_SIGMA = 3;
export const DEFAULT_LABEL_SIZE = 14;
+export const DEFAULT_ICON_SIZE = 6;
export const LABEL_BORDER_SIZES = {
NONE: 'NONE',
@@ -31,10 +30,11 @@ export const LABEL_BORDER_SIZES = {
};
export const VECTOR_STYLES = {
- SYMBOL: 'symbol',
+ SYMBOLIZE_AS: 'symbolizeAs',
FILL_COLOR: 'fillColor',
LINE_COLOR: 'lineColor',
LINE_WIDTH: 'lineWidth',
+ ICON: 'icon',
ICON_SIZE: 'iconSize',
ICON_ORIENTATION: 'iconOrientation',
LABEL_TEXT: 'labelText',
@@ -54,10 +54,9 @@ export const POLYGON_STYLES = [
export function getDefaultProperties(mapColors = []) {
return {
...getDefaultStaticProperties(mapColors),
- [VECTOR_STYLES.SYMBOL]: {
+ [VECTOR_STYLES.SYMBOLIZE_AS]: {
options: {
- symbolizeAs: SYMBOLIZE_AS_CIRCLE,
- symbolId: DEFAULT_ICON,
+ value: SYMBOLIZE_AS_TYPES.CIRCLE,
},
},
[VECTOR_STYLES.LABEL_BORDER_SIZE]: {
@@ -78,6 +77,12 @@ export function getDefaultStaticProperties(mapColors = []) {
const isDarkMode = chrome.getUiSettingsClient().get('theme:darkMode', false);
return {
+ [VECTOR_STYLES.ICON]: {
+ type: VectorStyle.STYLE_TYPE.STATIC,
+ options: {
+ value: DEFAULT_ICON,
+ },
+ },
[VECTOR_STYLES.FILL_COLOR]: {
type: VectorStyle.STYLE_TYPE.STATIC,
options: {
@@ -137,6 +142,13 @@ export function getDefaultStaticProperties(mapColors = []) {
export function getDefaultDynamicProperties() {
return {
+ [VECTOR_STYLES.ICON]: {
+ type: VectorStyle.STYLE_TYPE.DYNAMIC,
+ options: {
+ iconPaletteId: 'filledShapes',
+ field: undefined,
+ },
+ },
[VECTOR_STYLES.FILL_COLOR]: {
type: VectorStyle.STYLE_TYPE.DYNAMIC,
options: {
diff --git a/x-pack/legacy/plugins/siem/public/components/embeddables/__mocks__/mock.ts b/x-pack/legacy/plugins/siem/public/components/embeddables/__mocks__/mock.ts
index 1f06385e12c94..7834bb4511dc6 100644
--- a/x-pack/legacy/plugins/siem/public/components/embeddables/__mocks__/mock.ts
+++ b/x-pack/legacy/plugins/siem/public/components/embeddables/__mocks__/mock.ts
@@ -51,8 +51,12 @@ export const mockSourceLayer = {
type: 'STATIC',
options: { orientation: 0 },
},
- symbol: {
- options: { symbolizeAs: 'icon', symbolId: 'home' },
+ symbolizeAs: {
+ options: { value: 'icon' },
+ },
+ icon: {
+ type: 'STATIC',
+ options: { value: 'home' },
},
},
},
@@ -103,8 +107,12 @@ export const mockDestinationLayer = {
type: 'STATIC',
options: { orientation: 0 },
},
- symbol: {
- options: { symbolizeAs: 'icon', symbolId: 'marker' },
+ symbolizeAs: {
+ options: { value: 'icon' },
+ },
+ icon: {
+ type: 'STATIC',
+ options: { value: 'marker' },
},
},
},
@@ -154,8 +162,12 @@ export const mockClientLayer = {
type: 'STATIC',
options: { orientation: 0 },
},
- symbol: {
- options: { symbolizeAs: 'icon', symbolId: 'home' },
+ symbolizeAs: {
+ options: { value: 'icon' },
+ },
+ icon: {
+ type: 'STATIC',
+ options: { value: 'home' },
},
},
},
@@ -206,8 +218,12 @@ export const mockServerLayer = {
type: 'STATIC',
options: { orientation: 0 },
},
- symbol: {
- options: { symbolizeAs: 'icon', symbolId: 'marker' },
+ symbolizeAs: {
+ options: { value: 'icon' },
+ },
+ icon: {
+ type: 'STATIC',
+ options: { value: 'marker' },
},
},
},
@@ -266,8 +282,12 @@ export const mockLineLayer = {
type: 'STATIC',
options: { orientation: 0 },
},
- symbol: {
- options: { symbolizeAs: 'circle', symbolId: 'airfield' },
+ symbolizeAs: {
+ options: { value: 'icon' },
+ },
+ icon: {
+ type: 'STATIC',
+ options: { value: 'airfield' },
},
},
},
@@ -326,8 +346,12 @@ export const mockClientServerLineLayer = {
type: 'STATIC',
options: { orientation: 0 },
},
- symbol: {
- options: { symbolizeAs: 'circle', symbolId: 'airfield' },
+ symbolizeAs: {
+ options: { value: 'icon' },
+ },
+ icon: {
+ type: 'STATIC',
+ options: { value: 'airfield' },
},
},
},
diff --git a/x-pack/legacy/plugins/siem/public/components/embeddables/map_config.ts b/x-pack/legacy/plugins/siem/public/components/embeddables/map_config.ts
index f34376421e9b2..e8b267122f86f 100644
--- a/x-pack/legacy/plugins/siem/public/components/embeddables/map_config.ts
+++ b/x-pack/legacy/plugins/siem/public/components/embeddables/map_config.ts
@@ -164,8 +164,12 @@ export const getSourceLayer = (
type: 'STATIC',
options: { orientation: 0 },
},
- symbol: {
- options: { symbolizeAs: 'icon', symbolId: 'home' },
+ symbolizeAs: {
+ options: { value: 'icon' },
+ },
+ icon: {
+ type: 'STATIC',
+ options: { value: 'home' },
},
},
},
@@ -223,8 +227,12 @@ export const getDestinationLayer = (
type: 'STATIC',
options: { orientation: 0 },
},
- symbol: {
- options: { symbolizeAs: 'icon', symbolId: 'marker' },
+ symbolizeAs: {
+ options: { value: 'icon' },
+ },
+ icon: {
+ type: 'STATIC',
+ options: { value: 'marker' },
},
},
},
@@ -303,8 +311,12 @@ export const getLineLayer = (
type: 'STATIC',
options: { orientation: 0 },
},
- symbol: {
- options: { symbolizeAs: 'circle', symbolId: 'airfield' },
+ symbolizeAs: {
+ options: { value: 'icon' },
+ },
+ icon: {
+ type: 'STATIC',
+ options: { value: 'airfield' },
},
},
},
diff --git a/x-pack/test/api_integration/apis/maps/migrations.js b/x-pack/test/api_integration/apis/maps/migrations.js
index fea36f7ceea74..c4587530e160b 100644
--- a/x-pack/test/api_integration/apis/maps/migrations.js
+++ b/x-pack/test/api_integration/apis/maps/migrations.js
@@ -41,7 +41,7 @@ export default function({ getService }) {
type: 'index-pattern',
},
]);
- expect(resp.body.migrationVersion).to.eql({ map: '7.6.0' });
+ expect(resp.body.migrationVersion).to.eql({ map: '7.7.0' });
expect(resp.body.attributes.layerListJSON.includes('indexPatternRefName')).to.be(true);
});
});