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

mapfish-print-component #6

Merged
merged 98 commits into from Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
1e8b5cf
create print request helper
Aug 14, 2019
8006a06
need to resolve: Uncaught TypeError: Converting circular structure to…
Aug 14, 2019
eae141a
get dev branch
Aug 15, 2019
dabb774
Merge branch 'develop' of https://github.com/SpatialDNA/SimcoeCountyW…
Aug 15, 2019
2cddb3f
resolved error (coverting circular structure to json), need to make w…
Aug 15, 2019
f7c12e9
parsing map layer
Aug 16, 2019
fa541b6
testing parent props for printrequest
Aug 16, 2019
2f48991
pull down changes
Aug 17, 2019
0c1dc83
started to add top levele props to share state
Aug 17, 2019
11820a7
added custom window property to attach active/visible map service pro…
Aug 17, 2019
5e4f357
added service to set property to expose urls
Aug 18, 2019
7965836
parsing data from window map layer based on service url type
Aug 18, 2019
ee2006d
added service to layer props to expose service url
Aug 19, 2019
b4a4743
updater print request helper, need to complete scalebar, legend and t…
Aug 19, 2019
6b220db
added mymaps custom props
Aug 19, 2019
a203e74
updated window.map layer properties to expose bothe service names and…
Aug 22, 2019
48802b8
added temp legend data for testing
Aug 22, 2019
3df4e56
added styling for custom layers
Aug 22, 2019
51ed91d
updated map center coords
Aug 22, 2019
27f7db1
now able to parse and view tiled images for tilelayers and grouplayers
Aug 23, 2019
73d2a53
added basmap json config files
Aug 28, 2019
403cfee
added service type and name to allow for basemap configs to be select…
Aug 28, 2019
4a64ddf
added filters for basemap tilelayers and image layers based on select…
Aug 28, 2019
ed9fa59
removed exposed service type, utilizing objectprototyp constuctor nam…
Aug 28, 2019
6214957
using object prototype constuctor name to grab visible baselayers
Aug 28, 2019
b242b9b
local commit
Aug 28, 2019
2f0f1e3
wmts configs added to render basemaps
Aug 28, 2019
6a2958f
updated get layers function
Aug 28, 2019
e87cb2b
updated extraction for print request map layers
Aug 29, 2019
6ef9da5
added legend layer to layer extraction method
Aug 29, 2019
9368ee7
added transparent property to config
Aug 30, 2019
e598481
fixed my map layer coordinates
Aug 30, 2019
c2c332e
pull down latest
Aug 30, 2019
3664312
Merge branch 'develop' of https://github.com/SpatialDNA/SimcoeCountyW…
Aug 30, 2019
6586f4e
updated basemap configs
Aug 30, 2019
6e39398
working on dynamic scale
Aug 30, 2019
ca42bb2
added current map scale and map center values
Sep 1, 2019
50662d6
updated world imagery config
Sep 2, 2019
6ecff02
image icon layers inserted in after geoJson layer
Sep 2, 2019
5780e39
basemap layers sort with streets_cache at top
Sep 3, 2019
4e1fd56
added ortho 2018 config.json to basemap entries
Sep 3, 2019
804f48c
updated maptitle bug
Sep 4, 2019
a822a4d
added polling to print server for document
Sep 4, 2019
ffe8241
overviewMap bug resolved
Sep 5, 2019
4705ea8
added geoJson styling
Sep 6, 2019
623c3c6
started geoJson feature lable
Sep 6, 2019
c47d061
aded xml parser for basemaps
Sep 9, 2019
ee6758b
clean up print component architecture
Sep 9, 2019
cea4c5c
added config json files for all basemaps
Sep 9, 2019
a281db3
bug on line in configuretileLayer method
Sep 9, 2019
7cb19e0
fixed url bug in basemap urls
Sep 9, 2019
d9302e4
fixed loadWMTSConfig method url bug
Sep 10, 2019
ef7e7de
testing changes
Sep 10, 2019
4ecb8a0
testing commits
Sep 10, 2019
0da1650
updated configTilayer Method
Sep 10, 2019
9076977
working tranforming basemap config to wmts config
Sep 12, 2019
7af62d8
updating wmts dynamic config
Sep 24, 2019
50b5f5f
fixed name extractor bug
Sep 26, 2019
465b9d0
setup method to dynamically build wmts object
Sep 26, 2019
c245e4e
url implimentation
Sep 26, 2019
7dae2f9
implimented layer sorting feature
Sep 27, 2019
d4f0ba0
removed static wmts config files
Sep 27, 2019
cc07d24
implimented dynamic wmts config
Sep 28, 2019
d6b22c1
bug fix: promise resolved by using await Promise.all(Array) ;
Sep 28, 2019
86e4e85
break out independent methods to be testable
Sep 30, 2019
981af9b
code clean up for print request
Sep 30, 2019
5f8f996
unit tests form print component
Sep 30, 2019
6403d1e
updated print component with print data returned and fetch request fr…
Sep 30, 2019
6cb14fa
moved print requests to print component
Sep 30, 2019
551e7da
removed log util anomaly
Sep 30, 2019
7019e6c
updated print test to be sychronouns using async/await format
Sep 30, 2019
52f9fa4
updated utils test scripts
Sep 30, 2019
8bf0c37
utils unit tests passed
Sep 30, 2019
b8f5c51
bug fix for tilematix url and matrix size
Oct 1, 2019
8dad9f5
resolve labelling and line typ bug
Oct 1, 2019
a65354d
added string to hash color method , test passed
Oct 1, 2019
cb76f57
resolved line type bug
Oct 2, 2019
cc8be5c
resolving osm layer
Oct 2, 2019
4629722
need to fix map only and overview scale
Oct 2, 2019
6106cd0
print formats converted to mapfish standard
Oct 3, 2019
2608228
print format converted to mapfish standard
Oct 3, 2019
1152f71
working on prserve map extent
Oct 3, 2019
b82841f
preserve mapscale option implimented
Oct 5, 2019
c87b874
added dimension method for preserve extent
Oct 9, 2019
0456687
code clean up
Oct 10, 2019
37947e9
updated wmts config
Oct 16, 2019
bdbd212
updated origin url
Oct 16, 2019
8a31aca
updated tile url source to read from cached tile arrays
Oct 16, 2019
1faf36a
updated origin url
Oct 16, 2019
c9188ea
updated osm url, fixed geojson visibility bug
Oct 17, 2019
b80f450
code clean up, and osm tile server alternative
Oct 18, 2019
43a8610
update master with print component
Oct 18, 2019
851a28b
removed unwanted test files
Oct 18, 2019
34be168
added incoming package-lock.json file
Oct 18, 2019
3f0ae2c
updated my maps feature index store
Oct 18, 2019
7d5715b
code clean up: removed wmts fail on error
Oct 18, 2019
6b07a4c
bu fix: condition for isolating osm layer config
Oct 21, 2019
bcd2f22
reverted osm url to osm orinal server with comment on maptiler altern…
Oct 21, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 7 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/App.js
Expand Up @@ -9,6 +9,7 @@ ReactGA.initialize("UA-3104541-53");
ReactGA.pageview(window.location.pathname + window.location.search);

