/[schmitzm]/branches/1.0-gt2-2.6/src/skrueger/geotools/labelsearch/LabelSearch.java
ViewVC logotype

Diff of /branches/1.0-gt2-2.6/src/skrueger/geotools/labelsearch/LabelSearch.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 456 by alfonx, Sun Oct 11 21:43:40 2009 UTC revision 574 by alfonx, Wed Nov 25 08:09:42 2009 UTC
# Line 73  public class LabelSearch { Line 73  public class LabelSearch {
73                  return RESOURCE.getString(key, values);                  return RESOURCE.getString(key, values);
74          }          }
75    
76          protected final schmitzm.geotools.gui.JMapPane mapPane;          protected final schmitzm.geotools.gui.SelectableXMapPane mapPane;
77    
78          public LabelSearch(final schmitzm.geotools.gui.JMapPane mapPane) {          public LabelSearch(final schmitzm.geotools.gui.SelectableXMapPane mapPane) {
79                  this.mapPane = mapPane;                  this.mapPane = mapPane;
80          }          }
81    
# Line 95  public class LabelSearch { Line 95  public class LabelSearch {
95                          final String propertyName = pn.getPropertyName();                          final String propertyName = pn.getPropertyName();
96                          return schema.getDescriptor(propertyName);                          return schema.getDescriptor(propertyName);
97                  } else {                  } else {
98                          // When does this happen                          return null;
                         throw new RuntimeException("labelExp " + labelExp  
                                         + " IS NOT instanceof PropertyName!");  
99                  }                  }
100    
101          }          }
# Line 108  public class LabelSearch { Line 106  public class LabelSearch {
106    
107                  final ArrayList<SearchResult> hits = new ArrayList<SearchResult>();                  final ArrayList<SearchResult> hits = new ArrayList<SearchResult>();
108    
109                  for (final MapLayer ml : mapPane.getContext().getLayers()) {                  for (final MapLayer ml : mapPane.getMapContext().getLayers()) {
110                          try {                          try {
111    
112                                  // System.out.println("layer = "+ml.getTitle());                                  // System.out.println("layer = "+ml.getTitle());
# Line 157  public class LabelSearch { Line 155  public class LabelSearch {
155                                                                  .getTextSymbolizer(ml.getStyle(), f);                                                                  .getTextSymbolizer(ml.getStyle(), f);
156                                                  if (ts == null)                                                  if (ts == null)
157                                                          continue;                                                          continue;
158                                                    
159                                                  // TODO Evaluate the Rule that belongs to the                                                  // TODO Evaluate the Rule that belongs to the
160                                                  // TextSymbolizer against the feature...                                                  SimpleFeatureType schema = featureSource.getSchema();
161                                                  final AttributeDescriptor labelAttribute = getLabelAttribute(                                                  PropertyName pn = StylingUtil.getFirstPropertyName(
162                                                                  ts, featureSource.getSchema());                                                                  schema, ts);
163                                                    if (pn == null) continue;
164                                                  if (labelAttribute == null) {                                                  
165                                                          continue;                                                  final AttributeDescriptor labelAttribute = schema
166                                                  }                                                                  .getDescriptor(pn.getPropertyName());
   
                                                 // System.out.println("labelAttrib local name" +  
                                                 // labelAttribute.getLocalName());  
167    
168                                                  final Object value = f.getAttribute(labelAttribute                                                  final Object value = f.getAttribute(labelAttribute
169                                                                  .getLocalName());                                                                  .getLocalName());
170    
                                                 // System.out.println("labelAttrib value " + value);  
   
171                                                  if (value == null) {                                                  if (value == null) {
172                                                          LOGGER                                                          LOGGER
173                                                                          .info("Skipping f: getLocalName() is null for feature="                                                                          .info("Skipping f: getLocalName() is null for feature="

Legend:
Removed from v.456  
changed lines
  Added in v.574

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26