Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
C
cms
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pedro-dev_2
cms
Commits
a545eea6
Commit
a545eea6
authored
Jun 24, 2021
by
PDuarte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edit geo map UI
parent
f2540d85
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
29 deletions
+25
-29
MapTooltip.js
src/views/settings/locations/card/MapTooltip.js
+19
-28
index.js
src/views/settings/locations/card/index.js
+6
-1
No files found.
src/views/settings/locations/card/MapTooltip.js
View file @
a545eea6
...
@@ -10,12 +10,13 @@ import {
...
@@ -10,12 +10,13 @@ import {
Rectangle
,
Rectangle
,
TileLayer
,
TileLayer
,
FeatureGroup
,
FeatureGroup
,
LayerGroup
,
MapContainer
as
LeafletMap
,
MapContainer
as
LeafletMap
,
Tooltip
Tooltip
}
from
'react-leaflet'
}
from
'react-leaflet'
import
{
EditControl
}
from
"react-leaflet-draw"
import
{
EditControl
}
from
"react-leaflet-draw"
import
L
from
'leaflet'
import
L
from
'leaflet'
import
{
useLeafletContext
}
from
'@react-leaflet/core'
import
{
useLeafletContext
}
from
'@react-leaflet/core'
import
'@styles/map/leaflet.draw.css'
import
'@styles/map/leaflet.draw.css'
...
@@ -55,6 +56,7 @@ const MapTooltip = ({gis, handleGis}) => {
...
@@ -55,6 +56,7 @@ const MapTooltip = ({gis, handleGis}) => {
let
numEdited
=
0
let
numEdited
=
0
e
.
layers
.
eachLayer
((
layer
)
=>
{
e
.
layers
.
eachLayer
((
layer
)
=>
{
numEdited
+=
1
numEdited
+=
1
layer
.
_enableLayerEdit
=
true
console
.
log
(
layer
)
console
.
log
(
layer
)
handleGis
(
layer
.
_latlngs
[
0
])
handleGis
(
layer
.
_latlngs
[
0
])
})
})
...
@@ -117,33 +119,18 @@ const MapTooltip = ({gis, handleGis}) => {
...
@@ -117,33 +119,18 @@ const MapTooltip = ({gis, handleGis}) => {
console
.
log
(
'_onDeleteStop'
,
e
)
console
.
log
(
'_onDeleteStop'
,
e
)
}
}
const
_onFeatureGroupReady
=
(
reactFGref
)
=>
{
const
_onFeatureGroupReady
=
(
ref
)
=>
{
console
.
log
(
reactFGref
)
console
.
log
(
'_onFeatureGroupReady'
)
// console.log(ref)
// if (ref === null) {
// return
// }
// console.log('importing service area from state')
// const leafletGeoJSON = new L.GeoJSON(gis)
// const leafletFG = ref.leafletElement
// leafletGeoJSON.eachLayer(layer => leafletFG.addLayer(layer))
}
}
const
showAdd
=
gis
.
length
<
1
useEffect
(()
=>
{
// const test = gis + ''
},
[
gis
])
// const regExp = /(-?\d+(\.\d+)?)\s*(-?\d+(\.\d+)?)(,?)/
// const matches = gis.match(regExp)
// console.log(matches)
const
polygon
=
[
[
[
51.51
,
-
0.12
],
[
51.51
,
-
0.13
],
[
51.53
,
-
0.13
]
],
[
[
51.51
,
-
0.05
],
[
51.51
,
-
0.07
],
[
51.53
,
-
0.07
]
]
]
const
purpleOptions
=
{
color
:
'purple'
}
const
purpleOptions
=
{
color
:
'purple'
}
return
(
return
(
...
@@ -172,13 +159,17 @@ const MapTooltip = ({gis, handleGis}) => {
...
@@ -172,13 +159,17 @@ const MapTooltip = ({gis, handleGis}) => {
onDeleteStop
=
{
_onDeleteStop
}
onDeleteStop
=
{
_onDeleteStop
}
draw
=
{
myControl
}
draw
=
{
myControl
}
/
>
/
>
{
/* <LayerGroup id="lg1"> */
}
<
Polygon
enable
=
{
true
}
pathOptions
=
{
purpleOptions
}
positions
=
{
gis
}
/
>
{
/* </LayerGroup> */
}
<
/FeatureGroup
>
<
/FeatureGroup
>
<
TileLayer
<
TileLayer
attribution
=
'&copy <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
attribution
=
'&copy <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
url
=
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
url
=
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
/>
/>
<
Polygon
pathOptions
=
{
purpleOptions
}
positions
=
{
gis
}
/
>
<
/LeafletMap
>
<
/LeafletMap
>
<
/CardBody
>
<
/CardBody
>
<
/Card
>
<
/Card
>
...
@@ -297,7 +288,7 @@ function getGeoJson() {
...
@@ -297,7 +288,7 @@ function getGeoJson() {
]
]
}
}
_onFeatureGroupReady
=
(
reactFGref
)
=>
{
_onFeatureGroupReady
Z
=
(
reactFGref
)
=>
{
// populate the leaflet FeatureGroup with the geoJson layers
// populate the leaflet FeatureGroup with the geoJson layers
const
leafletGeoJSON
=
new
L
.
GeoJSON
(
getGeoJson
())
const
leafletGeoJSON
=
new
L
.
GeoJSON
(
getGeoJson
())
...
...
src/views/settings/locations/card/index.js
View file @
a545eea6
...
@@ -137,7 +137,12 @@ const handleError = (text) => {
...
@@ -137,7 +137,12 @@ const handleError = (text) => {
matches
.
map
(
point
=>
{
matches
.
map
(
point
=>
{
const
cords
=
point
.
replace
(
','
,
''
).
split
(
' '
)
const
cords
=
point
.
replace
(
','
,
''
).
split
(
' '
)
polygon
.
push
(
cords
)
// polygon.push(cords)
polygon
.
push
({
lat
:
cords
[
0
],
lng
:
cords
[
1
]
})
console
.
log
(
cords
)
console
.
log
(
cords
)
})
})
console
.
log
(
matches
)
console
.
log
(
matches
)
...
...
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