Exemplo n.º 1
0
 public override IEnumerable <Point> GetVertexes()
 {
     foreach (ICoordinate coordinate in _vertices)
     {
         yield return((Point)FactoryInternal.CreatePoint(coordinate));
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a deep copy of the Point.
        /// </summary>
        /// <returns>A copy of the Point instance.</returns>
        public override Geometry Clone()
        {
            if (IsEmpty)
            {
                return(FactoryInternal.CreatePoint() as Geometry);
            }

            return(new Point(FactoryInternal, X, Y));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a copy of this geometry.
        /// </summary>
        /// <returns>Copy of the MultiPoint.</returns>
        public override Geometry Clone()
        {
            MultiPoint multiPoint = FactoryInternal.CreateMultiPoint() as MultiPoint;

            Debug.Assert(multiPoint != null);

            foreach (Point p in (IEnumerable <IPoint>) this)
            {
                multiPoint.Add(p.Clone() as Point);
            }

            return(multiPoint);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Returns a geometry that represents the point set difference of this
        /// Geometry with another Geometry.
        /// </summary>
        /// <param name="geom">Geometry to compare to</param>
        /// <returns>Geometry</returns>
        public override IGeometry Difference(IGeometry geom)
        {
            if (geom == null)
            {
                throw new ArgumentNullException("geom");
            }

            if (Equals(geom))
            {
                return(FactoryInternal.CreatePoint());
            }

            return(geom);
        }
        private IStringLocalizer CreateStringLocalizer(string baseName, Assembly assembly, CultureInfo cultureInfo)
        {
            // First use the cache.
            var localizer = this.cacheService.Match(assembly, baseName, cultureInfo);

            if (localizer != null)
            {
                this.logger.LogDebug($"Got String localizer for {baseName} in {assembly} with culture {cultureInfo} from cache");

                return(localizer);
            }

            var task = LoadStringLocalizerAsync(assembly, baseName, cultureInfo);

            if (task.Status == TaskStatus.RanToCompletion)
            {
                this.logger.LogInformation($"Loading task completed synchronously for {baseName} in {assembly} with culture {cultureInfo}");

                var map = task.Result;
                if (map != null)
                {
                    localizer = new JsonStringLocalizer(map, cultureInfo, new FactoryInternal(ci => this.CreateStringLocalizer(baseName, assembly, ci)));
                    this.cacheService.Cache(assembly, baseName, cultureInfo, localizer);
                }
                else
                {
                    localizer = new NullStringLocalizer(cultureInfo, new FactoryInternal(ci => this.CreateStringLocalizer(baseName, assembly, ci)), true);
                }
            }
            else
            {
                this.logger.LogInformation($"Loading data asynchronously for {baseName} in {assembly} with culture {cultureInfo}");

                var factory = new FactoryInternal(ci => this.CreateStringLocalizer(baseName, assembly, ci));

                IStringLocalizer loadingLocalizer = this.options.IsDisplayKeysWhileLoadingAsynchronouslyEnabled
                    ? new NullStringLocalizer(cultureInfo, factory, false)
                    : new ConstStringLocalizer("...", factory);

                localizer = new JsonStringLocalizerAsync(task, cultureInfo, factory, loadingLocalizer);
                this.cacheService.Cache(assembly, baseName, cultureInfo, localizer);
            }

            return(localizer);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Creates a deep copy of the GeometryCollection.
 /// </summary>
 /// <returns>A copy of the GeometryCollection instance.</returns>
 public override Geometry Clone()
 {
     return(FactoryInternal.CreateGeometryCollection(
                Enumerable.Upcast <IGeometry, TGeometry>(_geometries)) as Geometry);
 }
Exemplo n.º 7
0
        ///// <summary>
        ///// Gets an empty (uninitialized) point.
        ///// </summary>
        ///// <remarks>
        ///// Returns a new empty point. If checking if a point is empty, especially in a loop, use <see cref="IsEmpty"/>
        ///// since it doesn't create a new object.
        ///// </remarks>
        //public static Point Empty
        //{
        //    get { return _empty.Clone() as Point; }
        //}

        ///// <summary>
        ///// Gets a point representing (0, 0).
        ///// </summary>
        ///// <remarks>
        ///// Returns a new point set to (0, 0). If checking if a point is zero, especially in a loop, use the <see cref="X"/>
        ///// and <see cref="Y"/> properties, since these operations don't create a new object.
        ///// </remarks>
        //public static Point Zero
        //{
        //    get { return _zero.Clone() as Point; }
        //}

        /// <summary>
        /// Returns a 2D <see cref="Point"/> instance from this <see cref="Point"/>.
        /// </summary>
        /// <remarks>
        /// This method, which implements an OGC standard, behaves the same as <see cref="Clone"/> in
        /// returning an exact copy of a point.
        /// </remarks>
        /// <returns><see cref="Point"/></returns>
        public Point AsPoint()
        {
            return((Point)FactoryInternal.CreatePoint(_coord));
        }
Exemplo n.º 8
0
 /// <summary>
 /// Creates a deep copy of the LinearRing.
 /// </summary>
 /// <returns>A copy of the LinearRing instance.</returns>
 public override Geometry Clone()
 {
     return((Geometry)FactoryInternal.CreateLinearRing(GetVertexes()));
 }
Exemplo n.º 9
0
 /// <summary>
 /// Creates a deep copy of the LineString.
 /// </summary>
 /// <returns>A copy of the LineString instance.</returns>
 public override Geometry Clone()
 {
     return(FactoryInternal.CreateLineString(_vertices) as Geometry);
 }