本文整理汇总了Java中com.google.appengine.api.search.GeoPoint类的典型用法代码示例。如果您正苦于以下问题:Java GeoPoint类的具体用法?Java GeoPoint怎么用?Java GeoPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeoPoint类属于com.google.appengine.api.search包,在下文中一共展示了GeoPoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createBasicMappings
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
protected static Map<Class<?>, IndexType> createBasicMappings() {
Map<Class<?>, IndexType> map = new LinkedHashMap<>();
map.put(Short.class, IndexType.SmallDecimal);
map.put(Integer.class, IndexType.SmallDecimal);
map.put(short.class, IndexType.SmallDecimal);
map.put(int.class, IndexType.SmallDecimal);
map.put(AtomicInteger.class, IndexType.SmallDecimal);
map.put(AtomicBoolean.class, IndexType.Identifier);
map.put(boolean.class, IndexType.Identifier);
map.put(Boolean.class, IndexType.Identifier);
map.put(Enum.class, IndexType.Identifier);
map.put(UUID.class, IndexType.Identifier);
map.put(Number.class, IndexType.BigDecimal);
map.put(long.class, IndexType.BigDecimal);
map.put(float.class, IndexType.BigDecimal);
map.put(double.class, IndexType.BigDecimal);
map.put(CharSequence.class, IndexType.Text);
map.put(ReadableInstant.class, IndexType.Date);
map.put(Date.class, IndexType.Date);
map.put(GeoPoint.class, IndexType.GeoPoint);
return map;
}
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:23,代码来源:IndexTypeLookup.java
示例2: shouldProvideMetadataAboutTargetType
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
@Test
public void shouldProvideMetadataAboutTargetType() {
SearchMetadata<MetadataTestType, String> metadata = new SearchMetadata<>(MetadataTestType.class, indexTypeLookup);
MetadataTestType testType = new MetadataTestType("stringVal", 123, 456L, new Date(123456789), true, new BigDecimal("1.23"), new GeoPoint(1.23, 4.56));
assertThat(metadata.getType() == MetadataTestType.class, is(true));
assertThat(metadata.getKeyType() == String.class, is(true));
assertThat(metadata.getId(testType), is("stringVal"));
assertThat(metadata.hasIndexableFields(), is(true));
assertThat(metadata.getFieldType("stringVal") == String.class, is(true));
assertThat(metadata.getFieldType("intVal") == int.class, is(true));
assertThat(metadata.getFieldType("longVal") == Long.class, is(true));
assertThat(metadata.getFieldType("dateVal") == Date.class, is(true));
assertThat(metadata.getFieldType("boolVal") == boolean.class, is(true));
assertThat(metadata.getFieldType("bigdecVal") == BigDecimal.class, is(true));
assertThat(metadata.getFieldType("geoPointVal") == GeoPoint.class, is(true));
}
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:18,代码来源:SearchMetadataTest.java
示例3: shouldProvideMetadataAboutTargetJavabeanType
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
@Test
public void shouldProvideMetadataAboutTargetJavabeanType() {
SearchMetadata<MetadataTestJavabeanType, String> metadata = new SearchMetadata<>(MetadataTestJavabeanType.class, indexTypeLookup);
MetadataTestJavabeanType testType = new MetadataTestJavabeanType("stringVal", 123, 456L, new Date(123456789), true, new BigDecimal("1.23"), new GeoPoint(1.23, 4.56));
assertThat(metadata.getType() == MetadataTestJavabeanType.class, is(true));
assertThat(metadata.getKeyType() == String.class, is(true));
assertThat(metadata.getId(testType), is("stringVal"));
assertThat(metadata.hasIndexableFields(), is(true));
assertThat(metadata.getFieldType("stringVal") == String.class, is(true));
assertThat(metadata.getFieldType("intVal") == int.class, is(true));
assertThat(metadata.getFieldType("longVal") == Long.class, is(true));
assertThat(metadata.getFieldType("dateVal") == Date.class, is(true));
assertThat(metadata.getFieldType("boolVal") == boolean.class, is(true));
assertThat(metadata.getFieldType("bigdecVal") == BigDecimal.class, is(true));
assertThat(metadata.getFieldType("geoPointVal") == GeoPoint.class, is(true));
}
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:18,代码来源:SearchMetadataTest.java
示例4: shouldGetDataRelyingOnAnnotatedFieldsInSuperClass
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
@Test
public void shouldGetDataRelyingOnAnnotatedFieldsInSuperClass() throws Exception {
SearchMetadata<ConcreteFieldPojo, String> metadata = new SearchMetadata<>(ConcreteFieldPojo.class, indexTypeLookup);
ConcreteFieldPojo concreteFieldPojo = new ConcreteFieldPojo("stringVal", 123, 456L, new Date(123456789), true, new BigDecimal("1.23"), new GeoPoint(1.23, 4.56));
Map<String, Object> data = metadata.getData(concreteFieldPojo);
assertThat(data.size(), is(7));
assertThat(data, hasEntry("stringVal", (Object) "stringVal"));
assertThat(data, hasEntry("intVal", (Object) 123));
assertThat(data, hasEntry("longVal", (Object) 456L));
assertThat(data, hasEntry("dateVal", (Object) new Date(123456789)));
assertThat(data, hasEntry("boolVal", (Object) true));
assertThat(data, hasEntry("bigdecVal", (Object) new BigDecimal("1.23")));
assertThat(data, hasEntry(is("geoPointVal"), notNullValue()));
}
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:17,代码来源:SearchMetadataTest.java
示例5: addDefaultMappings
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
protected void addDefaultMappings() {
mappings.put(Number.class, IndexType.NUMBER);
mappings.put(Short.class, IndexType.NUMBER);
mappings.put(Integer.class, IndexType.NUMBER);
mappings.put(short.class, IndexType.NUMBER);
mappings.put(int.class, IndexType.NUMBER);
mappings.put(long.class, IndexType.NUMBER);
mappings.put(float.class, IndexType.NUMBER);
mappings.put(double.class, IndexType.NUMBER);
mappings.put(boolean.class, IndexType.IDENTIFIER);
mappings.put(Boolean.class, IndexType.IDENTIFIER);
mappings.put(Enum.class, IndexType.IDENTIFIER);
mappings.put(UUID.class, IndexType.IDENTIFIER);
mappings.put(CharSequence.class, IndexType.TEXT);
mappings.put(Date.class, IndexType.DATE);
mappings.put(OffsetDateTime.class, IndexType.DATE);
mappings.put(ZonedDateTime.class, IndexType.DATE);
mappings.put(GeoPoint.class, IndexType.GEOPOINT);
}
开发者ID:n15g,项目名称:spring-boot-gae,代码行数:24,代码来源:DefaultIndexTypeRegistry.java
示例6: getSearchFieldValues
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
@Test
public void getSearchFieldValues() throws Exception {
TestSearchEntity entity = new TestSearchEntity("id")
.setStringField("stringValue")
.setStringArrayField(new String[]{"one", "two", "three"})
.setStringListField(Arrays.asList("10", "9", "8"))
.setLongField(1234567890L)
.setGeoPointField(new GeoPoint(1.1, 2.2))
.setUnindexedValue("unindexedValue");
Map<String, SearchFieldMetadata> result = searchMetadata.getFields(entity.getClass());
assertThat(result.get("stringField").getValue(entity)).isEqualTo("stringValue");
assertThat(result.get("stringField").getValue(entity)).isEqualTo("stringValue");
assertThat(result.get("longField").getValue(entity)).isEqualTo(1234567890L);
assertThat(result.get("geoPointField").getValue(entity)).isEqualTo(entity.getGeoPointField());
assertThat(result.get("stringArrayField").getValue(entity)).isEqualTo(new String[]{"one", "two", "three"});
assertThat(result.get("stringListField").getValue(entity)).isEqualTo(Arrays.asList("10", "9", "8"));
assertThat(result.get("stringMethod").getValue(entity)).isEqualTo("indexedMethodValue");
assertThat(result.get("stringArrayMethod").getValue(entity)).isEqualTo(new String[]{"value1", "value2", "value3"});
assertThat(result.get("stringListMethod").getValue(entity)).isEqualTo(Arrays.asList("1", "2", "3"));
assertThat(result).doesNotContainKeys("unindexedValue", "unindexedMethod");
}
开发者ID:n15g,项目名称:spring-boot-gae,代码行数:23,代码来源:SearchMetadataImplTest.java
示例7: buildDocument
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
/**
* Builds a new Place document to insert in the Places index.
* @param placeId the identifier of the place in the database.
* @param placeName the name of the place.
* @param placeAddress the address of the place.
* @param location the GPS location of the place, as a GeoPt.
* @return the Place document created.
*/
public static Document buildDocument(
final Long placeId, final String placeName,
final String placeAddress, final GeoPt location) {
GeoPoint geoPoint = new GeoPoint(location.getLatitude(),
location.getLongitude());
Document.Builder builder = Document.newBuilder()
.addField(Field.newBuilder().setName("id")
.setText(placeId.toString()))
.addField(Field.newBuilder().setName("name").setText(placeName))
.addField(Field.newBuilder().setName("address")
.setText(placeAddress))
.addField(Field.newBuilder().setName("place_location")
.setGeoPoint(geoPoint));
// geo-location doesn't work under dev_server, so let's add another
// field to use for retrieving documents
if (environment.value() == Development) {
builder.addField(Field.newBuilder().setName("value").setNumber(1));
}
return builder.build();
}
开发者ID:googlearchive,项目名称:MobileShoppingAssistant-sample,代码行数:32,代码来源:PlacesHelper.java
示例8: getDistance
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
public static double getDistance(GeoPoint gp1, GeoPoint gp2) {
if (gp1 == null || gp2 == null) {
return Double.MAX_VALUE;
}
// double dLat = Math.abs(gp2.getLatitude() - gp1.getLatitude());
// double dLon = Math.abs(gp2.getLongitude() - gp1.getLongitude());
// return Math.sqrt((dLat * dLat) + (dLon * dLon));
double dLat = Math.toRadians(gp2.getLatitude() - gp1.getLatitude());
double dLon = Math.toRadians(gp2.getLongitude() - gp1.getLongitude());
double lat1 = Math.toRadians(gp1.getLatitude());
double lat2 = Math.toRadians(gp2.getLatitude());
double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.sin(dLon / 2)
* Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return R * c;
}
开发者ID:hasier,项目名称:voxpopuli,代码行数:18,代码来源:Utils.java
示例9: buildDocument
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
static Document buildDocument(
String placeId, String placeName, String placeAddress, GeoPt location) {
GeoPoint geoPoint = new GeoPoint(location.getLatitude(), location.getLongitude());
Document.Builder builder = Document.newBuilder()
.addField(Field.newBuilder().setName("id").setText(placeId))
.addField(Field.newBuilder().setName("name").setText(placeName))
.addField(Field.newBuilder().setName("address").setText(placeAddress))
.addField(Field.newBuilder().setName("place_location").setGeoPoint(geoPoint));
// geo-location doesn't work under dev_server, so let's add another
// field to use for retrieving documents
if (environment.value() == Development) {
builder.addField(Field.newBuilder().setName("value").setNumber(1));
}
Document place = builder.build();
return place;
}
开发者ID:googlearchive,项目名称:solutions-mobile-shopping-assistant-backend-java,代码行数:21,代码来源:PlacesHelper.java
示例10: shouldGetDataRelyingOnAnnotatedFields
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
@Test
public void shouldGetDataRelyingOnAnnotatedFields() {
SearchMetadata<MetadataTestType, String> metadata = new SearchMetadata<>(MetadataTestType.class, indexTypeLookup);
MetadataTestType testType = new MetadataTestType("stringVal", 123, 456L, new Date(123456789), true, new BigDecimal("1.23"), new GeoPoint(1.23, 4.56));
Map<String, Object> data = metadata.getData(testType);
assertThat(data.size(), is(7));
assertThat(data, hasEntry("stringVal", (Object) "stringVal"));
assertThat(data, hasEntry("intVal", (Object) 123));
assertThat(data, hasEntry("longVal", (Object) 456L));
assertThat(data, hasEntry("dateVal", (Object) new Date(123456789)));
assertThat(data, hasEntry("boolVal", (Object) true));
assertThat(data, hasEntry("bigdecVal", (Object) new BigDecimal("1.23")));
assertThat(data, hasEntry(is("geoPointVal"), notNullValue()));
}
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:16,代码来源:SearchMetadataTest.java
示例11: shouldGetDataRelyingOnAnnotatedGetters
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
@Test
public void shouldGetDataRelyingOnAnnotatedGetters() {
SearchMetadata<MetadataTestJavabeanType, String> metadata = new SearchMetadata<>(MetadataTestJavabeanType.class, indexTypeLookup);
MetadataTestJavabeanType testType = new MetadataTestJavabeanType("stringVal", 123, 456L, new Date(123456789), true, new BigDecimal("1.23"), new GeoPoint(1.23, 4.56));
Map<String, Object> data = metadata.getData(testType);
assertThat(data.size(), is(7));
assertThat(data, hasEntry("stringVal", (Object) "stringVal"));
assertThat(data, hasEntry("intVal", (Object) 123));
assertThat(data, hasEntry("longVal", (Object) 456L));
assertThat(data, hasEntry("dateVal", (Object) new Date(123456789)));
assertThat(data, hasEntry("boolVal", (Object) true));
assertThat(data, hasEntry("bigdecVal", (Object) new BigDecimal("1.23")));
assertThat(data, hasEntry(is("geoPointVal"), notNullValue()));
}
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:16,代码来源:SearchMetadataTest.java
示例12: shouldGuessIndexTypeWhenAutomatic
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
@Test
public void shouldGuessIndexTypeWhenAutomatic() {
SearchMetadata<MetadataTestType, String> metadata = new SearchMetadata<>(MetadataTestType.class, indexTypeLookup);
assertThat(metadata.getIndexType("stringVal"), is(IndexType.Text));
assertThat(metadata.getIndexType("intVal"), is(IndexType.SmallDecimal));
assertThat(metadata.getIndexType("longVal"), is(IndexType.BigDecimal));
assertThat(metadata.getIndexType("dateVal"), is(IndexType.Date));
assertThat(metadata.getIndexType("boolVal"), is(IndexType.Identifier));
assertThat(metadata.getIndexType("bigdecVal"), is(IndexType.BigDecimal));
assertThat(metadata.getIndexType("geoPointVal"), is(IndexType.GeoPoint));
}
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:12,代码来源:SearchMetadataTest.java
示例13: shouldUseAnnotatedIndexTypesWhenPresent
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
@Test
public void shouldUseAnnotatedIndexTypesWhenPresent() {
SearchMetadata<MetadataTestTypeWithNamesAndIndexTypes, String> metadata = new SearchMetadata<>(MetadataTestTypeWithNamesAndIndexTypes.class, indexTypeLookup);
assertThat(metadata.getIndexType("string value"), is(IndexType.Html));
assertThat(metadata.getIndexType("int value"), is(IndexType.BigDecimal));
assertThat(metadata.getIndexType("long value"), is(IndexType.SmallDecimal));
assertThat(metadata.getIndexType("date value"), is(IndexType.Identifier));
assertThat(metadata.getIndexType("bool $% value"), is(IndexType.Text));
assertThat(metadata.getIndexType("big decimal value"), is(IndexType.SmallDecimal));
assertThat(metadata.getIndexType("geo point value"), is(IndexType.GeoPoint));
}
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:12,代码来源:SearchMetadataTest.java
示例14: shouldGetDataRelyingOnAnnotatedGettersInSuperClass
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
@Test
public void shouldGetDataRelyingOnAnnotatedGettersInSuperClass() {
SearchMetadata<ConcreteMethodBean, String> metadata = new SearchMetadata<>(ConcreteMethodBean.class, indexTypeLookup);
ConcreteMethodBean concreteMethodBean = new ConcreteMethodBean("stringVal", 123, 456L, new Date(123456789), true, new BigDecimal("1.23"), new GeoPoint(1.23, 4.56));
Map<String, Object> data = metadata.getData(concreteMethodBean);
assertThat(data.size(), is(7));
assertThat(data, hasEntry("stringVal", (Object) "stringVal"));
assertThat(data, hasEntry("intVal", (Object) 123));
assertThat(data, hasEntry("longVal", (Object) 456L));
assertThat(data, hasEntry("dateVal", (Object) new Date(123456789)));
assertThat(data, hasEntry("boolVal", (Object) true));
assertThat(data, hasEntry("bigdecVal", (Object) new BigDecimal("1.23")));
assertThat(data, hasEntry(is("geoPointVal"), notNullValue()));
}
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:16,代码来源:SearchMetadataTest.java
示例15: MetadataTestType
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
public MetadataTestType(String stringVal, int intVal, Long longVal, Date dateVal, boolean boolVal, BigDecimal bigdecVal, GeoPoint geoPointVal) {
super();
this.stringVal = this.notstringVal = stringVal;
this.intVal = this.notintVal = intVal;
this.longVal = this.notlongVal = longVal;
this.dateVal = this.notdateVal = dateVal;
this.boolVal = this.notboolVal = boolVal;
this.bigdecVal = this.notbigdecVal = bigdecVal;
this.geoPointVal = this.notgeoPointVal = geoPointVal;
}
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:11,代码来源:SearchMetadataTest.java
示例16: MetadataTestJavabeanType
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
public MetadataTestJavabeanType(String stringVal, int intVal, Long longVal, Date dateVal, boolean boolVal, BigDecimal bigdecVal, GeoPoint geoPointVal) {
super();
this.stringValField = stringVal;
this.intValField = intVal;
this.longValField = longVal;
this.dateValField = dateVal;
this.boolValField = boolVal;
this.bigdecValField = bigdecVal;
this.geoPointValField = geoPointVal;
}
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:11,代码来源:SearchMetadataTest.java
示例17: MetadataTestTypeWithNamesAndIndexTypes
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
public MetadataTestTypeWithNamesAndIndexTypes(String stringVal, int intVal, Long longVal, Date dateVal, boolean boolVal, BigDecimal bigdecVal, GeoPoint geoPointVal) {
super();
this.stringVal = stringVal;
this.intVal = intVal;
this.longVal = longVal;
this.dateVal = dateVal;
this.boolVal = boolVal;
this.bigdecVal = bigdecVal;
this.geoPointVal = geoPointVal;
}
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:11,代码来源:SearchMetadataTest.java
示例18: MetadataTestTypeWithNamesAndIndexTypesOnGetters
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
public MetadataTestTypeWithNamesAndIndexTypesOnGetters(String stringVal, int intVal, Long longVal, Date dateVal, boolean boolVal, BigDecimal bigdecVal, GeoPoint geoPointVal) {
super();
this.stringVal = stringVal;
this.intVal = intVal;
this.longVal = longVal;
this.dateVal = dateVal;
this.boolVal = boolVal;
this.bigdecVal = bigdecVal;
this.geoPointVal = geoPointVal;
}
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:11,代码来源:SearchMetadataTest.java
示例19: BaseFieldPojo
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
protected BaseFieldPojo(String stringVal, int intVal, Long longVal, Date dateVal, boolean boolVal, BigDecimal bigdecVal, GeoPoint geoPointVal) {
this.stringVal = stringVal;
this.intVal = intVal;
this.longVal = longVal;
this.dateVal = dateVal;
this.boolVal = boolVal;
this.bigdecVal = bigdecVal;
this.geoPointVal = geoPointVal;
}
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:10,代码来源:SearchMetadataTest.java
示例20: BaseMethodBean
import com.google.appengine.api.search.GeoPoint; //导入依赖的package包/类
protected BaseMethodBean(String stringVal, int intVal, Long longVal, Date dateVal, boolean boolVal, BigDecimal bigdecVal, GeoPoint geoPointVal) {
this.stringValField = stringVal;
this.intValField = intVal;
this.longValField = longVal;
this.dateValField = dateVal;
this.boolValField = boolVal;
this.bigdecValField = bigdecVal;
this.geoPointValField = geoPointVal;
}
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:11,代码来源:SearchMetadataTest.java
注:本文中的com.google.appengine.api.search.GeoPoint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论