ranger-compiler 2.1.69 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +103 -0
- package/README.md +991 -96
- package/{compiler/Lang.clj → dist/Lang.rgr} +2345 -75
- package/dist/README.md +116 -0
- package/dist/{bin/api.d.ts → api.d.ts} +430 -154
- package/dist/api.js +34345 -0
- package/{lib/Ajax.clj → dist/lib/Ajax.rgr} +1 -1
- package/{lib/CmdParams.clj → dist/lib/CmdParams.rgr} +72 -72
- package/{lib/Crypto.clj → dist/lib/Crypto.rgr} +1 -1
- package/{lib/DOMLib.clj → dist/lib/DOMLib.rgr} +2 -2
- package/{lib/Engine3D.clj → dist/lib/Engine3D.rgr} +1 -1
- package/{lib/ImmutableVector.clj → dist/lib/ImmutableVector.rgr} +364 -364
- package/{lib/IndexedDB.clj → dist/lib/IndexedDB.rgr} +1 -1
- package/{lib/JSON.clj → dist/lib/JSON.rgr} +105 -2
- package/{lib/JinxProcess.clj → dist/lib/JinxProcess.rgr} +3 -3
- package/{lib/Storage.clj → dist/lib/Storage.rgr} +1 -1
- package/{lib/Timers.clj → dist/lib/Timers.rgr} +176 -170
- package/{lib/ViewLib.clj → dist/lib/ViewLib.rgr} +1 -1
- package/dist/lib/lib/ACEEditor.rgr +5 -0
- package/dist/lib/lib/Ajax.rgr +196 -0
- package/dist/lib/lib/CmdParams.rgr +72 -0
- package/dist/lib/lib/Crypto.rgr +90 -0
- package/dist/lib/lib/DOMLib.rgr +307 -0
- package/{examples/3D/Engine3D.clj → dist/lib/lib/Engine3D.rgr} +870 -857
- package/dist/lib/lib/ImmutableVector.rgr +364 -0
- package/dist/lib/lib/IndexedDB.rgr +32 -0
- package/{compiler/JSON.clj → dist/lib/lib/JSON.rgr} +106 -3
- package/dist/lib/lib/JinxProcess.rgr +838 -0
- package/dist/lib/lib/SQL.rgr +44 -0
- package/dist/lib/lib/ServiceLib.rgr +9 -0
- package/dist/lib/lib/Storage.rgr +89 -0
- package/dist/lib/lib/Time.rgr +75 -0
- package/dist/lib/lib/Timers.rgr +176 -0
- package/dist/lib/lib/TypedArrays.rgr +14 -0
- package/dist/lib/lib/ViewLib.rgr +851 -0
- package/dist/lib/lib/WebLib.rgr +47 -0
- package/dist/lib/lib/WebServerLib.rgr +137 -0
- package/{lib/ranger-dir.clj → dist/lib/lib/ranger-dir.rgr} +1 -1
- package/{compiler/stdlib.clj → dist/lib/lib/stdlib.rgr} +42 -19
- package/{lib/stdops.clj → dist/lib/lib/stdops.rgr} +1 -1
- package/dist/lib/ranger-dir.rgr +175 -0
- package/{lib/stdlib.clj → dist/lib/stdlib.rgr} +2 -2
- package/dist/lib/stdops.rgr +168 -0
- package/dist/package.json +47 -0
- package/{bin/output.js → dist/rgrc.js} +15377 -7935
- package/dist/stdops.rgr +168 -0
- package/package.json +196 -38
- package/adventofcode/day1/bin/LambdaSignature1.java +0 -3
- package/adventofcode/day1/bin/LambdaSignature2.java +0 -3
- package/adventofcode/day1/bin/LambdaSignature3.java +0 -3
- package/adventofcode/day1/bin/day1.cpp +0 -124
- package/adventofcode/day1/bin/day1.go +0 -75
- package/adventofcode/day1/bin/day1.js +0 -45
- package/adventofcode/day1/bin/day1.php +0 -46
- package/adventofcode/day1/bin/day1.scala +0 -48
- package/adventofcode/day1/bin/day1.swift +0 -48
- package/adventofcode/day1/bin/day1_part2.cpp +0 -180
- package/adventofcode/day1/bin/day1_part2.go +0 -123
- package/adventofcode/day1/bin/day1_part2.js +0 -76
- package/adventofcode/day1/bin/day1_part2.php +0 -88
- package/adventofcode/day1/bin/day1_part2.scala +0 -81
- package/adventofcode/day1/bin/day1_part2.swift +0 -91
- package/adventofcode/day1/bin/day_one.java +0 -38
- package/adventofcode/day1/bin/day_one_part_two.java +0 -57
- package/adventofcode/day1/bin/operatorsOf.java +0 -37
- package/adventofcode/day1/bin/operatorsOf_5.java +0 -10
- package/adventofcode/day1/bin/operatorsOfboolean_5.java +0 -10
- package/adventofcode/day1/bin/variant.hpp +0 -2416
- package/adventofcode/day1/compile.bat +0 -7
- package/adventofcode/day1/compile2.bat +0 -7
- package/adventofcode/day1/day1.clj +0 -19
- package/adventofcode/day1/day1_part2.clj +0 -43
- package/adventofcode/day1/input1.txt +0 -1
- package/adventofcode/day2/bin/LambdaSignature1.class +0 -0
- package/adventofcode/day2/bin/LambdaSignature1.java +0 -3
- package/adventofcode/day2/bin/LambdaSignature2.class +0 -0
- package/adventofcode/day2/bin/LambdaSignature2.java +0 -3
- package/adventofcode/day2/bin/day2.cpp +0 -133
- package/adventofcode/day2/bin/day2.go +0 -85
- package/adventofcode/day2/bin/day2.js +0 -45
- package/adventofcode/day2/bin/day2.php +0 -59
- package/adventofcode/day2/bin/day2.scala +0 -54
- package/adventofcode/day2/bin/day2.swift +0 -62
- package/adventofcode/day2/bin/day2_part2.cpp +0 -150
- package/adventofcode/day2/bin/day2_part2.go +0 -101
- package/adventofcode/day2/bin/day2_part2.js +0 -54
- package/adventofcode/day2/bin/day2_part2.php +0 -80
- package/adventofcode/day2/bin/day2_part2.scala +0 -68
- package/adventofcode/day2/bin/day2_part2.swift +0 -82
- package/adventofcode/day2/bin/day_two.java +0 -61
- package/adventofcode/day2/bin/day_two_part_two$1$1$1.class +0 -0
- package/adventofcode/day2/bin/day_two_part_two$1$1.class +0 -0
- package/adventofcode/day2/bin/day_two_part_two$1.class +0 -0
- package/adventofcode/day2/bin/day_two_part_two.class +0 -0
- package/adventofcode/day2/bin/day_two_part_two.java +0 -80
- package/adventofcode/day2/bin/operatorsOf.class +0 -0
- package/adventofcode/day2/bin/operatorsOf.java +0 -18
- package/adventofcode/day2/bin/variant.hpp +0 -2416
- package/adventofcode/day2/compile.bat +0 -7
- package/adventofcode/day2/compile2.bat +0 -7
- package/adventofcode/day2/day2.clj +0 -60
- package/adventofcode/day2/day2_part2.clj +0 -69
- package/adventofcode/day2/input1.txt +0 -1
- package/adventofcode/day3/bin/Grid.java +0 -92
- package/adventofcode/day3/bin/GridRow.java +0 -5
- package/adventofcode/day3/bin/LambdaSignature1.java +0 -3
- package/adventofcode/day3/bin/LambdaSignature2.java +0 -3
- package/adventofcode/day3/bin/LambdaSignature3.java +0 -3
- package/adventofcode/day3/bin/day3.cpp +0 -64
- package/adventofcode/day3/bin/day3.go +0 -55
- package/adventofcode/day3/bin/day3.js +0 -42
- package/adventofcode/day3/bin/day3.php +0 -41
- package/adventofcode/day3/bin/day3.scala +0 -52
- package/adventofcode/day3/bin/day3.swift +0 -43
- package/adventofcode/day3/bin/day3_part2.cpp +0 -216
- package/adventofcode/day3/bin/day3_part2.go +0 -188
- package/adventofcode/day3/bin/day3_part2.js +0 -123
- package/adventofcode/day3/bin/day3_part2.php +0 -135
- package/adventofcode/day3/bin/day3_part2.swift +0 -131
- package/adventofcode/day3/bin/day_three_part_two.java +0 -43
- package/adventofcode/day3/bin/day_two.java +0 -42
- package/adventofcode/day3/bin/operatorsOf.java +0 -14
- package/adventofcode/day3/bin/variant.hpp +0 -2416
- package/adventofcode/day3/compile.bat +0 -7
- package/adventofcode/day3/compile2.bat +0 -7
- package/adventofcode/day3/day3.clj +0 -42
- package/adventofcode/day3/day3_part2.clj +0 -112
- package/adventofcode/day4/bin/LambdaSignature1.java +0 -3
- package/adventofcode/day4/bin/day4.cpp +0 -118
- package/adventofcode/day4/bin/day4.go +0 -75
- package/adventofcode/day4/bin/day4.js +0 -40
- package/adventofcode/day4/bin/day4.php +0 -52
- package/adventofcode/day4/bin/day4.scala +0 -47
- package/adventofcode/day4/bin/day4.swift +0 -56
- package/adventofcode/day4/bin/day4_part2.go +0 -129
- package/adventofcode/day4/bin/day4_part2.js +0 -72
- package/adventofcode/day4/bin/day_four.java +0 -41
- package/adventofcode/day4/bin/inputData.java +0 -7
- package/adventofcode/day4/bin/operatorsOf.java +0 -11
- package/adventofcode/day4/bin/variant.hpp +0 -2416
- package/adventofcode/day4/compile.bat +0 -7
- package/adventofcode/day4/compile2.bat +0 -7
- package/adventofcode/day4/day4.clj +0 -32
- package/adventofcode/day4/day4_part2.clj +0 -44
- package/adventofcode/day4/input.clj +0 -519
- package/adventofcode/day4/input.txt +0 -512
- package/bin/api.ts +0 -24471
- package/bin/compiler.ts +0 -24482
- package/compiler/ColorConsole.clj +0 -22
- package/compiler/ContextOperators.clj +0 -75
- package/compiler/FlowEnterVarDef.clj +0 -223
- package/compiler/InputFileSystem.clj +0 -276
- package/compiler/RangerDocs.clj +0 -7
- package/compiler/TFactory.clj +0 -146
- package/compiler/TFiles.clj +0 -23
- package/compiler/TFlow.clj +0 -39
- package/compiler/TNodeFactory.clj +0 -84
- package/compiler/TTypes.clj +0 -188
- package/compiler/VirtualCompiler.clj +0 -800
- package/compiler/bin/ng_Compiler.js +0 -23779
- package/compiler/commonmark_plugin.clj +0 -359
- package/compiler/feat2.bat +0 -2
- package/compiler/feats.bat +0 -9
- package/compiler/feature_tests.clj +0 -192
- package/compiler/index.js +0 -2
- package/compiler/issue_57.clj +0 -25
- package/compiler/makefile_plugin.clj +0 -135
- package/compiler/markdown_plugin.clj +0 -386
- package/compiler/maven_plugin.clj +0 -162
- package/compiler/ng_AndroidPageWriter.clj +0 -299
- package/compiler/ng_CodeNode.clj +0 -756
- package/compiler/ng_CodeNodeCompilerExtensions.clj +0 -839
- package/compiler/ng_Compiler.clj +0 -49
- package/compiler/ng_CompilerGeneric.clj +0 -260
- package/compiler/ng_CompilerOrig.clj +0 -854
- package/compiler/ng_DictNode.clj +0 -346
- package/compiler/ng_DictNode2.clj +0 -316
- package/compiler/ng_Execute.clj +0 -138
- package/compiler/ng_Execute1.clj +0 -129
- package/compiler/ng_FlowWork.clj +0 -3951
- package/compiler/ng_LiveCompiler.clj +0 -1109
- package/compiler/ng_RagnerJavaScriptClassWriter.clj +0 -402
- package/compiler/ng_RangerActiveOperators.clj +0 -86
- package/compiler/ng_RangerAppClassDesc.clj +0 -400
- package/compiler/ng_RangerAppEnums.clj +0 -86
- package/compiler/ng_RangerAppFunctionDesc.clj +0 -127
- package/compiler/ng_RangerAppMessages.clj +0 -15
- package/compiler/ng_RangerAppOperatorDesc.clj +0 -20
- package/compiler/ng_RangerAppParamDesc.clj +0 -388
- package/compiler/ng_RangerAppWriterContext.clj +0 -1793
- package/compiler/ng_RangerArgMatch.clj +0 -638
- package/compiler/ng_RangerCSharpClassWriter.clj +0 -484
- package/compiler/ng_RangerCppClassWriter.clj +0 -1023
- package/compiler/ng_RangerDocGenerator.clj +0 -305
- package/compiler/ng_RangerFlowParser.clj +0 -4992
- package/compiler/ng_RangerFlowParserOrig.clj +0 -4002
- package/compiler/ng_RangerGenericClassWriter.clj +0 -573
- package/compiler/ng_RangerGolangClassWriter.clj +0 -1766
- package/compiler/ng_RangerImmutableExtension.clj +0 -77
- package/compiler/ng_RangerJava7ClassWriter.clj +0 -961
- package/compiler/ng_RangerJavaScriptClassWriter.clj +0 -1042
- package/compiler/ng_RangerKotlinClassWriter.clj +0 -372
- package/compiler/ng_RangerLanguageWriters.clj +0 -14
- package/compiler/ng_RangerLispParser.clj +0 -873
- package/compiler/ng_RangerPHPClassWriter.clj +0 -643
- package/compiler/ng_RangerPlugin.clj +0 -41
- package/compiler/ng_RangerRangerClassWriter.clj +0 -357
- package/compiler/ng_RangerRustClassWriter.clj +0 -420
- package/compiler/ng_RangerScalaClassWriter.clj +0 -818
- package/compiler/ng_RangerSerializeClass.clj +0 -502
- package/compiler/ng_RangerServiceBuilder.clj +0 -63
- package/compiler/ng_RangerSwift3ClassWriter.clj +0 -809
- package/compiler/ng_RangerSwiftClassWriter.clj +0 -0
- package/compiler/ng_RangerTypeClass.clj +0 -45
- package/compiler/ng_SourceParser.clj +0 -241
- package/compiler/ng_SourceParser2.clj +0 -214
- package/compiler/ng_WebPageWriter.clj +0 -39
- package/compiler/ng_jsonParser.clj +0 -340
- package/compiler/ng_p_test.clj +0 -1711
- package/compiler/ng_parser.clj +0 -911
- package/compiler/ng_parser2.clj +0 -735
- package/compiler/ng_parser2_backup.clj +0 -1679
- package/compiler/ng_parser_backup.clj +0 -886
- package/compiler/ng_parser_ok.clj +0 -1718
- package/compiler/ng_parser_ok2.clj +0 -1717
- package/compiler/ng_parser_std_match.clj +0 -687
- package/compiler/ng_parser_std_match2.clj +0 -1012
- package/compiler/ng_parser_v2.clj +0 -1251
- package/compiler/ng_ui.clj +0 -403
- package/compiler/ng_ui_test.clj +0 -18
- package/compiler/ng_writer.clj +0 -338
- package/compiler/ng_xmlParser.clj +0 -472
- package/compiler/ng_xmlParser2.clj +0 -317
- package/compiler/ng_xmlParser3.clj +0 -251
- package/compiler/opdoc.bat +0 -4
- package/compiler/operators.md +0 -290
- package/compiler/p.bat +0 -4
- package/compiler/package.json +0 -10
- package/compiler/pcmd.bat +0 -4
- package/compiler/pcmd2.bat +0 -3
- package/compiler/plaintext_plugin.clj +0 -69
- package/compiler/plugin.bat +0 -19
- package/compiler/plugin2.bat +0 -4
- package/compiler/plugin_app.bat +0 -3
- package/compiler/plugin_apps.clj +0 -27
- package/compiler/plugins.bat +0 -10
- package/compiler/reveal_plugin.clj +0 -409
- package/compiler/simplePlugin.clj +0 -780
- package/compiler/t.bat +0 -3
- package/compiler/test_any.clj +0 -43
- package/compiler/test_call.clj +0 -141
- package/compiler/test_chain.clj +0 -79
- package/compiler/test_json.clj +0 -10
- package/compiler/test_lambda.clj +0 -153
- package/compiler/test_pcmd.clj +0 -32
- package/compiler/test_pcmd2.clj +0 -29
- package/compiler/test_plugin.clj +0 -237
- package/compiler/test_readfile.clj +0 -13
- package/compiler/test_reveal.clj +0 -19
- package/compiler/test_slides.clj +0 -312
- package/compiler/test_types.clj +0 -143
- package/compiler/test_types2.clj +0 -49
- package/compiler/test_types3.clj +0 -53
- package/compiler/test_var.clj +0 -40
- package/compiler/tonpm.bat +0 -14
- package/compiler/tonpm2.bat +0 -12
- package/compiler/ui_plugin.clj +0 -507
- package/compiler/ui_plugin2.clj +0 -427
- package/compiler/update-git.bat +0 -3
- package/compiler/vcomp.bat +0 -4
- package/compiler/viewbuilder_Android.clj +0 -176
- package/compiler/viewbuilder_Web.clj +0 -105
- package/dist/bin/api.js +0 -32422
- package/dist/bin/api.js.map +0 -1
- package/dist/bin/compiler.d.ts +0 -1638
- package/dist/bin/compiler.js +0 -32444
- package/dist/bin/compiler.js.map +0 -1
- package/examples/3D/bin/test_3d.js +0 -329
- package/examples/3D/test_3d.clj +0 -385
- package/examples/EVGColor/EVGColor.clj +0 -310
- package/examples/EVGColor/EVGColorContext.clj +0 -176
- package/examples/EVGColor/bin/EVGColor.js +0 -286
- package/examples/EVGColor/bin/minimized.js +0 -286
- package/examples/SVGPath/SVGPath.clj +0 -625
- package/examples/SVGPath/Vec2.clj +0 -103
- package/examples/SVGPath/bin/SVGPath.cpp +0 -887
- package/examples/SVGPath/bin/SVGPath.js +0 -682
- package/examples/SVGPath/bin/minimized.js +0 -578
- package/examples/SVGPath/bin/variant.hpp +0 -2416
- package/examples/minification/Vec2.clj +0 -103
- package/examples/minification/bin/minified.js +0 -44
- package/examples/minification/bin/test.js +0 -117
- package/examples/minification/test.clj +0 -13
- package/fiddle/VirtualCompiler.js +0 -23495
- package/fiddle/browser_editor.js +0 -13240
- package/fiddle/compileEnv.js +0 -1
- package/fiddle/compileEnv.json +0 -1
- package/fiddle/lang_data.js +0 -1
- package/index.html +0 -18
- package/native/httpd/HttpTester.clj +0 -33
- package/native/httpd/RangerWebService.clj +0 -81
- package/operators.md +0 -290
- package/tsconfig.json +0 -29
- package/versions/cpp/compiler.cpp +0 -15032
- package/versions/es6/compiler.js +0 -12860
- package/versions/go/compiler.go +0 -21338
- package/versions/java/AfterCodeNode.java +0 -4
- package/versions/java/ClassJoinPoint.java +0 -6
- package/versions/java/CodeFile.java +0 -42
- package/versions/java/CodeFileSystem.java +0 -72
- package/versions/java/CodeNode.java +0 -807
- package/versions/java/CodeSlice.java +0 -13
- package/versions/java/CodeWriter.java +0 -185
- package/versions/java/ColorConsole.java +0 -8
- package/versions/java/CompilerInterface.java +0 -213
- package/versions/java/DictNode.java +0 -353
- package/versions/java/LiveCompiler.java +0 -772
- package/versions/java/NodeEvalState.java +0 -24
- package/versions/java/OpFindResult.java +0 -6
- package/versions/java/RangerAppArrayValue.java +0 -7
- package/versions/java/RangerAppClassDesc.java +0 -217
- package/versions/java/RangerAppEnum.java +0 -14
- package/versions/java/RangerAppFunctionDesc.java +0 -20
- package/versions/java/RangerAppHashValue.java +0 -11
- package/versions/java/RangerAppInterfaceImpl.java +0 -6
- package/versions/java/RangerAppMethodVariants.java +0 -6
- package/versions/java/RangerAppParamDesc.java +0 -321
- package/versions/java/RangerAppTodo.java +0 -6
- package/versions/java/RangerAppValue.java +0 -10
- package/versions/java/RangerAppWriterContext.java +0 -800
- package/versions/java/RangerArgMatch.java +0 -317
- package/versions/java/RangerBackReference.java +0 -7
- package/versions/java/RangerCSharpClassWriter.java +0 -287
- package/versions/java/RangerCompilerMessage.java +0 -9
- package/versions/java/RangerCppClassWriter.java +0 -725
- package/versions/java/RangerFlowParser.java +0 -2142
- package/versions/java/RangerGenericClassWriter.java +0 -367
- package/versions/java/RangerGolangClassWriter.java +0 -1379
- package/versions/java/RangerJava7ClassWriter.java +0 -652
- package/versions/java/RangerJavaScriptClassWriter.java +0 -305
- package/versions/java/RangerKotlinClassWriter.java +0 -380
- package/versions/java/RangerLispParser.java +0 -845
- package/versions/java/RangerNodeValue.java +0 -9
- package/versions/java/RangerPHPClassWriter.java +0 -527
- package/versions/java/RangerParamEventHandler.java +0 -6
- package/versions/java/RangerParamEventList.java +0 -5
- package/versions/java/RangerParamEventMap.java +0 -27
- package/versions/java/RangerRangerClassWriter.java +0 -268
- package/versions/java/RangerRefForce.java +0 -7
- package/versions/java/RangerScalaClassWriter.java +0 -365
- package/versions/java/RangerSerializeClass.java +0 -148
- package/versions/java/RangerSwift3ClassWriter.java +0 -548
- package/versions/java/RangerTypeClass.java +0 -17
- package/versions/java/SourceCode.java +0 -65
- package/versions/php/compiler.php +0 -13830
- package/versions/swift3/compiler.swift +0 -12542
- /package/{lib/ACEEditor.clj → dist/lib/ACEEditor.rgr} +0 -0
- /package/{lib/SQL.clj → dist/lib/SQL.rgr} +0 -0
- /package/{lib/ServiceLib.clj → dist/lib/ServiceLib.rgr} +0 -0
- /package/{lib/Time.clj → dist/lib/Time.rgr} +0 -0
- /package/{lib/TypedArrays.clj → dist/lib/TypedArrays.rgr} +0 -0
- /package/{lib/WebLib.clj → dist/lib/WebLib.rgr} +0 -0
- /package/{lib/WebServerLib.clj → dist/lib/WebServerLib.rgr} +0 -0
|
@@ -1,887 +0,0 @@
|
|
|
1
|
-
#include <memory>
|
|
2
|
-
#include "variant.hpp"
|
|
3
|
-
#include <math.h>
|
|
4
|
-
#include <cmath>
|
|
5
|
-
#include <iostream>
|
|
6
|
-
#include <string>
|
|
7
|
-
#include <vector>
|
|
8
|
-
#include <sstream>
|
|
9
|
-
#include <cstring>
|
|
10
|
-
|
|
11
|
-
// define classes here to avoid compiler errors
|
|
12
|
-
class Vec2;
|
|
13
|
-
class Mat2;
|
|
14
|
-
class PathExecutor;
|
|
15
|
-
class PathCollector;
|
|
16
|
-
class PathSegment;
|
|
17
|
-
class EVGBezierPath;
|
|
18
|
-
class EVGPathParser;
|
|
19
|
-
|
|
20
|
-
typedef mpark::variant<std::shared_ptr<Vec2>, std::shared_ptr<Mat2>, std::shared_ptr<PathExecutor>, std::shared_ptr<PathCollector>, std::shared_ptr<PathSegment>, std::shared_ptr<EVGBezierPath>, std::shared_ptr<EVGPathParser>, int, std::string, bool, double> r_union_Any;
|
|
21
|
-
|
|
22
|
-
template <typename T>
|
|
23
|
-
std::string join(const T& v, const std::string& delim) {
|
|
24
|
-
std::ostringstream s;
|
|
25
|
-
for (const auto& i : v) {
|
|
26
|
-
if (&i != &v[0]) {
|
|
27
|
-
s << delim;
|
|
28
|
-
}
|
|
29
|
-
s << i;
|
|
30
|
-
}
|
|
31
|
-
return s.str();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
template <class T>
|
|
36
|
-
class r_optional_primitive {
|
|
37
|
-
public:
|
|
38
|
-
bool has_value;
|
|
39
|
-
T value;
|
|
40
|
-
r_optional_primitive<T> & operator=(const r_optional_primitive<T> & rhs) {
|
|
41
|
-
has_value = rhs.has_value;
|
|
42
|
-
value = rhs.value;
|
|
43
|
-
return *this;
|
|
44
|
-
}
|
|
45
|
-
r_optional_primitive<T> & operator=(const T a_value) {
|
|
46
|
-
has_value = true;
|
|
47
|
-
value = a_value;
|
|
48
|
-
return *this;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
r_optional_primitive<double> cpp_str_to_double(std::string s) {
|
|
53
|
-
r_optional_primitive<double> result;
|
|
54
|
-
try {
|
|
55
|
-
result.value = std::stod(s);
|
|
56
|
-
result.has_value = true;
|
|
57
|
-
} catch (...) {
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
return result;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// header definitions
|
|
64
|
-
class Vec2 : public std::enable_shared_from_this<Vec2> {
|
|
65
|
-
public :
|
|
66
|
-
double x;
|
|
67
|
-
double y;
|
|
68
|
-
/* class constructor */
|
|
69
|
-
Vec2( );
|
|
70
|
-
/* static methods */
|
|
71
|
-
static std::shared_ptr<Vec2> CreateNew( double i , double j );
|
|
72
|
-
};
|
|
73
|
-
class Mat2 : public std::enable_shared_from_this<Mat2> {
|
|
74
|
-
public :
|
|
75
|
-
double m0;
|
|
76
|
-
double m1;
|
|
77
|
-
double m2;
|
|
78
|
-
double m3;
|
|
79
|
-
double m4;
|
|
80
|
-
double m5;
|
|
81
|
-
/* class constructor */
|
|
82
|
-
Mat2( );
|
|
83
|
-
/* instance methods */
|
|
84
|
-
void toIdentity();
|
|
85
|
-
void setTranslate( double tx , double ty );
|
|
86
|
-
void setScale( double sx , double sy );
|
|
87
|
-
void setSkewX( double v );
|
|
88
|
-
void setSkewY( double v );
|
|
89
|
-
void setRotation( double v );
|
|
90
|
-
void multiply( std::shared_ptr<Mat2> b );
|
|
91
|
-
std::shared_ptr<Mat2> inverse();
|
|
92
|
-
std::shared_ptr<Vec2> transformPoint( std::shared_ptr<Vec2> v );
|
|
93
|
-
std::shared_ptr<Vec2> rotateVector( std::shared_ptr<Vec2> v );
|
|
94
|
-
};
|
|
95
|
-
class PathExecutor : public std::enable_shared_from_this<PathExecutor> {
|
|
96
|
-
public :
|
|
97
|
-
/* class constructor */
|
|
98
|
-
PathExecutor( );
|
|
99
|
-
/* instance methods */
|
|
100
|
-
virtual void Move( double x , double y );
|
|
101
|
-
virtual void Line( double x , double y );
|
|
102
|
-
virtual void Curve( double x0 , double y0 , double x1 , double y1 , double x2 , double y2 );
|
|
103
|
-
};
|
|
104
|
-
class PathCollector : public PathExecutor {
|
|
105
|
-
public :
|
|
106
|
-
std::vector<std::string> pathParts;
|
|
107
|
-
/* class constructor */
|
|
108
|
-
PathCollector( );
|
|
109
|
-
/* instance methods */
|
|
110
|
-
void Move( double x , double y );
|
|
111
|
-
void Line( double x , double y );
|
|
112
|
-
void Curve( double x0 , double y0 , double x1 , double y1 , double x2 , double y2 );
|
|
113
|
-
std::string getString();
|
|
114
|
-
};
|
|
115
|
-
class PathSegment : public std::enable_shared_from_this<PathSegment> {
|
|
116
|
-
public :
|
|
117
|
-
double t0;
|
|
118
|
-
double t1;
|
|
119
|
-
double t2;
|
|
120
|
-
double t3;
|
|
121
|
-
double t4;
|
|
122
|
-
double t5;
|
|
123
|
-
double t6;
|
|
124
|
-
/* class constructor */
|
|
125
|
-
PathSegment( );
|
|
126
|
-
};
|
|
127
|
-
class EVGBezierPath : public std::enable_shared_from_this<EVGBezierPath> {
|
|
128
|
-
public :
|
|
129
|
-
std::vector<std::shared_ptr<Vec2>> points /** note: unused */;
|
|
130
|
-
std::shared_ptr<EVGBezierPath> next /** note: unused */;
|
|
131
|
-
int pointCnt /** note: unused */;
|
|
132
|
-
bool closed;
|
|
133
|
-
std::shared_ptr<Vec2> bounds /** note: unused */;
|
|
134
|
-
std::shared_ptr<Vec2> cp1 /** note: unused */;
|
|
135
|
-
std::shared_ptr<Vec2> cp2 /** note: unused */;
|
|
136
|
-
std::shared_ptr<Vec2> controlPoint;
|
|
137
|
-
/* class constructor */
|
|
138
|
-
EVGBezierPath( );
|
|
139
|
-
/* instance methods */
|
|
140
|
-
void close();
|
|
141
|
-
void Line( std::shared_ptr<Vec2> point );
|
|
142
|
-
void moveTo( std::shared_ptr<Vec2> point );
|
|
143
|
-
};
|
|
144
|
-
class EVGPathParser : public std::enable_shared_from_this<EVGPathParser> {
|
|
145
|
-
public :
|
|
146
|
-
int i;
|
|
147
|
-
int __len;
|
|
148
|
-
const char* buff;
|
|
149
|
-
double last_number;
|
|
150
|
-
/* class constructor */
|
|
151
|
-
EVGPathParser( );
|
|
152
|
-
/* static methods */
|
|
153
|
-
static void m();
|
|
154
|
-
/* instance methods */
|
|
155
|
-
double __sqr( double v );
|
|
156
|
-
std::shared_ptr<Vec2> __xformPoint( std::shared_ptr<Vec2> point , std::shared_ptr<PathSegment> seg );
|
|
157
|
-
std::shared_ptr<Vec2> __xformVec( std::shared_ptr<Vec2> point , std::shared_ptr<PathSegment> seg );
|
|
158
|
-
double __vmag( std::shared_ptr<Vec2> point );
|
|
159
|
-
double __vecrat( std::shared_ptr<Vec2> u , std::shared_ptr<Vec2> v );
|
|
160
|
-
double __vecang( std::shared_ptr<Vec2> u , std::shared_ptr<Vec2> v );
|
|
161
|
-
bool scanNumber();
|
|
162
|
-
std::shared_ptr<Vec2> pathArcTo( std::shared_ptr<PathExecutor> callback , std::shared_ptr<Vec2> cp , std::shared_ptr<PathSegment> args , bool rel );
|
|
163
|
-
void parsePath( std::string path , std::shared_ptr<PathExecutor> callback );
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
int __g_argc;
|
|
167
|
-
char **__g_argv;
|
|
168
|
-
Vec2::Vec2( ) {
|
|
169
|
-
this->x = 0;
|
|
170
|
-
this->y = 0;
|
|
171
|
-
}
|
|
172
|
-
std::shared_ptr<Vec2> Vec2::CreateNew( double i , double j ) {
|
|
173
|
-
std::shared_ptr<Vec2> v = std::make_shared<Vec2>();
|
|
174
|
-
v->x = i;
|
|
175
|
-
v->y = j;
|
|
176
|
-
return v;
|
|
177
|
-
}
|
|
178
|
-
Mat2::Mat2( ) {
|
|
179
|
-
this->m0 = 1;
|
|
180
|
-
this->m1 = 0;
|
|
181
|
-
this->m2 = 0;
|
|
182
|
-
this->m3 = 1;
|
|
183
|
-
this->m4 = 0;
|
|
184
|
-
this->m5 = 0;
|
|
185
|
-
}
|
|
186
|
-
void Mat2::toIdentity() {
|
|
187
|
-
m0 = 1;
|
|
188
|
-
m1 = 0;
|
|
189
|
-
m2 = 0;
|
|
190
|
-
m3 = 1;
|
|
191
|
-
m4 = 0;
|
|
192
|
-
m5 = 0;
|
|
193
|
-
}
|
|
194
|
-
void Mat2::setTranslate( double tx , double ty ) {
|
|
195
|
-
m4 = tx;
|
|
196
|
-
m5 = ty;
|
|
197
|
-
}
|
|
198
|
-
void Mat2::setScale( double sx , double sy ) {
|
|
199
|
-
m1 = sx;
|
|
200
|
-
m3 = sy;
|
|
201
|
-
}
|
|
202
|
-
void Mat2::setSkewX( double v ) {
|
|
203
|
-
m0 = 1;
|
|
204
|
-
m1 = 0;
|
|
205
|
-
m2 = tan(v);
|
|
206
|
-
m3 = 1;
|
|
207
|
-
m4 = 0;
|
|
208
|
-
m5 = 0;
|
|
209
|
-
}
|
|
210
|
-
void Mat2::setSkewY( double v ) {
|
|
211
|
-
m0 = 1;
|
|
212
|
-
m1 = tan(v);
|
|
213
|
-
m2 = 0;
|
|
214
|
-
m3 = 1;
|
|
215
|
-
m4 = 0;
|
|
216
|
-
m5 = 0;
|
|
217
|
-
}
|
|
218
|
-
void Mat2::setRotation( double v ) {
|
|
219
|
-
double cs = cos(v);
|
|
220
|
-
double sn = sin(v);
|
|
221
|
-
m0 = cs;
|
|
222
|
-
m1 = sn;
|
|
223
|
-
m2 = -1 * sn;
|
|
224
|
-
m3 = cs;
|
|
225
|
-
m4 = 0;
|
|
226
|
-
m5 = 0;
|
|
227
|
-
}
|
|
228
|
-
void Mat2::multiply( std::shared_ptr<Mat2> b ) {
|
|
229
|
-
double t0 = (m0 * b->m0) + (m1 * b->m2);
|
|
230
|
-
double t2 = (m2 * b->m0) + (m3 * b->m2);
|
|
231
|
-
double t4 = ((m4 * b->m0) + (m5 * b->m2)) + b->m4;
|
|
232
|
-
m1 = (m0 * b->m1) + (m1 * b->m3);
|
|
233
|
-
m3 = (m2 * b->m1) + (m3 * b->m3);
|
|
234
|
-
m5 = ((m4 * b->m1) + (m5 * b->m3)) + b->m5;
|
|
235
|
-
m0 = t0;
|
|
236
|
-
m2 = t2;
|
|
237
|
-
m4 = t4;
|
|
238
|
-
}
|
|
239
|
-
std::shared_ptr<Mat2> Mat2::inverse() {
|
|
240
|
-
double invdet = (m0 * m3) - (m2 * m1);
|
|
241
|
-
double det = invdet;
|
|
242
|
-
if ( (det > -0.0001) && (det < 0.0001) ) {
|
|
243
|
-
this->toIdentity();
|
|
244
|
-
return shared_from_this();
|
|
245
|
-
}
|
|
246
|
-
invdet = 1 / det;
|
|
247
|
-
std::shared_ptr<Mat2> inv = std::make_shared<Mat2>();
|
|
248
|
-
inv->m0 = m3 * invdet;
|
|
249
|
-
inv->m2 = (-1 * m2) * invdet;
|
|
250
|
-
inv->m4 = (m2 * m5) - ((m3 * m4) * invdet);
|
|
251
|
-
inv->m1 = (-1 * m1) * invdet;
|
|
252
|
-
inv->m3 = m0 * invdet;
|
|
253
|
-
inv->m5 = (m1 * m4) - ((m0 * m5) * invdet);
|
|
254
|
-
return inv;
|
|
255
|
-
}
|
|
256
|
-
std::shared_ptr<Vec2> Mat2::transformPoint( std::shared_ptr<Vec2> v ) {
|
|
257
|
-
std::shared_ptr<Vec2> res = std::make_shared<Vec2>();
|
|
258
|
-
res->x = ((v->x * m0) + (v->y * m2)) + m4;
|
|
259
|
-
res->y = ((v->x * m1) + (v->y * m3)) + m5;
|
|
260
|
-
return res;
|
|
261
|
-
}
|
|
262
|
-
std::shared_ptr<Vec2> Mat2::rotateVector( std::shared_ptr<Vec2> v ) {
|
|
263
|
-
std::shared_ptr<Vec2> res = std::make_shared<Vec2>();
|
|
264
|
-
res->x = (v->x * m0) + (v->y * m2);
|
|
265
|
-
res->y = (v->x * m1) + (v->y * m3);
|
|
266
|
-
return res;
|
|
267
|
-
}
|
|
268
|
-
PathExecutor::PathExecutor( ) {
|
|
269
|
-
}
|
|
270
|
-
void PathExecutor::Move( double x , double y ) {
|
|
271
|
-
std::cout << ((std::string("Move called with ") + std::to_string(x)) + std::string(", ")) + std::to_string(y) << std::endl;
|
|
272
|
-
}
|
|
273
|
-
void PathExecutor::Line( double x , double y ) {
|
|
274
|
-
std::cout << ((std::string("Line called with ") + std::to_string(x)) + std::string(", ")) + std::to_string(y) << std::endl;
|
|
275
|
-
}
|
|
276
|
-
void PathExecutor::Curve( double x0 , double y0 , double x1 , double y1 , double x2 , double y2 ) {
|
|
277
|
-
std::cout << (((((((((((std::string("Cubic bezier curve called with ") + std::to_string(x0)) + std::string(", ")) + std::to_string(y0)) + std::string(" ")) + std::to_string(x1)) + std::string(", ")) + std::to_string(y1)) + std::string(" ")) + std::to_string(x2)) + std::string(", ")) + std::to_string(y2)) + std::string(" ") << std::endl;
|
|
278
|
-
}
|
|
279
|
-
PathCollector::PathCollector( ) {
|
|
280
|
-
}
|
|
281
|
-
void PathCollector::Move( double x , double y ) {
|
|
282
|
-
pathParts.push_back( (((std::string("M ") + std::to_string(x)) + std::string(" ")) + std::to_string(y)) + std::string(" ") );
|
|
283
|
-
}
|
|
284
|
-
void PathCollector::Line( double x , double y ) {
|
|
285
|
-
pathParts.push_back( (((std::string("L ") + std::to_string(x)) + std::string(" ")) + std::to_string(y)) + std::string(" ") );
|
|
286
|
-
}
|
|
287
|
-
void PathCollector::Curve( double x0 , double y0 , double x1 , double y1 , double x2 , double y2 ) {
|
|
288
|
-
pathParts.push_back( (((((((((((std::string("C ") + std::to_string(x0)) + std::string(" ")) + std::to_string(y0)) + std::string(" ")) + std::to_string(x1)) + std::string(" ")) + std::to_string(y1)) + std::string(" ")) + std::to_string(x2)) + std::string(" ")) + std::to_string(y2)) + std::string(" ") );
|
|
289
|
-
}
|
|
290
|
-
std::string PathCollector::getString() {
|
|
291
|
-
return join( pathParts , std::string(" "));
|
|
292
|
-
}
|
|
293
|
-
PathSegment::PathSegment( ) {
|
|
294
|
-
this->t0 = 0;
|
|
295
|
-
this->t1 = 0;
|
|
296
|
-
this->t2 = 0;
|
|
297
|
-
this->t3 = 0;
|
|
298
|
-
this->t4 = 0;
|
|
299
|
-
this->t5 = 0;
|
|
300
|
-
this->t6 = 0;
|
|
301
|
-
}
|
|
302
|
-
EVGBezierPath::EVGBezierPath( ) {
|
|
303
|
-
this->pointCnt = 0;
|
|
304
|
-
this->closed = false;
|
|
305
|
-
this->bounds = Vec2::CreateNew(0, 0);
|
|
306
|
-
;
|
|
307
|
-
this->cp1 = Vec2::CreateNew(0, 0);
|
|
308
|
-
;
|
|
309
|
-
this->cp2 = Vec2::CreateNew(0, 0);
|
|
310
|
-
;
|
|
311
|
-
this->controlPoint = Vec2::CreateNew(0, 0);
|
|
312
|
-
;
|
|
313
|
-
}
|
|
314
|
-
void EVGBezierPath::close() {
|
|
315
|
-
closed = true;
|
|
316
|
-
}
|
|
317
|
-
void EVGBezierPath::Line( std::shared_ptr<Vec2> point ) {
|
|
318
|
-
}
|
|
319
|
-
void EVGBezierPath::moveTo( std::shared_ptr<Vec2> point ) {
|
|
320
|
-
controlPoint->x = point->x;
|
|
321
|
-
controlPoint->y = point->y;
|
|
322
|
-
}
|
|
323
|
-
EVGPathParser::EVGPathParser( ) {
|
|
324
|
-
this->i = 0;
|
|
325
|
-
this->__len = 0;
|
|
326
|
-
this->last_number = 0;
|
|
327
|
-
}
|
|
328
|
-
double EVGPathParser::__sqr( double v ) {
|
|
329
|
-
return v * v;
|
|
330
|
-
}
|
|
331
|
-
std::shared_ptr<Vec2> EVGPathParser::__xformPoint( std::shared_ptr<Vec2> point , std::shared_ptr<PathSegment> seg ) {
|
|
332
|
-
std::shared_ptr<Vec2> res = Vec2::CreateNew((((point->x * seg->t0) + (point->y * seg->t2)) + seg->t4), (((point->x * seg->t1) + (point->y * seg->t3)) + seg->t5));
|
|
333
|
-
return res;
|
|
334
|
-
}
|
|
335
|
-
std::shared_ptr<Vec2> EVGPathParser::__xformVec( std::shared_ptr<Vec2> point , std::shared_ptr<PathSegment> seg ) {
|
|
336
|
-
return Vec2::CreateNew(((point->x * seg->t0) + (point->y * seg->t2)), ((point->x * seg->t1) + (point->y * seg->t3)));
|
|
337
|
-
}
|
|
338
|
-
double EVGPathParser::__vmag( std::shared_ptr<Vec2> point ) {
|
|
339
|
-
return sqrt(((point->x * point->x) + (point->y * point->y)));
|
|
340
|
-
}
|
|
341
|
-
double EVGPathParser::__vecrat( std::shared_ptr<Vec2> u , std::shared_ptr<Vec2> v ) {
|
|
342
|
-
return ((u->x * v->x) + (u->y * v->y)) / (this->__vmag(u) * this->__vmag(v));
|
|
343
|
-
}
|
|
344
|
-
double EVGPathParser::__vecang( std::shared_ptr<Vec2> u , std::shared_ptr<Vec2> v ) {
|
|
345
|
-
double r = this->__vecrat(u, v);
|
|
346
|
-
if ( r < -1 ) {
|
|
347
|
-
r = -1;
|
|
348
|
-
}
|
|
349
|
-
if ( r > 1 ) {
|
|
350
|
-
r = 1;
|
|
351
|
-
}
|
|
352
|
-
double res = 1;
|
|
353
|
-
if ( (u->x * v->y) < (u->y * v->x) ) {
|
|
354
|
-
res = -1;
|
|
355
|
-
}
|
|
356
|
-
return res * (acos(r));
|
|
357
|
-
}
|
|
358
|
-
bool EVGPathParser::scanNumber() {
|
|
359
|
-
const char* s = this->buff;
|
|
360
|
-
char fc = s[i];
|
|
361
|
-
char c = fc;
|
|
362
|
-
int sp = 0;
|
|
363
|
-
int ep = 0;
|
|
364
|
-
fc = s[i];
|
|
365
|
-
if ( (((fc == 45) && ((s[(i + 1)]) >= 46)) && ((s[(i + 1)]) <= 57)) || ((fc >= 48) && (fc <= 57)) ) {
|
|
366
|
-
sp = i;
|
|
367
|
-
i = 1 + i;
|
|
368
|
-
c = s[i];
|
|
369
|
-
while ((i < __len) && ((((c >= 48) && (c <= 57)) || (c == (46))) || ((i == sp) && ((c == (43)) || (c == (45)))))) {
|
|
370
|
-
i = 1 + i;
|
|
371
|
-
if ( i >= __len ) {
|
|
372
|
-
break;
|
|
373
|
-
}
|
|
374
|
-
c = s[i];
|
|
375
|
-
}
|
|
376
|
-
ep = i;
|
|
377
|
-
last_number = /*unwrap dbl*/(cpp_str_to_double((std::string( s + sp, ep - sp )))).value;
|
|
378
|
-
return true;
|
|
379
|
-
}
|
|
380
|
-
return false;
|
|
381
|
-
}
|
|
382
|
-
std::shared_ptr<Vec2> EVGPathParser::pathArcTo( std::shared_ptr<PathExecutor> callback , std::shared_ptr<Vec2> cp , std::shared_ptr<PathSegment> args , bool rel ) {
|
|
383
|
-
double rx = 0;
|
|
384
|
-
double ry = 0;
|
|
385
|
-
double rotx = 0;
|
|
386
|
-
double x1 = 0;
|
|
387
|
-
double y1 = 0;
|
|
388
|
-
double x2 = 0;
|
|
389
|
-
double y2 = 0;
|
|
390
|
-
double cx = 0;
|
|
391
|
-
double cy = 0;
|
|
392
|
-
double dx = 0;
|
|
393
|
-
double dy = 0;
|
|
394
|
-
double d = 0;
|
|
395
|
-
double x1p = 0;
|
|
396
|
-
double y1p = 0;
|
|
397
|
-
double cxp = 0;
|
|
398
|
-
double cyp = 0;
|
|
399
|
-
double s = 0;
|
|
400
|
-
double sa = 0;
|
|
401
|
-
double sb = 0;
|
|
402
|
-
/** unused: double ux = 0 **/ ;
|
|
403
|
-
/** unused: double uy = 0 **/ ;
|
|
404
|
-
/** unused: double vx = 0 **/ ;
|
|
405
|
-
/** unused: double vy = 0 **/ ;
|
|
406
|
-
double a1 = 0;
|
|
407
|
-
double da = 0;
|
|
408
|
-
double x = 0;
|
|
409
|
-
double y = 0;
|
|
410
|
-
double tanx = 0;
|
|
411
|
-
double tany = 0;
|
|
412
|
-
double a = 0;
|
|
413
|
-
double px = 0;
|
|
414
|
-
double py = 0;
|
|
415
|
-
double ptanx = 0;
|
|
416
|
-
double ptany = 0;
|
|
417
|
-
std::shared_ptr<PathSegment> t = std::make_shared<PathSegment>();
|
|
418
|
-
double sinrx = 0;
|
|
419
|
-
double cosrx = 0;
|
|
420
|
-
double fa = 0;
|
|
421
|
-
double fs = 0;
|
|
422
|
-
int i_1 = 0;
|
|
423
|
-
int ndivs = 0;
|
|
424
|
-
double hda = 0;
|
|
425
|
-
double kappa = 0;
|
|
426
|
-
double PI_VALUE = M_PI;
|
|
427
|
-
double cpx = cp->x;
|
|
428
|
-
double cpy = cp->y;
|
|
429
|
-
rx = fabs(args->t0);
|
|
430
|
-
ry = fabs(args->t1);
|
|
431
|
-
rotx = (args->t2 / 180) * PI_VALUE;
|
|
432
|
-
fa = (((fabs(args->t3)) > 0.00001) ? 1 : 0);
|
|
433
|
-
fs = (((fabs(args->t4)) > 0.00001) ? 1 : 0);
|
|
434
|
-
x1 = cpx;
|
|
435
|
-
y1 = cpy;
|
|
436
|
-
if ( rel ) {
|
|
437
|
-
x2 = cpx + args->t5;
|
|
438
|
-
y2 = cpy + args->t6;
|
|
439
|
-
} else {
|
|
440
|
-
x2 = args->t5;
|
|
441
|
-
y2 = args->t6;
|
|
442
|
-
}
|
|
443
|
-
dx = x1 - x2;
|
|
444
|
-
dy = y1 - y2;
|
|
445
|
-
d = sqrt(((dx * dx) + (dy * dy)));
|
|
446
|
-
if ( ((d < 0.00001) || (rx < 0.00001)) || (ry < 0.00001) ) {
|
|
447
|
-
callback->Line(x2, y2);
|
|
448
|
-
return Vec2::CreateNew(x2, y2);
|
|
449
|
-
}
|
|
450
|
-
sinrx = sin(rotx);
|
|
451
|
-
cosrx = cos(rotx);
|
|
452
|
-
x1p = ((cosrx * dx) / 2) + ((sinrx * dy) / 2);
|
|
453
|
-
y1p = (((-1 * sinrx) * dx) / 2) + ((cosrx * dy) / 2);
|
|
454
|
-
d = ((x1p * x1p) / (rx * rx)) + ((y1p * y1p) / (ry * ry));
|
|
455
|
-
if ( d > 1 ) {
|
|
456
|
-
d = sqrt(d);
|
|
457
|
-
rx = rx * d;
|
|
458
|
-
ry = ry * d;
|
|
459
|
-
}
|
|
460
|
-
s = 0;
|
|
461
|
-
sa = (((rx * rx) * (ry * ry)) - ((rx * rx) * (y1p * y1p))) - ((ry * ry) * (x1p * x1p));
|
|
462
|
-
sb = ((rx * rx) * (y1p * y1p)) + ((ry * ry) * (x1p * x1p));
|
|
463
|
-
if ( sa < 0 ) {
|
|
464
|
-
sa = 0;
|
|
465
|
-
}
|
|
466
|
-
if ( sb > 0 ) {
|
|
467
|
-
s = sqrt((sa / sb));
|
|
468
|
-
}
|
|
469
|
-
if ( fa == fs ) {
|
|
470
|
-
s = -1 * s;
|
|
471
|
-
}
|
|
472
|
-
cxp = ((s * rx) * y1p) / ry;
|
|
473
|
-
cyp = ((s * (-1 * ry)) * x1p) / rx;
|
|
474
|
-
cx = ((x1 + x2) / 2) + ((cosrx * cxp) - (sinrx * cyp));
|
|
475
|
-
cy = ((y1 + y2) / 2) + ((sinrx * cxp) + (cosrx * cyp));
|
|
476
|
-
std::shared_ptr<Vec2> u = Vec2::CreateNew(((x1p - cxp) / rx), ((y1p - cyp) / ry));
|
|
477
|
-
std::shared_ptr<Vec2> v = Vec2::CreateNew((((-1 * x1p) - cxp) / rx), (((-1 * y1p) - cyp) / ry));
|
|
478
|
-
std::shared_ptr<Vec2> unitV = Vec2::CreateNew(1, 0);
|
|
479
|
-
a1 = this->__vecang(unitV, u);
|
|
480
|
-
da = this->__vecang(u, v);
|
|
481
|
-
if ( (fs == 0) && (da > 0) ) {
|
|
482
|
-
da = da - (2 * PI_VALUE);
|
|
483
|
-
} else {
|
|
484
|
-
if ( (fs == 1) && (da < 0) ) {
|
|
485
|
-
da = (2 * PI_VALUE) + da;
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
t->t0 = cosrx;
|
|
489
|
-
t->t1 = sinrx;
|
|
490
|
-
t->t2 = -1 * sinrx;
|
|
491
|
-
t->t3 = cosrx;
|
|
492
|
-
t->t4 = cx;
|
|
493
|
-
t->t5 = cy;
|
|
494
|
-
ndivs = (int)floor( (((fabs(da)) / (PI_VALUE * 0.5)) + 1));
|
|
495
|
-
hda = (da / ((double)(ndivs))) / 2;
|
|
496
|
-
kappa = fabs((((4 / 3) * (1 - (cos(hda)))) / (sin(hda))));
|
|
497
|
-
if ( da < 0 ) {
|
|
498
|
-
kappa = -1 * kappa;
|
|
499
|
-
}
|
|
500
|
-
i_1 = 0;
|
|
501
|
-
while (i_1 <= ndivs) {
|
|
502
|
-
a = a1 + ((da * ((double)(i_1))) / ((double)(ndivs)));
|
|
503
|
-
dx = cos(a);
|
|
504
|
-
dy = sin(a);
|
|
505
|
-
std::shared_ptr<Vec2> trans = this->__xformPoint(Vec2::CreateNew((dx * rx), (dy * ry)), t);
|
|
506
|
-
x = trans->x;
|
|
507
|
-
y = trans->y;
|
|
508
|
-
std::shared_ptr<Vec2> v_trans = this->__xformVec(Vec2::CreateNew((((-1 * dy) * rx) * kappa), ((dx * ry) * kappa)), t);
|
|
509
|
-
tanx = v_trans->x;
|
|
510
|
-
tany = v_trans->y;
|
|
511
|
-
if ( i_1 > 0 ) {
|
|
512
|
-
callback->Curve(px + ptanx, py + ptany, x - tanx, y - tany, x, y);
|
|
513
|
-
}
|
|
514
|
-
px = x;
|
|
515
|
-
py = y;
|
|
516
|
-
ptanx = tanx;
|
|
517
|
-
ptany = tany;
|
|
518
|
-
i_1 = i_1 + 1;
|
|
519
|
-
}
|
|
520
|
-
std::shared_ptr<Vec2> rv = Vec2::CreateNew(x2, y2);
|
|
521
|
-
return rv;
|
|
522
|
-
}
|
|
523
|
-
void EVGPathParser::parsePath( std::string path , std::shared_ptr<PathExecutor> callback ) {
|
|
524
|
-
i = 0;
|
|
525
|
-
this->buff = path.c_str();
|
|
526
|
-
const char* s = this->buff;
|
|
527
|
-
__len = strlen( s );
|
|
528
|
-
/** unused: const char* buff_1 = path.c_str() **/ ;
|
|
529
|
-
char cmd = 76;
|
|
530
|
-
/** unused: std::shared_ptr<EVGBezierPath> path_1 = std::make_shared<EVGBezierPath>() **/ ;
|
|
531
|
-
std::shared_ptr<PathSegment> args = std::make_shared<PathSegment>();
|
|
532
|
-
int require_args = 2;
|
|
533
|
-
int arg_cnt = 0;
|
|
534
|
-
std::shared_ptr<PathSegment> QPx = std::make_shared<PathSegment>();
|
|
535
|
-
std::shared_ptr<PathSegment> QPy = std::make_shared<PathSegment>();
|
|
536
|
-
std::shared_ptr<PathSegment> CPx = std::make_shared<PathSegment>();
|
|
537
|
-
std::shared_ptr<PathSegment> CPy = std::make_shared<PathSegment>();
|
|
538
|
-
double cx = 0;
|
|
539
|
-
double cy = 0;
|
|
540
|
-
double cx2 = 0;
|
|
541
|
-
double cy2 = 0;
|
|
542
|
-
int last_i = -1;
|
|
543
|
-
while (i < __len) {
|
|
544
|
-
if ( last_i == i ) {
|
|
545
|
-
i = i + 1;
|
|
546
|
-
}
|
|
547
|
-
last_i = i;
|
|
548
|
-
char c = s[i];
|
|
549
|
-
if ( (((c == (86)) || (c == (118))) || (c == (72))) || (c == (104)) ) {
|
|
550
|
-
cmd = c;
|
|
551
|
-
require_args = 1;
|
|
552
|
-
arg_cnt = 0;
|
|
553
|
-
continue;
|
|
554
|
-
}
|
|
555
|
-
if ( (((((c == (109)) || (c == (77))) || (c == (76))) || (c == (108))) || (c == (116))) || (c == (84)) ) {
|
|
556
|
-
cmd = c;
|
|
557
|
-
require_args = 2;
|
|
558
|
-
arg_cnt = 0;
|
|
559
|
-
continue;
|
|
560
|
-
}
|
|
561
|
-
if ( (((c == (113)) || (c == (81))) || (c == (83))) || (c == (115)) ) {
|
|
562
|
-
cmd = c;
|
|
563
|
-
require_args = 4;
|
|
564
|
-
arg_cnt = 0;
|
|
565
|
-
continue;
|
|
566
|
-
}
|
|
567
|
-
if ( (c == (99)) || (c == (67)) ) {
|
|
568
|
-
cmd = c;
|
|
569
|
-
require_args = 6;
|
|
570
|
-
arg_cnt = 0;
|
|
571
|
-
continue;
|
|
572
|
-
}
|
|
573
|
-
if ( (c == (97)) || (c == (65)) ) {
|
|
574
|
-
cmd = c;
|
|
575
|
-
require_args = 7;
|
|
576
|
-
arg_cnt = 0;
|
|
577
|
-
continue;
|
|
578
|
-
}
|
|
579
|
-
if ( this->scanNumber() ) {
|
|
580
|
-
switch (arg_cnt ) {
|
|
581
|
-
case 0 :
|
|
582
|
-
{
|
|
583
|
-
args->t0 = last_number;
|
|
584
|
-
break;
|
|
585
|
-
}
|
|
586
|
-
case 1 :
|
|
587
|
-
{
|
|
588
|
-
args->t1 = last_number;
|
|
589
|
-
break;
|
|
590
|
-
}
|
|
591
|
-
case 2 :
|
|
592
|
-
{
|
|
593
|
-
args->t2 = last_number;
|
|
594
|
-
break;
|
|
595
|
-
}
|
|
596
|
-
case 3 :
|
|
597
|
-
{
|
|
598
|
-
args->t3 = last_number;
|
|
599
|
-
break;
|
|
600
|
-
}
|
|
601
|
-
case 4 :
|
|
602
|
-
{
|
|
603
|
-
args->t4 = last_number;
|
|
604
|
-
break;
|
|
605
|
-
}
|
|
606
|
-
case 5 :
|
|
607
|
-
{
|
|
608
|
-
args->t5 = last_number;
|
|
609
|
-
break;
|
|
610
|
-
}
|
|
611
|
-
case 6 :
|
|
612
|
-
{
|
|
613
|
-
args->t6 = last_number;
|
|
614
|
-
break;
|
|
615
|
-
}
|
|
616
|
-
default:
|
|
617
|
-
break;
|
|
618
|
-
}
|
|
619
|
-
arg_cnt = arg_cnt + 1;
|
|
620
|
-
if ( arg_cnt >= require_args ) {
|
|
621
|
-
switch (cmd ) {
|
|
622
|
-
case 109 :
|
|
623
|
-
{
|
|
624
|
-
callback->Move(cx + args->t0, cy + args->t1);
|
|
625
|
-
cx = args->t0;
|
|
626
|
-
cy = args->t1;
|
|
627
|
-
cmd = 76;
|
|
628
|
-
require_args = 2;
|
|
629
|
-
cx2 = cx;
|
|
630
|
-
cy2 = cy;
|
|
631
|
-
break;
|
|
632
|
-
}
|
|
633
|
-
case 77 :
|
|
634
|
-
{
|
|
635
|
-
callback->Move(args->t0, args->t1);
|
|
636
|
-
cx = args->t0;
|
|
637
|
-
cy = args->t1;
|
|
638
|
-
cmd = 76;
|
|
639
|
-
require_args = 2;
|
|
640
|
-
cx2 = cx;
|
|
641
|
-
cy2 = cy;
|
|
642
|
-
break;
|
|
643
|
-
}
|
|
644
|
-
case 108 :
|
|
645
|
-
{
|
|
646
|
-
callback->Line(cx + args->t0, cy + args->t1);
|
|
647
|
-
cx = cx + args->t0;
|
|
648
|
-
cy = cy + args->t1;
|
|
649
|
-
cx2 = cx;
|
|
650
|
-
cy2 = cy;
|
|
651
|
-
break;
|
|
652
|
-
}
|
|
653
|
-
case 76 :
|
|
654
|
-
{
|
|
655
|
-
callback->Line(args->t0, args->t1);
|
|
656
|
-
cx = args->t0;
|
|
657
|
-
cy = args->t1;
|
|
658
|
-
cx2 = cx;
|
|
659
|
-
cy2 = cy;
|
|
660
|
-
break;
|
|
661
|
-
}
|
|
662
|
-
case 104 :
|
|
663
|
-
{
|
|
664
|
-
callback->Line(cx + args->t0, cy);
|
|
665
|
-
cx = cx + args->t0;
|
|
666
|
-
cx2 = cx;
|
|
667
|
-
break;
|
|
668
|
-
}
|
|
669
|
-
case 72 :
|
|
670
|
-
{
|
|
671
|
-
callback->Line(args->t0, cy);
|
|
672
|
-
cx = args->t0;
|
|
673
|
-
cx2 = cx;
|
|
674
|
-
break;
|
|
675
|
-
}
|
|
676
|
-
case 118 :
|
|
677
|
-
{
|
|
678
|
-
callback->Line(cx, cy + args->t0);
|
|
679
|
-
cy = cy + args->t0;
|
|
680
|
-
cy2 = cy;
|
|
681
|
-
break;
|
|
682
|
-
}
|
|
683
|
-
case 86 :
|
|
684
|
-
{
|
|
685
|
-
callback->Line(cx, args->t0);
|
|
686
|
-
cy = args->t0;
|
|
687
|
-
cy2 = cy;
|
|
688
|
-
break;
|
|
689
|
-
}
|
|
690
|
-
case 99 :
|
|
691
|
-
{
|
|
692
|
-
callback->Curve(cx + args->t0, cy + args->t1, cx + args->t2, cy + args->t3, cx + args->t4, cy + args->t5);
|
|
693
|
-
cx2 = cx + args->t2;
|
|
694
|
-
cy2 = cy + args->t3;
|
|
695
|
-
cx = cx + args->t4;
|
|
696
|
-
cy = cy + args->t5;
|
|
697
|
-
break;
|
|
698
|
-
}
|
|
699
|
-
case 67 :
|
|
700
|
-
{
|
|
701
|
-
callback->Curve(args->t0, args->t1, args->t2, args->t3, args->t4, args->t5);
|
|
702
|
-
cx2 = args->t2;
|
|
703
|
-
cy2 = args->t3;
|
|
704
|
-
cx = args->t4;
|
|
705
|
-
cy = args->t5;
|
|
706
|
-
break;
|
|
707
|
-
}
|
|
708
|
-
case 115 :
|
|
709
|
-
{
|
|
710
|
-
callback->Curve((cx + cx) - cx2, (cy + cy) - cy2, cx + args->t0, cy + args->t1, cx + args->t2, cy + args->t3);
|
|
711
|
-
cx2 = cx + args->t0;
|
|
712
|
-
cy2 = cy + args->t1;
|
|
713
|
-
cx = cx + args->t2;
|
|
714
|
-
cy = cy + args->t3;
|
|
715
|
-
break;
|
|
716
|
-
}
|
|
717
|
-
case 83 :
|
|
718
|
-
{
|
|
719
|
-
callback->Curve((cx + cx) - cx2, (cy + cy) - cy2, args->t0, args->t1, args->t2, args->t3);
|
|
720
|
-
cx2 = args->t0;
|
|
721
|
-
cy2 = args->t1;
|
|
722
|
-
cx = args->t2;
|
|
723
|
-
cy = args->t3;
|
|
724
|
-
break;
|
|
725
|
-
}
|
|
726
|
-
case 113 :
|
|
727
|
-
{
|
|
728
|
-
QPx->t0 = cx;
|
|
729
|
-
QPy->t0 = cy;
|
|
730
|
-
QPx->t1 = cx + args->t0;
|
|
731
|
-
QPy->t1 = cy + args->t1;
|
|
732
|
-
QPx->t2 = cx + args->t2;
|
|
733
|
-
QPy->t2 = cy + args->t3;
|
|
734
|
-
CPx->t0 = QPx->t0;
|
|
735
|
-
CPy->t0 = QPy->t0;
|
|
736
|
-
CPx->t1 = QPx->t0 + ((2 / 3) * (QPx->t1 - QPx->t0));
|
|
737
|
-
CPy->t1 = QPy->t0 + ((2 / 3) * (QPy->t1 - QPy->t0));
|
|
738
|
-
CPx->t2 = QPx->t2 + ((2 / 3) * (QPx->t1 - QPx->t2));
|
|
739
|
-
CPy->t2 = QPy->t2 + ((2 / 3) * (QPy->t1 - QPy->t2));
|
|
740
|
-
CPx->t3 = QPx->t2;
|
|
741
|
-
CPy->t3 = QPy->t2;
|
|
742
|
-
callback->Curve(CPx->t1, CPy->t1, CPx->t2, CPy->t2, CPx->t3, CPy->t3);
|
|
743
|
-
cx2 = CPx->t2;
|
|
744
|
-
cy2 = CPy->t2;
|
|
745
|
-
cx = CPx->t3;
|
|
746
|
-
cy = CPy->t3;
|
|
747
|
-
break;
|
|
748
|
-
}
|
|
749
|
-
case 81 :
|
|
750
|
-
{
|
|
751
|
-
QPx->t0 = cx;
|
|
752
|
-
QPy->t0 = cy;
|
|
753
|
-
QPx->t1 = args->t0;
|
|
754
|
-
QPy->t1 = args->t1;
|
|
755
|
-
QPx->t2 = args->t2;
|
|
756
|
-
QPy->t2 = args->t3;
|
|
757
|
-
CPx->t0 = QPx->t0;
|
|
758
|
-
CPy->t0 = QPy->t0;
|
|
759
|
-
CPx->t1 = QPx->t0 + ((2 / 3) * (QPx->t1 - QPx->t0));
|
|
760
|
-
CPy->t1 = QPy->t0 + ((2 / 3) * (QPy->t1 - QPy->t0));
|
|
761
|
-
CPx->t2 = QPx->t2 + ((2 / 3) * (QPx->t1 - QPx->t2));
|
|
762
|
-
CPy->t2 = QPy->t2 + ((2 / 3) * (QPy->t1 - QPy->t2));
|
|
763
|
-
CPx->t3 = QPx->t2;
|
|
764
|
-
CPy->t3 = QPy->t2;
|
|
765
|
-
callback->Curve(CPx->t1, CPy->t1, CPx->t2, CPy->t2, CPx->t3, CPy->t3);
|
|
766
|
-
cx2 = CPx->t1;
|
|
767
|
-
cy2 = CPy->t1;
|
|
768
|
-
cx = CPx->t2;
|
|
769
|
-
cy = CPy->t3;
|
|
770
|
-
break;
|
|
771
|
-
}
|
|
772
|
-
case 84 :
|
|
773
|
-
{
|
|
774
|
-
QPx->t0 = cx;
|
|
775
|
-
QPy->t0 = cy;
|
|
776
|
-
QPx->t1 = (2 * cx) - cx2;
|
|
777
|
-
QPy->t1 = (2 * cy) - cy2;
|
|
778
|
-
QPx->t2 = args->t0;
|
|
779
|
-
QPy->t2 = args->t1;
|
|
780
|
-
CPx->t0 = QPx->t0;
|
|
781
|
-
CPy->t0 = QPy->t0;
|
|
782
|
-
CPx->t1 = QPx->t0 + ((2 / 3) * (QPx->t1 - QPx->t0));
|
|
783
|
-
CPy->t1 = QPy->t0 + ((2 / 3) * (QPy->t1 - QPy->t0));
|
|
784
|
-
CPx->t2 = QPx->t2;
|
|
785
|
-
CPy->t2 = QPy->t2;
|
|
786
|
-
callback->Curve(CPx->t0, CPy->t0, CPx->t1, CPy->t1, CPx->t2, CPy->t2);
|
|
787
|
-
cx2 = CPx->t1;
|
|
788
|
-
cy2 = CPy->t1;
|
|
789
|
-
cx = CPx->t2;
|
|
790
|
-
cy = CPy->t3;
|
|
791
|
-
break;
|
|
792
|
-
}
|
|
793
|
-
case 116 :
|
|
794
|
-
{
|
|
795
|
-
QPx->t0 = cx;
|
|
796
|
-
QPy->t0 = cy;
|
|
797
|
-
QPx->t1 = (2 * cx) - cx2;
|
|
798
|
-
QPy->t1 = (2 * cy) - cy2;
|
|
799
|
-
QPx->t2 = cx + args->t0;
|
|
800
|
-
QPy->t2 = cy + args->t1;
|
|
801
|
-
CPx->t0 = QPx->t0;
|
|
802
|
-
CPy->t0 = QPy->t0;
|
|
803
|
-
CPx->t1 = QPx->t0 + ((2 / 3) * (QPx->t1 - QPx->t0));
|
|
804
|
-
CPy->t1 = QPy->t0 + ((2 / 3) * (QPy->t1 - QPy->t0));
|
|
805
|
-
CPx->t2 = QPx->t2;
|
|
806
|
-
CPy->t2 = QPy->t2;
|
|
807
|
-
callback->Curve(CPx->t0, CPy->t0, CPx->t1, CPy->t1, CPx->t2, CPy->t2);
|
|
808
|
-
cx2 = CPx->t1;
|
|
809
|
-
cy2 = CPy->t1;
|
|
810
|
-
cx = CPx->t2;
|
|
811
|
-
cy = CPy->t3;
|
|
812
|
-
break;
|
|
813
|
-
}
|
|
814
|
-
case 97 :
|
|
815
|
-
{
|
|
816
|
-
std::shared_ptr<Vec2> res = this->pathArcTo(callback, Vec2::CreateNew(cx, cy), args, true);
|
|
817
|
-
cx = res->x;
|
|
818
|
-
cy = res->y;
|
|
819
|
-
cx2 = cx;
|
|
820
|
-
cy2 = cy;
|
|
821
|
-
break;
|
|
822
|
-
}
|
|
823
|
-
case 65 :
|
|
824
|
-
{
|
|
825
|
-
std::shared_ptr<Vec2> res_1 = this->pathArcTo(callback, Vec2::CreateNew(cx, cy), args, false);
|
|
826
|
-
cx = res_1->x;
|
|
827
|
-
cy = res_1->y;
|
|
828
|
-
cx2 = cx;
|
|
829
|
-
cy2 = cy;
|
|
830
|
-
break;
|
|
831
|
-
}
|
|
832
|
-
default:
|
|
833
|
-
if ( arg_cnt >= 2 ) {
|
|
834
|
-
cx = args->t0;
|
|
835
|
-
cy = args->t1;
|
|
836
|
-
cx2 = cx;
|
|
837
|
-
cy2 = cy;
|
|
838
|
-
}
|
|
839
|
-
break;
|
|
840
|
-
}
|
|
841
|
-
arg_cnt = 0;
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
int main(int argc, char* argv[]) {
|
|
847
|
-
__g_argc = argc;
|
|
848
|
-
__g_argv = argv;
|
|
849
|
-
std::string path1 = std::string("M130 110 C 120 140, 180 140, 170 110");
|
|
850
|
-
std::string path2 = std::string("M10 80 C 40 10, 65 10, 95 80 S 150 150, 180 80");
|
|
851
|
-
std::string path3 = std::string("M10 80 Q 95 10 180 80");
|
|
852
|
-
std::string path4 = std::string("M10 80 Q 52.5 10, 95 80 T 180 80");
|
|
853
|
-
std::string path5 = std::string("M-130 -110 C 120 140, 180 140, 170 110");
|
|
854
|
-
std::string path6 = std::string("M10 315\r\n L 110 215\r\n A 30 50 0 0 1 162.55 162.45\r\n L 172.55 152.45\r\n A 30 50 -45 0 1 215.1 109.9\r\n L 315 10");
|
|
855
|
-
std::string path7 = std::string("M 14.781 14.347 h 1.738 c 0.24 0 0.436 -0.194 0.436 -0.435 v -1.739 c 0 -0.239 -0.195 -0.435 -0.436 -0.435 h -1.738 c -0.239 0 -0.435 0.195 -0.435 0.435 v 1.739 C 14.347 14.152 14.542 14.347 14.781 14.347 M 18.693 3.045 H 1.307 c -0.48 0 -0.869 0.39 -0.869 0.869 v 12.17 c 0 0.479 0.389 0.869 0.869 0.869 h 17.387 c 0.479 0 0.869 -0.39 0.869 -0.869 V 3.915 C 19.562 3.435 19.173 3.045 18.693 3.045 M 18.693 16.085 H 1.307 V 9.13 h 17.387 V 16.085 Z M 18.693 5.653 H 1.307 V 3.915 h 17.387 V 5.653 Z M 3.48 12.608 h 7.824 c 0.24 0 0.435 -0.195 0.435 -0.436 c 0 -0.239 -0.194 -0.435 -0.435 -0.435 H 3.48 c -0.24 0 -0.435 0.195 -0.435 0.435 C 3.045 12.413 3.24 12.608 3.48 12.608 M 3.48 14.347 h 6.085 c 0.24 0 0.435 -0.194 0.435 -0.435 s -0.195 -0.435 -0.435 -0.435 H 3.48 c -0.24 0 -0.435 0.194 -0.435 0.435 S 3.24 14.347 3.48 14.347");
|
|
856
|
-
std::string path8 = std::string("M 4.423 9.141 H 3.565 c -0.237 0 -0.429 0.192 -0.429 0.429 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.192 0.429 -0.429 S 4.66 9.141 4.423 9.141 M 6.997 16.861 H 6.139 c -0.237 0 -0.429 0.192 -0.429 0.43 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.191 0.429 -0.429 S 7.234 16.861 6.997 16.861 M 4.423 16.861 H 3.565 c -0.237 0 -0.429 0.192 -0.429 0.43 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.191 0.429 -0.429 S 4.66 16.861 4.423 16.861 M 13.861 9.998 h 0.857 c 0.236 0 0.429 -0.192 0.429 -0.429 s -0.192 -0.429 -0.429 -0.429 h -0.857 c -0.237 0 -0.43 0.192 -0.43 0.429 S 13.624 9.998 13.861 9.998 M 14.719 16.861 h -0.857 c -0.237 0 -0.43 0.192 -0.43 0.43 s 0.192 0.429 0.43 0.429 h 0.857 c 0.236 0 0.429 -0.191 0.429 -0.429 S 14.955 16.861 14.719 16.861 M 15.576 13.001 c -0.236 0 -0.429 0.192 -0.429 0.43 c 0 0.236 0.192 0.429 0.429 0.429 c 0.237 0 0.43 -0.192 0.43 -0.429 C 16.006 13.193 15.813 13.001 15.576 13.001 M 6.997 9.141 H 6.139 c -0.237 0 -0.429 0.192 -0.429 0.429 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.192 0.429 -0.429 S 7.234 9.141 6.997 9.141 M 12.145 9.141 h -0.857 c -0.236 0 -0.429 0.192 -0.429 0.429 s 0.193 0.429 0.429 0.429 h 0.857 c 0.237 0 0.43 -0.192 0.43 -0.429 S 12.382 9.141 12.145 9.141 M 17.722 10.856 V 7.424 c 0 -0.948 -0.769 -1.716 -1.716 -1.716 h -0.617 l -1.038 -3.873 c -0.245 -0.916 -1.186 -1.458 -2.101 -1.213 L 3.592 2.912 C 2.676 3.157 2.133 4.098 2.378 5.014 l 0.186 0.695 H 2.278 c -0.947 0 -1.716 0.768 -1.716 1.716 V 17.72 c 0 0.947 0.769 1.716 1.716 1.716 h 13.728 c 0.947 0 1.716 -0.769 1.716 -1.716 v -1.716 c 0.947 0 1.716 -0.769 1.716 -1.716 v -1.716 C 19.438 11.624 18.669 10.856 17.722 10.856 M 16.006 6.566 c 0.473 0 0.857 0.384 0.857 0.858 v 0.238 c -0.253 -0.146 -0.544 -0.238 -0.857 -0.238 h -0.157 l -0.229 -0.858 H 16.006 Z M 14.41 5.372 l 0.55 2.053 H 6.67 L 14.41 5.372 Z M 3.814 3.741 l 8.657 -2.29 c 0.458 -0.123 0.928 0.149 1.051 0.607 l 0.222 0.828 L 3.43 5.621 l -0.223 -0.83 C 3.084 4.333 3.356 3.863 3.814 3.741 M 1.42 7.424 c 0 -0.474 0.384 -0.858 0.858 -0.858 h 0.517 l 0.229 0.858 H 2.278 c -0.314 0 -0.605 0.091 -0.858 0.238 V 7.424 Z M 16.863 17.72 c 0 0.474 -0.385 0.858 -0.857 0.858 H 2.278 c -0.474 0 -0.858 -0.385 -0.858 -0.858 V 9.141 c 0 -0.474 0.384 -0.858 0.858 -0.858 h 13.728 c 0.473 0 0.857 0.384 0.857 0.858 v 1.715 h -1.716 c -0.947 0 -1.716 0.768 -1.716 1.716 v 1.716 c 0 0.947 0.769 1.716 1.716 1.716 h 1.716 V 17.72 Z M 18.58 14.288 c 0 0.474 -0.385 0.857 -0.858 0.857 h -2.574 c -0.474 0 -0.857 -0.384 -0.857 -0.857 v -1.716 c 0 -0.474 0.384 -0.858 0.857 -0.858 h 2.574 c 0.474 0 0.858 0.385 0.858 0.858 V 14.288 Z M 9.571 16.861 H 8.713 c -0.237 0 -0.429 0.192 -0.429 0.43 s 0.192 0.429 0.429 0.429 h 0.858 c 0.236 0 0.429 -0.191 0.429 -0.429 S 9.808 16.861 9.571 16.861 M 12.145 16.861 h -0.857 c -0.236 0 -0.429 0.192 -0.429 0.43 s 0.193 0.429 0.429 0.429 h 0.857 c 0.237 0 0.43 -0.191 0.43 -0.429 S 12.382 16.861 12.145 16.861 M 9.571 9.141 H 8.713 c -0.237 0 -0.429 0.192 -0.429 0.429 s 0.192 0.429 0.429 0.429 h 0.858 C 9.808 9.998 10 9.806 10 9.569 S 9.808 9.141 9.571 9.141");
|
|
857
|
-
std::string path9 = std::string("M 4.423 9.141 H 3.565 c -0.237 0 -0.429 0.192 -0.429 0.429 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.192 0.429 -0.429 S 4.66 9.141 4.423 9.141 M 6.997 16.861 H 6.139 c -0.237 0 -0.429 0.192 -0.429 0.43 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.191 0.429 -0.429 S 7.234 16.861 6.997 16.861 M 4.423 16.861 H 3.565 c -0.237 0 -0.429 0.192 -0.429 0.43 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.191 0.429 -0.429 S 4.66 16.861 4.423 16.861 M 13.861 9.998 h 0.857 c 0.236 0 0.429 -0.192 0.429 -0.429 s -0.192 -0.429 -0.429 -0.429 h -0.857 c -0.237 0 -0.43 0.192 -0.43 0.429 S 13.624 9.998 13.861 9.998 M 14.719 16.861 h -0.857 c -0.237 0 -0.43 0.192 -0.43 0.43 s 0.192 0.429 0.43 0.429 h 0.857 c 0.236 0 0.429 -0.191 0.429 -0.429 S 14.955 16.861 14.719 16.861 M 15.576 13.001 c -0.236 0 -0.429 0.192 -0.429 0.43 c 0 0.236 0.192 0.429 0.429 0.429 c 0.237 0 0.43 -0.192 0.43 -0.429 C 16.006 13.193 15.813 13.001 15.576 13.001 M 6.997 9.141 H 6.139 c -0.237 0 -0.429 0.192 -0.429 0.429 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.192 0.429 -0.429 S 7.234 9.141 6.997 9.141 M 12.145 9.141 h -0.857 c -0.236 0 -0.429 0.192 -0.429 0.429 s 0.193 0.429 0.429 0.429 h 0.857 c 0.237 0 0.43 -0.192 0.43 -0.429 S 12.382 9.141 12.145 9.141 M 17.722 10.856 V 7.424 c 0 -0.948 -0.769 -1.716 -1.716 -1.716 h -0.617 l -1.038 -3.873 -3 -4");
|
|
858
|
-
std::string path10 = std::string("M 16.853 8.355 V 5.888 c 0 -3.015 -2.467 -5.482 -5.482 -5.482 H 8.629 c -3.015 0 -5.482 2.467 -5.482 5.482 v 2.467 l -2.741 7.127 c 0 1.371 4.295 4.112 9.594 4.112 s 9.594 -2.741 9.594 -4.112 L 16.853 8.355 Z M 5.888 17.367 c -0.284 0 -0.514 -0.23 -0.514 -0.514 c 0 -0.284 0.23 -0.514 0.514 -0.514 c 0.284 0 0.514 0.23 0.514 0.514 C 6.402 17.137 6.173 17.367 5.888 17.367 Z M 5.203 10 c 0 -0.377 0.19 -0.928 0.423 -1.225 c 0 0 0.651 -0.831 1.976 -0.831 c 0.672 0 1.141 0.309 1.141 0.309 C 9.057 8.46 9.315 8.938 9.315 9.315 v 1.028 c 0 0.188 -0.308 0.343 -0.685 0.343 H 5.888 C 5.511 10.685 5.203 10.377 5.203 10 Z M 7.944 16.853 H 7.259 v -1.371 l 0.685 -0.685 V 16.853 Z M 9.657 16.853 H 8.629 v -2.741 h 1.028 V 16.853 Z M 8.972 13.426 v -1.028 c 0 -0.568 0.46 -1.028 1.028 -1.028 c 0.568 0 1.028 0.46 1.028 1.028 v 1.028 H 8.972 Z M 11.371 16.853 h -1.028 v -2.741 h 1.028 V 16.853 Z M 12.741 16.853 h -0.685 v -2.056 l 0.685 0.685 V 16.853 Z M 14.112 17.367 c -0.284 0 -0.514 -0.23 -0.514 -0.514 c 0 -0.284 0.23 -0.514 0.514 -0.514 c 0.284 0 0.514 0.23 0.514 0.514 C 14.626 17.137 14.396 17.367 14.112 17.367 Z M 14.112 10.685 h -2.741 c -0.377 0 -0.685 -0.154 -0.685 -0.343 V 9.315 c 0 -0.377 0.258 -0.855 0.572 -1.062 c 0 0 0.469 -0.309 1.141 -0.309 c 1.325 0 1.976 0.831 1.976 0.831 c 0.232 0.297 0.423 0.848 0.423 1.225 S 14.489 10.685 14.112 10.685 Z M 18.347 15.801 c -0.041 0.016 -0.083 0.023 -0.124 0.023 c -0.137 0 -0.267 -0.083 -0.319 -0.218 l -2.492 -6.401 c -0.659 -1.647 -1.474 -2.289 -2.905 -2.289 c -0.95 0 -1.746 0.589 -1.754 0.595 c -0.422 0.317 -1.084 0.316 -1.507 0 C 9.239 7.505 8.435 6.916 7.492 6.916 c -1.431 0 -2.246 0.642 -2.906 2.292 l -2.491 6.398 c -0.069 0.176 -0.268 0.264 -0.443 0.195 c -0.176 -0.068 -0.264 -0.267 -0.195 -0.444 l 2.492 -6.401 c 0.765 -1.911 1.824 -2.726 3.543 -2.726 c 1.176 0 2.125 0.702 2.165 0.731 c 0.179 0.135 0.506 0.135 0.685 0 c 0.04 -0.029 0.99 -0.731 2.165 -0.731 c 1.719 0 2.779 0.814 3.542 2.723 l 2.493 6.404 C 18.611 15.534 18.524 15.733 18.347 15.801 Z");
|
|
859
|
-
/** unused: std::string path11 = std::string("M10,6.536c-2.263,0-4.099,1.836-4.099,4.098S7.737,14.732,10,14.732s4.099-1.836,4.099-4.098S12.263,6.536,10,6.536M10,13.871c-1.784,0-3.235-1.453-3.235-3.237S8.216,7.399,10,7.399c1.784,0,3.235,1.452,3.235,3.235S11.784,13.871,10,13.871M17.118,5.672l-3.237,0.014L12.52,3.697c-0.082-0.105-0.209-0.168-0.343-0.168H7.824c-0.134,0-0.261,0.062-0.343,0.168L6.12,5.686H2.882c-0.951,0-1.726,0.748-1.726,1.699v7.362c0,0.951,0.774,1.725,1.726,1.725h14.236c0.951,0,1.726-0.773,1.726-1.725V7.195C18.844,6.244,18.069,5.672,17.118,5.672 M17.98,14.746c0,0.477-0.386,0.861-0.862,0.861H2.882c-0.477,0-0.863-0.385-0.863-0.861V7.384c0-0.477,0.386-0.85,0.863-0.85l3.451,0.014c0.134,0,0.261-0.062,0.343-0.168l1.361-1.989h3.926l1.361,1.989c0.082,0.105,0.209,0.168,0.343,0.168l3.451-0.014c0.477,0,0.862,0.184,0.862,0.661V14.746z") **/ ;
|
|
860
|
-
std::shared_ptr<PathExecutor> ex = std::make_shared<PathExecutor>();
|
|
861
|
-
std::shared_ptr<EVGPathParser> parser = std::make_shared<EVGPathParser>();
|
|
862
|
-
parser->parsePath(path1, ex);
|
|
863
|
-
parser->parsePath(path2, ex);
|
|
864
|
-
parser->parsePath(path3, ex);
|
|
865
|
-
parser->parsePath(path4, ex);
|
|
866
|
-
parser->parsePath(path5, ex);
|
|
867
|
-
parser->parsePath(path6, ex);
|
|
868
|
-
std::shared_ptr<PathCollector> coll = std::make_shared<PathCollector>();
|
|
869
|
-
parser->parsePath(path6, coll);
|
|
870
|
-
std::cout << coll->getString() << std::endl;
|
|
871
|
-
std::shared_ptr<PathCollector> coll_2 = std::make_shared<PathCollector>();
|
|
872
|
-
parser->parsePath(path7, coll_2);
|
|
873
|
-
std::cout << coll_2->getString() << std::endl;
|
|
874
|
-
std::cout << std::string(" ----- ") << std::endl;
|
|
875
|
-
std::shared_ptr<PathCollector> coll_3 = std::make_shared<PathCollector>();
|
|
876
|
-
parser->parsePath(path8, coll_3);
|
|
877
|
-
std::cout << coll_3->getString() << std::endl;
|
|
878
|
-
std::cout << std::string(" ----- ") << std::endl;
|
|
879
|
-
std::shared_ptr<PathCollector> coll_4 = std::make_shared<PathCollector>();
|
|
880
|
-
parser->parsePath(path9, coll_4);
|
|
881
|
-
std::cout << coll_4->getString() << std::endl;
|
|
882
|
-
std::cout << std::string(" ----- ") << std::endl;
|
|
883
|
-
std::shared_ptr<PathCollector> coll_5 = std::make_shared<PathCollector>();
|
|
884
|
-
parser->parsePath(path10, coll_5);
|
|
885
|
-
std::cout << coll_5->getString() << std::endl;
|
|
886
|
-
return 0;
|
|
887
|
-
}
|