Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Albert Beltran
map
Commits
9ff75db6
Commit
9ff75db6
authored
Dec 05, 2018
by
Raph El
Browse files
Amélioration Map : popUp + debut d'integration de mapbox
parent
e00b2ac0
Changes
28
Show whitespace changes
Inline
Side-by-side
assets/images/thumb/default_ressources.png
0 → 100644
View file @
9ff75db6
942 Bytes
assets/images/thumb/default_sharedLibrary.png
0 → 100644
View file @
9ff75db6
25.8 KB
assets/images/thumb/default_something2See.png
0 → 100644
View file @
9ff75db6
25.3 KB
assets/images/thumb/default_streetArts.png
0 → 100644
View file @
9ff75db6
88.5 KB
assets/images/thumb/default_trash.png
0 → 100644
View file @
9ff75db6
3.47 KB
assets/images/thumb/default_video.png
0 → 100644
View file @
9ff75db6
25.5 KB
assets/images/thumb/run.png
0 → 100644
View file @
9ff75db6
3.74 KB
assets/js/map.js
View file @
9ff75db6
...
...
@@ -31,7 +31,27 @@ var mapObj = {
//creation de la carte
mapObj
.
map
=
L
.
map
(
mapObj
.
container
,
mapObj
.
mapOpt
);
// création tpl
L
.
tileLayer
(
'
https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}
'
,
{
foo
:
'
bar
'
}).
addTo
(
mapObj
.
map
);
//L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar'}).addTo(mapObj.map);
var
accessToken
=
'
pk.eyJ1IjoiY29tbXVuZWN0ZXIiLCJhIjoiY2l6eTIyNTYzMDAxbTJ3bng1YTBsa3d0aCJ9.elyGqovHs-mrji3ttn_Yjw
'
;
// Replace 'mapbox.streets' with your map id.
var
mapboxTiles
=
L
.
tileLayer
(
'
https://api.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}.png?access_token=
'
+
accessToken
,
{
attribution
:
'
© <a href="https://www.mapbox.com/feedback/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>
'
});
mapObj
.
map
.
addLayer
(
mapboxTiles
);
// L.tileLayer('https://api.mapbox.com/styles/v4/{id}/{zoom}/{x}/{y}{@2x}.{format}?access_token={accessToken}',
// {
// accessToken: 'pk.eyJ1IjoiY29tbXVuZWN0ZXIiLCJhIjoiY2l6eTIyNTYzMDAxbTJ3bng1YTBsa3d0aCJ9.elyGqovHs-mrji3ttn_Yjw',
// id : 'mapbox.light',
// format : 'png',
// zoom : 0
// }).addTo(mapObj.map);
if
(
mapObj
.
activeCluster
===
true
){
mapObj
.
markersCluster
=
new
L
.
markerClusterGroup
({
...
...
@@ -186,6 +206,20 @@ var mapCustom = {
return
mapCustom
.
markers
.
default
;
}
},
custom
:
{
getThumbProfil
:
function
(
data
){
var
imgProfilPath
=
assetPath
+
"
/images/thumb/default.png
"
;
if
(
typeof
data
.
profilThumbImageUrl
!==
"
undefined
"
&&
data
.
profilThumbImageUrl
!=
""
)
imgProfilPath
=
baseUrl
+
data
.
profilThumbImageUrl
;
else
imgProfilPath
=
modules
.
map
.
assets
+
"
/images/thumb/default_
"
+
data
.
type
+
"
.png
"
;
return
imgProfilPath
;
}
},
clusters
:
{
default
:
function
(
cluster
)
{
var
childCount
=
cluster
.
getChildCount
();
...
...
@@ -205,21 +239,24 @@ var mapCustom = {
mylog
.
log
(
"
mapCustom.popup.default
"
,
data
);
// CODE A SUPPRIMER
data
.
profilThumbImageUrl
=
"
/ph/assets/753062fa/images/filtres/Loisir.png
"
;
//
data.profilThumbImageUrl = "/ph/assets/753062fa/images/filtres/Loisir.png";
//var icons = '<i class="fa fa-user text-'+ headerParams[data.type].color +'"></i>';
// END CODE A SUPPRIMER
var
id
=
(
typeof
data
.
id
!=
"
undefined
"
)
?
data
.
id
:
data
.
_id
.
$id
;
var
imgProfil
=
mapCustom
.
custom
.
getThumbProfil
(
data
)
;
var
popup
=
""
;
popup
+=
"
<div class='' id='popup
"
+
id
+
"
'>
"
;
popup
+=
"
<img src='
"
+
data
.
profilThumbImageUr
l
+
"
' height='30' width='30' class='' style='display: inline; vertical-align: middle; border-radius:100%;'>
"
;
popup
+=
"
<span style='font-size:18px'>
"
+
data
[
'
name
'
]
+
"
</span>
"
;
popup
+=
"
<img src='
"
+
imgProfi
l
+
"
' height='30' width='30' class='' style='display: inline; vertical-align: middle; border-radius:100%;'>
"
;
popup
+=
"
<span style='
margin-left : 5px;
font-size:18px'>
"
+
data
[
'
name
'
]
+
"
</span>
"
;
if
(
typeof
data
.
tags
!=
"
undefined
"
&&
data
.
tags
!=
null
&&
data
.
tags
.
length
>
0
){
popup
+=
"
<div
class='
'>
"
;
popup
+=
"
<div
style='margin-top : 5px;
'>
"
;
var
totalTags
=
0
;
$
.
each
(
data
.
tags
,
function
(
index
,
value
){
totalTags
++
;
if
(
totalTags
<
4
){
if
(
totalTags
<
3
){
popup
+=
"
<div class='popup-tags'>#
"
+
value
+
"
</div>
"
;
}
});
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
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