diff --git a/module.xml b/module.xml index ee4f763..de23f05 100755 --- a/module.xml +++ b/module.xml @@ -3,7 +3,7 @@ dsw-map - 1.0.13 + 1.0.14 Provides sample data for use with InterSystems IRIS Business Intelligence, as well as fully developed sample BI models and dashboards. module src @@ -12,6 +12,7 @@ + @@ -25,7 +26,7 @@ dsw - 3.1.* + 3.2.* diff --git a/src/DSWMap/Utils.cls b/src/DSWMap/Utils.cls index 472f6d7..5ed1236 100644 --- a/src/DSWMap/Utils.cls +++ b/src/DSWMap/Utils.cls @@ -4,7 +4,7 @@ Class DSWMap.Utils ClassMethod SetupAll() { - for map="CZ","FIN","RSA","SE","RF.SAKH","RF.KHAB","USA","UK","KZ","UA","UA21","RF.PERM","BG" { + for map="CZ","FIN","RSA","SE","RF.SAKH","RF.KHAB","USA","UK","KZ","UA","UA21","RF.PERM","BG", "ID" { do $CLASSMETHOD(map_".Utils", "Setup") } } diff --git a/src/ID/Area.cls b/src/ID/Area.cls new file mode 100644 index 0000000..b815281 --- /dev/null +++ b/src/ID/Area.cls @@ -0,0 +1,39 @@ +Class ID.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 +{ + + +%%CLASSNAME + + +Name + + +DataUrl + + +^ID.AreaD +AreaDefaultData +^ID.AreaD +^ID.AreaI +^ID.AreaS +%Storage.Persistent +} + +} diff --git a/src/ID/BI/IDCube.cls b/src/ID/BI/IDCube.cls new file mode 100644 index 0000000..93d0a3b --- /dev/null +++ b/src/ID/BI/IDCube.cls @@ -0,0 +1,69 @@ +/// +Class ID.BI.IDCube Extends %DeepSee.CubeDefinition [ DependsOn = ID.Region, ProcedureBlock ] +{ + +/// Cube definition from Architect. +XData Cube [ XMLNamespace = "http://www.intersystems.com/deepsee" ] +{ + + + + + +} + +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(ID.Region).%OpenId(guid) + if $IsObject(region) { + s parameter=##class(ID.ParameterValue).RegionParameterIndexOpen(region.Guid,type) + if $IsObject(parameter) return parameter.Value} + return "" +} + +Parameter DOMAIN; + +} diff --git a/src/ID/Parameter.cls b/src/ID/Parameter.cls new file mode 100644 index 0000000..c584cc8 --- /dev/null +++ b/src/ID/Parameter.cls @@ -0,0 +1,31 @@ +Class ID.Parameter Extends (%Persistent, %XML.Adaptor) +{ + +Property Name As %String; + +Property UnitName As %String; + +Relationship Values As ParameterValue [ Cardinality = many, Inverse = Parameter ]; + +Storage Default +{ + + +%%CLASSNAME + + +Name + + +UnitName + + +^ID.ParameterD +ParameterDefaultData +^ID.ParameterD +^ID.ParameterI +^ID.ParameterS +%Storage.Persistent +} + +} diff --git a/src/ID/ParameterValue.cls b/src/ID/ParameterValue.cls new file mode 100644 index 0000000..3d29eac --- /dev/null +++ b/src/ID/ParameterValue.cls @@ -0,0 +1,41 @@ +Class ID.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 +{ + + +%%CLASSNAME + + +Region + + +Parameter + + +Value + + +^ID.ParameterValueD +ParameterValueDefaultData +^ID.ParameterValueD +^ID.ParameterValueI +^ID.ParameterValueS +%Storage.Persistent +} + +} diff --git a/src/ID/Region.cls b/src/ID/Region.cls new file mode 100644 index 0000000..227ce91 --- /dev/null +++ b/src/ID/Region.cls @@ -0,0 +1,24 @@ +Class ID.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 +{ + +"Region" + +ParentRegion + + +RegionDefaultData +%Storage.Persistent +} + +} diff --git a/src/ID/Utils.cls b/src/ID/Utils.cls new file mode 100644 index 0000000..5b05f25 --- /dev/null +++ b/src/ID/Utils.cls @@ -0,0 +1,117 @@ +Class ID.Utils +{ + +ClassMethod Setup() +{ + do ..Populate() + do ##class(%DeepSee.Utils).%BuildCube("IDCube",0) +} + +ClassMethod Populate() As %Status +{ + do $CLASSMETHOD("ID.Area", "%KillExtent") + do ..ImportXData("ID.Region", "RegionXData") + do ..ImportXData("ID.Parameter", "ParameterXData") + do ..ImportXData("ID.ParameterValue", "ParameterValueXData") + quit $$$OK +} + +ClassMethod ImportXData(className As %String, xDataName As %String) As %Status +{ + #dim sc As %Status = $$$OK + set sc= $CLASSMETHOD(className, "%KillExtent") + + set itemsCount = 0 + + try{ + + if $$$ISERR(sc) + { + write !, $System.Status.DisplayError(sc) + $$$THROWONERROR(sc,sc) + } + + #dim stream As %Stream.Object = ##class(%Dictionary.CompiledXData).%OpenId("ID.Utils"_"||"_xDataName).Data + #dim reader As %XML.Reader = ##class(%XML.Reader).%New() + + set sc = reader.OpenStream(stream, "literal") + $$$THROWONERROR(sc,sc) + + do reader.Correlate($piece(className, ".", 2), className) + + while reader.Next(.obj, .sc) + { + if $$$ISERR(sc) + { + write !, $System.Status.DisplayError(sc) + $$$THROWONERROR(sc,sc) + } + + set sc = obj.%Save() + + if $$$ISERR(sc) + { + write !, $System.Status.DisplayError(sc) + $$$THROWONERROR(sc,sc) + } + + set obj = "" + set itemsCount = itemsCount + 1 + } + } + catch(ex){ + w !, ex.Name_" "_ex.Location + } + + write !,"Import - "_itemsCount_" objects of class "_className + + Quit $$$OK +} + +XData RegionXData +{ + + + North Sulawesi + 1 + North Sulawesi + + + Gorontalo + 1.1 + Gorontalo + 1 + + +} + +XData ParameterValueXData +{ + + + 1 + 1 + 2621923 + + + 1.1 + 1 + 1171681 + + +} + +XData ParameterXData +{ + + + Population + + + Area + sq km + + +} + +} diff --git a/src/dfi/ID/Map of Indonesia.dashboard.xml b/src/dfi/ID/Map of Indonesia.dashboard.xml new file mode 100644 index 0000000..3bead9d --- /dev/null +++ b/src/dfi/ID/Map of Indonesia.dashboard.xml @@ -0,0 +1,20 @@ + + + + + + + false + + + + 0.7893 + 113.9213 + 4 + + + + + + + diff --git a/src/dfi/ID/Population Map Mini Dist.pivot.xml b/src/dfi/ID/Population Map Mini Dist.pivot.xml new file mode 100644 index 0000000..59c08d6 --- /dev/null +++ b/src/dfi/ID/Population Map Mini Dist.pivot.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/dfi/ID/Population Map.pivot.xml b/src/dfi/ID/Population Map.pivot.xml new file mode 100644 index 0000000..75fb3f9 --- /dev/null +++ b/src/dfi/ID/Population Map.pivot.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/js/idpolygons.js b/src/js/idpolygons.js new file mode 100644 index 0000000..e2810aa --- /dev/null +++ b/src/js/idpolygons.js @@ -0,0 +1,9 @@ +function loadCoordinates(polygonCoordsArray) { + +// north sulawesi +polygonCoordsArray['1'] = +'123.095,0.92 123.095,1.25 123.11,1.27 124.215,1.365 124.535,1.865 124.945,2.795 125.1,4.26 125.23,4.77 125.32,4.895 126.455,5.745 126.525,5.78 126.61,5.785 126.705,5.755 126.77,5.695 127.325,4.895 127.36,4.81 127.385,4.6 127.12,3.845 127.815,3.465 127.825,3.455 127.825,3.435 127.1,2.89 126.265,2.03 125.93,1.73 125.545,0.93 125.54,0.24 124.885,-0.565 124.865,-0.575 123.375,-0.085 123.365,-0.075 123.365,-0.06 123.46,0.32 123.46,0.355 123.495,0.41 123.515,0.425 123.5,0.49 123.505,0.505 123.53,0.515 123.52,0.515 123.505,0.535 123.515,0.565 123.495,0.57 123.47,0.59 123.47,0.61 123.44,0.62 123.365,0.625 123.34,0.64 123.325,0.67 123.295,0.68 123.275,0.675 123.235,0.7 123.23,0.76 123.25,0.78 123.25,0.79 123.235,0.795 123.23,0.815 123.215,0.82 123.21,0.83 123.145,0.85 123.11,0.87 123.095,0.895 123.095,0.92'; +// gorontalo +polygonCoordsArray['1.1'] = +'121.145,0.665 121.135,0.685 121.16,0.71 121.165,0.725 121.16,0.75 121.175,0.775 121.195,0.78 121.195,0.8 121.23,0.82 121.32,0.81 121.33,0.815 121.325,0.855 121.345,0.87 121.46,0.865 121.49,0.855 121.51,0.865 121.52,0.89 121.53,0.895 121.555,0.9 121.6,0.89 121.62,0.905 121.675,0.925 121.695,0.925 121.735,0.95 121.77,0.955 121.805,0.975 121.815,0.99 121.85,1 121.89,0.99 121.96,0.93 121.975,0.95 122.005,0.965 122.02,0.99 122.055,1.01 122.095,1.01 122.105,1.025 122.13,1.025 122.15,1.04 122.17,1.04 122.18,1.05 122.275,1.37 122.285,1.385 122.3,1.385 122.465,1.355 123.125,1.27 123.135,1.26 123.14,0.905 123.205,0.875 123.22,0.875 123.26,0.845 123.265,0.83 123.29,0.81 123.295,0.78 123.27,0.74 123.275,0.725 123.34,0.71 123.39,0.66 123.47,0.655 123.51,0.635 123.51,0.61 123.55,0.59 123.555,0.575 123.55,0.545 123.57,0.53 123.565,0.49 123.54,0.475 123.565,0.45 123.57,0.43 123.54,0.39 123.525,0.385 123.5,0.33 123.405,-0.08 123.395,-0.085 122.375,0.075 121.35,0.11 121.315,0.46 121.325,0.49 121.31,0.505 121.31,0.53 121.315,0.54 121.325,0.54 121.325,0.55 121.305,0.545 121.28,0.565 121.265,0.565 121.225,0.59 121.21,0.62 121.185,0.625 121.145,0.665'; +} \ No newline at end of file