/** * Initializes the {@link GeospatialCoordinateEncoder.Builder} specified * @param b the builder on which to set the mapping. * @param m the map containing the values * @param key the key to be set. */ private static void SetGeoFieldBits(GeospatialCoordinateEncoder.Builder b, Dictionary <string, object> m, string key) { object obj = m[key]; if (obj is string) { string t = (string)m[key]; switch (key) { case "scale": { b.Scale(int.Parse(t)); break; } case "timestep": { b.Timestep(int.Parse(t)); break; } default: break; } } else { int t = (int)obj; switch (key) { case "scale": { b.Scale(t); break; } case "timestep": { b.Timestep(t); break; } default: break; } } }
/** * Specific configuration for GeospatialCoordinateEncoder builder * @param encoderSettings * @param builder */ private static void ConfigureGeoBuilder(MultiEncoder multiEncoder, string fieldName, Map <string, Map <string, object> > encoderSettings, GeospatialCoordinateEncoder.Builder builder) { Map <string, object> geoEncoderSettings = GetEncoderMap(fieldName, encoderSettings, "GeospatialCoordinateEncoder"); if (geoEncoderSettings == null) { throw new InvalidOperationException("Input requires missing GeospatialCoordinateEncoder settings mapping."); } foreach (string key in geoEncoderSettings.Keys) { if (!key.Equals("fieldName") && !key.Equals("encoderType") && !key.Equals("fieldType") && !key.Equals("fieldEncodings")) { if (!key.Equals("scale") && !key.Equals("timestep")) { multiEncoder.SetValue(builder, key, geoEncoderSettings[key]); } else { SetGeoFieldBits(builder, geoEncoderSettings, key); } } } }