Factory for creating GeohashPrefixTree instances with useful defaults
상속: SpatialPrefixTreeFactory
예제 #1
0
        /// <summary>
        /// The factory  is looked up via "prefixTree" in args, expecting "geohash" or "quad".
        /// If its neither of these, then "geohash" is chosen for a geo context, otherwise "quad" is chosen.
        /// </summary>
        /// <param name="args"></param>
        /// <param name="ctx"></param>
        /// <returns></returns>
        public static SpatialPrefixTree MakeSPT(Dictionary <String, String> args, SpatialContext ctx)
        {
            SpatialPrefixTreeFactory instance;
            String cname;

            if (!args.TryGetValue(PREFIX_TREE, out cname) || cname == null)
            {
                cname = ctx.IsGeo() ? "geohash" : "quad";
            }
            if ("geohash".Equals(cname, StringComparison.OrdinalIgnoreCase))
            {
                instance = new GeohashPrefixTree.Factory();
            }
            else if ("quad".Equals(cname, StringComparison.OrdinalIgnoreCase))
            {
                instance = new QuadPrefixTree.Factory();
            }
            else
            {
                Type t = Type.GetType(cname);
                instance = (SpatialPrefixTreeFactory)Activator.CreateInstance(t);
            }
            instance.Init(args, ctx);
            return(instance.NewSPT());
        }
예제 #2
0
        /// <summary>The factory  is looked up via "prefixTree" in args, expecting "geohash" or "quad".</summary>
        /// <remarks>
        /// The factory  is looked up via "prefixTree" in args, expecting "geohash" or "quad".
        /// If its neither of these, then "geohash" is chosen for a geo context, otherwise "quad" is chosen.
        /// </remarks>
        public static SpatialPrefixTree MakeSPT(IDictionary <string, string> args, SpatialContext ctx)
        {
            SpatialPrefixTreeFactory instance;
            string cname;

            if (!args.TryGetValue(PREFIX_TREE, out cname))
            {
                cname = ctx.IsGeo ? "geohash" : "quad";
            }
            if ("geohash".Equals(cname, StringComparison.OrdinalIgnoreCase))
            {
                instance = new GeohashPrefixTree.Factory();
            }
            else if ("quad".Equals(cname, StringComparison.OrdinalIgnoreCase))
            {
                instance = new QuadPrefixTree.Factory();
            }
            else
            {
                try
                {
                    Type c = Type.GetType(cname);
                    instance = (SpatialPrefixTreeFactory)Activator.CreateInstance(c);
                }
                catch (Exception e)
                {
                    throw new ApplicationException(string.Empty, e);
                }
            }
            instance.Init(args, ctx);
            return(instance.NewSPT());
        }
 //1m
 /// <summary>The factory  is looked up via "prefixTree" in args, expecting "geohash" or "quad".
 /// 	</summary>
 /// <remarks>
 /// The factory  is looked up via "prefixTree" in args, expecting "geohash" or "quad".
 /// If its neither of these, then "geohash" is chosen for a geo context, otherwise "quad" is chosen.
 /// </remarks>
 public static SpatialPrefixTree MakeSPT(IDictionary<string, string> args, SpatialContext ctx)
 {
     SpatialPrefixTreeFactory instance;
     string cname = args[PrefixTree];
     if (cname == null)
     {
         cname = ctx.IsGeo() ? "geohash" : "quad";
     }
     if ("geohash".Equals(cname, StringComparison.OrdinalIgnoreCase))
     {
         instance = new GeohashPrefixTree.Factory();
     }
     else
     {
         if ("quad".Equals(cname, StringComparison.OrdinalIgnoreCase))
         {
             instance = new QuadPrefixTree.Factory();
         }
         else
         {
             try
             {
                 Type c = Type.GetType(cname);
                 instance = (SpatialPrefixTreeFactory)System.Activator.CreateInstance(c);
             }
             catch (Exception e)
             {
                 throw new Exception(string.Empty, e);
             }
         }
     }
     instance.Init(args, ctx);
     return instance.NewSPT();
 }
