示例#1
0
文件: Point.cs 项目: nakijun/geosik
        internal protected override void InternalPopulate(IGeometrySink sink)
        {
            int dim = 2;

            if (srsDimension.HasValue)
            {
                dim = Convert.ToInt32(srsDimension.Value);
            }

            sink.BeginGeometry(GeometryType.Point);

            //if (pos!=null)
            if (Untyped.Descendants("{http://www.opengis.net/gml}pos").Any <XElement>())
            {
                if (pos.srsDimension.HasValue)
                {
                    dim = Convert.ToInt32(pos.srsDimension.Value);
                }

                if ((pos.TypedValue != null) && (pos.TypedValue.Count >= dim))
                {
                    sink.BeginFigure(pos.TypedValue[0], pos.TypedValue[1], dim > 2 ? pos.TypedValue[2] : (double?)null);
                    sink.EndFigure();
                }
            }

            sink.EndGeometry();
        }
示例#2
0
 public override void WriteStartElement(string prefix, string localName, string ns)
 {
     try {
         this.builder.startElement(CreateNodeName(prefix, localName, ns), Untyped.getInstance(), 0, 0);
     } catch {
         this.currentState = WriteState.Error;
         throw;
     }
 }
示例#3
0
文件: Polygon.cs 项目: nakijun/geosik
 protected override void PopulateEnvelope(Envelope envelope)
 {
     //if ((exterior!=null) && (exterior._Ring!=null))
     if (
         Untyped.Descendants("{http://www.opengis.net/gml}exterior").Any <XElement>() &&
         exterior.Untyped.Descendants("{http://www.opengis.net/gml}LinearRing").Any <XElement>()
         )
     {
         exterior._Ring.Populate(envelope);
     }
 }
示例#4
0
        /// <summary>Fills the current bounding box with the specified geometry information.</summary>
        /// <param name="g">THe geometry to fill this bounding box with.</param>
        public void InitFromGeometry(ISimpleGeometry g)
        {
            if (g == null)
            {
                LowerCorner = null;
                UpperCorner = null;
                return;
            }

            CoordinateSystem = g.CoordinateSystem;

            var lc = new List <double>(2);
            var uc = new List <double>(2);

            ISimpleGeometry env = g.Envelope();

            var envelope = env as Gml.V311.Envelope;

            if (envelope == null)
            {
                envelope = new Gml.V311.Envelope();
                env.Populate(envelope);
            }
            Debug.Assert(envelope != null);

            lc.Add(envelope.lowerCorner.TypedValue[0]);
            lc.Add(envelope.lowerCorner.TypedValue[1]);
            uc.Add(envelope.upperCorner.TypedValue[0]);
            uc.Add(envelope.upperCorner.TypedValue[1]);

            // Bug in LinqToXsd : serialization is culture dependent...
            //LowerCorner=lc;
            //UpperCorner=uc;
            LowerCorner = new List <double>();
            foreach (XElement el in Untyped.Descendants("{http://www.opengis.net/ows}LowerCorner"))
            {
                el.Value = string.Join(
                    " ",
                    lc.Select <double, string>(d => d.ToString(CultureInfo.InvariantCulture))
                    );
            }
            UpperCorner = new List <double>();
            foreach (XElement el in Untyped.Descendants("{http://www.opengis.net/ows}UpperCorner"))
            {
                el.Value = string.Join(
                    " ",
                    uc.Select <double, string>(d => d.ToString(CultureInfo.InvariantCulture))
                    );
            }
        }
示例#5
0
        protected internal override void InternalPopulate(IGeometrySink sink)
        {
            sink.BeginGeometry(GeometryType.MultiPolygon);

            //if ((polygonMember!=null)
            if (Untyped.Descendants("{http://www.opengis.net/gml}polygonMember").Any <XElement>())
            {
                foreach (polygonMember p in polygonMember)
                {
                    p.Polygon.Populate(sink);
                }
            }

            sink.EndGeometry();
        }
示例#6
0
        protected internal override void InternalPopulate(IGeometrySink sink)
        {
            sink.BeginGeometry(GeometryType.MultiLineString);

            //if ((lineStringMember!=null)
            if (Untyped.Descendants("{http://www.opengis.net/gml}lineStringMember").Any <XElement>())
            {
                foreach (lineStringMember l in lineStringMember)
                {
                    l.LineString.Populate(sink);
                }
            }

            sink.EndGeometry();
        }
示例#7
0
        protected internal override void InternalPopulate(IGeometrySink sink)
        {
            sink.BeginGeometry(GeometryType.GeometryCollection);

            //if ((geometryMember!=null)
            if (Untyped.Descendants("{http://www.opengis.net/gml}geometryMember").Any <XElement>())
            {
                foreach (geometryMember g in geometryMember)
                {
                    g._Geometry.Populate(sink);
                }
            }

            sink.EndGeometry();
        }
示例#8
0
        internal LambdaExpression CreateLambda(IQueryable source, XmlNamespaceManager namespaceManager, bool mayRootPathBeImplied, IOperatorImplementationProvider operatorImplementationProvider, Func <Type, IXmlNamespaceResolver, XPathTypeNavigator> navigatorCreator = null)
        {
            Expression body = null;

            ParameterExpression[] parameters = new ParameterExpression[] {
                Expression.Parameter(source.ElementType)
            };

            if (Untyped.Elements().Any())
            {
                var ebp = new ExpressionBuilderParameters(parameters, source.Provider, source.ElementType, namespaceManager, mayRootPathBeImplied, operatorImplementationProvider, navigatorCreator);

                Type st = typeof(bool);
                if (logicOps != null)
                {
                    body = logicOps.CreateExpression(ebp, st, null);
                }
                else if (comparisonOps != null)
                {
                    body = comparisonOps.CreateExpression(ebp, st, null);
                }
                else if (spatialOps != null)
                {
                    body = spatialOps.CreateExpression(ebp, st, null);
                }
            }
            else if (string.IsNullOrWhiteSpace(Untyped.Value))
            {
                body = Expression.Constant(true, typeof(bool));
            }

            if (body == null)
            {
                throw new ArgumentException(
                          string.Format(
                              CultureInfo.InvariantCulture,
                              SR.InvalidFilterDefinitionException,
                              Untyped.Value
                              )
                          );
            }

            return(Expression.Lambda(body, parameters));
        }
 public ICommand IssueApplyChangesCommand(DataVaultUIContext context)
 {
     if (Untyped == null)
     {
         return(new ValueNewTypedCommand(context, this));
     }
     else
     {
         if (Untyped.ContentString != AsStoredString ||
             Untyped.GetTypeToken2() != TypeToken)
         {
             return(new ValueEditTypedFinishCommand(context, this));
         }
         else
         {
             return(null);
         }
     }
 }
示例#10
0
        internal protected override void InternalPopulate(IGeometrySink sink)
        {
            sink.BeginGeometry(GeometryType.LineString);

            //if (posList!=null)
            if (Untyped.Descendants("{http://www.opengis.net/gml}posList").Any <XElement>())
            {
                if ((posList.TypedValue != null) && (posList.TypedValue.Count >= 2))
                {
                    sink.BeginFigure(posList.TypedValue[0], posList.TypedValue[1], null);
                    for (int i = 2; i < posList.TypedValue.Count; i += 2)
                    {
                        sink.AddLine(posList.TypedValue[i], posList.TypedValue[i + 1], null);
                    }
                    sink.EndFigure();
                }
            }

            sink.EndGeometry();
        }