Example #1
0
        public override object Clone()
        {
            SpatialQuery clone = (SpatialQuery)this.MemberwiseClone();

            if (Buffer != null)
            {
                clone.Buffer = (Buffer)Buffer.Clone();
            }

            if (FeatureCoordSys != null)
            {
                clone.FeatureCoordSys = (FeatureCoordSys)FeatureCoordSys.Clone();
            }

            if (FilterCoordSys != null)
            {
                clone.FilterCoordSys = (FilterCoordSys)FilterCoordSys.Clone();
            }

            if (SpatialFilter != null)
            {
                clone.SpatialFilter = (SpatialFilter)SpatialFilter.Clone();
            }

            return(clone);
        }
Example #2
0
        public static Properties ReadFrom(ArcXmlReader reader)
        {
            try
            {
                Properties properties = new Properties();

                if (!reader.IsEmptyElement)
                {
                    reader.Read();

                    while (!(reader.NodeType == XmlNodeType.EndElement && reader.Name == XmlName))
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            switch (reader.Name)
                            {
                            case Background.XmlName: properties.Background = Background.ReadFrom(reader); break;

                            case "ENVELOPE": properties.Envelope = EnvelopeSerializer.ReadFrom(reader); break;

                            case FeatureCoordSys.XmlName: properties.FeatureCoordSys = FeatureCoordSys.ReadFrom(reader); break;

                            case FilterCoordSys.XmlName: properties.FilterCoordSys = FilterCoordSys.ReadFrom(reader); break;

                            case ImageGeneralization.XmlName: properties.ImageGeneralization = ImageGeneralization.ReadFrom(reader); break;

                            case ImageSize.XmlName: properties.ImageSize = ImageSize.ReadFrom(reader); break;

                            case MapUnits.XmlName: properties.MapUnits = MapUnits.ReadFrom(reader); break;

                            case Output.XmlName: properties.Output = Output.ReadFrom(reader); break;
                            }
                        }

                        reader.Read();
                    }
                }

                return(properties);
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not read {0} element.", XmlName), ex);
                }
            }
        }
Example #3
0
        public override void WriteTo(ArcXmlWriter writer)
        {
            try
            {
                writer.WriteStartElement(XmlName);

                if (Accuracy > 0)
                {
                    writer.WriteAttributeString("accuracy", Accuracy.ToString());
                }

                if (FeatureLimit > 0)
                {
                    writer.WriteAttributeString("featurelimit", FeatureLimit.ToString());
                }

                if (!String.IsNullOrEmpty(JoinExpression))
                {
                    writer.WriteAttributeString("joinexpression", JoinExpression);
                }

                if (!String.IsNullOrEmpty(JoinTables))
                {
                    writer.WriteAttributeString("jointables", JoinTables);
                }

                if (!String.IsNullOrEmpty(OrderBy))
                {
                    writer.WriteAttributeString("order_by", OrderBy);
                }

                if (!String.IsNullOrEmpty(Subfields))
                {
                    writer.WriteAttributeString("subfields", Subfields);
                }

                if (!String.IsNullOrEmpty(Where))
                {
                    writer.WriteAttributeString("where", Where);
                }

                if (Buffer != null)
                {
                    Buffer.WriteTo(writer);
                }

                if (FeatureCoordSys != null)
                {
                    FeatureCoordSys.WriteTo(writer);
                }

                if (FilterCoordSys != null)
                {
                    FilterCoordSys.WriteTo(writer);
                }

                if (SpatialFilter != null)
                {
                    SpatialFilter.WriteTo(writer);
                }

                writer.WriteEndElement();
            }
            catch (Exception ex)
            {
                if (ex is ArcXmlException)
                {
                    throw ex;
                }
                else
                {
                    throw new ArcXmlException(String.Format("Could not write {0} object.", GetType().Name), ex);
                }
            }
        }