예제 #4
0
 /// <summary>The factory  is looked up via "prefixTree" in args, expecting "geohash" or "quad".</summary>
 /// <remarks>
 /// The factory  is looked up via "prefixTree" in args, expecting "geohash" or "quad".
 /// If its neither of these, then "geohash" is chosen for a geo context, otherwise "quad" is chosen.
 /// </remarks>
 public static SpatialPrefixTree MakeSPT(IDictionary<string, string> args, SpatialContext ctx)
 {
     SpatialPrefixTreeFactory instance;
     string cname;
     if (!args.TryGetValue(PREFIX_TREE, out cname))
     {
         cname = ctx.IsGeo ? "geohash" : "quad";
     }
     if ("geohash".Equals(cname, StringComparison.OrdinalIgnoreCase))
     {
         instance = new GeohashPrefixTree.Factory();
     }
     else if ("quad".Equals(cname, StringComparison.OrdinalIgnoreCase))
     {
         instance = new QuadPrefixTree.Factory();
     }
     else
     {
         try
         {
             Type c = Type.GetType(cname);
             instance = (SpatialPrefixTreeFactory)Activator.CreateInstance(c);
         }
         catch (Exception e)
         {
             throw new ApplicationException(string.Empty, e);
         }
     }
     instance.Init(args, ctx);
     return instance.NewSPT();
 }
예제 #5
0
        //1m
        /// <summary>The factory  is looked up via "prefixTree" in args, expecting "geohash" or "quad".
        ///     </summary>
        /// <remarks>
        /// The factory  is looked up via "prefixTree" in args, expecting "geohash" or "quad".
        /// If its neither of these, then "geohash" is chosen for a geo context, otherwise "quad" is chosen.
        /// </remarks>
        public static SpatialPrefixTree MakeSPT(IDictionary <string, string> args, SpatialContext ctx)
        {
            SpatialPrefixTreeFactory instance;
            string cname = args[PrefixTree];

            if (cname == null)
            {
                cname = ctx.IsGeo() ? "geohash" : "quad";
            }
            if ("geohash".Equals(cname, StringComparison.OrdinalIgnoreCase))
            {
                instance = new GeohashPrefixTree.Factory();
            }
            else
            {
                if ("quad".Equals(cname, StringComparison.OrdinalIgnoreCase))
                {
                    instance = new QuadPrefixTree.Factory();
                }
                else
                {
                    try
                    {
                        Type c = Type.GetType(cname);
                        instance = (SpatialPrefixTreeFactory)System.Activator.CreateInstance(c);
                    }
                    catch (Exception e)
                    {
                        throw new Exception(string.Empty, e);
                    }
                }
            }
            instance.Init(args, ctx);
            return(instance.NewSPT());
        }
예제 #6
0
		/// <summary>
		/// The factory  is looked up via "prefixTree" in args, expecting "geohash" or "quad".
		/// If its neither of these, then "geohash" is chosen for a geo context, otherwise "quad" is chosen.
		/// </summary>
		/// <param name="args"></param>
		/// <param name="ctx"></param>
		/// <returns></returns>
		public static SpatialPrefixTree MakeSPT(Dictionary<String, String> args, SpatialContext ctx)
		{
			SpatialPrefixTreeFactory instance;
			String cname;
            if (!args.TryGetValue(PREFIX_TREE, out cname) || cname == null)
				cname = ctx.IsGeo() ? "geohash" : "quad";
			if ("geohash".Equals(cname, StringComparison.InvariantCultureIgnoreCase))
				instance = new GeohashPrefixTree.Factory();
			else if ("quad".Equals(cname, StringComparison.InvariantCultureIgnoreCase))
				instance = new QuadPrefixTree.Factory();
			else
			{
				Type t = Type.GetType(cname);
				instance = (SpatialPrefixTreeFactory)Activator.CreateInstance(t);
			}
			instance.Init(args, ctx);
			return instance.NewSPT();
		}