Skip to content

Commit

Permalink
feat(workspace*) Wks color selection is now the same as queryOverlayS…
Browse files Browse the repository at this point in the history
…tyle.selection config (#1045)
  • Loading branch information
josee666 authored and cbourget committed Mar 21, 2023
1 parent 9aec494 commit b70d62d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ import { VectorLayer } from '../../layer';
import { GeoWorkspaceOptions } from '../../layer/shared/layers/layer.interface';
import { IgoMap } from '../../map';
import { SourceFieldsOptionsParams, FeatureDataSource, RelationOptions } from '../../datasource';
import { getCommonVectorSelectedStyle} from '../../utils';

import { FeatureWorkspace } from './feature-workspace';
import { skipWhile, take } from 'rxjs/operators';
import { StorageService } from '@igo2/core';
import { ConfigService, StorageService } from '@igo2/core';

import olFeature from 'ol/Feature';
import type { default as OlGeometry } from 'ol/geom/Geometry';
Expand All @@ -42,7 +43,7 @@ export class FeatureWorkspaceService {

public ws$ = new BehaviorSubject<string>(undefined);

constructor(private storageService: StorageService) {}
constructor(private storageService: StorageService, private configService: ConfigService) {}

createWorkspace(layer: VectorLayer, map: IgoMap): FeatureWorkspace {
if (layer.options.workspace?.enabled === false || layer.dataSource.options.edition) {
Expand Down Expand Up @@ -81,11 +82,15 @@ export class FeatureWorkspaceService {
const inMapExtentStrategy = new FeatureStoreInMapExtentStrategy({});
const inMapResolutionStrategy = new FeatureStoreInMapResolutionStrategy({});
const selectedRecordStrategy = new EntityStoreFilterSelectionStrategy({});
const confQueryOverlayStyle= this.configService.getConfig('queryOverlayStyle');

const selectionStrategy = new FeatureStoreSelectionStrategy({
layer: new VectorLayer({
zIndex: 300,
source: new FeatureDataSource(),
style: undefined,
style: (feature) => {
return getCommonVectorSelectedStyle(Object.assign({}, {feature}, confQueryOverlayStyle.selection || {}));
},
showInLayerList: false,
exportable: false,
browsable: false
Expand Down
12 changes: 8 additions & 4 deletions packages/geo/src/lib/workspace/shared/wfs-workspace.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import { VectorLayer } from '../../layer';
import { GeoWorkspaceOptions } from '../../layer/shared/layers/layer.interface';
import { IgoMap } from '../../map';
import { SourceFieldsOptionsParams, FeatureDataSource, RelationOptions } from '../../datasource';
import { getCommonVectorSelectedStyle} from '../../utils';

import { WfsWorkspace } from './wfs-workspace';
import { skipWhile, take } from 'rxjs/operators';
import { StorageService } from '@igo2/core';
import { StorageService, ConfigService } from '@igo2/core';
import olFeature from 'ol/Feature';
import type { default as OlGeometry } from 'ol/geom/Geometry';

@Injectable({
providedIn: 'root'
})
Expand All @@ -41,7 +41,7 @@ export class WfsWorkspaceService {

public ws$ = new BehaviorSubject<string>(undefined);

constructor(private storageService: StorageService) {}
constructor(private storageService: StorageService, private configService: ConfigService) {}

createWorkspace(layer: VectorLayer, map: IgoMap): WfsWorkspace {
if (layer.options.workspace?.enabled === false || layer.dataSource.options.edition) {
Expand Down Expand Up @@ -78,11 +78,15 @@ export class WfsWorkspaceService {
const inMapExtentStrategy = new FeatureStoreInMapExtentStrategy({});
const inMapResolutionStrategy = new FeatureStoreInMapResolutionStrategy({});
const selectedRecordStrategy = new EntityStoreFilterSelectionStrategy({});
const confQueryOverlayStyle= this.configService.getConfig('queryOverlayStyle');

const selectionStrategy = new FeatureStoreSelectionStrategy({
layer: new VectorLayer({
zIndex: 300,
source: new FeatureDataSource(),
style: undefined,
style: (feature) => {
return getCommonVectorSelectedStyle(Object.assign({}, {feature}, confQueryOverlayStyle.selection || {}));
},
showInLayerList: false,
exportable: false,
browsable: false
Expand Down
11 changes: 8 additions & 3 deletions packages/geo/src/lib/workspace/shared/wms-workspace.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
EntityStoreStrategyFuncOptions,
EntityTableColumnRenderer,
EntityTableTemplate } from '@igo2/common';
import { StorageService } from '@igo2/core';
import { StorageService, ConfigService } from '@igo2/core';
import { skipWhile, take } from 'rxjs/operators';
import { RelationOptions, SourceFieldsOptionsParams, WMSDataSource } from '../../datasource';
import { FeatureDataSource } from '../../datasource/shared/datasources/feature-datasource';
Expand All @@ -28,6 +28,7 @@ import { GeoWorkspaceOptions } from '../../layer/shared/layers/layer.interface';
import { IgoMap } from '../../map';
import { QueryableDataSourceOptions } from '../../query/shared/query.interfaces';
import { WfsWorkspace } from './wfs-workspace';
import { getCommonVectorSelectedStyle} from '../../utils';

import olFeature from 'ol/Feature';
import type { default as OlGeometry } from 'ol/geom/Geometry';
Expand All @@ -43,7 +44,7 @@ export class WmsWorkspaceService {

public ws$ = new BehaviorSubject<string>(undefined);

constructor(private layerService: LayerService, private storageService: StorageService) { }
constructor(private layerService: LayerService, private storageService: StorageService, private configService: ConfigService) { }

createWorkspace(layer: ImageLayer, map: IgoMap): WfsWorkspace {
if (
Expand Down Expand Up @@ -179,11 +180,15 @@ export class WmsWorkspaceService {
const inMapExtentStrategy = new FeatureStoreInMapExtentStrategy({});
const inMapResolutionStrategy = new FeatureStoreInMapResolutionStrategy({});
const selectedRecordStrategy = new EntityStoreFilterSelectionStrategy({});
const confQueryOverlayStyle= this.configService.getConfig('queryOverlayStyle');

const selectionStrategy = new FeatureStoreSelectionStrategy({
layer: new VectorLayer({
zIndex: 300,
source: new FeatureDataSource(),
style: undefined,
style: (feature) => {
return getCommonVectorSelectedStyle(Object.assign({}, {feature}, confQueryOverlayStyle.selection || {}));
},
showInLayerList: false,
exportable: false,
browsable: false
Expand Down

0 comments on commit b70d62d

Please sign in to comment.