Driftsättning av ny version av gitlab 23 sep kl.06:30. Driftsättningen beräknas vara klart 07:30.

index.html 12.5 KB
Newer Older
Tomas Pettersson's avatar
Tomas Pettersson committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en" style="font-size: 100%">

<head>
    <title>stwkit - Demo</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta http-equiv='x-dns-prefetch-control' content='on'>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <meta name='copyright' content='STW'>
    <meta name='owner' content='STW'>

    <!-- bower:css -->
    <link rel="stylesheet" href="../bower_components/uikit-stw/css/uikit.almost-flat.min.css" />
    <link rel="stylesheet" href="../bower_components/uikit-stw/css/components/notify.almost-flat.min.css" />
    <link rel="stylesheet" href="../bower_components/uikit-stw/css/components/datepicker.almost-flat.min.css" />
    <link rel="stylesheet" href="../bower_components/uikit-stw/css/components/autocomplete.almost-flat.min.css" />
    <link rel="stylesheet" href="../bower_components/uikit-stw/css/components/accordion.almost-flat.min.css" />
    <link rel="stylesheet" href="../bower_components/leaflet/dist/leaflet.css" />
    <link rel="stylesheet" href="../bower_components/ion.rangeSlider/css/ion.rangeSlider.css" />
    <link rel="stylesheet" href="../bower_components/ion.rangeSlider/css/ion.rangeSlider.skinNice.css" />
    <link rel="stylesheet" href="../bower_components/leaflet-container-control/dist/leaflet-container-control.css" />
    <link rel="stylesheet" href="../bower_components/DataTables/media/css/jquery.dataTables.min.css" />
    <link rel="stylesheet" href="../bower_components/DataTables/media/css/dataTables.uikit.min.css" />
    <link rel="stylesheet" href="../bower_components/datatables.net-select-dt/css/select.dataTables.css" />
    <link rel="stylesheet" href="../bower_components/leaflet.draw/dist/leaflet.draw.css" />
    <link rel="stylesheet" href="../bower_components/leaflet-coordinates-control/dist/leaflet-coordinates-control.css" />
    <link rel="stylesheet" href="../bower_components/leaflet-forcing-boundary/dist/leaflet-forcing-boundary.css" />
    <link rel="stylesheet" href="../bower_components/intro.js/introjs.css" />
    <link rel="stylesheet" href="../src/components/cards.css" />
    <!-- endbower -->
</head>

<body>
    <div id="map" style="position:absolute; top:0; bottom:0; left:0;right:0"></div>

    <!-- bower:js -->
    <script src="../bower_components/jquery/dist/jquery.js"></script>
    <script src="../bower_components/uikit-stw/js/uikit.js"></script>
    <script src="../bower_components/uikit-stw/js/components/notify.min.js"></script>
    <script src="../bower_components/uikit-stw/js/components/datepicker.min.js"></script>
    <script src="../bower_components/uikit-stw/js/components/timepicker.min.js"></script>
    <script src="../bower_components/uikit-stw/js/components/autocomplete.min.js"></script>
    <script src="../bower_components/uikit-stw/js/components/accordion.min.js"></script>
    <script src="../bower_components/leaflet/dist/leaflet-src.js"></script>
    <script src="../bower_components/reqwest/reqwest.js"></script>
    <script src="../bower_components/moment/moment.js"></script>
    <script src="../bower_components/ion.rangeSlider/js/ion.rangeSlider.min.js"></script>
    <script src="../bower_components/leaflet-container-control/dist/leaflet-container-control.js"></script>
    <script src="../bower_components/jquery.inputmask/dist/jquery.inputmask.bundle.js"></script>
    <script src="../bower_components/jquery-file-upload/js/vendor/jquery.ui.widget.js"></script>
    <script src="../bower_components/jquery-file-upload/js/jquery.iframe-transport.js"></script>
    <script src="../bower_components/jquery-file-upload/js/jquery.fileupload.js"></script>
    <script src="../bower_components/DataTables/media/js/jquery.dataTables.min.js"></script>
    <script src="../bower_components/DataTables/media/js/dataTables.uikit.min.js"></script>
    <script src="../bower_components/datatables.net/js/jquery.dataTables.js"></script>
    <script src="../bower_components/datatables.net-select/js/dataTables.select.js"></script>
    <script src="../bower_components/leaflet.draw/dist/leaflet.draw.js"></script>
    <script src="../bower_components/leaflet-coordinates-control/dist/leaflet-coordinates-control.js"></script>
    <script src="../bower_components/leaflet-forcing-boundary/dist/leaflet-forcing-boundary.js"></script>
    <script src="../bower_components/intro.js/intro.js"></script>
    <script src="../src/stwkit.js"></script>
    <script src="../src/components/cards.js"></script>
