From f23f4549dcf506bd802581a943536e514e2be99c Mon Sep 17 00:00:00 2001
From: "stuart.woodman"
{{onlineResource.type}}: - {{onlineResource.type}} GetCapabilities Info + {{onlineResource.type}} GetCapabilities Info + {{onlineResource.type}} Info
diff --git a/src/app/menupanel/common/infopanel/subpanel/subpanel.component.ts b/src/app/menupanel/common/infopanel/subpanel/subpanel.component.ts
index 524f0f330..9ff897dcf 100644
--- a/src/app/menupanel/common/infopanel/subpanel/subpanel.component.ts
+++ b/src/app/menupanel/common/infopanel/subpanel/subpanel.component.ts
@@ -1,11 +1,10 @@
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
-import { CSWRecordModel } from '@auscope/portal-core-ui';
+import { CSWRecordModel, OnlineResourceModel } from '@auscope/portal-core-ui';
import { LayerModel } from '@auscope/portal-core-ui';
import { LegendService } from '@auscope/portal-core-ui';
import { UtilitiesService } from '@auscope/portal-core-ui';
-
@Component({
selector: 'info-sub-panel',
templateUrl: './subpanel.component.html',
@@ -37,18 +36,16 @@ export class InfoPanelSubComponent implements OnChanges {
}
}
-
/**
* Remove unwanted and empty strings from metadata constraints fields
* @param constraints string array of contraints
* @return string constraints in string format
*/
public cleanConstraints(constraints: string[]) {
-
let outStr = "";
for (const conStr of constraints) {
- if (conStr.indexOf("no conditions apply") < 0 &&
- conStr.indexOf("#MD_RestrictionCode") < 0 && conStr.trim() != "") {
+ if (conStr.indexOf("no conditions apply") < 0 &&
+ conStr.indexOf("#MD_RestrictionCode") < 0 && conStr.trim() !== "") {
outStr += conStr.trim() + ", ";
}
}
@@ -56,6 +53,33 @@ export class InfoPanelSubComponent implements OnChanges {
return outStr.replace(/, $/, "");
}
+ /**
+ * Create a WMS/WFS GetCapabilities URL from the provided OnlineResource
+ *
+ * @param onlineResource the OnlineResourceModel
+ * @returns a WMS or WFS GetCapabilities URL as a string
+ */
+ public onlineResourceGetCapabilitiesUrl(onlineResource: OnlineResourceModel): string {
+ // Determine base path, append mandatory service and request parameters
+ const paramIndex = onlineResource.url.indexOf('?');
+ let path = paramIndex !== -1 ? onlineResource.url.substr(0, onlineResource.url.indexOf('?')) : onlineResource.url;
+ path += '?service=' + onlineResource.type + '&request=GetCapabilities';
+ // Apend any other non-service or request parameters to path
+ if (paramIndex !== -1 && onlineResource.url.length > paramIndex + 1) {
+ const paramString = onlineResource.url.substr(paramIndex + 1, onlineResource.url.length);
+ const paramArray = paramString.split('&');
+ for (const keyValueString of paramArray) {
+ const keyValue = keyValueString.split('=');
+ if (keyValue.length === 2) {
+ if (keyValue[0].toLowerCase() !== 'service' && keyValue[0].toLowerCase() !== 'request') {
+ path += keyValue[0] + '=' + keyValue[1];
+ }
+ }
+ }
+ }
+ return path;
+ }
+
/**
* Gets called by Angular framework upon any changes
* @param changes object which holds the changes
From e61621620c794cca560bf5e08fd72d975c665662 Mon Sep 17 00:00:00 2001
From: "stuart.woodman"
{{onlineResource.type}}: - {{onlineResource.type}} GetCapabilities Info - {{onlineResource.type}} Info + {{onlineResource.type}} GetCapabilities Info + {{onlineResource.type}} Info
diff --git a/src/app/menupanel/common/infopanel/subpanel/subpanel.component.ts b/src/app/menupanel/common/infopanel/subpanel/subpanel.component.ts
index 9ff897dcf..0e52297b8 100644
--- a/src/app/menupanel/common/infopanel/subpanel/subpanel.component.ts
+++ b/src/app/menupanel/common/infopanel/subpanel/subpanel.component.ts
@@ -54,19 +54,29 @@ export class InfoPanelSubComponent implements OnChanges {
}
/**
- * Create a WMS/WFS GetCapabilities URL from the provided OnlineResource
+ * Is the OnlineResourceModel of a type that supports GetCapabilities?
*
* @param onlineResource the OnlineResourceModel
- * @returns a WMS or WFS GetCapabilities URL as a string
+ * @returns true if OnlineResource is of type WMS, WFS or WCS
+ */
+ public isGetCapabilitiesType(onlineResource: OnlineResourceModel): boolean {
+ return onlineResource.type === 'WMS' || onlineResource.type === 'WFS' || onlineResource.type === 'WCS';
+ }
+
+ /**
+ * Create a WMS/WFS/WCS GetCapabilities URL from the provided OnlineResource
+ *
+ * @param onlineResource the OnlineResourceModel
+ * @returns a WMS, WFS or WCS GetCapabilities URL as a string
*/
public onlineResourceGetCapabilitiesUrl(onlineResource: OnlineResourceModel): string {
// Determine base path, append mandatory service and request parameters
const paramIndex = onlineResource.url.indexOf('?');
- let path = paramIndex !== -1 ? onlineResource.url.substr(0, onlineResource.url.indexOf('?')) : onlineResource.url;
+ let path = paramIndex !== -1 ? onlineResource.url.substring(0, onlineResource.url.indexOf('?')) : onlineResource.url;
path += '?service=' + onlineResource.type + '&request=GetCapabilities';
// Apend any other non-service or request parameters to path
if (paramIndex !== -1 && onlineResource.url.length > paramIndex + 1) {
- const paramString = onlineResource.url.substr(paramIndex + 1, onlineResource.url.length);
+ const paramString = onlineResource.url.substring(paramIndex + 1, onlineResource.url.length);
const paramArray = paramString.split('&');
for (const keyValueString of paramArray) {
const keyValue = keyValueString.split('=');
From e05a63d5c0deced01372a2998f8b7836ae706892 Mon Sep 17 00:00:00 2001
From: "stuart.woodman"