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

                writer.WriteAttributeString("layerid", LayerID);
                writer.WriteAttributeString("x", X.ToString());
                writer.WriteAttributeString("y", Y.ToString());

                if (!String.IsNullOrEmpty(DataFrame))
                {
                    writer.WriteAttributeString("dataframe", DataFrame);
                }

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

                if (!String.IsNullOrEmpty(ID))
                {
                    writer.WriteAttributeString("id", ID);
                }

                if (Type != LayerType.None)
                {
                    writer.WriteAttributeString("type", ArcXmlEnumConverter.ToArcXml(typeof(LayerType), Type));
                }

                if (!String.IsNullOrEmpty(MaxScale))
                {
                    writer.WriteAttributeString("maxscale", MaxScale);
                }

                if (!String.IsNullOrEmpty(MinScale))
                {
                    writer.WriteAttributeString("mincale", MinScale);
                }

                if (!String.IsNullOrEmpty(Name))
                {
                    writer.WriteAttributeString("name", Name);
                }

                if (!Visible)
                {
                    writer.WriteAttributeString("visible", "false");
                }

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

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

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

                if (Objects != null)
                {
                    foreach (Object obj in Objects)
                    {
                        obj.WriteTo(writer);
                    }
                }

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

                if (Renderer != null)
                {
                    Renderer.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);
                }
            }
        }
コード例 #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);
                }
            }
        }