diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/viz/ts/svg/svg/README.md b/viz/ts/svg/svg/README.md new file mode 100644 index 0000000..3a0b820 --- /dev/null +++ b/viz/ts/svg/svg/README.md @@ -0,0 +1,3 @@ +# svg + + diff --git a/viz/ts/svg/svg/svg.sln b/viz/ts/svg/svg/svg.sln new file mode 100644 index 0000000..7163f6c --- /dev/null +++ b/viz/ts/svg/svg/svg.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2027 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "svg", "svg\svg.njsproj", "{8C2DAE18-8B11-4B37-A4EC-0234D7FCCF2A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8C2DAE18-8B11-4B37-A4EC-0234D7FCCF2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8C2DAE18-8B11-4B37-A4EC-0234D7FCCF2A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8C2DAE18-8B11-4B37-A4EC-0234D7FCCF2A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8C2DAE18-8B11-4B37-A4EC-0234D7FCCF2A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B4A546BE-4F0B-404C-B748-77719A3EDCF7} + EndGlobalSection +EndGlobal diff --git a/viz/ts/svg/svg/svg/Utils.ts b/viz/ts/svg/svg/svg/Utils.ts new file mode 100644 index 0000000..b84cab0 --- /dev/null +++ b/viz/ts/svg/svg/svg/Utils.ts @@ -0,0 +1,4 @@ +function componentToHex(c) { + var hex = c.toString(16); + return hex.length == 1 ? "0" + hex : hex; +} diff --git a/viz/ts/svg/svg/svg/package-lock.json b/viz/ts/svg/svg/svg/package-lock.json new file mode 100644 index 0000000..3f61927 --- /dev/null +++ b/viz/ts/svg/svg/svg/package-lock.json @@ -0,0 +1,14 @@ +{ + "name": "svg", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/node": { + "version": "6.0.106", + "resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.106.tgz", + "integrity": "sha512-U4Zv5fx7letrisRv6HgSSPSY00FZM4NMIkilt+IAExvQLuNa6jYVwCKcnSs2NqTN4+KDl9PskvcCiMce9iePCA==", + "dev": true + } + } +} diff --git a/viz/ts/svg/svg/svg/package.json b/viz/ts/svg/svg/svg/package.json new file mode 100644 index 0000000..da0f0ae --- /dev/null +++ b/viz/ts/svg/svg/svg/package.json @@ -0,0 +1,12 @@ +{ + "name": "svg", + "version": "0.0.0", + "description": "svg", + "main": "app.js", + "author": { + "name": "Evia" + }, + "devDependencies": { + "@types/node": "^6.0.87" + } +} diff --git a/viz/ts/svg/svg/svg/svg.njsproj b/viz/ts/svg/svg/svg/svg.njsproj new file mode 100644 index 0000000..8172904 --- /dev/null +++ b/viz/ts/svg/svg/svg/svg.njsproj @@ -0,0 +1,86 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + svg + svg + Debug|Any CPU + + + + Debug + 2.0 + 8c2dae18-8b11-4b37-a4ec-0234d7fccf2a + . + svg.ts + True + + + . + . + v4.0 + {3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD} + 1337 + true + CommonJS + 2.6 + true + True + + + true + + + true + + + + + + + Code + + + + + + + + + + False + True + 0 + / + http://localhost:48022/ + False + True + http://localhost:1337 + False + + + + + + + CurrentPage + True + False + False + False + + + + + + + + + False + False + + + + + \ No newline at end of file diff --git a/viz/ts/svg/svg/svg/svg.ts b/viz/ts/svg/svg/svg/svg.ts new file mode 100644 index 0000000..5cc463d --- /dev/null +++ b/viz/ts/svg/svg/svg/svg.ts @@ -0,0 +1,107 @@ +/// + +/** + * 提供类似于VB.NET之中的Graphics对象的模拟 + * +*/ +class Graphics { + + svg: HTMLElement; + container: HTMLElement; + + /** + * 创建一个SVG画布对象 + * + * @param div div id + */ + constructor(div: string) { + this.svg = document.createElement("svg"); + this.container = document.getElementById(div); + this.container.appendChild(this.svg); + } + + drawLine(pen: Pen, a: Point, b: Point) { + + } + + drawRectangle(rect: Rectangle, border: Pen, fill: Color = null) { + + } +} + +class Pen { + + color: Color; + width: number; + + constructor(color: Color, width: number = 1) { + this.color = color; + this.width = width; + } +} + +class Color { + + r: number; + g: number; + b: number; + + constructor(r: number, g: number, b: number) { + this.r = r; + this.g = g; + this.b = b; + } + + ToHtmlColor(): string { + return "#" + componentToHex(this.r) + componentToHex(this.g) + componentToHex(this.b); + } + + ToRGBColor(): string { + return `rgb(${this.r},${this.g},${this.b})`; + } +} + +class Point { + + x: number; + y: number; + + constructor(x: number, y: number) { + this.x = x; + this.y = y; + } +} + +class Size { + + width: number; + height: number; + + constructor(width: number, height: number) { + this.width = width; + this.height = height; + } +} + +class Rectangle { + + left: number; + top: number; + width: number; + height: number; + + constructor(x: number, y: number, width: number, height: number) { + this.left = x; + this.top = y; + this.width = width; + this.height = height; + } + + Location(): Point { + return new Point(this.left, this.top); + } + + Size(): Size { + return new Size(this.width, this.height); + } +} \ No newline at end of file diff --git a/viz/ts/svg/svg/svg/tsconfig.json b/viz/ts/svg/svg/svg/tsconfig.json new file mode 100644 index 0000000..aeed878 --- /dev/null +++ b/viz/ts/svg/svg/svg/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "module": "amd", + "target": "es5", + "lib": [ "dom", "es5", "dom.iterable", "scripthost" ], + "sourceMap": true, + "allowSyntheticDefaultImports": true, + "outFile": "bin/svg.js" + }, + "exclude": [ + "node_modules" + ] +}