Skip to content

Commit

Permalink
Merge pull request #110 from developmentseed/feature/current-trace-layer
Browse files Browse the repository at this point in the history
show gps track while recording
  • Loading branch information
geohacker authored Oct 22, 2019
2 parents d70880e + b618a32 commit 00e5091
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/components/RecordHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const headerStyles = getPlatformStyles({
height: 100
},
android: {
height: 64,
height: 80,
paddingTop: 0
}
})
Expand Down
6 changes: 5 additions & 1 deletion app/screens/Explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ class Explore extends React.Component {
selectedFeatures,
editsGeojson,
mode,
currentTraceStatus
currentTraceStatus,
currentTrace
} = this.props
let selectedFeatureIds = null

Expand Down Expand Up @@ -561,6 +562,9 @@ class Explore extends React.Component {
<MapboxGL.LineLayer id='editedLines' filter={filters.editedLines} style={style.editedLines} minZoomLevel={16} />
<MapboxGL.SymbolLayer id='editedPois' style={style.icons} filter={filters.editedPois} />
</MapboxGL.ShapeSource>
<MapboxGL.ShapeSource id='currentTraceGeojsonSource' shape={currentTrace}>
<MapboxGL.LineLayer id='trace' style={style.traces} minZoomLevel={16} />
</MapboxGL.ShapeSource>
</StyledMap>
{ overlay }
{/* should hide this entire element when not in loading state */}
Expand Down
14 changes: 13 additions & 1 deletion app/selectors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,19 @@ export const getPendingEviction = state => state.map.pendingEviction

export const getIsTracing = state => !!state.traces.currentTrace

export const getCurrentTraceGeoJSON = state => state.currentTrace
export const getCurrentTraceGeoJSON = state => {
if (state.traces.currentTrace && state.traces.currentTrace.geometry.coordinates.length > 2) {
return {
'type': 'FeatureCollection',
'features': [ state.traces.currentTrace ]
}
} else {
return {
'type': 'FeatureCollection',
'features': []
}
}
}

export const getCurrentTraceLength = state => {
const currentTrace = state.traces.currentTrace
Expand Down
13 changes: 12 additions & 1 deletion app/style/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ const editedLines = {
lineColor: 'blue'
}

const traces = {
lineWidth: [
'interpolate', ['linear'],
['zoom'],
16, 1,
20, 3
],
lineColor: 'red'
}

const highways = {
lineWidth: standardLineWidth,
lineColor: [
Expand Down Expand Up @@ -170,5 +180,6 @@ export default {
icons,
iconEditedHalo,
editedPolygons,
editedLines
editedLines,
traces
}

0 comments on commit 00e5091

Please sign in to comment.