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


Java SearchFeatureRequest.setBooleanOperator方法代码示例

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


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

示例1: 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

示例2: setFeatures

import org.geomajas.command.dto.SearchFeatureRequest; //导入方法依赖的package包/类
public void setFeatures(List<Feature> features) {
	this.features = features;
	SearchFeatureRequest featReq = new SearchFeatureRequest();
	featReq.setCriteria(buildCriteria());
	featReq.setBooleanOperator("OR");
	featReq.setCrs(model.getCrs());
	featReq.setLayerId(layer.getServerLayerId());
	featReq.setFilter(layer.getFilter());
	featReq.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect());
	setRequest(featReq);
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:12,代码来源:ExportFeatureListToCsvHandler.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: testSearchMultipleCriteria

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

	// 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(4, 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"));
	Assert.assertTrue(actual.contains("Country 3"));
	Assert.assertTrue(actual.contains("Country 4"));
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:38,代码来源:SearchFeatureCommandTest.java


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