示例#1
0
        /// <summary>
        /// Get the Keyword
        /// </summary>
        /// <param name="node">Configuration node</param>
        /// <param name="handler">Orquestation</param>
        /// <returns>Keyword Object</returns>
        public IKeyword GetXOMLKeyword(XmlNode node, OwlHandler handler)
        {
            if (node == null)
            {
                return(null);
            }

            #region Instancia

            // Para las instancias solo se permite Predeterminado, Variable y Reservada
            if (handler.Settings.Instance && (node.Name != "default" && node.Name != "variable" && node.Name != "key"))
            {
                return(null);
            }

            #endregion

            #region Value

            var className = node.Name.XOMLName();
            if (KeywordsList.Contains(className))
            {
                IXOMLObject keywordInstance = (IXOMLObject)Activator.CreateInstance(Type.GetType(string.Format("Fiive.Owl.Core.Keywords.{0}", className)));
                IKeyword    keyword         = (IKeyword)handler.XOMLValidator.GetXOMLObject(keywordInstance, node, handler);

                KeywordsType keywordType = (KeywordsType)Enum.Parse(typeof(KeywordsType), className);
                keyword.KeywordType = keywordType;
                return(keyword);
            }

            #endregion

            return(null);
        }
示例#2
0
 /// <summary>
 /// Construye la clase
 /// </summary>
 /// <param name="message">Mensaje de error</param>
 /// <param name="xml">Valor contenido en el nodo XML</param>
 /// <param name="parentNode">Nombre del nodo padre del atributo</param>
 /// <param name="section">Seccion donde se produjo el error</param>
 /// <param name="innerException">Excepcion que provoca la excepcion actual</param>
 public OwlKeywordException(KeywordsType keywordType, string message, string section, System.Exception innerException) : base(message, section, innerException)
 {
     this.KeywordType = keywordType;
 }
示例#3
0
 /// <summary>
 /// Construye la clase
 /// </summary>
 /// <param name="message">Mensaje de error</param>
 public OwlKeywordException(KeywordsType keywordType, string message) : base(message)
 {
     this.KeywordType = keywordType;
 }
示例#4
0
 /// <summary>
 /// Construye la clase
 /// </summary>
 public OwlKeywordException(KeywordsType keywordType) : base()
 {
     this.KeywordType = keywordType;
 }
示例#5
0
        public virtual Capabilities CreateCapabilities(string href)
        {
            #region ServiceIdentification
            LanguageStringType[] titles = new LanguageStringType[]
            {
                new LanguageStringType()
                {
                    Value = "Web Map Tile Service"
                }
            };
            LanguageStringType[] abstracts = new LanguageStringType[]
            {
                new LanguageStringType()
                {
                    Value = "Service that contrains the map access interface to some TileMatrixSets"
                }
            };
            LanguageStringType[] keyword1 = new LanguageStringType[]
            {
                new LanguageStringType()
                {
                    Value = "tile"
                }
            };
            KeywordsType keywordsType1 = new KeywordsType()
            {
                Keyword = keyword1
            };
            LanguageStringType[] keyword2 = new LanguageStringType[]
            {
                new LanguageStringType()
                {
                    Value = "map"
                }
            };
            KeywordsType keywordsType2 = new KeywordsType()
            {
                Keyword = keyword2
            };
            KeywordsType[] keywords = new KeywordsType[]
            {
                keywordsType1, keywordsType2
            };
            CodeType serviceType = new CodeType()
            {
                Value = "OGC WMTS"
            };
            string[] serviceTypeVersion = new string[]
            {
                "1.0.0"
            };
            string   fees = "none";
            string[] accessConstraints = new string[]
            {
                "none"
            };
            ServiceIdentification serviceIdentification = new ServiceIdentification()
            {
                Title              = titles,
                Abstract           = abstracts,
                Keywords           = keywords,
                ServiceType        = serviceType,
                ServiceTypeVersion = serviceTypeVersion,
                Fees = fees,
                AccessConstraints = accessConstraints
            };
            #endregion

            #region ServiceProvider
            string             poroviderName    = "SharpMapServer";
            OnlineResourceType providerSiteType = new OnlineResourceType()
            {
                href = href
            };
            string[]      voices     = new string[] { "0000-00000000" };
            string[]      facsimiles = new string[] { "0001-00000001" };
            TelephoneType phone      = new TelephoneType()
            {
                Voice     = voices,
                Facsimile = facsimiles
            };
            string[]    deliveryPoints        = new string[] { "jinjiang" };
            string      city                  = "chengdu";
            string      administrativeArea    = "sichuan";
            string      country               = "china";
            string[]    electronicMailAddress = new string[] { "*****@*****.**" };
            string      postalCode            = "123456";
            AddressType address               = new AddressType()
            {
                DeliveryPoint         = deliveryPoints,
                City                  = city,
                AdministrativeArea    = administrativeArea,
                Country               = country,
                ElectronicMailAddress = electronicMailAddress,
                PostalCode            = postalCode
            };
            ContactType contactInfo = new ContactType()
            {
                Phone   = phone,
                Address = address
            };
            string individualName = "lc";
            string positionName   = "Senior Software Engineer";
            ResponsiblePartySubsetType serviceContact = new ResponsiblePartySubsetType()
            {
                IndividualName = individualName,
                PositionName   = positionName,
                ContactInfo    = contactInfo
            };
            ServiceProvider serviceProvider = new ServiceProvider()
            {
                ProviderName   = poroviderName,
                ProviderSite   = providerSiteType,
                ServiceContact = serviceContact
            };
            #endregion

            #region OperationsMetadata
            Operation   getCapabilitiesOperation = GetOperation(href, "GetCapabilities");
            Operation   getTileOperation         = GetOperation(href, "GetTile");
            Operation   getFeatureinfoOperation  = GetOperation(href, "GetFeatureinfo");
            Operation[] operations = new Operation[]
            {
                getCapabilitiesOperation,
                getTileOperation,
                getFeatureinfoOperation
            };
            OperationsMetadata operationsMetadata = new OperationsMetadata()
            {
                Operation = operations
            };
            #endregion

            Capabilities capabilities = new Capabilities()
            {
                ServiceIdentification = serviceIdentification,
                ServiceProvider       = serviceProvider,
                OperationsMetadata    = operationsMetadata
            };
            return(capabilities);
        }
