下面是我的代码 布局中添加了地图等 只出了标题和指北针
public void createLayout(Map map, Point2D center) {
int mapId;
MapLayout mapLayout = new MapLayout(_workspace);
mapLayout.getPaper().setOrientation(PaperOrientation.LANDSCAPE);
Dimension dimension = new Dimension();
dimension.width = 2400;
dimension.height = 1800;
mapLayout.setImageSize(dimension);
//设置横向页数
mapLayout.setHorizontalPaperCount(1);
//设置纵向页数
mapLayout.setVerticalPaperCount(1);
mapLayout.setCenter(centerPoint2D);
mapLayout.ensureVisible(bounds);
mapLayout.setViewBounds(bounds);
//布局元素获取 下面就开始添加布局元素 比如地图 标题 图例 指北针等
LayoutElements elements = mapLayout.getElements();
//地图添加
GeoRectangle geoRectangle = new GeoRectangle(center, 2400, 1800, 0);
GeoMap geoMap = new GeoMap(map.getName(),geoRectangle);
geoMap.setMapName(map.getName());
geoMap.setMapCenter(centerPoint2D);
geoMap.setGridVisible(false);
mapLayout.getElements().addNew(geoMap);
mapLayout.getElements().moveFirst();
mapId = elements.getID();
//标题设置
TextStyle textStyle = new TextStyle();
textStyle.setBackColor(Color.RED);
GeoText geoText = new GeoText();
TextPart part = new TextPart("布局出图测试", new Point2D(150, 150), 10.0);
geoText.addPart(part);
geoText.setTextStyle(textStyle);
mapLayout.getElements().addNew(geoText);
//图例添加
//指北针
GeoNorthArrow northArrow = new GeoNorthArrow(
NorthArrowStyleType.EIGHTDIRECTION, new Rectangle2D(
new Point2D(140, 140), new Size2D(35, 35)), 0);
northArrow.setBindingGeoMapID(mapId);
mapLayout.getElements().addNew(northArrow);
mapLayout.zoomToPaper();
mapLayout.refresh();
mapLayout.outputLayoutToJPG(uploadDirectory);
}
请问一下大佬怎么解决我这个不能把地图加载到布局重的问题
另外我workspace.save之后 布局没有保存进去