Tag Archive 改变图元

By海天一鱼儿

改变图元的属性值

Layer olayer = null;
olayer = m_map.getLayers().getLayer("摄像机");
olayer.setAutoLabel(true) ;
LabelThemeList oLabelThemeList = null;
oLabelThemeList = olayer.getLabelThemeList();
Integer iNum=null;
iNum = new Integer(oLabelThemeList.size());

//System.out.println(iNum.toString());
LabelProperties oLabelProperties = new LabelProperties();
String labelString = ""Name:["+Name+"]"";
//System.out.println(labelString);
oLabelProperties.setMultiLineTextMode(oLabelProperties.MULTILINE_TEXT_ON) ;
oLabelProperties.setOffset(new DoublePoint(0,0));
oLabelProperties.setLabelExpression(labelString);
oLabelProperties.setHorizontalAlignment(LabelProperties.HORIZ_ALIGN_DEFAULT);
oLabelProperties.setVerticalAlignment(LabelProperties.VERT_ALIGN_DEFAULT);
com.mapinfo.graphics.Rendition rend = com.mapinfo.graphics.RenditionImpl.getDefaultRendition();
rend.setvalue(com.mapinfo.graphics.Rendition.FONT_FAMILY,"宋体");
rend.setvalue(com.mapinfo.graphics.Rendition.FONT_SIZE,9);
rend.setvalue(com.mapinfo.graphics.Rendition.FONT_WEIGHT ,4);
rend.setvalue(com.mapinfo.graphics.Rendition.FONT_STYLE,
com.mapinfo.graphics.Rendition.FontStyle.NORMAL);
rend.setvalue(com.mapinfo.graphics.Rendition.SYMBOL_FOREGROUND,Color.black );
//rend.setvalue(com.mapinfo.graphics.Rendition.FILTER_EFFECTS,
com.mapinfo.graphics.Rendition.FilterEffects.OUTLINE);

oLabelProperties.setRenditi ;
OverrideLabelTheme ovlt = new OverrideLabelTheme(oLabelProperties,"myLabel");
oLabelThemeList.add(ovlt) ;
iNum = new Integer(oLabelThemeList.size());
//System.out.println(iNum.toString());

BaseLabelProperties oblp = new BaseLabelProperties(oLabelProperties);
olayer.setLabelProperties(oblp) ;