-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.js
129 lines (129 loc) · 3.77 KB
/
models.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//var MongoClient = require('mongodb').MongoClient;
//var format = require('util').format;
//
//var Class = require('./modules/oop').Class;
//
//function printMongoCollection() {
// MongoClient.connect('mongodb://intelli-place:[email protected]:41168/intelli-place', function (err, db) {
// if (err) throw err;
//
// var collection = db.collection('workspaces');
// // Locate all the entries using find
// collection.findOne({'_id': 'miromiroslavov'}, function (err, result) {
// console.log(result);
// // Let's close the db
// db.close();
// });
// });
// var collection = db.collection('workspaces');
// // Locate all the entries using find
// collection.findOne({'_id': '[email protected]'}, function (err, result) {
// console.log(result);
// // Let's close the db
// db.close();
// });
//};
//var collection = db.collection('workspaces');
//// Locate all the entries using find
//collection.findOne({'_id': 'miromiroslavov'}, function (err, result) {
// console.log(result);
// // Let's close the db
// db.close();
//});
//
//exports.printMongoCollection = printMongoCollection
//
//exports.getWorkspaces = function (callback) {
// MongoClient.connect('mongodb://intelli-place:[email protected]:41168/intelli-place', function (err, db) {
// if (err) throw err;
//
// var collection = db.collection('workspaces');
// // Locate all the entries using find
// collection.find().toArray(function (err, items) {
// if (err) throw err;
//
// callback(items);
// // Let's close the db
// db.close();
// });
// });
//}
//
//var createWorkspace = function (json) {
// var result = new Object();
// result.name = json.name;
// result.offices = [];
// result.toString = function () {
// return result.name + ', []';
// }
// return result;
//}
//
//var workspace = {
// "_id": "[email protected]",
// "name": "Sofia Valley",
// "offices": [
// {
// "name": "HQ1",
// "rooms": [
// {
// "name": "101",
// "boundary": "m0,0 L0,500 L500,500 L500,0z",
// "position": "100 100",
// "artifacts": [
// {
// "type": "air-conditioner",
// "position": "50 50",
// "boundary": "m0,0 L0,50 L50,50 L50,0z",
// "obstacle": false
// },
// {
// "type": "column",
// "position": "300 150",
// "boundary": "m0,0 L0,50 L50,50 L50,0z",
// "obstacle": true
// }
// ],
// "arrangements": [
// {
// "name": "plan1",
// "objects": [
// {
// "type": "desk",
// "name": "Miro's desk",
// "position": "400 250",
// "boundary": "m0,0 L0,50 L50,50 L50,0z"
// },
// {
// "type": "chair",
// "name": "Miro's chair",
// "position": "412.5 300",
// "boundary": "m0,0 L0,25 L25,25 L25,0z"
// }
// ]
// }
// ]
// }
// ]
// }
// ]
//};
//
//var office = workspace.offices[0];
//
//var room = office.rooms[0];
//
//console.log(room);
//
//var ext = require('./modules/geometryExtensions');
//var g = require('geometry');
//var p = new ext.Polygon([new g.Point(0, 0), new g.Point(0, 10), new g.Point(10, 10), new g.Point(10, 0)]);
//console.log(p);
//console.log(p.perimeter());
//console.log(p.area());
//console.log(g.Point.parse('10.5,20'));
//console.log(ext.Polygon.parse('0,0 10,0 10,10 0,10').area());
//// var parser = require('./svgPathGrammer').pathParser;
//
//// var p = parser.parse('m0,0 L0,500 L500,500 L500,0z');
//// console.dir(p);