refactored some uneven spacing from server-side push, changed test sql to be more appropriate characters, and disabled camera functionality for demo.
This commit is contained in:
@@ -47,15 +47,11 @@ module.exports = {
|
||||
let firstPoint = points[0];
|
||||
let lastPoint = points[points.length - 1];
|
||||
let distance = mathFunc.gpsToMeters(firstPoint.lat, firstPoint.lng, lastPoint.lat, lastPoint.lng);
|
||||
console.log(distance);
|
||||
if (distance < 20) {
|
||||
console.log(lastPoint);
|
||||
console.log(firstPoint);
|
||||
if (lastPoint.lat != firstPoint.lat || lastPoint.lng != firstPoint.lng) {
|
||||
// points.pop();
|
||||
points.push({lat: firstPoint.lat, lng: lastPoint.lng});
|
||||
}
|
||||
console.log(points);
|
||||
areaFunctions.collatePolygons(res, gameID, userID, points);
|
||||
} else {
|
||||
res.send([]);
|
||||
|
||||
@@ -26,7 +26,6 @@ module.exports = {
|
||||
},
|
||||
submitFinalCollation(res, gameID, userID, points, area, mergedPolygonIDs) {
|
||||
let query = util.format("CALL insertPolygon(\"%s\", \"%s\", %d)", gameID, userID, area);
|
||||
console.log(query);
|
||||
db.get().query(query, function(err, rows) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
@@ -60,7 +59,6 @@ module.exports = {
|
||||
deleteMergedPolygons(mergedPolygonIDs, next) {
|
||||
if (mergedPolygonIDs.length > 0) {
|
||||
let id = mergedPolygonIDs.pop();
|
||||
console.log(id);
|
||||
let deleteQuery = util.format("CALL deletePolygon(\"%s\");", id);
|
||||
db.get().query(deleteQuery, function(err, pointRows) {
|
||||
if (err) {
|
||||
@@ -87,10 +85,8 @@ module.exports = {
|
||||
let polygonResult = [];
|
||||
let polygonsMerged = [];
|
||||
polygons.map((polygon) => {
|
||||
console.log(polygon);
|
||||
if (polygon.coords[0].lat != polygon.coords[polygon.coords.length - 1].lat &&
|
||||
polygon.coords[0].lng != polygon.coords[polygon.coords.length - 1].lng) {
|
||||
console.log("Duplicated");
|
||||
polygon.coords.push({lat: polygon.coords[0].lat, lng: polygon.coords[0].lng})
|
||||
}
|
||||
let intersect = module.exports.checkIntersects(polygonPoints, polygon.coords);
|
||||
@@ -118,8 +114,6 @@ module.exports = {
|
||||
checkIntersects(points1, points2) {
|
||||
let arrayPoints1 = [module.exports.convertPointsObjToArray(points1)];
|
||||
let arrayPoints2 = [module.exports.convertPointsObjToArray(points2)];
|
||||
console.log("apt1: %s", arrayPoints1);
|
||||
console.log("apt2: %s", arrayPoints2);
|
||||
let poly1 = turf.polygon(arrayPoints1);
|
||||
let poly2 = turf.polygon(arrayPoints2);
|
||||
return turf.intersect(poly1, poly2);
|
||||
|
||||
Reference in New Issue
Block a user