Esempio n. 1
0
        public void RemoveContent(string identifier, Type type)
        {
            if (string.IsNullOrEmpty(identifier) || type == null)
            {
                return;
            }
            DatasetDescriptionSummaryBaseType[] srcContents = Contents?.DatasetDescriptionSummary;
            if (srcContents == null)
            {
                return;
            }
            DatasetDescriptionSummaryBaseType baseType = srcContents.FirstOrDefault(x => x.Identifier.Value == identifier && x.GetType() == type);

            if (baseType == null)
            {
                return;
            }
            if (baseType is LayerType content)
            {
                if (content.TileMatrixSetLink == null || content.TileMatrixSetLink.Length == 0)
                {
                    return;
                }
                //remove tileMatrixSet
                TileMatrixSetLink tileMatrixSetLink = content.TileMatrixSetLink[0];
                string            tileMatrixSetName = tileMatrixSetLink.TileMatrixSet;
                TileMatrixSet     tileMatrixSet     = Contents.TileMatrixSet?.FirstOrDefault(x => x.Identifier.Value == tileMatrixSetName);
                if (tileMatrixSet != null)
                {
                    var  layerTypes   = srcContents.Where(x => x is LayerType layerType && x != baseType).Select(x => x as LayerType);
                    bool isReferenced = false;
                    foreach (var item in layerTypes)
                    {
                        if (item.TileMatrixSetLink == null || item.TileMatrixSetLink.Length == 0)
                        {
                            continue;
                        }
                        if (item.TileMatrixSetLink[0].TileMatrixSet == tileMatrixSetName)
                        {
                            isReferenced = true;
                            break;
                        }
                    }
                    if (!isReferenced)
                    {
                        Contents.TileMatrixSet = Contents.TileMatrixSet.Remove(tileMatrixSet);
                    }
                }
            }
            DatasetDescriptionSummaryBaseType[] destContents = srcContents.Remove(baseType);
            Contents.DatasetDescriptionSummary = destContents;
        }
Esempio n. 2
0
        public TileMatrixSet GetTileMatrixSet(string tileMatrixSetName)
        {
            TileMatrixSet tileMatrixSet = GetTileMatrixSets(tileMatrixSetName).FirstOrDefault();

            return(tileMatrixSet);
        }