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; |
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(); |
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, |
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( |