class App extends Component {

render() {
return (
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/map/BasemapSwitcher.jsx
Expand Up @@ -387,4 +387,4 @@ function importAllImages(r) {
let images = {};
r.keys().map((item, index) => (images[item.replace("./", "")] = r(item)));
return images;
}
}
67 changes: 59 additions & 8 deletions src/sidebar/components/tools/print/Print.jsx
Expand Up @@ -3,6 +3,7 @@ import Select from "react-select";
import Collapsible from 'react-collapsible';
import PanelComponent from "../../../PanelComponent";
import * as helpers from "../../../../helpers/helpers";
import * as printRequest from "./printRequest/printRequest";
import "./Print.css";

const termsOfUse = "This map, either in whole or in part, may not be reproduced without the written authority from" +
Expand Down Expand Up @@ -116,22 +117,72 @@ class Print extends Component {
this.props.onClose();
}

onDownloadButtonClick = evt => {
this.setState({isPrinting: true});
const { printSelectedOption} = this.state;
onDownloadButtonClick = async evt => {
//this.setState({isPrinting: true});
const {printSelectedOption} = this.state;
//console.log(this.state);

helpers.showMessage("Print", "Coming soon!");
// helpers.showMessage("Print", "Coming soon!");

// GET VISIBLE LAYERS
const printLayers = this.getPrintLayers();

// =======================
// SEND PRINT SERVER REQUEST HERE
// =======================

// ONCE PRINT IS COMPLETE (RETURNED FROM SERVER)
//helpers.showMessage("Print", "Your print has been downloaded");
//this.setState({isPrinting: false}); // THIS WILL RE-ENABLE BUTTON AND HIDE LOADING MSG
const printData = await printRequest.printRequest(printLayers, termsOfUse, this.state);
const printAppId = printData.layout.replace(/ /g,"_");
const outputFormat = printData.outputFormat;
// console.log(JSON.stringify(printData));
let interval = 5000;
let origin = "https://opengis.simcoe.ca";
let testOrigin = 'http://localhost:8080'
let encodedPrintRequest = encodeURIComponent(JSON.stringify(printData))
let url = `${origin}/print/print/${printAppId}/report.${outputFormat}`;

//check print Status and retreive print
let checkStatus = (response) => {

fetch(`${origin}${response.statusURL}`)
.then(data => data.json())
.then((data) => {
//console.log(data);
if ((data.done === true) && (data.status === "finished")) {
interval = 0
helpers.showMessage("Print", "Your print has been downloaded", "green", 10000);
window.open(`${origin}${data.downloadURL}`);
this.setState({isPrinting: false}); // THIS WILL RE-ENABLE BUTTON AND HIDE LOADING MSG
} else if ((data.done === false) && (data.status === "running")) {
setTimeout(() => {
if (interval < 30000) {
interval += 2500
checkStatus(response)
} else {
interval = 5000
checkStatus(response)
}
}, interval);
} else if ((data.done === true) && (data.status === "error")) {
helpers.showMessage("Print Failed", "please report issue to site admin", "red", 15000);
this.setState({isPrinting: false});
}
})
}
//post request to server and check status
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: encodedPrintRequest
})
.then(response => response.json())
.then((response) => {
this.setState({isPrinting: true});
checkStatus(response);
})
.catch(error => helpers.showMessage("Print Failed",`There has been a problem with your fetch operation: ${error.message}`, "red", 15000))

};

getPrintLayers = () => {
Expand Down
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" ?><note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>
@@ -0,0 +1,47 @@
import utils from "../utils";
import fs from "fs";

let xml_string = fs.readFileSync(__dirname +"/testXML.xml", "utf8");
let parser = new DOMParser();
let xml = parser.parseFromString(xml_string, "text/xml");

test('converts rgb', () => {
expect(utils.rgbToHex(91, 91, 91, 1)).toBe("#5b5b5b");
});

test('converts string to hash color', () => {
expect(utils.stringToColour("greenish")).toBe("#9bc63b");
});

test('converts xml to json data', () => {
expect(utils.xmlToJson(xml)).toEqual({
"note": {
"body": {
"#text": "Don't forget me this weekend!"
},
"from": {
"#text": "Jani"
},
"heading": {
"#text": "Reminder"
},
"to": {
"#text": "Tove"
}
}
});
});

test('remove null and undefined values from object', () => {
expect(utils.removeNull({
a: null,
b: 1,
c: undefined
})).toEqual({
b: 1
});
});

test('Extracts Service name from url', () => {
expect(utils.extractServiceName("https://ws.giscache.lrc.gov.on.ca/arcgis/rest/services/LIO_Cartographic/LIO_Topographic/MapServer")).toBe("LIO_Cartographic_LIO_Topographic");
});

This file was deleted.

31 changes: 0 additions & 31 deletions src/sidebar/components/tools/print/printRequest/_test_/utilTest.js

This file was deleted.