Skip to content

Commit

Permalink
fix(context/vector/map/measure): various fix (#934)
Browse files Browse the repository at this point in the history
* fix(context/vector): fix wfs layer in context / vector layer source

* fix(map): method to get layer by ol_uid

* feat(measure): set the layer exportable

Co-authored-by: Pierre-Etienne Lord <[email protected]>
  • Loading branch information
PhilippeLafreniere18 and pelord authored Nov 15, 2021
1 parent 33543e5 commit 227d5e8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion demo/src/app/geo/hover/hover.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class AppHoverComponent {
featureTypes: 'CASERNE',
fieldNameGeometry: 'geometry',
maxFeatures: 10000,
version: '3.0.0',
version: '2.0.0',
outputFormat: undefined,
outputFormatDownload: 'shp'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ export class ContextService {
)
.sort((a, b) => a.zIndex - b.zIndex);
} else {
layers = igoMap.layers$.getValue().sort((a, b) => a.zIndex - b.zIndex);
layers = igoMap.layers$.getValue().filter(lay => !lay.id.includes('WfsWorkspaceTableDest')).sort((a, b) => a.zIndex - b.zIndex);
}

let i = 0;
Expand Down Expand Up @@ -569,13 +569,14 @@ export class ContextService {
}
);
} else {
// features = writer.writeFeatures(
// layer.ol.getSource().getFeatures(),
// {
// dataProjection: 'EPSG:4326',
// featureProjection: 'EPSG:3857'
// }
// );
const source = layer.ol.getSource() as any;
features = writer.writeFeatures(
source.getFeatures(),
{
dataProjection: 'EPSG:4326',
featureProjection: 'EPSG:3857'
}
);
}
features = JSON.parse(features);
features.name = layer.options.title;
Expand Down
3 changes: 0 additions & 3 deletions packages/geo/src/lib/layer/shared/layers/vector-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ export class VectorLayer extends Layer {
}

const vector = new olLayerVector(olOptions);
// const vectorSource = (this.dataSource instanceof ClusterDataSource
// ? vector.getSource().
// : vector.getSource()) as olSourceVector<OlGeometry>;
const vectorSource = vector.getSource() as olSourceVector<OlGeometry>;
const url = vectorSource.getUrl();
if (url) {
Expand Down
2 changes: 1 addition & 1 deletion packages/geo/src/lib/map/shared/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export class IgoMap {

getLayerByOlUId(olUId: string): Layer {
return this.layers.find(
(layer: Layer) => layer.ol.get('ol_uid') && layer.ol.get('ol_uid') === olUId
(layer: Layer) => (layer.ol as any).ol_uid && (layer.ol as any).ol_uid === olUId
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ export class MeasurerComponent implements OnInit, OnDestroy {
source: new FeatureDataSource(),
style: createMeasureLayerStyle(),
showInLayerList: true,
exportable: false,
exportable: true,
browsable: false,
workspace: { enabled: false }
});
Expand Down

0 comments on commit 227d5e8

Please sign in to comment.