geoStyle_P.setMarkerSymbolID(10);没有效果,是什么原因,需要有初始化的操作吗
以及怎么获取工作空间的符号集合显示出来供用户选择
开发文档中GeoStyle类的例子:
例子中的设置符号不起作用
public void geoStyleTest(){ // 假设打开一个工作空间 workspace 对象。 // 实例化一个线几何对象,并对其进行风格设置 GeoStyle geoStyle_L = new GeoStyle(); geoStyle_L.setLineColor(java.awt.Color.black); geoStyle_L.setLineSymbolID(15); geoStyle_L.setLineWidth(5.0); Point2Ds point2Ds = new Point2Ds(); Point2D[] point2DArray = {new Point2D(100, 100), new Point2D(200, 100), new Point2D(100, 200), new Point2D(200, 200)}; point2Ds.addRange(point2DArray); GeoLine geoLine = new GeoLine(point2Ds); geoLine.setStyle(geoStyle_L); // 实例化一个点几何对象,并对其进行风格设置 GeoStyle geoStyle_P = new GeoStyle(); geoStyle_P.setMarkerAngle(14.0); geoStyle_P.setMarkerSize(new Size2D(10, 10)); geoStyle_P.setMarkerSymbolID(10); GeoPoint geoPoint = new GeoPoint(); geoPoint.setX(100.0); geoPoint.setY(100.0); geoPoint.setStyle(geoStyle_P); // 实例化一个面几何对象,并对其进行渐变风格设置 GeoStyle geoStyle_R = new GeoStyle(); geoStyle_R.setFillBackColor(new Color(0,255,0)); geoStyle_R.setFillForeColor(new Color(255,0,0)); geoStyle_R.setFillBackOpaque(true); geoStyle_R.setFillOpaqueRate(50); geoStyle_R.setFillGradientAngle(30.0); geoStyle_R.setFillGradientMode(FillGradientMode.LINEAR); GeoRegion geoRegion = new GeoRegion(); Point2Ds point2Ds_R = new Point2Ds(); Point2D[] point2DArray_R = {new Point2D(10, 50), new Point2D(150, 50), new Point2D(100, 150), new Point2D(10, 150)}; point2Ds_R.addRange(point2DArray_R); geoRegion.addPart(point2Ds_R); geoRegion.setStyle(geoStyle_R); // 查看所设置的风格 Map map = new Map(workspace); TrackingLayer layer = map.getTrackingLayer(); layer.add(geoLine, "Line"); layer.add(geoPoint, "Point"); layer.add(geoRegion, "Region"); map.setAntialias(true); map.setViewBounds(new Rectangle2D(0, 0, 250, 250)); }