本文整理汇总了Java中org.geomajas.command.dto.SearchByLocationRequest.setFeatureIncludes方法的典型用法代码示例。如果您正苦于以下问题:Java SearchByLocationRequest.setFeatureIncludes方法的具体用法?Java SearchByLocationRequest.setFeatureIncludes怎么用?Java SearchByLocationRequest.setFeatureIncludes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geomajas.command.dto.SearchByLocationRequest
的用法示例。
在下文中一共展示了SearchByLocationRequest.setFeatureIncludes方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSearchByLocationRequest
import org.geomajas.command.dto.SearchByLocationRequest; //导入方法依赖的package包/类
protected SearchByLocationRequest getSearchByLocationRequest(VectorLayer layer) {
if (request instanceof SearchByLocationRequest) {
SearchByLocationRequest req = (SearchByLocationRequest) request;
SearchByLocationRequest clone = new SearchByLocationRequest();
clone.setBuffer(req.getBuffer());
clone.setCrs(req.getCrs());
clone.setFilter(req.getFilter());
clone.setFeatureIncludes(req.getFeatureIncludes());
clone.setLocation(req.getLocation());
clone.setQueryType(req.getQueryType());
clone.setRatio(req.getRatio());
clone.setSearchType(req.getSearchType());
// not bothering to include the other layers, we won't use the
// result anyway
clone.setLayerIds(new String[] { layer.getServerLayerId() });
return clone;
} else {
return null;
}
}
示例2: getSnappingSources
import org.geomajas.command.dto.SearchByLocationRequest; //导入方法依赖的package包/类
/**
* Get the geometries of all features within the map view bounds.
*/
public void getSnappingSources(final GeometryArrayFunction callback) {
GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND);
SearchByLocationRequest request = new SearchByLocationRequest();
request.addLayerWithFilter(layer.getServerLayerId(), layer.getServerLayerId(), layer.getFilter());
request.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_GEOMETRY);
request.setLocation(boundsAsGeometry());
request.setCrs(layer.getMapModel().getCrs());
request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS);
request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
commandRequest.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(commandRequest,
new AbstractCommandCallback<SearchByLocationResponse>() {
public void execute(SearchByLocationResponse response) {
if (response.getFeatureMap().size() > 0) {
List<Feature> features = response.getFeatureMap().values().iterator().next();
Geometry[] geometries = new Geometry[features.size()];
for (int i = 0; i < features.size(); i++) {
geometries[i] = features.get(i).getGeometry();
}
callback.execute(geometries);
}
}
});
}
示例3: searchInBounds
import org.geomajas.command.dto.SearchByLocationRequest; //导入方法依赖的package包/类
/**
* Search all features within a certain layer that intersect a certain bounding box.
*
* @param layer
* The features supported layer wherein to search.
* @param bbox
* The bounding box wherein to search.
* @param callback
* Call-back method executed on return (when features have been found).
*/
public void searchInBounds(final FeaturesSupported layer, Bbox bbox, final FeatureArrayCallback callback) {
MapModel mapModel = map.getMapWidget().getMapModel();
Layer<?> gwtLayer = mapModel.getLayer(layer.getId());
if (gwtLayer != null && gwtLayer instanceof VectorLayer) {
final VectorLayer vLayer = (VectorLayer) gwtLayer;
SearchByLocationRequest request = new SearchByLocationRequest();
request.addLayerWithFilter(vLayer.getId(), vLayer.getServerLayerId(), layer.getFilter());
GeometryFactory factory = new GeometryFactory(mapModel.getSrid(), GeometryFactory.PARAM_DEFAULT_PRECISION);
org.geomajas.gwt.client.spatial.Bbox box = new org.geomajas.gwt.client.spatial.Bbox(bbox.getX(),
bbox.getY(), bbox.getWidth(), bbox.getHeight());
request.setLocation(GeometryConverter.toDto(factory.createPolygon(box)));
request.setCrs(mapModel.getCrs());
request.setSearchType(SearchByLocationRequest.QUERY_INTERSECTS);
request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
request.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_ALL);
GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND);
commandRequest.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(commandRequest,
new AbstractCommandCallback<SearchByLocationResponse>() {
public void execute(SearchByLocationResponse response) {
Map<String, List<org.geomajas.layer.feature.Feature>> featureMap = response.getFeatureMap();
List<org.geomajas.layer.feature.Feature> dtos = featureMap.get(vLayer.getId());
Feature[] features = new Feature[dtos.size()];
for (int i = 0; i < dtos.size(); i++) {
features[i] = new FeatureImpl(dtos.get(i), layer);
}
callback.execute(new FeatureArrayHolder(features));
}
});
}
}
示例4: getData
import org.geomajas.command.dto.SearchByLocationRequest; //导入方法依赖的package包/类
private void getData() {
Point point = mapWidget.getMapModel().getGeometryFactory().createPoint(worldPosition);
final Coordinate coordUsedForRetrieval = worldPosition;
SearchByLocationRequest request = new SearchByLocationRequest();
request.setLocation(GeometryConverter.toDto(point));
request.setCrs(mapWidget.getMapModel().getCrs());
request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS);
int layersToSearch = SearchByLocationRequest.SEARCH_ALL_LAYERS;
request.setSearchType(layersToSearch);
request.setBuffer(calculateBufferFromPixelTolerance());
request.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect());
for (Layer<?> layer : mapWidget.getMapModel().getLayers()) {
if (layer.isShowing() && layer instanceof VectorLayer) {
request.addLayerWithFilter(layer.getId(), layer.getServerLayerId(), ((VectorLayer) layer).getFilter());
}
}
GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND);
commandRequest.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(commandRequest,
new AbstractCommandCallback<SearchByLocationResponse>() {
public void execute(SearchByLocationResponse commandResponse) {
setTooltipData(coordUsedForRetrieval, commandResponse.getFeatureMap());
}
});
}
示例5: retrieveFeatures
import org.geomajas.command.dto.SearchByLocationRequest; //导入方法依赖的package包/类
private void retrieveFeatures() {
// setting current bounds before method returns so it isn't called
// multiple times while waiting for result
// (this is adequate for javascript, no real concurrency)
currentBounds = mapModel.getMapView().getBounds();
if (serverLayerIds == null) {
init();
}
Polygon polygon = mapModel.getGeometryFactory().createPolygon(currentBounds);
GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND);
SearchByLocationRequest request = new SearchByLocationRequest();
request.setLayerIds(serverLayerIds);
addFilters(request);
request.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_GEOMETRY);
request.setLocation(GeometryConverter.toDto(polygon));
request.setCrs(mapModel.getCrs());
request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS);
request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
commandRequest.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(commandRequest,
new AbstractCommandCallback<SearchByLocationResponse>() {
public void execute(SearchByLocationResponse response) {
Map<String, List<org.geomajas.layer.feature.Feature>> featureMap = response.getFeatureMap();
featureCache.clear();
for (String serverLayerId : featureMap.keySet()) {
VectorLayer vl = findLayer(serverLayerId);
List<Feature> features = new ArrayList<Feature>();
featureCache.put(vl, features);
for (org.geomajas.layer.feature.Feature dtoFeat : featureMap.get(serverLayerId)) {
features.add(new Feature(dtoFeat, vl));
}
}
}
});
}
示例6: selectRectangle
import org.geomajas.command.dto.SearchByLocationRequest; //导入方法依赖的package包/类
@Override
protected void selectRectangle(Bbox selectedArea) {
// we can clear here !
if (!shiftOrCtrl) {
MapModel mapModel = mapWidget.getMapModel();
mapModel.clearSelectedFeatures();
}
GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND);
SearchByLocationRequest request = new SearchByLocationRequest();
request.setLayerIds(getSelectionLayerIds());
for (Layer<?> layer : mapWidget.getMapModel().getLayers()) {
if (layer.isShowing() && layer instanceof VectorLayer) {
request.setFilter(layer.getServerLayerId(), ((VectorLayer) layer).getFilter());
}
}
Polygon polygon = mapWidget.getMapModel().getGeometryFactory().createPolygon(selectedArea);
request.setLocation(GeometryConverter.toDto(polygon));
request.setCrs(mapWidget.getMapModel().getCrs());
request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS);
request.setRatio(coverageRatio);
request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
request.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect());
commandRequest.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(commandRequest,
new AbstractCommandCallback<SearchByLocationResponse>() {
public void execute(SearchByLocationResponse response) {
Map<String, List<org.geomajas.layer.feature.Feature>> featureMap = response.getFeatureMap();
for (String layerId : featureMap.keySet()) {
selectFeatures(layerId, featureMap.get(layerId));
}
}
});
}
示例7: toggle
import org.geomajas.command.dto.SearchByLocationRequest; //导入方法依赖的package包/类
private void toggle(Coordinate coordinate, final boolean clearSelection, final boolean singleSelection) {
if (null == coordinate) {
return;
}
// we can clear here (but remember the selected feature for the special case of single selection) !
final String singleSelectionId = mapWidget.getMapModel().getSelectedFeature();
if (clearSelection) {
mapWidget.getMapModel().clearSelectedFeatures();
}
MapModel mapModel = mapWidget.getMapModel();
Coordinate worldPosition = mapModel.getMapView().getWorldViewTransformer().viewToWorld(coordinate);
GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND);
SearchByLocationRequest request = new SearchByLocationRequest();
Layer<?> layer = mapModel.getSelectedLayer();
if (priorityToSelectedLayer && layer != null && layer instanceof VectorLayer) {
if (!layer.isShowing()) {
return;
}
request.addLayerWithFilter(layer.getId(), layer.getServerLayerId(), ((VectorLayer) layer).getFilter());
} else {
addVisibleLayers(request, mapModel);
}
Point point = mapModel.getGeometryFactory().createPoint(worldPosition);
request.setLocation(GeometryConverter.toDto(point));
request.setCrs(mapWidget.getMapModel().getCrs());
request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS);
request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
request.setBuffer(calculateBufferFromPixelTolerance());
request.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect());
commandRequest.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(commandRequest,
new AbstractCommandCallback<SearchByLocationResponse>() {
public void execute(SearchByLocationResponse response) {
Map<String, List<Feature>> featureMap = response.getFeatureMap();
for (String layerId : featureMap.keySet()) {
selectFeatures(layerId, featureMap.get(layerId), singleSelectionId, singleSelection);
if (singleSelection) {
break;
}
}
}
});
}