Tomas Pettersson's avatar
Tomas Pettersson committed
65
    <script src="../src/components/pleasewait.js"></script>
Tomas Pettersson's avatar
Tomas Pettersson committed
66 67 68 69
    <!-- endbower -->

    <script>

Tomas Pettersson's avatar
Tomas Pettersson committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87


		
		
		var map = L.map('map').setView([ 58.5, 19.0 ], 5);
		var osm = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
			maxZoom : 18,
			attribution : '&copy; <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors</a>'
		});
		map.addLayer(osm);
		
        var containerControl = new L.Control.Container({
            position: 'topright',
			collapse: true                     
        });
        map.addControl(containerControl);
        

Tomas Pettersson's avatar
Tomas Pettersson committed
88
        var language = 'en';
Tomas Pettersson's avatar
Tomas Pettersson committed
89 90 91
        var itracerLangData = {
        };

Tomas Pettersson's avatar
Tomas Pettersson committed
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
        var coordinatesLangData = {
            "tMarkerstart": "Click map to place point.",
            "tPolygonstart": "Hold left mouse button to draw polygon on map.",
            "tPolygoncont": "Hold left mouse button to draw polygon on map. Release button to finnish drawing.",
            "tPolygonend": "Release button to finnish drawing.",
            "tPolylinestart": "Hold left mouse button to draw line on map.",
            "tPolylinecont": "Hold left mouse button to draw line on map. Release button to finnish drawing.",
            "tPolylineend": "Release button to finnish drawing.",
            "tDraw": "Draw outlet on map. Use LEFT mouse button while drawing.",
            "tEdit": "Edit outlet shape",
            "tManual": "Enter coordinates manually",
            "tImport": "Import outlet as geojson file",
            "tClear": "Clear drawn shapes from map",
            "bManual": "Enter coordinates manually",
            "bDraw": "Free hand draw on map",
            "bImport": "Import GeoJson file",
            "bClear": "Clear map",
            "btClear": "Clear",
            "sAreaPoint": "Point",
            "sAreaPolyline": "Polyline",
            "sAreaPolygon": "Polygon",
            "sAreaMultiPoint": "MultiPoint",
            "sAreaMultiPolyline": "MultiPolyline",
            "sAreaMultiPolygon": "MultiPolygon",
            "tArea": "Select outlet type",
            "tLatitude": "Latitude",
            "tLatituderange": "range",
            "tLongitude": "Longitude",
            "tLongituderange": "rang",

            "rDDM": "Degrees Decimal Minutes ",
            "rDD": "Decimal Degrees",
            "bAdd": "Add",
            "bDel": "Del",
            "bCreate": "Create",
            "bEdit": "Edit",
            "bCancel": "Cancel",

            "cCoordinates": "Coordinates"
        };

        var langData = {
            "coordinates": coordinatesLangData
        };