示例#6
0
 public Entry(string keywords, KeywordsType type)
 {
     Keywords = keywords;
     Type     = type;
 }
示例#7
0
        public REP_CapabilitiesType GetCapabilities()
        {
            //Build Cababilities.XML
            //ServiceIndentification
            REP_CapabilitiesType rootCapabilities = new REP_CapabilitiesType();

            rootCapabilities.version = "2.0.0";

            rootCapabilities.ServiceIdentification = new ServiceIdentification();
            //Title
            IList <string> values = new List <string>();

            values.Add(ServiceData.Title());
            rootCapabilities.ServiceIdentification.Title = CreateNode(values);

            values = new List <string>();
            values.Add(ServiceData.Abstract());
            //Abstract
            rootCapabilities.ServiceIdentification.Abstract = CreateNode(values);

            //Keywords
            KeywordsType keyWords = new KeywordsType();

            //TODO: Sjekk om dette fungerer!!!
            values              = ServiceData.Keywords();
            keyWords.Keyword    = CreateNode(values);
            keyWords.Type       = new CodeType();
            keyWords.Type.Value = "String";
            List <KeywordsType> lstDesc = new List <KeywordsType>();

            lstDesc.Add(keyWords);
            rootCapabilities.ServiceIdentification.Keywords = lstDesc.ToArray();



            //<ows:ServiceType>WFS</ows:ServiceType>

            //TODO: Legg til felt i databasen
            rootCapabilities.ServiceIdentification.ServiceType       = new CodeType();
            rootCapabilities.ServiceIdentification.ServiceType.Value = "WFS";

            //<ows:ServiceTypeVersion>2.0.0</ows:ServiceTypeVersion><ows:ServiceTypeVersion>1.1.0</ows:ServiceTypeVersion><ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>
            //TODO Legg til felt i basen.
            rootCapabilities.ServiceIdentification.ServiceTypeVersion    = new string[3];
            rootCapabilities.ServiceIdentification.ServiceTypeVersion[0] = "2.0.0";
            rootCapabilities.ServiceIdentification.ServiceTypeVersion[1] = "1.1.0";
            rootCapabilities.ServiceIdentification.ServiceTypeVersion[2] = "1.0.0";


            rootCapabilities.ServiceIdentification.Fees = ServiceData.Fees();
            rootCapabilities.ServiceIdentification.AccessConstraints = CreateNode(ServiceData.AccessConstraints());

            ////ServiceProvider
            rootCapabilities.ServiceProvider = new ServiceProvider();
            rootCapabilities.ServiceProvider.ProviderName = ServiceData.ProviderName();

            rootCapabilities.ServiceProvider.ProviderSite      = new OnlineResourceType();
            rootCapabilities.ServiceProvider.ProviderSite.href = ServiceData.ProviderSite();

            rootCapabilities.ServiceProvider.ServiceContact = new ResponsiblePartySubsetType();
            rootCapabilities.ServiceProvider.ServiceContact.IndividualName = ServiceData.IndividualName();
            rootCapabilities.ServiceProvider.ServiceContact.PositionName   = ""; //TODO: Lgg i basen. Innstilling for dette

            rootCapabilities.ServiceProvider.ServiceContact.ContactInfo       = new ContactType();
            rootCapabilities.ServiceProvider.ServiceContact.ContactInfo.Phone = new TelephoneType();

            rootCapabilities.ServiceProvider.ServiceContact.ContactInfo.Phone.Voice                   = CreateNode(ServiceData.Phone());
            rootCapabilities.ServiceProvider.ServiceContact.ContactInfo.Phone.Facsimile               = CreateNode(ServiceData.Fax());
            rootCapabilities.ServiceProvider.ServiceContact.ContactInfo.Address                       = new AddressType();
            rootCapabilities.ServiceProvider.ServiceContact.ContactInfo.Address.DeliveryPoint         = CreateNode(ServiceData.Adresse());
            rootCapabilities.ServiceProvider.ServiceContact.ContactInfo.Address.City                  = ServiceData.City();
            rootCapabilities.ServiceProvider.ServiceContact.ContactInfo.Address.AdministrativeArea    = ServiceData.City();
            rootCapabilities.ServiceProvider.ServiceContact.ContactInfo.Address.Country               = ServiceData.Country();
            rootCapabilities.ServiceProvider.ServiceContact.ContactInfo.Address.ElectronicMailAddress = CreateNode(ServiceData.EMail());
            rootCapabilities.ServiceProvider.ServiceContact.ContactInfo.OnlineResource                = new OnlineResourceType();
            rootCapabilities.ServiceProvider.ServiceContact.ContactInfo.OnlineResource.href           = ServiceData.OnlineResourcesUrl();
            rootCapabilities.ServiceProvider.ServiceContact.ContactInfo.HoursOfService                = ServiceData.HoursOfService();
            rootCapabilities.ServiceProvider.ServiceContact.ContactInfo.ContactInstructions           = ServiceData.ContactInstructions();
            rootCapabilities.ServiceProvider.ServiceContact.Role       = new CodeType();
            rootCapabilities.ServiceProvider.ServiceContact.Role.Value = ServiceData.Role();

            rootCapabilities.OperationsMetadata = new OperationsMetadata();
            List <Operation> listLst       = new List <Operation>();
            Operation        operationNode = CreateOperation("GetCapabilities", "Acceptversions", "2.0.0"); //TODO, må inn i databasen

            listLst.Add(operationNode);
            operationNode = CreateOperation("DescribeFeatureType", "", "");
            listLst.Add(operationNode);
            operationNode = CreateOperation("ListStoredChangelog", "", "");
            listLst.Add(operationNode);
            operationNode = CreateOperation("OrderChangelog", "", "");
            listLst.Add(operationNode);
            operationNode = CreateOperation("GetChangelogStatus", "", "");
            listLst.Add(operationNode);
            rootCapabilities.OperationsMetadata.Operation = listLst.ToArray();
            List <DomainType> lstDomain = new List <DomainType>();

            lstDomain.Add(CreateParameter("version", "2.0.0"));
            rootCapabilities.OperationsMetadata.Parameter = lstDomain.ToArray();
            List <DomainType> lstConstraints = new List <DomainType>();

            lstConstraints.Add(CreateConstraints("ImplementsReplicationWFS", "TRUE"));
            lstConstraints.Add(CreateConstraints("ImplementsTransactionalWFS", "FALSE"));
            lstConstraints.Add(CreateConstraints("ImplementsLockingWFS", "FALSE"));
            lstConstraints.Add(CreateConstraints("KVPEncoding", "TRUE"));
            lstConstraints.Add(CreateConstraints("XMLEncoding", "FALSE"));
            lstConstraints.Add(CreateConstraints("SOAPEncoding", "FALSE"));
            lstConstraints.Add(CreateConstraints("ImplementsInheritance", "FALSE"));
            lstConstraints.Add(CreateConstraints("ImplementsRemoteResolve", "FALSE"));
            lstConstraints.Add(CreateConstraints("ImplementsResultPaging", "FALSE"));
            lstConstraints.Add(CreateConstraints("ImplementsStandardJoins", "FALSE"));
            lstConstraints.Add(CreateConstraints("ImplementsSpatialJoins", "FALSE"));
            lstConstraints.Add(CreateConstraints("ImplementsTemporalJoins", "FALSE"));
            lstConstraints.Add(CreateConstraints("ImplementsFeatureVersioning", "FALSE"));
            lstConstraints.Add(CreateConstraints("ManageStoredQueries", "FALSE"));
            lstConstraints.Add(CreateConstraints("CountDefault", "1000")); //TODO: Legge denne verdie for servicen.
            lstConstraints.Add(CreateParameter("QueryExpressions", "wfs:StoredQuery"));
            rootCapabilities.OperationsMetadata.Constraint = lstConstraints.ToArray();


            rootCapabilities.datasets = CreateDatasets();

            return(rootCapabilities);
        }
