Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] Point symbolizer questions

Hi,
 
I am using uDig 1.1.1 and I need to represent programaticaly a point on a layer as an image.
 
I can represent it as a Circle for example with the code bellow.
 
Question 1)
Is this the correct way to do it?
 
Question 2)
At the end I have 3 lines of code that I use to assign the style to the layer. Which one should I use? I try several  combinations and all of them seems to work!
  sld.addFeatureTypeStyle(fts[0]);
  sld.setFeatureTypeStyles(fts);
  actLayer.getStyleBlackboard().put(SLDContent.ID, pointStyle);
 
Question 3)
 
How should I change the could if I want to use an image like a JPG or an ICON to represent the point instead one of the pre-defined symbols?
 
----- Code -----
 
  StyleBuilder sb=new StyleBuilder();
  PointSymbolizer pointSymb = sb.createPointSymbolizer();
  
  Mark circle = sb.createMark(StyleBuilder.MARK_CIRCLE, sb.createFill(Color.red, 0.5), null);//, Color.red);
  pointSymb.setGraphic(sb.createGraphic(null, circle, null, 1, 10, 0));
  
  Style pointStyle=sb.createStyle();
  pointStyle.setDefault(true);
  pointStyle.setName("Style1");
  pointStyle.addFeatureTypeStyle(sb.createFeatureTypeStyle(pointSymb));
  
  FeatureTypeStyle[] fts = new FeatureTypeStyle[1];
  fts[0]=sb.createFeatureTypeStyle(pointSymb);
  fts[0].setName("FTS_1");
  
  ILayer actLayer = context.getSelectedLayer();
  
  Style sld = (Style) actLayer.getStyleBlackboard().get(SLDContent.ID);
  sld.addFeatureTypeStyle(fts[0]);
  //sld.setFeatureTypeStyles(fts);
  actLayer.getStyleBlackboard().put(SLDContent.ID, pointStyle);
 
 
Thank you for your help.
Regards,
 
Rui Alves

Back to the top