コード例 #1
0
        public override void WriteTo(ArcXmlWriter writer)
        {
            try
            {
                writer.WriteStartElement(XmlName);

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

                if (Compact)
                {
                    writer.WriteAttributeString("compact", "true");
                }

                if (DensifyTolerance != 0)
                {
                    writer.WriteAttributeString("densifytolerance", DensifyTolerance.ToString());
                }

                if (Envelope)
                {
                    writer.WriteAttributeString("envelope", "true");
                }

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

                _fromCoordSys.WriteTo(writer);
                _toCoordSys.WriteTo(writer);

                foreach (IGeometry shape in _shapes)
                {
                    if (shape.OgcGeometryType == OgcGeometryType.Point)
                    {
                        GeometrySerializer.WriteAsMultiPointTo(writer, (IPoint)shape);
                    }
                    else
                    {
                        GeometrySerializer.WriteTo(writer, shape);
                    }
                }

                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);
                }
            }
        }
コード例 #2
0
        public void WriteTo(ArcXmlWriter writer)
        {
            try
            {
                writer.WriteStartElement(XmlName);

                writer.WriteAttributeString("relation", ArcXmlEnumConverter.ToArcXml(typeof(SpatialRelation), Relation));

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

                if (Shape != null)
                {
                    if (Shape.OgcGeometryType == OgcGeometryType.Point)
                    {
                        GeometrySerializer.WriteAsMultiPointTo(writer, (IPoint)Shape);
                    }
                    else
                    {
                        GeometrySerializer.WriteTo(writer, Shape);
                    }
                }

                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);
                }
            }
        }
コード例 #3
0
        public void WriteTo(ArcXmlWriter writer)
        {
            try
            {
                writer.WriteStartElement(XmlName);

                if (!String.IsNullOrEmpty(Lower))
                {
                    writer.WriteAttributeString("lower", Lower);
                }

                if (Alignment != ObjectAlignment.BottomLeft)
                {
                    writer.WriteAttributeString("alignment", ArcXmlEnumConverter.ToArcXml(typeof(ObjectAlignment), Alignment));
                }

                writer.WriteAttributeString("units", ArcXmlEnumConverter.ToArcXml(typeof(ObjectUnits), Units));

                if (!String.IsNullOrEmpty(Upper))
                {
                    writer.WriteAttributeString("upper", Upper);
                }

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

                if (_shape != null)
                {
                    if (_shape.OgcGeometryType == OgcGeometryType.Point)
                    {
                        GeometrySerializer.WriteAsMultiPointTo(writer, (IPoint)_shape);
                    }
                    else
                    {
                        GeometrySerializer.WriteTo(writer, _shape);
                    }

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

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

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

                if (_text != null)
                {
                    bool symbolAdded = false;

                    if (_text.Symbol == null)
                    {
                        _text.Symbol = (TextMarkerSymbol)Symbol;
                        symbolAdded  = true;
                    }

                    _text.WriteTo(writer);

                    if (symbolAdded)
                    {
                        _text.Symbol = null;
                    }
                }

                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);
                }
            }
        }