-
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
4a68183
commit 98c9cf3
Showing
37 changed files
with
835 additions
and
29 deletions.
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,64 @@ | ||
/// | ||
Class RF.PERM.BI.PERMCube Extends %DeepSee.CubeDefinition [ DependsOn = RF.PERM.Region, ProcedureBlock ] | ||
{ | ||
|
||
/// Cube definition from Architect. | ||
XData Cube [ XMLNamespace = "http://www.intersystems.com/deepsee" ] | ||
{ | ||
<cube xmlns="http://www.intersystems.com/deepsee" name="PERMCube" displayName="PERMCube" disabled="false" abstract="false" sourceClass="RF.PERM.Region" countMeasureName="%COUNT" bucketSize="8" bitmapChunkInMemory="false" precompute="0" disableListingGroups="false"> | ||
<dimension name="Guid" disabled="false" hasAll="false" allCaption="All Guid" allDisplayName="Guid" type="data" hidden="false" showHierarchies="default"> | ||
<hierarchy name="H1" disabled="false" hidden="false"> | ||
<level name="Region" disabled="false" sourceProperty="Guid" list="false" useDisplayValue="true" useAsFilter="true" hidden="false"> | ||
<property name="Name" disabled="false" sourceProperty="Name" hidden="false" isName="true" isDescription="false" isReference="false" useDisplayValue="false"> | ||
</property> | ||
<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="Density" disabled="false" sourceExpression="%cube.GetValue(%source.Guid,3)" hidden="false" isName="false" 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(RF.PERM.Region).%OpenId(guid) | ||
if $IsObject(region) { | ||
s parameter=##class(RF.PERM.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 RF.PERM.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>^RF.PERM.ParameterD</DataLocation> | ||
<DefaultData>ParameterDefaultData</DefaultData> | ||
<IdLocation>^RF.PERM.ParameterD</IdLocation> | ||
<IndexLocation>^RF.PERM.ParameterI</IndexLocation> | ||
<StreamLocation>^RF.PERM.ParameterS</StreamLocation> | ||
<Type>%Storage.Persistent</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 RF.PERM.ParameterValue Extends (%Persistent, %XML.Adaptor) | ||
{ | ||
|
||
Relationship Region As Region(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>^RF.PERM.ParameterValueD</DataLocation> | ||
<DefaultData>ParameterValueDefaultData</DefaultData> | ||
<IdLocation>^RF.PERM.ParameterValueD</IdLocation> | ||
<IndexLocation>^RF.PERM.ParameterValueI</IndexLocation> | ||
<StreamLocation>^RF.PERM.ParameterValueS</StreamLocation> | ||
<Type>%Storage.Persistent</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,37 @@ | ||
Class RF.PERM.Region 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(MAXLEN = "") [ Required ]; | ||
|
||
/// All values | ||
Relationship Parameters As ParameterValue [ Cardinality = many, Inverse = Region ]; | ||
|
||
Index GuidIdx On Guid [ IdKey, Unique ]; | ||
|
||
Storage Default | ||
{ | ||
<Data name="RegionDefaultData"> | ||
<Value name="1"> | ||
<Value>%%CLASSNAME</Value> | ||
</Value> | ||
<Value name="2"> | ||
<Value>Name</Value> | ||
</Value> | ||
<Value name="3"> | ||
<Value>DataUrl</Value> | ||
</Value> | ||
</Data> | ||
<DataLocation>^RF.PERM.RegionD</DataLocation> | ||
<DefaultData>RegionDefaultData</DefaultData> | ||
<IdLocation>^RF.PERM.RegionD</IdLocation> | ||
<IndexLocation>^RF.PERM.RegionI</IndexLocation> | ||
<StreamLocation>^RF.PERM.RegionS</StreamLocation> | ||
<Type>%Storage.Persistent</Type> | ||
} | ||
|
||
} | ||
|
Oops, something went wrong.