本文整理汇总了Java中org.geomajas.plugin.geocoder.command.dto.GetLocationForStringResponse类的典型用法代码示例。如果您正苦于以下问题:Java GetLocationForStringResponse类的具体用法?Java GetLocationForStringResponse怎么用?Java GetLocationForStringResponse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GetLocationForStringResponse类属于org.geomajas.plugin.geocoder.command.dto包,在下文中一共展示了GetLocationForStringResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: goToLocation
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringResponse; //导入依赖的package包/类
public void goToLocation(final String location) {
GwtCommand command = new GwtCommand(GetLocationForStringRequest.COMMAND);
GetLocationForStringRequest request = new GetLocationForStringRequest();
request.setCrs(map.getMapModel().getCrs());
request.setLocation(location);
request.setServicePattern(servicePattern);
if (GWT.isClient()) {
// causes NPE when run as junit test
String locale = LocaleInfo.getCurrentLocale().getLocaleName();
if (!"default".equals(locale)) {
request.setLocale(locale);
}
}
command.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(command,
new AbstractCommandCallback<GetLocationForStringResponse>() {
public void execute(GetLocationForStringResponse response) {
goToLocation(response, location);
}
});
}
示例2: findLocation
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringResponse; //导入依赖的package包/类
@Override
public void findLocation(final String location) {
showAlternativesView(false);
GwtCommand command = new GwtCommand(GetLocationForStringRequest.COMMAND);
GetLocationForStringRequest request = new GetLocationForStringRequest();
request.setCrs(mapPresenter.getViewPort().getCrs());
request.setLocation(location);
request.setServicePattern(servicePattern);
command.setCommandRequest(request);
GeomajasServerExtension.getInstance().getCommandService().execute(command,
new AbstractCommandCallback<GetLocationForStringResponse>() {
public void execute(GetLocationForStringResponse response) {
goToLocation(response, location);
}
});
}
示例3: goToLocationOneLocationFoundTest
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringResponse; //导入依赖的package包/类
@Test
public void goToLocationOneLocationFoundTest() {
SelectLocationHandler selectLocationHandlerMock = mock(SelectLocationHandler.class);
presenter.setSelectLocationHandler(selectLocationHandlerMock);
GetLocationForStringResponse response = createGetLocationForStringResponse();
response.setLocationFound(true);
presenter.goToLocation(response, location);
ArgumentCaptor<SelectLocationEvent> selectLocationEventArgumentCaptor = ArgumentCaptor.forClass(SelectLocationEvent.class);
verify(selectLocationHandlerMock).onSelectLocation(selectLocationEventArgumentCaptor.capture());
SelectLocationEvent event = selectLocationEventArgumentCaptor.getValue();
Assert.assertEquals(response.getCanonicalLocation(), event.getCanonicalLocation());
Assert.assertEquals(response.getCenter(), event.getCenter());
Assert.assertEquals(response.getBbox(), event.getBbox());
Assert.assertEquals(response.getGeocoderName(), event.getGeocoderName());
Assert.assertEquals(response.getUserData(), event.getUserData());
Assert.assertEquals(mapPresenterMock, event.getMapWidget());
}
示例4: goToLocationAlternativeLocationsFoundTest
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringResponse; //导入依赖的package包/类
@Test
public void goToLocationAlternativeLocationsFoundTest() {
SelectAlternativeHandler selectAlternativeHandlerMock = mock(SelectAlternativeHandler.class);
stub(alternativeListMock.size()).toReturn(2);
presenter.setSelectAlternativeHandler(selectAlternativeHandlerMock);
GetLocationForStringResponse response = createGetLocationForStringResponse();
response.setLocationFound(false);
response.setAlternatives(alternativeListMock);
presenter.goToLocation(response, location);
ArgumentCaptor<SelectAlternativeEvent> selectAlternativeEventArgumentCaptor = ArgumentCaptor.forClass(SelectAlternativeEvent.class);
verify(selectAlternativeHandlerMock).onSelectAlternative(selectAlternativeEventArgumentCaptor.capture());
SelectAlternativeEvent event = selectAlternativeEventArgumentCaptor.getValue();
Assert.assertEquals(alternativeListMock, event.getAlternatives());
Assert.assertEquals(mapPresenterMock, event.getMapWidget());
}
示例5: expandPointTest
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringResponse; //导入依赖的package包/类
@Test
public void expandPointTest() throws Exception {
GetLocationForStringRequest request = new GetLocationForStringRequest();
request.setCrs("EPSG:900913");
request.setLocation("booischot");
CommandResponse commandResponse = commandDispatcher.execute(GetLocationForStringRequest.COMMAND, request, null,
"en");
Assert.assertNotNull(commandResponse);
Assert.assertTrue(commandResponse instanceof GetLocationForStringResponse);
GetLocationForStringResponse response = (GetLocationForStringResponse)commandResponse;
Assert.assertTrue(response.isLocationFound());
Assert.assertEquals("booischot", response.getCanonicalLocation());
Assert.assertNotNull(response.getCenter());
Assert.assertNotNull(response.getBbox());
Assert.assertEquals(621468.063486916, response.getCenter().getX(), DELTA);
Assert.assertEquals(5706881.117852388, response.getCenter().getY(), DELTA);
Assert.assertEquals(621325.5343735645, response.getBbox().getX(), DELTA);
Assert.assertEquals(5706809.617868648, response.getBbox().getY(), DELTA);
Assert.assertEquals(285.05822670296766, response.getBbox().getWidth(), DELTA);
Assert.assertEquals(142.99996748007834, response.getBbox().getHeight(), DELTA);
Assert.assertEquals("static-regex", response.getGeocoderName());
Assert.assertNotNull(response.getUserData());
Assert.assertEquals("schotbooi", ((UserDataTestInfo)response.getUserData()).getValue());
}
示例6: crsTest
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringResponse; //导入依赖的package包/类
@Test
public void crsTest() throws Exception {
GetLocationForStringRequest request = new GetLocationForStringRequest();
request.setCrs("EPSG:4326");
request.setLocation("Booischot");
CommandResponse commandResponse = commandDispatcher.execute(GetLocationForStringRequest.COMMAND, request, null,
"en");
Assert.assertNotNull(commandResponse);
Assert.assertTrue(commandResponse instanceof GetLocationForStringResponse);
GetLocationForStringResponse response = (GetLocationForStringResponse)commandResponse;
Assert.assertTrue(response.isLocationFound());
Assert.assertEquals("Booischot", response.getCanonicalLocation());
Assert.assertNotNull(response.getCenter());
Assert.assertNotNull(response.getBbox());
Assert.assertEquals(5.582742600224577, response.getCenter().getX(), DELTA);
Assert.assertEquals(45.53964302945367, response.getCenter().getY(), DELTA);
}
示例7: secondServiceTest
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringResponse; //导入依赖的package包/类
@Test
public void secondServiceTest() throws Exception {
GetLocationForStringRequest request = new GetLocationForStringRequest();
request.setCrs("EPSG:900913");
request.setLocation("second");
CommandResponse commandResponse = commandDispatcher.execute(GetLocationForStringRequest.COMMAND, request, null,
"en");
Assert.assertNotNull(commandResponse);
Assert.assertTrue(commandResponse instanceof GetLocationForStringResponse);
GetLocationForStringResponse response = (GetLocationForStringResponse)commandResponse;
Assert.assertTrue(response.isLocationFound());
Assert.assertEquals("secondService", response.getCanonicalLocation());
Assert.assertNotNull(response.getCenter());
Assert.assertNotNull(response.getBbox());
Assert.assertEquals(10000, response.getCenter().getX(), DELTA);
Assert.assertEquals(10000, response.getCenter().getY(), DELTA);
Assert.assertEquals("static-regex", response.getGeocoderName());
Assert.assertNull(response.getUserData());
}
示例8: bboxTest
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringResponse; //导入依赖的package包/类
@Test
public void bboxTest() throws Exception {
GetLocationForStringRequest request = new GetLocationForStringRequest();
request.setCrs("EPSG:900913");
request.setLocation("bbox");
CommandResponse commandResponse = commandDispatcher.execute(GetLocationForStringRequest.COMMAND, request, null,
"en");
Assert.assertNotNull(commandResponse);
Assert.assertTrue(commandResponse instanceof GetLocationForStringResponse);
GetLocationForStringResponse response = (GetLocationForStringResponse)commandResponse;
Assert.assertTrue(response.isLocationFound());
Assert.assertEquals("bbox", response.getCanonicalLocation());
Assert.assertNotNull(response.getCenter());
Assert.assertNotNull(response.getBbox());
Assert.assertEquals(50000, response.getCenter().getX(), DELTA);
Assert.assertEquals(90000, response.getCenter().getY(), DELTA);
Assert.assertEquals(0, response.getBbox().getX(), DELTA);
Assert.assertEquals(50000, response.getBbox().getY(), DELTA);
Assert.assertEquals(100000, response.getBbox().getWidth(), DELTA);
Assert.assertEquals(80000, response.getBbox().getHeight(), DELTA);
Assert.assertEquals("static-regex", response.getGeocoderName());
Assert.assertNull(response.getUserData());
}
示例9: combineBboxTest
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringResponse; //导入依赖的package包/类
@Test
public void combineBboxTest() throws Exception {
GetLocationForStringRequest request = new GetLocationForStringRequest();
request.setCrs("EPSG:900913");
request.setLocation("bla");
CommandResponse commandResponse = commandDispatcher.execute(GetLocationForStringRequest.COMMAND, request, null,
"en");
Assert.assertNotNull(commandResponse);
Assert.assertTrue(commandResponse instanceof GetLocationForStringResponse);
GetLocationForStringResponse response = (GetLocationForStringResponse)commandResponse;
Assert.assertTrue(response.isLocationFound());
Assert.assertEquals("bla", response.getCanonicalLocation());
Assert.assertNotNull(response.getCenter());
Assert.assertNotNull(response.getBbox());
Assert.assertEquals(57500, response.getCenter().getX(), DELTA);
Assert.assertEquals(72500, response.getCenter().getY(), DELTA);
Assert.assertEquals(30000, response.getBbox().getX(), DELTA);
Assert.assertEquals(50000, response.getBbox().getY(), DELTA);
Assert.assertEquals(55000, response.getBbox().getWidth(), DELTA);
Assert.assertEquals(45000, response.getBbox().getHeight(), DELTA);
Assert.assertNull(response.getGeocoderName());
}
示例10: oneBboxTest
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringResponse; //导入依赖的package包/类
@Test
public void oneBboxTest() throws Exception {
GetLocationForStringRequest request = new GetLocationForStringRequest();
request.setCrs("EPSG:900913");
request.setLocation("one");
CommandResponse commandResponse = commandDispatcher.execute(GetLocationForStringRequest.COMMAND, request, null,
"en");
Assert.assertNotNull(commandResponse);
Assert.assertTrue(commandResponse instanceof GetLocationForStringResponse);
GetLocationForStringResponse response = (GetLocationForStringResponse)commandResponse;
Assert.assertTrue(response.isLocationFound());
Assert.assertEquals("one", response.getCanonicalLocation());
Assert.assertNotNull(response.getCenter());
Assert.assertNotNull(response.getBbox());
Assert.assertEquals(50000, response.getCenter().getX(), DELTA);
Assert.assertEquals(50000, response.getCenter().getY(), DELTA);
Assert.assertEquals(0, response.getBbox().getX(), DELTA);
Assert.assertEquals(0, response.getBbox().getY(), DELTA);
Assert.assertEquals(100000, response.getBbox().getWidth(), DELTA);
Assert.assertEquals(100000, response.getBbox().getHeight(), DELTA);
Assert.assertEquals("static-regex", response.getGeocoderName());
}
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:24,代码来源:GetLocationForStringCommandCombineTest.java
示例11: combineBboxTest
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringResponse; //导入依赖的package包/类
@Test
public void combineBboxTest() throws Exception {
GetLocationForStringRequest request = new GetLocationForStringRequest();
request.setCrs("EPSG:900913");
request.setLocation("bla");
CommandResponse commandResponse = commandDispatcher.execute(GetLocationForStringRequest.COMMAND, request, null,
"en");
Assert.assertNotNull(commandResponse);
Assert.assertTrue(commandResponse instanceof GetLocationForStringResponse);
GetLocationForStringResponse response = (GetLocationForStringResponse)commandResponse;
Assert.assertTrue(response.isLocationFound());
Assert.assertEquals("bla", response.getCanonicalLocation());
Assert.assertNotNull(response.getCenter());
Assert.assertNotNull(response.getBbox());
Assert.assertEquals(87500, response.getCenter().getX(), DELTA);
Assert.assertEquals(90000, response.getCenter().getY(), DELTA);
Assert.assertEquals(75000, response.getBbox().getX(), DELTA);
Assert.assertEquals(85000, response.getBbox().getY(), DELTA);
Assert.assertEquals(25000, response.getBbox().getWidth(), DELTA);
Assert.assertEquals(10000, response.getBbox().getHeight(), DELTA);
Assert.assertNull(response.getGeocoderName());
}
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:24,代码来源:GetLocationForStringCommandCombineTest.java
示例12: oneResultTest
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringResponse; //导入依赖的package包/类
@Test
public void oneResultTest() throws Exception {
GetLocationForStringRequest request = new GetLocationForStringRequest();
request.setCrs("EPSG:4326");
request.setLocation("booischot");
CommandResponse commandResponse = commandDispatcher.execute(GetLocationForStringRequest.COMMAND, request, null,
"en");
// @extract-skip-start
Assert.assertNotNull(commandResponse);
Assert.assertTrue(commandResponse instanceof GetLocationForStringResponse);
GetLocationForStringResponse response = (GetLocationForStringResponse) commandResponse;
Assert.assertTrue(response.isLocationFound());
Assert.assertEquals("Booischot, BE", response.getCanonicalLocation());
Assert.assertNotNull(response.getCenter());
Assert.assertNotNull(response.getBbox());
Assert.assertEquals(4.7751, response.getCenter().getX(), DELTA);
Assert.assertEquals(51.05219, response.getCenter().getY(), DELTA);
Assert.assertNull(response.getAlternatives());
Assert.assertEquals("GeoNames", response.getGeocoderName());
// @extract-skip-end
}
示例13: oneResultCrsTest
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringResponse; //导入依赖的package包/类
@Test
public void oneResultCrsTest() throws Exception {
GetLocationForStringRequest request = new GetLocationForStringRequest();
request.setCrs("EPSG:900913");
request.setLocation("booischot");
CommandResponse commandResponse = commandDispatcher.execute(GetLocationForStringRequest.COMMAND, request, null,
"en");
Assert.assertNotNull(commandResponse);
Assert.assertTrue(commandResponse instanceof GetLocationForStringResponse);
GetLocationForStringResponse response = (GetLocationForStringResponse) commandResponse;
Assert.assertTrue(response.isLocationFound());
Assert.assertEquals("Booischot, BE", response.getCanonicalLocation());
Assert.assertNotNull(response.getCenter());
Assert.assertNotNull(response.getBbox());
Assert.assertEquals(531561.7004869606, response.getCenter().getX(), DELTA);
Assert.assertEquals(6630530.727245597, response.getCenter().getY(), DELTA);
Assert.assertNull(response.getAlternatives());
Assert.assertEquals("GeoNames", response.getGeocoderName());
}
示例14: alternativesTest
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringResponse; //导入依赖的package包/类
@Test
public void alternativesTest() throws Exception {
GetLocationForStringRequest request = new GetLocationForStringRequest();
request.setCrs("EPSG:4326");
request.setLocation("London, GB");
CommandResponse commandResponse = commandDispatcher.execute(GetLocationForStringRequest.COMMAND, request, null,
"en");
Assert.assertNotNull(commandResponse);
Assert.assertTrue(commandResponse instanceof GetLocationForStringResponse);
GetLocationForStringResponse response = (GetLocationForStringResponse) commandResponse;
Assert.assertFalse(response.isLocationFound());
Assert.assertNotNull(response.getAlternatives());
Assert.assertTrue(response.getAlternatives().size() > 0);
GetLocationForStringAlternative alt = response.getAlternatives().get(0);
Assert.assertEquals(-0.12574, alt.getCenter().getX(), DELTA);
Assert.assertEquals(51.50853, alt.getCenter().getY(), DELTA);
Assert.assertEquals("GeoNames", alt.getGeocoderName());
}
示例15: alternativesCrsTest
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringResponse; //导入依赖的package包/类
@Test
public void alternativesCrsTest() throws Exception {
GetLocationForStringRequest request = new GetLocationForStringRequest();
request.setCrs("EPSG:900913");
request.setLocation("London, GB");
CommandResponse commandResponse = commandDispatcher.execute(GetLocationForStringRequest.COMMAND, request, null,
"en");
Assert.assertNotNull(commandResponse);
Assert.assertTrue(commandResponse instanceof GetLocationForStringResponse);
GetLocationForStringResponse response = (GetLocationForStringResponse) commandResponse;
Assert.assertFalse(response.isLocationFound());
Assert.assertNotNull(response.getAlternatives());
Assert.assertTrue(response.getAlternatives().size() > 0);
GetLocationForStringAlternative alt = response.getAlternatives().get(0);
Assert.assertEquals(-13997.312772346217, alt.getCenter().getX(), DELTA);
Assert.assertEquals(6711744.580491004, alt.getCenter().getY(), DELTA);
Assert.assertEquals("GeoNames", alt.getGeocoderName());
}