本文整理汇总了Java中org.springframework.data.mongodb.core.geo.GeoJsonPoint类的典型用法代码示例。如果您正苦于以下问题:Java GeoJsonPoint类的具体用法?Java GeoJsonPoint怎么用?Java GeoJsonPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeoJsonPoint类属于org.springframework.data.mongodb.core.geo包,在下文中一共展示了GeoJsonPoint类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createRecordSet
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
private List<RecordSet> createRecordSet(Stream stream, int length) {
List<RecordSet> records = new ArrayList<>();
for (int i = 0; i < length; i++) {
long time = (long) (Instant.now().toEpochMilli() - (i * 1000) - (Math.random() * 100));
log.debug("Set timestamp to {}", time);
double posX = 11.45 + (System.currentTimeMillis() % 2 == 0 ? -1 * i : i);
double posY = 45.11 + (System.currentTimeMillis() % 2 == 0 ? -1 * i : i);
RecordSet record = new RecordSet(stream).channel("number", i)
.channel("string", System.currentTimeMillis() % 2 == 0 ? "Hello world" : "See you later")
.channel("boolean", System.currentTimeMillis() % 2 == 0).location(new GeoJsonPoint(posX, posY))
.timestamp(new Date(time));
records.add(record);
}
return records;
}
开发者ID:raptorbox,项目名称:raptor,代码行数:21,代码来源:DataStreamTest.java
示例2: searchByDistance
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
@Test
public void searchByDistance() {
Raptor raptor = Utils.createNewAdminInstance();
log.debug("Search by distance");
Device dev = createDevice(raptor);
Stream s = dev.stream("test");
int qt = 10;
pushRecords(raptor, s, qt);
DataQuery q = new DataQuery();
q.distance(new GeoJsonPoint(11.45, 45.11), 10000, Metrics.KILOMETERS);
ResultSet results = raptor.Stream().search(s, q);
log.debug("Found {} records", results.size());
Assert.assertEquals(qt, results.size());
}
开发者ID:raptorbox,项目名称:raptor,代码行数:21,代码来源:DataStreamTest.java
示例3: repositoryPopulator
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
/**
* Read JSON data from disk and insert those stores.
*
* @return
*/
public @Bean AbstractRepositoryPopulatorFactoryBean repositoryPopulator() {
ObjectMapper mapper = new ObjectMapper();
mapper.addMixIn(GeoJsonPoint.class, GeoJsonPointMixin.class);
mapper.configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
Jackson2RepositoryPopulatorFactoryBean factoryBean = new Jackson2RepositoryPopulatorFactoryBean();
factoryBean.setResources(new Resource[] { new ClassPathResource("starbucks-in-nyc.json") });
factoryBean.setMapper(mapper);
return factoryBean;
}
开发者ID:Just-Fun,项目名称:spring-data-examples,代码行数:18,代码来源:ApplicationConfiguration.java
示例4: searchByBoundingBox
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
@Test
public void searchByBoundingBox() {
Raptor raptor = Utils.createNewAdminInstance();
log.debug("Search by bounding box");
Device dev = createDevice(raptor);
Stream s = dev.stream("test");
int qt = 10;
pushRecords(raptor, s, qt);
ResultSet results = raptor.Stream().search(s,
new DataQuery().boundingBox(new GeoJsonPoint(12, 45), new GeoJsonPoint(10, 44)));
log.debug("Found {} records", results.size());
Assert.assertTrue(results.size() > 0);
}
开发者ID:raptorbox,项目名称:raptor,代码行数:20,代码来源:DataStreamTest.java
示例5: distance
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
public DataQuery distance(GeoJsonPoint center, double radius, Metrics unit) {
this.location.distance(center, radius, unit);
return this;
}
开发者ID:raptorbox,项目名称:raptor,代码行数:5,代码来源:DataQuery.java
示例6: boundingBox
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
public DataQuery boundingBox(GeoJsonPoint nw, GeoJsonPoint sw) {
this.location.boundingBox(nw, sw);
return this;
}
开发者ID:raptorbox,项目名称:raptor,代码行数:5,代码来源:DataQuery.java
示例7: getGeoJsonPoint
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
private GeoJsonPoint getGeoJsonPoint(JsonNode parent, String node) {
JsonNode centerNode = parent.get(node);
GeoJsonPoint geo = new GeoJsonPoint(centerNode.get("x").asDouble(), centerNode.get("y").asDouble());
return geo;
}
开发者ID:raptorbox,项目名称:raptor,代码行数:7,代码来源:DataQueryDeserializer.java
示例8: distance
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
public GeoQuery distance(GeoJsonPoint center, double radius, Metrics unit) {
distance.center = center;
distance.radius = radius;
distance.unit = unit;
return this;
}
开发者ID:raptorbox,项目名称:raptor,代码行数:7,代码来源:GeoQuery.java
示例9: boundingBox
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
public GeoQuery boundingBox(GeoJsonPoint nw, GeoJsonPoint sw) {
this.boundingBox.northWest = nw;
this.boundingBox.southWest = sw;
return this;
}
开发者ID:raptorbox,项目名称:raptor,代码行数:6,代码来源:GeoQuery.java
示例10: location
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
public GeoJsonPoint location() {
return location;
}
开发者ID:raptorbox,项目名称:raptor,代码行数:4,代码来源:RecordSet.java
示例11: getLocation
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
public GeoJsonPoint getLocation() {
return location;
}
开发者ID:raptorbox,项目名称:raptor,代码行数:4,代码来源:RecordSet.java
示例12: convert
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
@Override
public DBObject convert(final GeoJsonPoint source) {
return new BasicDBObject("type", "Point").append("coordinates", new Double[]{ source.getX(), source.getY() });
}
开发者ID:eubrazilcc,项目名称:leishvl,代码行数:5,代码来源:GeoJsonConverters.java
示例13: getLocation
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
public @Nullable GeoJsonPoint getLocation() {
return location.orElse(null);
}
开发者ID:eubrazilcc,项目名称:leishvl,代码行数:4,代码来源:LeishvlObject.java
示例14: setLocation
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
public void setLocation(final @Nullable GeoJsonPoint location) {
this.location = ofNullable(location);
}
开发者ID:eubrazilcc,项目名称:leishvl,代码行数:4,代码来源:LeishvlObject.java
示例15: newGeocoding
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
public static ProvGeocoding newGeocoding(final GeoJsonPoint point) {
return new ProvGeocoding(point, GeocodingHelper.class);
}
开发者ID:eubrazilcc,项目名称:leishvl,代码行数:4,代码来源:ProvFactory.java
示例16: ProvGeocoding
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
public ProvGeocoding(final GeoJsonPoint point, final Class<?> geocoder) {
this.point = point;
this.geocoder = geocoder;
}
开发者ID:eubrazilcc,项目名称:leishvl,代码行数:5,代码来源:ProvFactory.java
示例17: findByGeometryWithinBox
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
@ApiOperation("Find offices inside box")
@RequestMapping(method = RequestMethod.GET)
public List<Office> findByGeometryWithinBox(@RequestParam GeoJsonPoint first, @RequestParam GeoJsonPoint second) {
List<Office> result = officeService.findByGeometryWithin(new Box(first, second));
return result;
}
开发者ID:okode,项目名称:mongodb-maps,代码行数:7,代码来源:OfficeController.java
示例18: findByRegionAndGeometryWithinBox
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
@ApiOperation("Find offices from region inside box")
@RequestMapping(value = "/{region}", method = RequestMethod.GET)
public List<Office> findByRegionAndGeometryWithinBox(@PathVariable String region, @RequestParam GeoJsonPoint first, @RequestParam GeoJsonPoint second) {
return officeService.findByRegionAndGeometryWithin(region, new Box(first, second));
}
开发者ID:okode,项目名称:mongodb-maps,代码行数:6,代码来源:OfficeController.java
示例19: pullLastUpdate
import org.springframework.data.mongodb.core.geo.GeoJsonPoint; //导入依赖的package包/类
@Test
public void pullLastUpdate() {
Raptor raptor = Utils.createNewAdminInstance();
log.debug("Pull device last update");
Device dev = createDevice(raptor);
Stream s = dev.stream("test");
String msg = "LastUpdate";
RecordSet r = new RecordSet(s).channel("number", 1).channel("string", msg).channel("boolean", true)
.location(new GeoJsonPoint(11.45, 45.11));
raptor.Stream().push(r);
RecordSet record = raptor.Stream().lastUpdate(s);
Assert.assertNotNull(record);
Long val1 = record.value("number").getNumber().longValue();
Long val2 = r.value("number").getNumber().longValue();
Assert.assertTrue(val1.equals(val2));
Assert.assertEquals(record.value("string").getString(), r.value("string").getString());
Assert.assertEquals(record.value("boolean").getBoolean(), r.value("boolean").getBoolean());
}
开发者ID:raptorbox,项目名称:raptor,代码行数:29,代码来源:DataStreamTest.java
注:本文中的org.springframework.data.mongodb.core.geo.GeoJsonPoint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论