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

Mapserver Groups #6874

Merged
merged 5 commits into from
Sep 8, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
- Fixed broken point dragging interaction for user drawing in 3D mode.
- Fixed rectangle drawing in 2D mode.
- Added EPSG:7855 to `Proj4Definitions`.
- Fix multi level nesting in ArcGIS Mapserver.
- [The next improvement]

#### 8.3.2 - 2023-08-11

Expand Down
28 changes: 22 additions & 6 deletions lib/Models/Catalog/Esri/ArcGisMapServerCatalogGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ export class MapServerStratum extends LoadableStratum(
) as this;
}

/** returns an array of the parent layers id's */
findParentLayers(layerId: number): number[] {
sixlighthouses marked this conversation as resolved.
Show resolved Hide resolved
const parentLayerIds: number[] = [];
const layer = this.layers.find((l) => l.id === layerId);
if (layer !== undefined) {
parentLayerIds.push(layer.id);
if (layer.parentLayerId !== -1) {
parentLayerIds.push(...this.findParentLayers(layer.parentLayerId));
}
}
return parentLayerIds;
}

@computed get name() {
if (
this._mapServer.documentInfo &&
Expand Down Expand Up @@ -189,12 +202,14 @@ export class MapServerStratum extends LoadableStratum(
return;
}
const id = this._catalogGroup.uniqueId;
//if parent layer is not -1 then this is sublayer so we define its ID like that
const layerId =
id +
"/" +
(layer.parentLayerId !== -1 ? layer.parentLayerId + "/" : "") +
layer.id;
let layerId = id + "/" + layer.id;

const parentLayers = this.findParentLayers(layer.id);

if (parentLayers.length > 0) {
layerId = id + "/" + parentLayers.reverse().join("/");
}

let model: ArcGisMapServerCatalogItem | ArcGisMapServerCatalogGroup;

// Treat layer as a group if it has type "Group Layer" - or has subLayers
Expand All @@ -220,6 +235,7 @@ export class MapServerStratum extends LoadableStratum(
ArcGisMapServerCatalogItem,
layerId
);

if (existingModel === undefined) {
model = new ArcGisMapServerCatalogItem(
layerId,
Expand Down
1 change: 1 addition & 0 deletions lib/ReactViews/DataCatalog/DataCatalogGroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class DataCatalogGroup extends React.Component {
render() {
const group = this.props.group;
const { t } = this.props;

return (
<CatalogGroup
text={this.getNameOrPrettyUrl()}
Expand Down
Loading