当前位置: 首页>>代码示例>>Java>>正文


Java SearchFeatureRequest.setMax方法代码示例

本文整理汇总了Java中org.geomajas.command.dto.SearchFeatureRequest.setMax方法的典型用法代码示例。如果您正苦于以下问题:Java SearchFeatureRequest.setMax方法的具体用法?Java SearchFeatureRequest.setMax怎么用?Java SearchFeatureRequest.setMax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.geomajas.command.dto.SearchFeatureRequest的用法示例。


在下文中一共展示了SearchFeatureRequest.setMax方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSearchOneCriterionOffset

import org.geomajas.command.dto.SearchFeatureRequest; //导入方法依赖的package包/类
@Test
public void testSearchOneCriterionOffset() throws Exception {
	// prepare command
	SearchFeatureRequest request = new SearchFeatureRequest();
	request.setLayerId(LAYER_ID);
	request.setCrs("EPSG:4326");
	request.setMax(SearchFeatureRequest.MAX_UNLIMITED);
	request.setOffSet(2);
	SearchCriterion searchCriterion = new SearchCriterion();
	searchCriterion.setAttributeName(REGION_ATTRIBUTE);
	searchCriterion.setOperator("like");
	searchCriterion.setValue("'%1'");
	request.setCriteria(new SearchCriterion[] {searchCriterion});

	// execute
	SearchFeatureResponse response = (SearchFeatureResponse) dispatcher.execute(
			SearchFeatureRequest.COMMAND, request, null, "en");

	// test
	Assert.assertFalse(response.isError());
	Assert.assertEquals(LAYER_ID, response.getLayerId());
	List<Feature> features = Arrays.asList(response.getFeatures());
	Assert.assertNotNull(features);
	Assert.assertEquals(0, features.size());
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:26,代码来源:SearchFeatureCommandTest.java

示例2: searchById

import org.geomajas.command.dto.SearchFeatureRequest; //导入方法依赖的package包/类
/**
 * Search features within a certain layer, using the feature IDs.
 * 
 * @param layer
 *            The features supported layer wherein to search.
 * @param ids
 *            The unique IDs of the feature within the layer.
 * @param callback
 *            Call-back method executed on return (when the feature has been found).
 */
public void searchById(final FeaturesSupported layer, final String[] ids, final FeatureArrayCallback callback) {
	Layer<?> gwtLayer = map.getMapWidget().getMapModel().getLayer(layer.getId());
	if (gwtLayer != null && gwtLayer instanceof VectorLayer) {
		VectorLayer vLayer = (VectorLayer) gwtLayer;
		SearchCriterion[] criteria = new SearchCriterion[ids.length];
		for (int i = 0; i < ids.length; i++) {
			criteria[i] = new SearchCriterion(SearchFeatureRequest.ID_ATTRIBUTE, "=", ids[i]);
		}

		SearchFeatureRequest request = new SearchFeatureRequest();
		request.setBooleanOperator("OR");
		request.setCrs(map.getMapWidget().getMapModel().getCrs());
		request.setLayerId(vLayer.getServerLayerId());
		request.setMax(ids.length);
		request.setFilter(layer.getFilter());
		request.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_ALL);
		request.setCriteria(criteria);

		GwtCommand command = new GwtCommand(SearchFeatureRequest.COMMAND);
		command.setCommandRequest(request);
		GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<SearchFeatureResponse>() {

			public void execute(SearchFeatureResponse response) {
				if (response.getFeatures() != null && response.getFeatures().length > 0) {
					Feature[] features = new Feature[response.getFeatures().length];
					for (int i = 0; i < response.getFeatures().length; i++) {
						features[i] = new FeatureImpl(response.getFeatures()[i], layer);
					}
					callback.execute(new FeatureArrayHolder(features));
				}
			}
		});
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:45,代码来源:FeatureSearchServiceImpl.java

示例3: search

import org.geomajas.command.dto.SearchFeatureRequest; //导入方法依赖的package包/类
@Override
public void search(String crs, final VectorServerLayer layer, SearchCriterion[] criteria,
		LogicalOperator operator, int maxResultSize, final FeatureMapFunction callback) {
	SearchFeatureRequest request = new SearchFeatureRequest();
	request.setBooleanOperator(operator.getValue());
	request.setCriteria(criteria);
	request.setMax(maxResultSize);
	request.setLayerId(layer.getServerLayerId());
	request.setCrs(crs);
	request.setFilter(layer.getFilter());
	request.setFeatureIncludes(11);

	GwtCommand command = new GwtCommand(SearchFeatureRequest.COMMAND);
	command.setCommandRequest(request);
	GeomajasServerExtension.getInstance().getCommandService().execute(command,
			new AbstractCommandCallback<SearchFeatureResponse>() {

				public void execute(SearchFeatureResponse response) {
					List<Feature> features = new ArrayList<Feature>();
					for (org.geomajas.layer.feature.Feature feature : response.getFeatures()) {
						features.add(create(feature, layer));
					}
					Map<FeaturesSupported, List<Feature>> mapping = new HashMap<FeaturesSupported, List<Feature>>();
					mapping.put(layer, features);
					callback.execute(mapping);
				}
			});
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:29,代码来源:ServerFeatureServiceImpl.java

示例4: testSearchOneCriterionNoLimit

import org.geomajas.command.dto.SearchFeatureRequest; //导入方法依赖的package包/类
@Test
public void testSearchOneCriterionNoLimit() throws Exception {
	// prepare command
	SearchFeatureRequest request = new SearchFeatureRequest();
	request.setLayerId(LAYER_ID);
	request.setCrs("EPSG:4326");
	request.setMax(SearchFeatureRequest.MAX_UNLIMITED);
	SearchCriterion searchCriterion = new SearchCriterion();
	searchCriterion.setAttributeName(REGION_ATTRIBUTE);
	searchCriterion.setOperator("like");
	searchCriterion.setValue("'%1'");
	request.setCriteria(new SearchCriterion[] {searchCriterion});

	// execute
	SearchFeatureResponse response = (SearchFeatureResponse) dispatcher.execute(
			SearchFeatureRequest.COMMAND, request, null, "en");

	// test
	Assert.assertFalse(response.isError());
	Assert.assertEquals(LAYER_ID, response.getLayerId());
	List<Feature> features = Arrays.asList(response.getFeatures());
	Assert.assertNotNull(features);
	Assert.assertEquals(2, features.size());
	List<String> actual = new ArrayList<String>();
	for (Feature feature : features) {
		actual.add(feature.getLabel());
	}
	Assert.assertTrue(actual.contains("Country 1"));
	Assert.assertTrue(actual.contains("Country 2"));
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:31,代码来源:SearchFeatureCommandTest.java

示例5: testSearchOneCriterionLimit

import org.geomajas.command.dto.SearchFeatureRequest; //导入方法依赖的package包/类
@Test
public void testSearchOneCriterionLimit() throws Exception {
	// prepare command
	SearchFeatureRequest request = new SearchFeatureRequest();
	request.setLayerId(LAYER_ID);
	request.setCrs("EPSG:4326");
	request.setMax(3);
	SearchCriterion searchCriterion = new SearchCriterion();
	searchCriterion.setAttributeName(REGION_ATTRIBUTE);
	searchCriterion.setOperator("like");
	searchCriterion.setValue("'R%'");
	request.setCriteria(new SearchCriterion[] {searchCriterion});

	// execute
	SearchFeatureResponse response = (SearchFeatureResponse) dispatcher.execute(
			SearchFeatureRequest.COMMAND, request, null, "en");

	// test
	Assert.assertFalse(response.isError());
	Assert.assertEquals(LAYER_ID, response.getLayerId());
	List<Feature> features = Arrays.asList(response.getFeatures());
	Assert.assertNotNull(features);
	Assert.assertEquals(3, features.size());
	List<String> actual = new ArrayList<String>();
	for (Feature feature : features) {
		actual.add(feature.getLabel());
	}
	int count = 0;
	if (actual.contains("Country 1")) {
		count++;
	}
	if (actual.contains("Country 2")) {
		count++;
	}
	if (actual.contains("Country 3")) {
		count++;
	}
	if (actual.contains("Country 4")) {
		count++;
	}
	Assert.assertEquals(3, count);
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:43,代码来源:SearchFeatureCommandTest.java


注:本文中的org.geomajas.command.dto.SearchFeatureRequest.setMax方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。