Skip to content

Commit

Permalink
[Maps] fix IVectorLayer.getStyle typing
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Aug 24, 2020
1 parent 9dfcde2 commit 784862c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
import { ILayer } from '../layer';
import { IJoin } from '../../joins/join';
import { IVectorStyle } from '../../styles/vector/vector_style';
import { HeatmapStyle } from '../../styles/heatmap/heatmap_style';
import { IField } from '../../fields/field';
import { DataRequestContext } from '../../../actions';
import { ITooltipProperty } from '../../tooltips/tooltip_property';
Expand All @@ -32,7 +33,7 @@ export interface IVectorLayer extends ILayer {
getJoins(): IJoin[];
getValidJoins(): IJoin[];
getSource(): IVectorSource;
getStyle(): IVectorStyle;
getStyle(): IVectorStyle | HeatmapStyle;
getFeatureById(id: string | number): Feature | null;
getPropertiesForTooltip(properties: GeoJsonProperties): Promise<ITooltipProperty[]>;
hasJoins(): boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { AbstractStyleProperty, IStyleProperty } from './style_property';
import { DEFAULT_SIGMA } from '../vector_style_defaults';
import {
FIELD_ORIGIN,
LAYER_STYLE_TYPE,
MB_LOOKUP_FUNCTION,
SOURCE_META_DATA_REQUEST_ID,
STYLE_TYPE,
Expand All @@ -27,6 +28,7 @@ import {
import { IField } from '../../../fields/field';
import { IVectorLayer } from '../../../layers/vector_layer/vector_layer';
import { IJoin } from '../../../joins/join';
import { IVectorStyle } from '../vector_style';

export interface IDynamicStyleProperty<T> extends IStyleProperty<T> {
getFieldMetaOptions(): FieldMetaOptions;
Expand Down Expand Up @@ -89,7 +91,10 @@ export class DynamicStyleProperty<T> extends AbstractStyleProperty<T>

getRangeFieldMeta() {
const style = this._layer.getStyle();
const styleMeta = style.getStyleMeta();
if (style.getType() !== LAYER_STYLE_TYPE.VECTOR) {
return null;
}
const styleMeta = (style as IVectorStyle).getStyleMeta();
const fieldName = this.getFieldName();
const rangeFieldMetaFromLocalFeatures = styleMeta.getRangeFieldMetaDescriptor(fieldName);

Expand All @@ -114,7 +119,10 @@ export class DynamicStyleProperty<T> extends AbstractStyleProperty<T>

getCategoryFieldMeta() {
const style = this._layer.getStyle();
const styleMeta = style.getStyleMeta();
if (style.getType() !== LAYER_STYLE_TYPE.VECTOR) {
return null;
}
const styleMeta = (style as IVectorStyle).getStyleMeta();
const fieldName = this.getFieldName();
const categoryFieldMetaFromLocalFeatures = styleMeta.getCategoryFieldMetaDescriptor(fieldName);

Expand Down

0 comments on commit 784862c

Please sign in to comment.