add data models

master
xieguigang 8 years ago
parent 78bcf413b6
commit 714da8f268

@ -4,9 +4,14 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 15.0.27428.2027
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "thinkChart", "thinkChart\thinkChart.njsproj", "{F3C0F5AB-B554-4EF8-9DF0-482240FE020D}"
ProjectSection(ProjectDependencies) = postProject
{8C2DAE18-8B11-4B37-A4EC-0234D7FCCF2A} = {8C2DAE18-8B11-4B37-A4EC-0234D7FCCF2A}
EndProjectSection
EndProject
Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "Linq.ts", "..\TsLinq\Linq.ts\Linq.ts.njsproj", "{E0AEC189-6D05-47E4-9F69-DAFE43AC8398}"
EndProject
Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "svg", "svg\SVG\svg.njsproj", "{8C2DAE18-8B11-4B37-A4EC-0234D7FCCF2A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -21,6 +26,10 @@ Global
{E0AEC189-6D05-47E4-9F69-DAFE43AC8398}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0AEC189-6D05-47E4-9F69-DAFE43AC8398}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E0AEC189-6D05-47E4-9F69-DAFE43AC8398}.Release|Any CPU.Build.0 = Release|Any CPU
{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

@ -7,7 +7,7 @@
<RootNamespace>svg</RootNamespace>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<SaveNodeJsSettingsInProjectFile>True</SaveNodeJsSettingsInProjectFile>
<ToolsVersionPromptShown>2.9</ToolsVersionPromptShown>
<ToolsVersionPromptShown>2.8</ToolsVersionPromptShown>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
@ -26,7 +26,7 @@
<NodejsPort>1337</NodejsPort>
<TypeScriptSourceMap>true</TypeScriptSourceMap>
<TypeScriptModuleKind>CommonJS</TypeScriptModuleKind>
<TypeScriptToolsVersion>2.8</TypeScriptToolsVersion>
<TypeScriptToolsVersion>3.0</TypeScriptToolsVersion>
<EnableTypeScript>true</EnableTypeScript>
<StartWebBrowser>True</StartWebBrowser>
</PropertyGroup>

@ -0,0 +1,6 @@
namespace Layout {
export class Anchor {
}
}

@ -0,0 +1,6 @@
namespace Layout {
export class Label {
}
}

@ -2,8 +2,8 @@
export class Labeler {
private lab = [];
private anc = [];
private lab: Label[] = [];
private anc: Anchor[] = [];
private w = 1; // box width
private h = 1; // box width
@ -12,20 +12,14 @@
private acc = 0;
private rej = 0;
//#region "weights"
private w_len = 0.2; // leader line length
private w_inter = 1.0; // leader line intersection
private w_lab2 = 30.0; // label-label overlap
private w_lab_anc = 30.0; // label-anchor overlap
private w_orient = 3.0; // orientation bias
//#endregion
//#region ""
private weights: Weights;
private energy_function: (index: number) => number;
private schedule_function: (currT: number, initialT: number, nsweeps: number) => number;
//#endregion
public constructor(
weights: Weights = new Weights(),
energy: (index: number) => number = null,
schedule: (currT: number, initialT: number, nsweeps: number) => number = Labeler.cooling_schedule) {

@ -0,0 +1,27 @@
namespace Layout {
export class Weights {
/**
* leader line length
*/
public len: number = 0.2;
/**
* label-label overlap
*/
public inter: number = 1.0;
/**
* label-label overlap
*/
public lab2: number = 30.0;
/**
* label-anchor overlap
*/
public lab_anc: number = 30.0;
/**
* orientation bias
*/
public orient: number = 3.0;
}
}

@ -46,6 +46,15 @@
<TypeScriptCompile Include="Math\Geometry.ts">
<SubType>Code</SubType>
</TypeScriptCompile>
<TypeScriptCompile Include="Math\Layout\Label.ts">
<SubType>Code</SubType>
</TypeScriptCompile>
<TypeScriptCompile Include="Math\Layout\Anchor.ts">
<SubType>Code</SubType>
</TypeScriptCompile>
<TypeScriptCompile Include="Math\Layout\Weights.ts">
<SubType>Code</SubType>
</TypeScriptCompile>
</ItemGroup>
<ItemGroup>
<Folder Include="Math\" />

Loading…
Cancel
Save