示例#8
0
        static void TestWmts()
        {
            XmlAttributeOverrides attrOverrides = new XmlAttributeOverrides();

            XmlAttributes       ddsAttrs  = new XmlAttributes();
            XmlElementAttribute layerAttr = new XmlElementAttribute
            {
                ElementName = "Layer",
                Type        = typeof(LayerType)
            };

            ddsAttrs.XmlElements.Add(layerAttr);
            attrOverrides.Add(typeof(ContentsBaseType), "DatasetDescriptionSummary", ddsAttrs);

            #region ServiceIdentification
            LanguageStringType[] titles = new LanguageStringType[]
            {
                new LanguageStringType()
                {
                    Value = "Web Map Tile Service"
                }
            };
            LanguageStringType[] abstracts = new LanguageStringType[]
            {
                new LanguageStringType()
                {
                    Value = "Service that contrains the map access interface to some TileMatrixSets"
                }
            };
            LanguageStringType[] keyword1 = new LanguageStringType[]
            {
                new LanguageStringType()
                {
                    Value = "tile"
                }
            };
            KeywordsType keywordsType1 = new KeywordsType()
            {
                Keyword = keyword1
            };
            LanguageStringType[] keyword2 = new LanguageStringType[]
            {
                new LanguageStringType()
                {
                    Value = "map"
                }
            };
            KeywordsType keywordsType2 = new KeywordsType()
            {
                Keyword = keyword2
            };
            KeywordsType[] keywords = new KeywordsType[]
            {
                keywordsType1, keywordsType2
            };
            CodeType serviceType = new CodeType()
            {
                Value = "OGC WMTS"
            };
            string[] serviceTypeVersion = new string[]
            {
                "1.0.0"
            };
            string   fees = "none";
            string[] accessConstraints = new string[]
            {
                "none"
            };
            ServiceIdentification serviceIdentification = new ServiceIdentification()
            {
                Title              = titles,
                Abstract           = abstracts,
                Keywords           = keywords,
                ServiceType        = serviceType,
                ServiceTypeVersion = serviceTypeVersion,
                Fees = fees,
                AccessConstraints = accessConstraints
            };
            #endregion
            string href = "http://123";
            #region ServiceProvider
            string             poroviderName    = "SharpMapServer";
            OnlineResourceType providerSiteType = new OnlineResourceType()
            {
                href = href
            };
            string[]      voices     = new string[] { "0000-00000000" };
            string[]      facsimiles = new string[] { "0001-00000001" };
            TelephoneType phone      = new TelephoneType()
            {
                Voice     = voices,
                Facsimile = facsimiles
            };
            string[]    deliveryPoints        = new string[] { "jinjiang" };
            string      city                  = "chengdu";
            string      administrativeArea    = "sichuan";
            string      country               = "china";
            string[]    electronicMailAddress = new string[] { "*****@*****.**" };
            string      postalCode            = "123456";
            AddressType address               = new AddressType()
            {
                DeliveryPoint         = deliveryPoints,
                City                  = city,
                AdministrativeArea    = administrativeArea,
                Country               = country,
                ElectronicMailAddress = electronicMailAddress,
                PostalCode            = postalCode
            };
            ContactType contactInfo = new ContactType()
            {
                Phone   = phone,
                Address = address
            };
            string individualName = "lc";
            string positionName   = "Senior Software Engineer";
            ResponsiblePartySubsetType serviceContact = new ResponsiblePartySubsetType()
            {
                IndividualName = individualName,
                PositionName   = positionName,
                ContactInfo    = contactInfo
            };
            ServiceProvider serviceProvider = new ServiceProvider()
            {
                ProviderName   = poroviderName,
                ProviderSite   = providerSiteType,
                ServiceContact = serviceContact
            };
            #endregion

            #region OperationsMetadata
            Operation   getCapabilitiesOperation = CapabilitiesHelper.GetOperation(href, "GetCapabilities");
            Operation   getTileOperation         = CapabilitiesHelper.GetOperation(href, "GetTile");
            Operation   getFeatureinfoOperation  = CapabilitiesHelper.GetOperation(href, "GetFeatureinfo");
            Operation[] operations = new Operation[]
            {
                getCapabilitiesOperation,
                getTileOperation,
                getFeatureinfoOperation
            };
            OperationsMetadata operationsMetadata = new OperationsMetadata()
            {
                Operation = operations
            };
            #endregion
            Capabilities capabilities = new Capabilities()
            {
                ServiceIdentification = serviceIdentification,
                ServiceProvider       = serviceProvider,
                OperationsMetadata    = operationsMetadata
            };
            IWmtsService wmts1Service = OgcServiceHelper.GetOgcService("WMTS", "1.0.0") as IWmtsService;
            wmts1Service.AddContent(capabilities, @"E:\LC\数据\双流\2014年遥感影像.img");

            List <object> objs = new List <object>();
            capabilities.Themes = new Themes[]
            {
                new Themes()
                {
                    Theme = new Theme[]
                    {
                        new Theme()
                        {
                            Identifier = new CodeType()
                            {
                                Value = "123"
                            }
                        }
                    }
                }
            };
            objs.Add(capabilities);
            StringBuilder sb = new StringBuilder();
            using (TextWriter tw = new StringWriter(sb))
            {
                foreach (var item in objs)
                {
                    if (item == null)
                    {
                        continue;
                    }
                    var serializer = new XmlSerializer(item.GetType(), attrOverrides);
                    serializer.Serialize(tw, item);
                    var val = sb.ToString();
                    File.WriteAllText("123.xml", val);
                    sb.Clear();
                }
            }
        }
