Beispiel #1
0
        private void OmrådekartFraXml(XDocument gridLayerXml)
        {
            var mapElements = NinXmlParser.GetChildElements(gridLayerXml.Root, "kartElementer",
                                                            TillatAntall.EnEllerFlere);

            foreach (var mapElement in mapElements)
            {
                var gridMapElement = NinXmlParser.GetChildElements(mapElement, "OmraadeKartElement",
                                                                   TillatAntall.AkkuratEn);

                var gridLayerCell    = new GridLayerCellCustom();
                var gridLayerItemIds = NinXmlParser.GetChildElements(gridMapElement[0], "id",
                                                                     TillatAntall.AkkuratEn);
                gridLayerCell.CellId = gridLayerItemIds[0].Value;

                var gridLayerCellGeometries = NinXmlParser.GetChildElements(gridMapElement[0], "geometri",
                                                                            TillatAntall.AkkuratEn);
                int epsgCode;
                var geometry = NinXmlParser.ParseGeometry(gridLayerCellGeometries[0], out epsgCode);
                gridLayerCell.CustomCell = SqlGeometry.STGeomFromText(new SqlChars(geometry), epsgCode);

                var gridLayerItemValues = NinXmlParser.GetChildElements(gridMapElement[0], "trinnVerdi",
                                                                        TillatAntall.AkkuratEn);
                gridLayerCell.Value = gridLayerItemValues[0].Value;

                if (Cells.Count == 0)
                {
                    MinValue = gridLayerCell.Value;
                    MaxValue = gridLayerCell.Value;
                }
                else
                {
                    string minValue;
                    string maxValue;
                    AreaLayerImpl.GuessMinAndMaxValues(true, gridLayerCell.Value, MinValue,
                                                       MaxValue, out minValue, out maxValue);
                    MinValue = minValue;
                    MaxValue = maxValue;
                }

                Cells.Add(gridLayerCell);
            }
        }
Beispiel #2
0
        private void RutenettkartFraXml(XDocument gridLayerXml)
        {
            bool numberCompare             = true;
            Collection <XElement> gridNets = NinXmlParser.GetChildElements(gridLayerXml.Root, "ruteNett",
                                                                           TillatAntall.AkkuratEn);

            Type = TilGridType(gridNets[0].Value);

            var mapElements = NinXmlParser.GetChildElements(gridLayerXml.Root, "kartElementer",
                                                            TillatAntall.EnEllerFlere);

            foreach (var mapElement in mapElements)
            {
                var gridMapElement = NinXmlParser.GetChildElements(mapElement, "RuteNettKartElement",
                                                                   TillatAntall.AkkuratEn);

                var layer            = new GridLayerCell();
                var gridLayerCellIds = NinXmlParser.GetChildElements(gridMapElement[0], "id", TillatAntall.AkkuratEn);
                layer.CellId = gridLayerCellIds[0].Value;

                var gridLayerCellValues = NinXmlParser.GetChildElements(gridMapElement[0], "trinnVerdi",
                                                                        TillatAntall.AkkuratEn);
                layer.Value = gridLayerCellValues[0].Value;

                if (Cells.Count == 0)
                {
                    MinValue = layer.Value;
                    MaxValue = layer.Value;
                }
                else
                {
                    string minValue;
                    string maxValue;
                    numberCompare = AreaLayerImpl.GuessMinAndMaxValues(numberCompare, layer.Value, MinValue,
                                                                       MaxValue, out minValue, out maxValue);
                    MinValue = minValue;
                    MaxValue = maxValue;
                }

                Cells.Add(layer);
            }
        }