-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70418ec
commit 032cdf3
Showing
9 changed files
with
10,721 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
Class UA.Area Extends (%Persistent, %XML.Adaptor) | ||
{ | ||
|
||
/// Name of the Region | ||
Property Name As %String(MAXLEN = 500) [ Required ]; | ||
|
||
/// Guid for polygons in js file | ||
Property Guid As %String [ Required ]; | ||
|
||
/// Link to Wiki article | ||
Property DataUrl As %String(MAXLEN = 500); | ||
|
||
/// All values | ||
Relationship Parameters As ParameterValue [ Cardinality = many, Inverse = Region ]; | ||
|
||
Index GuidIdx On Guid [ IdKey, Unique ]; | ||
|
||
Storage Default | ||
{ | ||
<Data name="AreaDefaultData"> | ||
<Value name="1"> | ||
<Value>%%CLASSNAME</Value> | ||
</Value> | ||
<Value name="2"> | ||
<Value>Name</Value> | ||
</Value> | ||
<Value name="3"> | ||
<Value>DataUrl</Value> | ||
</Value> | ||
</Data> | ||
<DataLocation>^UA.AreaD</DataLocation> | ||
<DefaultData>AreaDefaultData</DefaultData> | ||
<IdLocation>^UA.AreaD</IdLocation> | ||
<IndexLocation>^UA.AreaI</IndexLocation> | ||
<StreamLocation>^UA.AreaS</StreamLocation> | ||
<Type>%Library.CacheStorage</Type> | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/// | ||
Class UA.BI.UACube Extends %DeepSee.CubeDefinition [ DependsOn = UA.Region, ProcedureBlock ] | ||
{ | ||
|
||
/// Cube definition from Architect. | ||
XData Cube [ XMLNamespace = "http://www.intersystems.com/deepsee" ] | ||
{ | ||
<cube xmlns="http://www.intersystems.com/deepsee" name="UACube" displayName="UACube" disabled="false" abstract="false" sourceClass="UA.Region" countMeasureName="%COUNT" bucketSize="8" bitmapChunkInMemory="false" precompute="0" disableListingGroups="false"> | ||
<dimension name="ParentRegion" disabled="false" hasAll="false" allCaption="All ParentRegion" allDisplayName="ParentRegion" type="data" hidden="false" showHierarchies="default"> | ||
<hierarchy name="H1" disabled="false" hidden="false"> | ||
<level name="Region" disabled="false" sourceProperty="ParentRegion" list="false" useDisplayValue="true" useAsFilter="true" hidden="false"> | ||
<property name="Population" disabled="false" sourceExpression="%cube.GetValue(%source.ParentRegion.Guid,1)" hidden="false" isName="false" isDescription="false" isReference="false" useDisplayValue="false"> | ||
</property> | ||
<property name="Area" disabled="false" sourceExpression="%cube.GetValue(%source.ParentRegion.Guid,2)" hidden="false" isName="false" isDescription="false" isReference="false" useDisplayValue="false"> | ||
</property> | ||
<property name="Name" disabled="false" sourceProperty="ParentRegion.Name" hidden="false" isName="true" isDescription="false" isReference="false" useDisplayValue="false"> | ||
</property> | ||
</level> | ||
<level name="District" disabled="false" sourceProperty="Guid" list="false" useDisplayValue="true" useAsFilter="true" hidden="false"> | ||
<property name="Population" disabled="false" sourceExpression="%cube.GetValue(%source.Guid,1)" hidden="false" isName="false" isDescription="false" isReference="false" useDisplayValue="false"> | ||
</property> | ||
<property name="Area" disabled="false" sourceExpression="%cube.GetValue(%source.Guid,2)" hidden="false" isName="false" isDescription="false" isReference="false" useDisplayValue="false"> | ||
</property> | ||
<property name="Name" disabled="false" sourceProperty="Name" hidden="false" isName="true" isDescription="false" isReference="false" useDisplayValue="false"> | ||
</property> | ||
</level> | ||
</hierarchy> | ||
</dimension> | ||
<listing name="New_listing1" disabled="false" listingType="table" fieldList="%ID,DataUrl,Name,ParentRegion->Guid,ParentRegion->Name"> | ||
</listing> | ||
</cube> | ||
} | ||
|
||
ClassMethod GetColor(min, max, value) As %String | ||
{ | ||
if ('value) return "rgb(0,0,0)" | ||
|
||
// Крайние границы: красный и зеленый, цвет для середины - желтый | ||
set middle = (max + min) / 2 | ||
|
||
if (value <= middle) | ||
{ | ||
set redPart = (value - min) / (middle - min) | ||
return "rgb(" _ (255 * redPart\1) _ ",255, 0)" | ||
} | ||
else | ||
{ | ||
set greenPart = (max - value) / (max - middle) | ||
return "rgb(255," _(255 * greenPart\1) _ ", 0)" | ||
} | ||
} | ||
|
||
ClassMethod GetValue(guid, type) As %Integer | ||
{ | ||
|
||
//b "L" | ||
//type=1 - population | ||
//type=2 - area | ||
// density | ||
s region=##class(UA.Region).%OpenId(guid) | ||
if $IsObject(region) { | ||
s parameter=##class(UA.ParameterValue).RegionParameterIndexOpen(region.Guid,type) | ||
if $IsObject(parameter) return parameter.Value} | ||
return "" | ||
} | ||
|
||
Parameter DOMAIN; | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Class UA.Parameter Extends (%Persistent, %XML.Adaptor) | ||
{ | ||
|
||
Property Name As %String; | ||
|
||
Property UnitName As %String; | ||
|
||
Relationship Values As ParameterValue [ Cardinality = many, Inverse = Parameter ]; | ||
|
||
Storage Default | ||
{ | ||
<Data name="ParameterDefaultData"> | ||
<Value name="1"> | ||
<Value>%%CLASSNAME</Value> | ||
</Value> | ||
<Value name="2"> | ||
<Value>Name</Value> | ||
</Value> | ||
<Value name="3"> | ||
<Value>UnitName</Value> | ||
</Value> | ||
</Data> | ||
<DataLocation>^UA.ParameterD</DataLocation> | ||
<DefaultData>ParameterDefaultData</DefaultData> | ||
<IdLocation>^UA.ParameterD</IdLocation> | ||
<IndexLocation>^UA.ParameterI</IndexLocation> | ||
<StreamLocation>^UA.ParameterS</StreamLocation> | ||
<Type>%Library.CacheStorage</Type> | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Class UA.ParameterValue Extends (%Persistent, %XML.Adaptor) | ||
{ | ||
|
||
Relationship Region As Area(XMLPROJECTION = "XELEMENT", XMLREFERENCE = "ID") [ Cardinality = one, Inverse = Parameters ]; | ||
|
||
/// State, county or city | ||
/// Parameter | ||
Relationship Parameter As Parameter(XMLPROJECTION = "XELEMENT", XMLREFERENCE = "ID") [ Cardinality = one, Inverse = Values ]; | ||
|
||
/// Value for region|county|city | ||
Property Value As %Float [ Required ]; | ||
|
||
Index PVIdx On (Region, Parameter); | ||
|
||
Index RegionParameterIndex On (Region, Parameter) [ Unique ]; | ||
|
||
Storage Default | ||
{ | ||
<Data name="ParameterValueDefaultData"> | ||
<Value name="1"> | ||
<Value>%%CLASSNAME</Value> | ||
</Value> | ||
<Value name="2"> | ||
<Value>Region</Value> | ||
</Value> | ||
<Value name="3"> | ||
<Value>Parameter</Value> | ||
</Value> | ||
<Value name="4"> | ||
<Value>Value</Value> | ||
</Value> | ||
</Data> | ||
<DataLocation>^UA.ParameterValueD</DataLocation> | ||
<DefaultData>ParameterValueDefaultData</DefaultData> | ||
<IdLocation>^UA.ParameterValueD</IdLocation> | ||
<IndexLocation>^UA.ParameterValueI</IndexLocation> | ||
<StreamLocation>^UA.ParameterValueS</StreamLocation> | ||
<Type>%Library.CacheStorage</Type> | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Class UA.Region Extends Area | ||
{ | ||
|
||
/// Parent of region. For state=null, for county=state | ||
Relationship ParentRegion As Region(XMLPROJECTION = "XELEMENT", XMLREFERENCE = "ID") [ Cardinality = one, Inverse = ChildrenRegions ]; | ||
|
||
/// Region childrens. For state=counties, for county=0 | ||
Relationship ChildrenRegions As Region [ Cardinality = many, Inverse = ParentRegion ]; | ||
|
||
Index ParentRegionIdx On ParentRegion; | ||
|
||
Storage Default | ||
{ | ||
<Data name="RegionDefaultData"> | ||
<Subscript>"Region"</Subscript> | ||
<Value name="1"> | ||
<Value>ParentRegion</Value> | ||
</Value> | ||
</Data> | ||
<DefaultData>RegionDefaultData</DefaultData> | ||
<Type>%Library.CacheStorage</Type> | ||
} | ||
|
||
} | ||
|
Oops, something went wrong.