示例#9
0
        public static ServiceIdentification GetServiceIdentification(string[] titles, string[] abstracts, string[] keyWords, string service, string[] serviceTypeVersions, string fees, string[] accessConstraints, string[] profiles)
        {
            LanguageStringType[] titleTypes = null;
            if (titles != null)
            {
                titleTypes = new LanguageStringType[titles.Length];
                for (int i = 0; i < titles.Length; i++)
                {
                    titleTypes[i] = new LanguageStringType()
                    {
                        Value = titles[i]
                    };
                }
            }
            LanguageStringType[] abstractTypes = null;
            if (abstracts != null)
            {
                abstractTypes = new LanguageStringType[abstracts.Length];
                for (int i = 0; i < abstracts.Length; i++)
                {
                    titleTypes[i] = new LanguageStringType()
                    {
                        Value = abstracts[i]
                    };
                }
            }
            KeywordsType[] keywordsTypes = null;
            if (keyWords != null)
            {
                keywordsTypes = new KeywordsType[keyWords.Length];
                for (int i = 0; i < keyWords.Length; i++)
                {
                    LanguageStringType[] keyword = new LanguageStringType[]
                    {
                        new LanguageStringType()
                        {
                            Value = keyWords[i]
                        }
                    };
                    keywordsTypes[i] = new KeywordsType()
                    {
                        Keyword = keyword
                    };
                }
            }
            CodeType serviceType = null;

            if (!string.IsNullOrWhiteSpace(service))
            {
                serviceType = new CodeType()
                {
                    Value = service
                };
            }
            ServiceIdentification serviceIdentification = new ServiceIdentification()
            {
                Title              = titleTypes,
                Abstract           = abstractTypes,
                Keywords           = keywordsTypes,
                ServiceType        = serviceType,
                ServiceTypeVersion = serviceTypeVersions,
                Fees = fees,
                AccessConstraints = accessConstraints,
                Profile           = profiles
            };

            return(serviceIdentification);
        }