Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stwkit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
stw
stwkit
Commits
586806da
Commit
586806da
authored
Sep 22, 2017
by
Tomas Pettersson
🏸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added period
parent
009eb85a
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
809 additions
and
182 deletions
+809
-182
demo/index.html
demo/index.html
+96
-60
demo/server.js
demo/server.js
+10
-0
package.json
package.json
+4
-1
src/components/cards.js
src/components/cards.js
+334
-55
src/components/cards.js.map
src/components/cards.js.map
+1
-1
src/components/cards.ts
src/components/cards.ts
+364
-65
No files found.
demo/index.html
View file @
586806da
...
...
@@ -66,7 +66,28 @@
<script>
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
:
'
© <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
);
var
language
=
'
en
'
;
var
itracerLangData
=
{
};
var
coordinatesLangData
=
{
"
tMarkerstart
"
:
"
Click map to place point.
"
,
"
tPolygonstart
"
:
"
Hold left mouse button to draw polygon on map.
"
,
...
...
@@ -112,67 +133,82 @@
"
coordinates
"
:
coordinatesLangData
};
L
.
Control
.
SimpleComponent
=
L
.
Control
.
extend
({
initialize
:
function
(
height
,
open
)
{
this
.
_height
=
'
500px
'
;
if
(
height
)
{
this
.
_height
=
height
;
}
this
.
open
=
false
;
if
(
typeof
open
===
'
boolean
'
)
{
this
.
open
=
open
;
}
},
onAdd
:
function
(
map
)
{
this
.
container
=
L
.
DomUtil
.
create
(
'
div
'
,
'
simple-component-control
'
);
var
accordionDiv
=
STWkit
.
DomUtil
.
create
(
'
div
'
,
'
uk-accordion
'
,
this
.
container
);
var
cardid
=
'
cardid1
'
;
var
forcing
=
{};
var
forcing
=
false
;
var
obs
=
false
;
var
card
=
new
STWkit
.
LocationCard
(
cardid
,
accordionDiv
,
language
,
langData
,
map
,
forcing
,
obs
);
card
.
show
();
L
.
DomEvent
.
disableClickPropagation
(
this
.
container
);
return
this
.
container
;
},
ready
:
function
(
name
)
{
// this method is optional
if
(
this
.
open
)
{
var
evt
=
document
.
createEvent
(
"
CustomEvent
"
);
evt
.
initCustomEvent
(
'
container:showComponent
'
,
false
,
false
,
{
'
name
'
:
name
,
'
show
'
:
true
});
window
.
dispatchEvent
(
evt
);
}
},
show
:
function
()
{},
hide
:
function
()
{}
});
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
:
'
© <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
var
forcing
=
{
"
model
"
:
"
NEMO
"
,
"
configuration
"
:
"
NORDIC
"
,
"
domain
"
:
"
NS02
"
};
var
domainname
=
"
HELCOM
"
;
reqwest
({
url
:
"
forcing/config
"
+
STWkit
.
jsonToQueryString
(
forcing
),
method
:
'
get
'
,
type
:
'
json
'
,
success
:
function
(
forcing
)
{
var
properties
=
{
"
domain
"
:
domainname
,
"
lang
"
:
language
,
"
langdata
"
:
langData
};
if
(
forcing
.
features
.
length
>
0
)
properties
[
"
forcing
"
]
=
forcing
;
// SimpleCardControl = STWkit.CardControl.extend({
// setup: function (map) {
// this.container = STWkit.DomUtil.create('div', +self.name+'-control');
// this.accordionDiv = STWkit.DomUtil.create('div', 'uk-accordion', this.container);
// var locationid = self.initials+'locationCard';
// self.cardMap[locationid] = new Location(locationid, this.accordionDiv, self.lang, self.langData, map, self.forcing);
// self.cardMap[locationid].show();
// // super.setup(map);
// },
// show: function() {},
// // ready: function(name) {super.ready(name)},
// // clear: function() {super.clear()},
// // hide: function() {super.hide()}
// });
class
SimpleCardControl
extends
STWkit
.
CardControl
{
constructor
(
options
)
{
super
(
options
);}
setup
(
map
)
{
this
.
container
=
STWkit
.
DomUtil
.
create
(
'
div
'
,
+
self
.
name
+
'
-control
'
);
this
.
accordionDiv
=
STWkit
.
DomUtil
.
create
(
'
div
'
,
'
uk-accordion
'
,
this
.
container
);
var
options
=
{};
var
initials
=
''
;
options
[
'
singlebutton
'
]
=
true
;
options
[
'
multiplebutton
'
]
=
true
;
options
[
'
linebutton
'
]
=
true
;
options
[
'
areabutton
'
]
=
true
;
options
[
'
initials
'
]
=
initials
;
var
locationid
=
'
locationCard
'
;
this
.
cardMap
[
locationid
]
=
new
STWkit
.
LocationCard
(
locationid
,
'
Specify location
'
,
this
.
accordionDiv
,
this
.
lang
,
this
.
langData
,
map
,
this
.
forcing
,
options
);
this
.
cardMap
[
locationid
].
show
();
var
periodid
=
'
periodCard
'
;
this
.
cardMap
[
periodid
]
=
new
STWkit
.
PeriodCard
(
periodid
,
'
Simulation period
'
,
this
.
accordionDiv
,
this
.
lang
,
map
,
this
.
domain
,
this
.
forcingmodel
);
super
.
setup
(
map
);
var
chain
=
[];
chain
[
locationid
]
=
periodid
;
chain
[
periodid
]
=
''
;
this
.
cardMap
[
locationid
].
oncallback
=
(
gonext
)
=>
{
super
.
callback
(
chain
,
locationid
,
gonext
);
};
this
.
cardMap
[
periodid
].
oncallback
=
(
gonext
)
=>
{
super
.
callback
(
chain
,
periodid
,
gonext
);
};
}
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
);
}
});
map
.
addControl
(
containerControl
);
containerControl
.
addComponent
(
"
Component1
"
,
new
L
.
Control
.
SimpleComponent
());
</script>
</body>
...
...
demo/server.js
View file @
586806da
var
express
=
require
(
'
express
'
);
var
path
=
require
(
'
path
'
);
var
request
=
require
(
'
request
'
);
var
bodyParser
=
require
(
'
body-parser
'
);
var
app
=
express
();
app
.
use
(
bodyParser
.
json
());
// for parsing application/json
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}));
// for parsing application/x-www-form-urlencoded
var
url
=
'
/demo
'
require
(
'
../bower_components/leaflet-forcing-boundary/src/routes/forcingboundary
'
)(
url
,
app
);
app
.
use
(
'
/bower_components
'
,
express
.
static
(
path
.
join
(
__dirname
,
'
../bower_components
'
)));
app
.
use
(
'
/src
'
,
express
.
static
(
path
.
join
(
__dirname
,
'
../src
'
)));
app
.
use
(
'
/demo
'
,
express
.
static
(
__dirname
));
...
...
package.json
View file @
586806da
...
...
@@ -5,7 +5,10 @@
"private"
:
true
,
"dependencies"
:
{
"
express
"
:
"
4.x
"
,
"
path
"
:
"
latest
"
"
path
"
:
"
latest
"
,
"
body-parser
"
:
"
latest
"
,
"
request
"
:
"
latest
"
,
"@turf/within"
:
"latest"
},
"devDependencies"
:
{
"
grunt
"
:
"
^1.0.1
"
,
...
...
src/components/cards.js
View file @
586806da
This diff is collapsed.
Click to expand it.
src/components/cards.js.map
View file @
586806da
This diff is collapsed.
Click to expand it.
src/components/cards.ts
View file @
586806da
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment