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
Hide 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 {
Rectangle
,
TileLayer
,
FeatureGroup
,
LayerGroup
,
MapContainer
as
LeafletMap
,
Tooltip
}
from
'react-leaflet'
import
{
EditControl
}
from
"react-leaflet-draw"
import
L
from
'leaflet'
import
{
useLeafletContext
}
from
'@react-leaflet/core'
import
{
useLeafletContext
}
from
'@react-leaflet/core'
import
'@styles/map/leaflet.draw.css'
...
...
@@ -55,6 +56,7 @@ const MapTooltip = ({gis, handleGis}) => {
let
numEdited
=
0
e
.
layers
.
eachLayer
((
layer
)
=>
{
numEdited
+=
1
layer
.
_enableLayerEdit
=
true
console
.
log
(
layer
)
handleGis
(
layer
.
_latlngs
[
0
])
})
...
...
@@ -117,33 +119,18 @@ const MapTooltip = ({gis, handleGis}) => {
console
.
log
(
'_onDeleteStop'
,
e
)
}
const
_onFeatureGroupReady
=
(
reactFGref
)
=>
{
console
.
log
(
reactFGref
)
const
_onFeatureGroupReady
=
(
ref
)
=>
{
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'
}
return
(
...
...
@@ -172,13 +159,17 @@ const MapTooltip = ({gis, handleGis}) => {
onDeleteStop
=
{
_onDeleteStop
}
draw
=
{
myControl
}
/
>
{
/* <LayerGroup id="lg1"> */
}
<
Polygon
enable
=
{
true
}
pathOptions
=
{
purpleOptions
}
positions
=
{
gis
}
/
>
{
/* </LayerGroup> */
}
<
/FeatureGroup
>
<
TileLayer
attribution
=
'&copy <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
url
=
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
/>
<
Polygon
pathOptions
=
{
purpleOptions
}
positions
=
{
gis
}
/
>
<
/LeafletMap
>
<
/CardBody
>
<
/Card
>
...
...
@@ -297,7 +288,7 @@ function getGeoJson() {
]
}
_onFeatureGroupReady
=
(
reactFGref
)
=>
{
_onFeatureGroupReady
Z
=
(
reactFGref
)
=>
{
// populate the leaflet FeatureGroup with the geoJson layers
const
leafletGeoJSON
=
new
L
.
GeoJSON
(
getGeoJson
())
...
...
src/views/settings/locations/card/index.js
View file @
a545eea6
...
...
@@ -137,7 +137,12 @@ const handleError = (text) => {
matches
.
map
(
point
=>
{
const
cords
=
point
.
replace
(
','
,
''
).
split
(
' '
)
polygon
.
push
(
cords
)
// polygon.push(cords)
polygon
.
push
({
lat
:
cords
[
0
],
lng
:
cords
[
1
]
})
console
.
log
(
cords
)
})
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