/[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 598 by alfonx, Tue Dec 1 14:12:11 2009 UTC revision 599 by alfonx, Tue Dec 1 14:35:24 2009 UTC
# Line 47  import org.geotools.styling.Style; Line 47  import org.geotools.styling.Style;
47  import org.geotools.styling.TextSymbolizer;  import org.geotools.styling.TextSymbolizer;
48  import org.opengis.feature.simple.SimpleFeature;  import org.opengis.feature.simple.SimpleFeature;
49  import org.opengis.feature.simple.SimpleFeatureType;  import org.opengis.feature.simple.SimpleFeatureType;
 import org.opengis.feature.type.AttributeDescriptor;  
50  import org.opengis.filter.Filter;  import org.opengis.filter.Filter;
 import org.opengis.filter.expression.Expression;  
51  import org.opengis.filter.expression.PropertyName;  import org.opengis.filter.expression.PropertyName;
52    
 import com.sun.jndi.toolkit.dir.SearchFilter;  
   
53  import schmitzm.geotools.feature.FeatureUtil;  import schmitzm.geotools.feature.FeatureUtil;
54  import schmitzm.geotools.styling.StylingUtil;  import schmitzm.geotools.styling.StylingUtil;
55  import schmitzm.lang.LangUtil;  import schmitzm.lang.LangUtil;
# Line 84  public class LabelSearch { Line 80  public class LabelSearch {
80                  this.mapPane = mapPane;                  this.mapPane = mapPane;
81          }          }
82    
         //  
         // /**  
         // * The Attribute that provides the labels for this text symbolizer.  
         // */  
         // private AttributeDescriptor getLabelAttribute(final TextSymbolizer ts,  
         // final SimpleFeatureType schema) {  
         // if (ts == null) {  
         // // This layer has no labels  
         // return null;  
         // }  
         //  
         // final Expression labelExp = ts.getLabel();  
         // if (labelExp instanceof PropertyName) {  
         // final PropertyName pn = (PropertyName) labelExp;  
         // final String propertyName = pn.getPropertyName();  
         // return schema.getDescriptor(propertyName);  
         // } else {  
         // return null;  
         // }  
         //  
         // }  
   
83          public List<SearchResult> search(final String string) {          public List<SearchResult> search(final String string) {
84    
85                  final String searchMe = string.toUpperCase();                  final String searchMe = string.toUpperCase();
# Line 153  public class LabelSearch { Line 127  public class LabelSearch {
127                                  // Only one property used...                                  // Only one property used...
128    
129                                  searchFilter = CQL.toFilter("strToUpperCase "                                  searchFilter = CQL.toFilter("strToUpperCase "
130                                                  + prop1.getPropertyName() + "  LIKE '%" + searchMe                                                  + prop1.getPropertyName() + " LIKE '%" + searchMe
131                                                  + "%'");                                                  + "%'");
132    
133                                  if (prop2 != null) {                                  if (prop2 != null) {
134                                          Filter searchFilter2 = CQL.toFilter("strToUpperCase "                                          Filter searchFilter2 = CQL.toFilter("strToUpperCase "
135                                                          + prop2.getPropertyName() + "  LIKE '%" + searchMe                                                          + prop2.getPropertyName() + " LIKE '%" + searchMe
136                                                          + "%'");                                                          + "%'");
137    
138                                          searchFilter = FeatureUtil.FILTER_FACTORY2.or(searchFilter,                                          searchFilter = FeatureUtil.FILTER_FACTORY2.or(searchFilter,
# Line 173  public class LabelSearch { Line 147  public class LabelSearch {
147                                  if (layerFilter != null && layerFilter != Filter.INCLUDE) {                                  if (layerFilter != null && layerFilter != Filter.INCLUDE) {
148                                          searchFilter = FeatureUtil.FILTER_FACTORY2.and(layerFilter,                                          searchFilter = FeatureUtil.FILTER_FACTORY2.and(layerFilter,
149                                                          searchFilter);                                                          searchFilter);
   
150                                  }                                  }
151                                                                    
152                                  LOGGER.info("Searching for "+searchFilter.toString());  //                              LOGGER.info("Searching for "+searchFilter.toString());
153    
154                                  FeatureCollection<SimpleFeatureType, SimpleFeature> features = (FeatureCollection<SimpleFeatureType, SimpleFeature>) ml                                  FeatureCollection<SimpleFeatureType, SimpleFeature> features = (FeatureCollection<SimpleFeatureType, SimpleFeature>) ml
155                                                  .getFeatureSource().getFeatures(                                                  .getFeatureSource().getFeatures(

Legend:
Removed from v.598  
changed lines
  Added in v.599

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26