Skip to content

Commit

Permalink
Add Perm Krai Map
Browse files Browse the repository at this point in the history
  • Loading branch information
MakarovS96 committed Jul 11, 2018
1 parent 4a68183 commit 98c9cf3
Show file tree
Hide file tree
Showing 37 changed files with 835 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/cls/DSWMap/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Class DSWMap.Utils
ClassMethod SetupAll()
{

for map="CZ","FIN","RSA","SE","RF.SAKH","RF.KHAB","USA","UK","KZ","UA" {
for map="CZ","FIN","RSA","SE","RF.SAKH","RF.KHAB","USA","UK","KZ","UA","RF.PERM" {
do $CLASSMETHOD(map_".Utils", "Setup")
}
}
Expand Down
64 changes: 64 additions & 0 deletions src/cls/RF/PERM/BI/PERMCube.cls
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-&gt;Guid,ParentRegion-&gt;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;

}

32 changes: 32 additions & 0 deletions src/cls/RF/PERM/Parameter.cls
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>
}

}

42 changes: 42 additions & 0 deletions src/cls/RF/PERM/ParameterValue.cls
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>
}

}

37 changes: 37 additions & 0 deletions src/cls/RF/PERM/Region.cls
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>
}

}

Loading

0 comments on commit 98c9cf3

Please sign in to comment.