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

testing - another rcs recreation demo - NO PULLIN' #4077

Closed
wants to merge 1 commit into from
Closed
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: 1 addition & 1 deletion packages/ramp-core/features/epsg/epsg.feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default {
}

return new Promise((resolve, reject) => {
$.get((location.protocol === 'https:' ? 'https:' : 'http:') + `//epsg.io/${matcher[1]}.proj4`)
$.get((location.protocol === 'https:' ? 'https:' : 'https:') + `//epsg.io/${matcher[1]}.proj4`)
.done(resolve)
.fail(reject);
});
Expand Down
38 changes: 36 additions & 2 deletions packages/ramp-core/src/app/core/config.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,15 @@ function configService($q, $rootElement, $http, $translate, events, gapiService,
return this.config;
}

/*
if (typeof this.rcsEndpoint === 'undefined') {
throw new Error(
'RCS keys provided with no endpoint. Set on HTML element through rv-service-endpoint property'
);
}

const endpoint = this.rcsEndpoint.endsWith('/') ? this.rcsEndpoint : this.rcsEndpoint + '/';
*/
const results = {};
let rcsLang = this.language.split('-')[0];

Expand All @@ -155,10 +157,42 @@ function configService($q, $rootElement, $http, $translate, events, gapiService,
rcsLang = 'en';
}

return $http.get(`${endpoint}v2/docs/${rcsLang}/${this._rcsKeys.join(',')}`).then(
(resp) => {
// return $http.get(`${endpoint}v2/docs/${rcsLang}/${this._rcsKeys.join(',')}`).then(
// (resp) => {

return new Promise((fakeResolve) => {
setTimeout(() => {
// mimic RCS waiting for a return
fakeResolve();
}, 500);
}).then(
() => {
const result = [];

// pretend we got data back
var resp = {
data: [
{
layers: [
{
id: 'rcs.fake1.en',
url: 'https://section917.canadacentral.cloudapp.azure.com/arcgis/rest/services/TestData/EcoAction/MapServer/6',
layerType: 'esriFeature',
},
],
},
{
layers: [
{
id: 'rcs.fake2.en',
url: 'https://section917.canadacentral.cloudapp.azure.com/arcgis/rest/services/TestData/EcoAction/MapServer/8',
layerType: 'esriFeature',
},
],
},
],
};

// there is an array of layer configs in resp.data.
// moosh them into one single layer array on the result
// FIXME may want to consider a more flexible approach than just assuming RCS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"version": "2.0",
"language": "en",
"services": {
"corsEverywhere": true,
"proxyUrl": "https://maps.canada.ca/wmsproxy/ws/wmsproxy/executeFromProxy",
"exportMapUrl": "https://section917.canadacentral.cloudapp.azure.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task",
"export": {
Expand Down
2 changes: 1 addition & 1 deletion packages/ramp-core/src/content/samples/features/epsg.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ window.customEPSG = {
}

return new Promise(function (resolve, reject) {
$.get('http://epsg.io/' + matcher[1] + '.proj4')
$.get('https://epsg.io/' + matcher[1] + '.proj4')
.done(resolve)
.fail(reject);
});
Expand Down
13 changes: 13 additions & 0 deletions packages/ramp-core/src/content/samples/index-fgp-en.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,12 @@
const baseUrl = window.location.href.split('?')[0] + '?keys={RV_LAYER_LIST}';
RAMP.mapAdded.subscribe(function (mapi) {
backToCart.setCatalogueUrl('fgpmap', baseUrl);

// listener to layers being added.
console.log('adding layer added listener now');
mapi.layers.layerAdded.subscribe(mylayer => {
console.log('Saw Layer Added', mylayer);
})
})

function queryStringToJSON(q) {
Expand All @@ -567,6 +573,13 @@
// console.log(bookmark);
RV.getMap('fgpmap').initialBookmark(bookmark);
}

// RCS fake test
setTimeout(()=>{
console.log('requesting rcs');
RV.getMap('fgpmap').loadRcsLayers(['fake1', 'fake2']);
}, 1000);

// Toggle language
function toggleLanguage(){
RV.getMap('fgpmap').getBookmark().then(function (bookmark) {
Expand Down
Loading