This repository has been archived by the owner on May 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
demo.html
executable file
·381 lines (381 loc) · 19.1 KB
/
demo.html
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Javascript Clipper Main Demo</title>
<link rel="stylesheet" type="text/css" href="demo.css" />
<script src="formatter.js"></script>
<script src="clipper.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.min.js"></script>
<script src="vendor/lodash.math.js"></script>
<script src="vendor/rgb-color.js"></script>
<script src="vendor/jquery.repeated-click.js"></script>
<script src="vendor/jquery.total-storage.js"></script>
</head>
<body>
<table>
<tr>
<td style="vertical-align:top;width:353px;">
<fieldset id="PolygonsFieldset">
<legend title="Builtin polygons">Polygons</legend>
<table class="polygons_fieldset">
<tr>
<td>
<label><input type="radio" name="polygons" value="0">Arrows</label>
<br>
<label><input type="radio" name="polygons" value="1">Texts</label>
<br>
<label><input type="radio" name="polygons" value="2">Rects</label>
<br>
</td>
<td>
<label><input type="radio" name="polygons" value="3">Same</label>
<br>
<label><input type="radio" name="polygons" value="4" title="Random rectangles">RandRects</label>
<br>
<label><input type="radio" name="polygons" value="5" title="Random polygons">Random</label>
<br>
</td>
<td>
<label><input type="radio" name="polygons" value="6">Star & rect</label>
<br>
<label><input type="radio" name="polygons" value="7">Spiral</label>
<br>
<label><input type="radio" name="polygons" value="8">Grid & star</label>
<br>
</td>
<td>
<label><input type="radio" name="polygons" value="9">Glyph</label>
<br>
<label><input type="radio" name="polygons" value="10" title="Your own custom polygon sets">Custom</label>
<br>
</td>
</tr>
</table>
</fieldset>
<fieldset id="custom_polygons_fieldset" style="position:relative">
<legend>Your own custom polygons</legend>
<select name="custom_polygons_select" id="custom_polygons_select" title="Saved custom polygon sets"></select>
<select name="sample_custom_polygon" id="sample_custom_polygon" title="Get Builtin polygon set">
<option value="">- Builtin -</option>
<option value="0">Arrows</option>
<option value="1">Texts</option>
<option value="2">Rects</option>
<option value="3">Same</option>
<option value="4">RandRects</option>
<option value="5">Random</option>
<option value="6">Star & rect</option>
<option value="7">Spiral</option>
<option value="8">Grid & star</option>
<option value="9">Glyph</option>
</select>
<button id="help_builtin_polygon_sets" title="Get help about Builtin polygon sets">?</button>
<div id="custom_polygon_inputs">
<table class="custom_polygon_inputs_table">
<tr>
<td>
<b title="Here you can type or paste custom subject polygons. Click the '?' button below to get help about string formats.">Subj</b>
</td>
<td>
<textarea class="custom_polygon_input" id="custom_polygon_subj"></textarea>
</td>
</tr>
<tr>
<td>
<b title="Here you can type or paste custom clip polygons. Click the '?' button below to get help about string formats.">Clip</b>
</td>
<td>
<textarea class="custom_polygon_input" id="custom_polygon_clip"></textarea>
</td>
</tr>
</table>
<button id="save_custom_polygon" title="Update polygon set">Save</button>
<button id="add_as_new_custom_polygon" title="Save as a new custom polygon set">Save as new</button>
<button id="remove_custom_polygon" title="Remove selected custom polygon set">Del</button>
<button id="removeall_custom_polygon" title="Remove all custom polygon sets">Del all</button>
<button id="help_custom_polygon" title="Get help about custom polygons">?</button>
</div>
</fieldset>
<fieldset id="random_polygons_fieldset">
<legend>Random polygon settings</legend>
<table class="random">
<thead>
<tr>
<th class="random_new_th">
<button id="generate_random_polygons" title="Generate random polygons">New</button>
</th>
<th>Polygon count</th>
<th style="padding-right:0px">Point count</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<b>Subject</b>
</td>
<td>
<button id="subj_polygon_count_minus" class="creaser">-</button>
<input class="random_inputs" type="text" id="subj_polygon_count" value="1">
<button id="subj_polygon_count_plus" class="creaser">+</button>
</td>
<td style="padding-right:0px">
<button id="subj_point_count_minus" class="creaser">-</button>
<input class="random_inputs" type="text" id="subj_point_count" value="1">
<button id="subj_point_count_plus" class="creaser">+</button>
</td>
</tr>
<tr>
<td>
<b>Clip</b>
</td>
<td>
<button id="clip_polygon_count_minus" class="creaser">-</button>
<input class="random_inputs" type="text" id="clip_polygon_count" value="1">
<button id="clip_polygon_count_plus" class="creaser">+</button>
</td>
<td style="padding-right:0px">
<button id="clip_point_count_minus" class="creaser">-</button>
<input class="random_inputs" type="text" id="clip_point_count" value="1">
<button id="clip_point_count_plus" class="creaser">+</button>
</td>
</tr>
</table>
</fieldset>
<table id="filltype_cliptype_table" class="filltype_cliptype">
<tr>
<td>
<fieldset>
<legend>Subject FillType</legend>
<label><input type="radio" name="subject_fillType" value="0">EvenOdd</label>
<label><input type="radio" name="subject_fillType" value="1">NonZero</label>
</fieldset>
</td>
<td>
<fieldset>
<legend>Clip FillType</legend>
<label><input type="radio" name="clip_fillType" value="0">EvenOdd</label>
<label><input type="radio" name="clip_fillType" value="1">NonZero</label>
</fieldset>
</td>
</tr>
</table>
<fieldset id="ClipTypeFieldset">
<legend>Clip type (operation)</legend>
<p>
<label><input type="radio" name="clipType" value="">No</label>
<label><input type="radio" name="clipType" value="0">Intersect</label>
<label><input type="radio" name="clipType" value="1">Union</label>
<label><input type="radio" name="clipType" value="2">Difference</label>
<label><input type="radio" name="clipType" value="3" checked>Xor</label>
</p>
</fieldset>
<fieldset id="CleaningFieldset">
<legend>Cleaning and simplifying</legend>
<p>
<label>
<b>Clean</b>
<input type="checkbox" id="clean" title="Clean. Joins sequential vertices if they are almost coincident. This is needed to prevent polygon breakage when offsetting. Not included in original Clipper, yet. This operation is done before offsetting." value="1">
</label>
<input style="width:28px" type="text" value="" id="cleandelta" title="Delta. The distance used for Clean. Sequential vertices are joined if they are at or below this distance of each other.">
<label>
<b>Simplify</b>
<input type="checkbox" id="Simplify" title="Simplify. Convert complex (self-intersecting) polygon to simple ones. Produces multiple polygons, if there are self-intersections. Note! Not work in self-intersections that are too small, you have to remove too-near-vertices using Clean feature. This operation is done before offsetting." value="1">
</label>
<label>
<b>Lighten</b>
<input type="checkbox" id="lighten" title="Lighten. Removes unnecessary vertices. Not included in original Clipper. This operation is done after offsetting." value="1">
</label>
<input style="width:28px;" type="text" value="" id="lighten_distance" title="Tolerance. The distance that is used when lightening polygon. Removes middle vertex of three sequential vertices, if the middle vertex is under (or at) this distance of the line between start and end vertex.">
</p>
</fieldset>
<fieldset id="OffsettingFieldset">
<legend>Offsetting</legend>
<table class="offset_outer">
<tr>
<td style="padding-right:6px;">
<b><span style="display:block;padding-bottom:3px">Polygon</span></b>
<label><input type="radio" name="offsettable_poly" value="subject">Subject</label>
<br>
<label><input type="radio" name="offsettable_poly" value="clip">Clip</label>
<br>
<label><input type="radio" name="offsettable_poly" value="solution" checked>Solution</label>
</td>
<td style="padding-right:6px;">
<b><span style="display:block;padding-bottom:3px">JoinType</span></b>
<label><input type="radio" name="joinType" value="0" checked>Square</label>
<br>
<label><input type="radio" name="joinType" value="1">Round</label>
<br>
<label><input type="radio" name="joinType" value="2">Miter</label>
<br>
</td>
<td style="padding-right:0px">
<table class="offset_inner">
<tr>
<td>
<b>Delta</b>
<button id="delta_minus" class="creaser">-</button>
<input type="text" id="delta" value="" style="width:50px">
<button id="delta_plus" class="creaser">+</button>
</td>
</tr>
<tr>
<td><b>MiterLimit</b>
<button id="miterLimit_minus" class="creaser">-</button>
<input type="text" id="miterLimit" value="" style="width:20px">
<button id="miterLimit_plus" class="creaser">+</button>
</td>
</tr>
<tr>
<td style="padding-bottom: 0px; padding-top: 3px;">
<label>
<b title="AutoFix">AutoFix</b>
<input type="checkbox" id="AutoFix" title="AutoFix. Fixes polygon orientation if necessary and removes duplicate vertices. Can be set false when you are sure that polygon orientation is correct and that there are no duplicate vertices." value="1">
</label>
</td>
</tr>
</table>
</td>
</tr>
</table>
</fieldset>
<fieldset id="ScaleFieldset">
<legend>Scale</legend>
<p>
<button id="scale_minus" class="creaser">-</button>
<input type="text" id="scale" value="" style="width:80px">
<button id="scale_plus" class="creaser">+</button>
<b>Bigints used:</b>
<span id="biginteger_used"></span>
</p>
</fieldset>
<fieldset id="misc_fieldset">
<legend>Misc</legend>
<button id="show_svg_source" title="Show current SVG source in textarea at the bottom of the page">Show SVG source</button>
<button id="show_enlarged_svg" title="Show current SVG enlarged at the bottom of the page">Show enlarged SVG</button>
<label>
<b>Bevel</b>
<input type="checkbox" id="bevel" value="1" title="Uncheck this to speedup drawing">
</label>
</fieldset>
</td>
<td style="vertical-align:top;width:506px;">
<div id="svgcontainer"></div>
<fieldset id="polygon_explorer_fieldset">
<legend>Polygon explorer</legend>
<label>
<b>Enable Explorer</b>
<input type="checkbox" id="explorer_enabled" title="Enable/disable Polygon Explorer">
</label>
<div id="polygon_explorer_div" style="overflow-y:auto;overflow-x:visible;padding-left:1px;max-height:300px">
<table class="polygon_explorer">
<tr>
<td colspan="4" style="padding:0px;white-space:nowrap; border:0px">
<table style="padding:0px;border-collapse:collapse">
<tr>
<td style="padding:0px;vertical-align:middle">
<textarea id="polygon_explorer_string_inp" title="When you click the numbers below, here comes coordinates of the clicked polygon (or polygons) as string." value="">Click below to see coordinates here!</textarea>
</td>
<td style="padding:0px;vertical-align:middle">
<select id="output_format" title="Output format" style="width:73px;margin-left:5px">
<option>Clipper</option>
<option>Plain</option>
<option>SVG</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<th style="white-space:nowrap; width:31px;" title="Polygon type">Type</th>
<th style="white-space:nowrap; width:35px;" title="Count of subpolygons">Polys</th>
<th style="white-space:nowrap; width:40px;" title="Count of points in all sub polygons. Hover numbers below to see the whole multi-polygon highlighted. Click them to see coordinates as strings and the area of multi-polygon (sum of areas of sub polygons).">Points</th>
<th style="white-space:nowrap;" title="Count of points in sub polygons. Hover numbers below to see sub polygons highlighted. Click to see coordinates as strings and the area of sub polygon.">Points in subpolygons</th>
</tr>
<tr>
<td id="subject_box" title="Subject">
<b>Subj</b>
</td>
<td>
<span id="subj_subpolygons"></span>
</td>
<td>
<span id="subj_points_total" class="subpolylinks" data-role="1"></span>
</td>
<td>
<span id="subj_points_in_subpolygons"></span>
</td>
</tr>
<tr>
<td id="clip_box" title="Clip">
<b>Clip</b>
</td>
<td>
<span id="clip_subpolygons"></span>
</td>
<td><span id="clip_points_total" class="subpolylinks" data-role="2"></span>
</td>
<td>
<span id="clip_points_in_subpolygons"></span>
</td>
</tr>
<tr>
<td id="solution_box" title="Solution">
<b>Solu</b>
</td>
<td>
<span id="solution_subpolygons"></span>
</td>
<td>
<span id="solution_points_total" class="subpolylinks" data-role="3"></span>
</td>
<td>
<span id="solution_points_in_subpolygons">
</span>
</td>
</tr>
<tr>
<td>
<b>Total</b>
</td>
<td>
<b><span id="all_subpolygons"></span></b>
</td>
<td>
<b><span id="points_total"></span></b>
</td>
<td style="padding-bottom:0px;padding-top:0px;text-align:right;white-space:nowrap">
<div id="area" style="padding:0px;display:inline-block;width:90%;text-align:left" title="Click above numbers to see the area of sub polygons.">Area: Click above to see polygon area!</div>
<button id="help_output_format" title="Get help about output format">?</button>
</td>
</tr>
</table>
</div>
</fieldset>
</td>
<td style="vertical-align:top;width:353px;">
<fieldset id="benchmark_fieldset_f">
<legend id="#benchmark_fieldset">Benchmark</legend>
<button id="benchmark1" title="Execute Normal benchmark">Run NB</button>
<button id="benchmark1b" title="Execute Normal benchmark 5x">Run NB 5x</button>
<button id="benchmark2" title="Execute Big Integer benchmark">Run BIB</button>
<button id="benchmark2b" title="Execute Big Integer benchmark 5x">Run BIB 5x</button>
<div id="benchmark_div_outer">
<div id="benchmark_div"></div>
<div id="benchmark_multiple_table_cont"></div>
</div>
</fieldset>
</td>
</tr>
</table>
<div id="svg_source_container">
<textarea id="svg_source_textarea"></textarea>
</div>
<div id="enlarged_svg"></div>
<div id="benchmark_exports_container"></div>
<script src="demo.js"></script>
</body>
</html>