137 138
        var forcingconfig = {
            "model": "GETM",
Tomas Pettersson's avatar
Tomas Pettersson committed
139
            "configuration": "NORDIC",
140
            "domain": "HELCOM"
Tomas Pettersson's avatar
Tomas Pettersson committed
141 142
        };        

Tomas Pettersson's avatar
Tomas Pettersson committed
143 144 145 146 147 148 149
        var guide = {
            "position" :[
            58.35725,
            11.41891
            ]
        };

Tomas Pettersson's avatar
Tomas Pettersson committed
150 151 152
        var domainname = "HELCOM";

        reqwest({
153
            url: "forcing/config"+STWkit.jsonToQueryString(forcingconfig),
Tomas Pettersson's avatar
Tomas Pettersson committed
154 155 156 157 158
            method: 'get',
            type: 'json',
            success: function (forcing) {
                var properties = {
                    "domain" : domainname, 
Tomas Pettersson's avatar
Tomas Pettersson committed
159
                    "guide" : guide,
Tomas Pettersson's avatar
Tomas Pettersson committed
160
                    "lang": language,
Tomas Pettersson's avatar
Tomas Pettersson committed
161
                    "langdata": langData,
162
                    "forcingmodel": forcingconfig.model,
Tomas Pettersson's avatar
Tomas Pettersson committed
163 164
                    calculationmode: true,
                    uncertainty: true
Tomas Pettersson's avatar
Tomas Pettersson committed
165
                };
166
                // if (forcing.features.length > 0) properties["forcing"] = forcing;
Tomas Pettersson's avatar
Tomas Pettersson committed
167 168

                class SimpleCardControl extends STWkit.CardControl {
Tomas Pettersson's avatar
Tomas Pettersson committed
169 170 171 172
                    constructor(options) {super(options);
                        this.type = 'objects';
                        this.subtype = 'instant';
                    }
Tomas Pettersson's avatar
Tomas Pettersson committed
173 174 175
                    setup(map) {
                        this.container = STWkit.DomUtil.create('div', +self.name+'-control');
                        this.accordionDiv = STWkit.DomUtil.create('div', 'uk-accordion', this.container);
176
                        var locationoptions = {};
Tomas Pettersson's avatar
Tomas Pettersson committed
177
                        var initials = 'fo';
Tomas Pettersson's avatar
Tomas Pettersson committed
178 179
                        var type = 'objects';
                        var subtype = 'instant';
Tomas Pettersson's avatar
Tomas Pettersson committed
180 181 182
                        locationoptions['single'] = true;
                        locationoptions['multiple'] = true;
                        locationoptions['line'] = true;
183 184 185
                        locationoptions['polygon'] = {};
                        locationoptions['polygon']['show'] = true;
                        // locationoptions['polygon']['name'] = 'Area';
Tomas Pettersson's avatar
Tomas Pettersson committed
186
                        locationoptions['circle'] = false;
Tomas Pettersson's avatar
Tomas Pettersson committed
187
                        locationoptions['domain'] = domainname;
Tomas Pettersson's avatar
Tomas Pettersson committed
188
                        locationoptions['guide'] = guide;
Tomas Pettersson's avatar
Tomas Pettersson committed
189
                        locationoptions['type'] = type;
Tomas Pettersson's avatar
Tomas Pettersson committed
190
                        locationoptions['subtype'] = subtype;
Tomas Pettersson's avatar
Tomas Pettersson committed
191
                        // locationoptions['outlettype'] = false;
192
                        locationoptions['initials'] = initials;
Tomas Pettersson's avatar
Tomas Pettersson committed
193
                        var locationid = 'locationCard';
194
                        this.cardMap[locationid] = new STWkit.LocationCard(locationid, 'Specify location', this.accordionDiv, this.lang, this.langData, map, this.forcing, locationoptions);
Tomas Pettersson's avatar
Tomas Pettersson committed
195
                        this.cardMap[locationid].show();
196
                        var periodoptions = {};
Tomas Pettersson's avatar
Tomas Pettersson committed
197
                        periodoptions['domain'] = domainname;
Tomas Pettersson's avatar
Tomas Pettersson committed
198
                        periodoptions['guide'] = guide;
Tomas Pettersson's avatar
Tomas Pettersson committed
199
                        periodoptions['type'] = type;
Tomas Pettersson's avatar
Tomas Pettersson committed
200
                        periodoptions['subtype'] = subtype;
Tomas Pettersson's avatar
Tomas Pettersson committed
201
                        periodoptions['initials'] = initials;                        
202
                        // periodoptions['forwardbackward'] = false;
Tomas Pettersson's avatar
Tomas Pettersson committed
203
                        var periodid = 'periodCard';
204
                        this.cardMap[periodid] = new STWkit.PeriodCard(periodid, 'Simulation period', this.accordionDiv, this.lang, map, this.domain, this.forcingmodel, periodoptions);
Tomas Pettersson's avatar
Tomas Pettersson committed
205
                        var oiltypeoptions = {};
Tomas Pettersson's avatar
Tomas Pettersson committed
206
                        oiltypeoptions['domain'] = domainname;
Tomas Pettersson's avatar
Tomas Pettersson committed
207
                        oiltypeoptions['guide'] = guide;
Tomas Pettersson's avatar
Tomas Pettersson committed
208
                        oiltypeoptions['type'] = type;
Tomas Pettersson's avatar
Tomas Pettersson committed
209
                        oiltypeoptions['subtype'] = subtype;
Tomas Pettersson's avatar
Tomas Pettersson committed
210
                        oiltypeoptions['initials'] = initials;                        
211
                        //                        oiltypeoptions['stateofoil'] = false;                        
Tomas Pettersson's avatar
Tomas Pettersson committed
212 213
                        var oiltypeid = 'oiltypeCard';
                        this.cardMap[oiltypeid] = new STWkit.OilTypeCard(oiltypeid, 'Type of oil', this.accordionDiv, this.lang, map, oiltypeoptions);
214
                        
Tomas Pettersson's avatar
Tomas Pettersson committed
215
                        this.cardMap[periodid].addChangeFnListener(this.cardMap[oiltypeid]);
216
                        this.cardMap[locationid].addChangeFnListener(this.cardMap[periodid]);
Tomas Pettersson's avatar
Tomas Pettersson committed
217

Tomas Pettersson's avatar
Tomas Pettersson committed
218 219 220
                        super.setup(map);
                        var chain = [];
                        chain[locationid] = periodid;
Tomas Pettersson's avatar
Tomas Pettersson committed
221 222
                        chain[periodid] = oiltypeid;
                        chain[oiltypeid] = '';
Tomas Pettersson's avatar
Tomas Pettersson committed
223 224 225 226 227 228
                        this.cardMap[locationid].oncallback = (gonext) => {
                            super.callback(chain, locationid, gonext);
                        };
                        this.cardMap[periodid].oncallback = (gonext)  => {
                            super.callback(chain, periodid, gonext);
                        };                        
Tomas Pettersson's avatar
Tomas Pettersson committed
229 230 231
                        this.cardMap[oiltypeid].oncallback = (gonext)  => {
                            super.callback(chain, oiltypeid, gonext);
                        };                        
Tomas Pettersson's avatar
Tomas Pettersson committed
232 233 234 235 236 237 238 239 240 241 242
                    }
                    show() {}
                    hide() {}
                    clear() {super.clear()}
                    ready(name) {super.ready(name)}
                }

                var cardcontrol = new SimpleCardControl(properties);
                containerControl.addComponent("CardControl", cardcontrol);
                cardcontrol.accordionDiv = STWkit.DomUtil.create('div', 'uk-accordion', cardcontrol.container);
            }
Tomas Pettersson's avatar
Tomas Pettersson committed
243 244 245 246 247 248
        });

    </script>
</body>

</html>