Esempio n. 1
0
        /// <summary>
        /// Determines the features present in the given <see cref="IAtomContainer"/>.
        /// </summary>
        /// <param name="molecule">IAtomContainer to determine the features off</param>
        /// <returns>integer representation of the present features</returns>
        public static DataFeatures GetSupportedDataFeatures(IAtomContainer molecule)
        {
            DataFeatures features = DataFeatures.None;

            if (MoleculeFeaturesTool.HasElementSymbols(molecule))
            {
                features = features | DataFeatures.HasAtomElementSymbol;
            }
            if (GeometryUtil.Has2DCoordinates(molecule))
            {
                features = features | DataFeatures.Has2DCoordinates;
            }
            if (GeometryUtil.Has3DCoordinates(molecule))
            {
                features = features | DataFeatures.Has3DCoordinates;
            }
            if (CrystalGeometryTools.HasCrystalCoordinates(molecule))
            {
                features = features | DataFeatures.HasFractionalCrystalCoordinates;
            }
            if (MoleculeFeaturesTool.HasFormalCharges(molecule))
            {
                features = features | DataFeatures.HasAtomFormalCharges;
            }
            if (MoleculeFeaturesTool.HasPartialCharges(molecule))
            {
                features = features | DataFeatures.HasAtomPartialCharges;
            }
            if (MoleculeFeaturesTool.HasGraphRepresentation(molecule))
            {
                features = features | DataFeatures.HasGraphRepresentation;
            }
            return(features);
        }
Esempio n. 2
0
        public JObject GetResponse(DataFeatures feature, string stationId)
        {
            Uri uri = new Uri(
                string.Format("http://api.wunderground.com/api/{0}/{1}/q/zmw:{2}.json", apiKey, dataFeaturesUrlMap[feature], stationId));

            return(GetServiceResponse(uri));
        }
Esempio n. 3
0
        /// <summary>
        /// Finds IChemFormats that provide a container for serialization for the
        /// given features. The syntax of the integer is explained in the DataFeatures class.
        /// </summary>
        /// <param name="features">the data features for which a IChemFormat is searched</param>
        /// <returns>an array of IChemFormat's that can contain the given features</returns>
        /// <seealso cref="Tools.DataFeatures"/>
        public IChemFormat[] FindChemFormats(DataFeatures features)
        {
            if (formats == null)
            {
                LoadFormats();
            }

            List <IChemFormat> matches = new List <IChemFormat>();

            foreach (var format in formats)
            {
                if ((format.SupportedDataFeatures & features) == features)
                {
                    matches.Add(format);
                }
            }
            return(matches.ToArray());
        }
 public JObject GetResponse(DataFeatures feature, string stationId)
 {
     Uri uri = new Uri(
         string.Format("http://api.wunderground.com/api/{0}/{1}/q/zmw:{2}.json", apiKey, dataFeaturesUrlMap[feature], stationId));
     return GetServiceResponse(uri);
 }