Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onCapturePress() {
let team = '';
for (let i=0; i
switch (trap.type) {
case TrapTypes.Types.CIRCLE:
if(GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.radius)) {
}
break;
case TrapTypes.Types.STEP:
const insideOuter = GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.outerRadius);
const insideInner = GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.innerRadius);
const stateMap = {
[TrapTypes.States.OUTSIDE]: [TrapTypes.States.ENTERED, () =>
{
const isWithinCourse = this.isWithinCourse(trap.step.bearing, heading, trap.courseTolerance);
return insideOuter ? (isWithinCourse ? TrapTypes.Events.ENTERING_ON_COURSE : TrapTypes.Events.ENTERING_OFF_COURSE) : false;
}],
[TrapTypes.States.ENTERED]: [TrapTypes.States.INSIDE, () =>
{
return insideOuter ? TrapTypes.Events.INSIDE : false;
}],
[TrapTypes.States.INSIDE] : [TrapTypes.States.CENTER, () =>
{
return traps.map(index => {
const trap = this.traps[index];
if(trap.state != TrapTypes.States.EXPIRED) {
switch (trap.type) {
case TrapTypes.Types.CIRCLE:
if(GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.radius)) {
}
break;
case TrapTypes.Types.STEP:
const insideOuter = GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.outerRadius);
const insideInner = GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.innerRadius);
const stateMap = {
[TrapTypes.States.OUTSIDE]: [TrapTypes.States.ENTERED, () =>
{
const isWithinCourse = this.isWithinCourse(trap.step.bearing, heading, trap.courseTolerance);
function checkPosition (app, context, normalizedDeltaData) {
var vessel = _.get(app.signalk.root, normalizedDeltaData.context)
var position = _.get(vessel, 'navigation.position')
var subsPosition = _.get(context, 'position')
if (
position &&
position.value &&
position.value.latitude &&
position.value.longitude &&
subsPosition &&
subsPosition.latitude &&
subsPosition.longitude
) {
return geolib.isPointInCircle(position.value, subsPosition, context.radius)
}
return false
}
filter: club =>
isPointInCircle(
club,
{ latitude: 37.641045, longitude: -122.228916 },
fromMiles(39)
),
slug: 'bay-area'
filter: club =>
club.parsed_city === 'Los Angeles' ||
isPointInCircle(
club,
{ latitude: 34.075365, longitude: -118.390819 },
fromMiles(20)
)
},
points.filter(point => isPointInCircle(point, center, radius))
if(trap.state != TrapTypes.States.EXPIRED) {
switch (trap.type) {
case TrapTypes.Types.CIRCLE:
if(GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.radius)) {
}
break;
case TrapTypes.Types.STEP:
const insideOuter = GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.outerRadius);
const insideInner = GeoLib.isPointInCircle(coordinate, trap.coordinate, trap.innerRadius);
const stateMap = {
[TrapTypes.States.OUTSIDE]: [TrapTypes.States.ENTERED, () =>
{
const isWithinCourse = this.isWithinCourse(trap.step.bearing, heading, trap.courseTolerance);
return insideOuter ? (isWithinCourse ? TrapTypes.Events.ENTERING_ON_COURSE : TrapTypes.Events.ENTERING_OFF_COURSE) : false;
}],
[TrapTypes.States.ENTERED]: [TrapTypes.States.INSIDE, () =>
{
return insideOuter ? TrapTypes.Events.INSIDE : false;
}],