【解决办法】将图层添加到地图中后,可以通过设置图层全幅显示来修改map的显示范围,代码如下:
Map map = new Map(workspace);
Layer layer = map.getLayers().add(dataset, layerSettingVector, true);
map.refresh();
map.ensureVisible(layer);
map.setLineAntialias(true);
workspace.getMaps().remove("name");
workspace.getMaps().add("name", map.toXML());
workspace.save();
map.outputMapToFile(filePath, ImageType.PNG, 96, dataset.getBounds(), true);