本文整理汇总了Java中org.geotools.feature.NameImpl类的典型用法代码示例。如果您正苦于以下问题:Java NameImpl类的具体用法?Java NameImpl怎么用?Java NameImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NameImpl类属于org.geotools.feature包,在下文中一共展示了NameImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFeatureType
import org.geotools.feature.NameImpl; //导入依赖的package包/类
public SimpleFeatureType createFeatureType(Geometry newGeometry, String uuid, CoordinateReferenceSystem coordinateReferenceSystem) {
String namespace = "http://www.52north.org/" + uuid;
SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder();
if (coordinateReferenceSystem == null) {
coordinateReferenceSystem = getDefaultCRS();
}
typeBuilder.setCRS(coordinateReferenceSystem);
typeBuilder.setNamespaceURI(namespace);
Name nameType = new NameImpl(namespace, "Feature-" + uuid);
typeBuilder.setName(nameType);
typeBuilder.add("GEOMETRY", newGeometry.getClass());
SimpleFeatureType featureType;
featureType = typeBuilder.buildFeatureType();
return featureType;
}
示例2: init
import org.geotools.feature.NameImpl; //导入依赖的package包/类
protected void init(String status, String geometryField) throws Exception {
indexDocuments(status);
attributes = dataStore.getElasticAttributes(new NameImpl(TYPE_NAME));
config = new ElasticLayerConfiguration(TYPE_NAME);
List<ElasticAttribute> layerAttributes = new ArrayList<>();
for (ElasticAttribute attribute : attributes) {
attribute.setUse(true);
if (geometryField.equals(attribute.getName())) {
ElasticAttribute copy = new ElasticAttribute(attribute);
copy.setDefaultGeometry(true);
layerAttributes.add(copy);
} else {
layerAttributes.add(attribute);
}
}
config.getAttributes().clear();
config.getAttributes().addAll(layerAttributes);
dataStore.setLayerConfiguration(config);
featureSource = (ElasticFeatureSource) dataStore.getFeatureSource(TYPE_NAME);
}
示例3: testOnlySourceFieldsWithSourceFiltering
import org.geotools.feature.NameImpl; //导入依赖的package包/类
@Test
public void testOnlySourceFieldsWithSourceFiltering() throws Exception {
init();
dataStore.setSourceFilteringEnabled(true);
Name name = new NameImpl("active");
for (final ElasticAttribute attribute : dataStore.getElasticAttributes(name) ){
if (attribute.isStored()) {
attribute.setUse(false);
}
}
featureSource = (ElasticFeatureSource) dataStore.getFeatureSource(TYPE_NAME);
assertEquals(11, featureSource.getCount(Query.ALL));
SimpleFeatureIterator features = featureSource.getFeatures().features();
for (int i=0; i<11; i++) {
assertTrue(features.hasNext());
features.next();
}
}
示例4: createTypeNames
import org.geotools.feature.NameImpl; //导入依赖的package包/类
@Override
protected List<Name> createTypeNames() throws IOException {
List<Name> ret = new Vector<Name>();
try {
PreparedStatement q = conn.prepareStatement("SELECT * from geometry_columns WHERE LOWER(type) = 'point'");
ResultSet res = q.executeQuery();
while(res.next()) {
String name = res.getString("f_table_name");
ret.add(new NameImpl(namespaceURI, name));
}
res.close();
q.close();
} catch (SQLException e) {
throw new IOException(e);
}
return ret;
}
示例5: example1
import org.geotools.feature.NameImpl; //导入依赖的package包/类
public static void example1() throws Exception {
// octo start
WKTReader wktReader = new WKTReader(new GeometryFactory());
Geometry geom = wktReader.read("MULTIPOINT (1 1, 5 4, 7 9, 5 5, 2 2)");
Name name = new NameImpl("tutorial","octagonalEnvelope");
Process process = Processors.createProcess( name );
ProcessExecutor engine = Processors.newProcessExecutor(2);
// quick map of inputs
Map<String,Object> input = new KVP("geom", geom);
Progress working = engine.submit(process, input );
// you could do other stuff whle working is doing its thing
if( working.isCancelled() ){
return;
}
Map<String,Object> result = working.get(); // get is BLOCKING
Geometry octo = (Geometry) result.get("result");
System.out.println( octo );
// octo end
}
示例6: withTestModels
import org.geotools.feature.NameImpl; //导入依赖的package包/类
private static void withTestModels(String folder) throws Exception {
URL schemaURL = new File("/Users/markus/Documents/Projects/EMFFrag/02_workspace/citygml.git/de.hub.citygml.models/schemas/"+folder+"/TestFeature.xsd").toURL();
URL modelURL = new File("/Users/markus/Documents/Projects/EMFFrag/02_workspace/citygml.git/de.hub.citygml.models/schemas/"+folder+"/TestFeature.xml").toURL();
GML gml = new GML(Version.WFS1_1);
gml.setCoordinateReferenceSystem(DefaultGeographicCRS.WGS84);
NameImpl typeName = new NameImpl("http://www.geotools.org/test", "TestFeature");
//
SimpleFeatureType featureType = gml.decodeSimpleFeatureType(schemaURL, typeName);
System.out.println("#1: " + (featureType == null ? "NULL" : featureType.toString()));
SimpleFeatureCollection featureCollection = gml.decodeFeatureCollection(modelURL.openStream());
System.out.println("#2: " + featureCollection.size());
MapContent map = new MapContent();
map.setTitle("Quickstart");
Style style = SLD.createSimpleStyle(featureCollection.getSchema());
Layer layer = new FeatureLayer(featureCollection, style);
map.addLayer(layer);
// Now display the map
JMapFrame.showMap(map);
}
示例7: getTypeName
import org.geotools.feature.NameImpl; //导入依赖的package包/类
Name getTypeName() {
try{
return new NameImpl(namespaceURI, shpFiles.getTypeName());
}catch(Exception e){
return new NameImpl(namespaceURI,"");
}
}
示例8: dataStoreChangeInternal
import org.geotools.feature.NameImpl; //导入依赖的package包/类
private void dataStoreChangeInternal(final TransactionEvent event) {
final Object source = event.getSource();
if (!(source instanceof InsertElementType || source instanceof UpdateElementType)) {
// We only care about operations that potentially the bounds.
return;
}
final EObject originatingTransactionRequest = (EObject) source;
Objects.requireNonNull(originatingTransactionRequest, "No original transaction request exists");
final TransactionEventType type = event.getType();
if (TransactionEventType.POST_INSERT.equals(type)) {
// no need to compute the bounds, they're the same as for PRE_INSERT
return;
}
final Name featureTypeName = new NameImpl(event.getLayerName());
final FeatureTypeInfo fti = catalog.getFeatureTypeByName(featureTypeName);
if(Objects.isNull(fti)) {
return;
}
final SimpleFeatureCollection affectedFeatures = event.getAffectedFeatures();
final ReferencedEnvelope affectedBounds = affectedFeatures.getBounds();
final TransactionType transaction = event.getRequest();
addDirtyRegion(transaction, featureTypeName, affectedBounds);
}
示例9: createPropertyName
import org.geotools.feature.NameImpl; //导入依赖的package包/类
protected PropertyName createPropertyName (String path, NamespaceSupport namespaceContext) {
if (path.contains("/")) {
return filterFactory.property(path, namespaceContext);
} else {
if (path.contains(":")) {
int i = path.indexOf(":");
return filterFactory.property(new NameImpl(namespaceContext.getURI(path.substring(0, i)), path.substring(i+1) ));
} else {
return filterFactory.property(path);
}
}
}
示例10: getPropertyDescriptorList
import org.geotools.feature.NameImpl; //导入依赖的package包/类
/**
* Gets the property descriptor list.
*
* @return the property descriptor list
*/
public Collection<PropertyDescriptor> getPropertyDescriptorList() {
if (schema != null) {
return schema.getDescriptors();
} else {
if (geometryType == GeometryTypeEnum.RASTER) {
if (rasterPropertyDescriptorList == null) {
rasterPropertyDescriptorList = new ArrayList<PropertyDescriptor>();
CoordinateReferenceSystem crs = null;
boolean isIdentifiable = false;
boolean isAbstract = false;
List<Filter> restrictions = null;
AttributeType superType = null;
InternationalString description = null;
GeometryType type = featureTypeFactory.createGeometryType(
new NameImpl(rasterGeometryField), GridCoverage2D.class, crs,
isIdentifiable, isAbstract, restrictions, superType, description);
GeometryDescriptor descriptor = featureTypeFactory.createGeometryDescriptor(
type, new NameImpl(rasterGeometryField), 0, 1, false, null);
rasterPropertyDescriptorList.add(descriptor);
}
return rasterPropertyDescriptorList;
}
}
return null;
}
示例11: attributeUpdated
import org.geotools.feature.NameImpl; //导入依赖的package包/类
/**
* Attribute updated.
*
* @param attributeName the attribute name
*/
@Override
public void attributeUpdated(String attributeName) {
expressionType = ExpressionTypeEnum.E_ATTRIBUTE;
NameImpl name = new NameImpl(attributeName);
setCachedExpression(new AttributeExpressionImpl(name));
setValueFieldState();
fireDataChanged();
}
示例12: getFunctionName
import org.geotools.feature.NameImpl; //导入依赖的package包/类
/**
* Gets the function name.
*
* @return the function name
*/
public Name getFunctionName() {
if (builtInSelected) {
if (builtInProcessFunction == null) {
return null;
}
return builtInProcessFunction.getFunctionName();
} else {
if (selectedCustomFunction == null) {
return null;
}
return new NameImpl(selectedCustomFunction.getTitle().getValue());
}
}
示例13: featureStore
import org.geotools.feature.NameImpl; //导入依赖的package包/类
/**
* Creates a new Feature Store for writing features
* @param originalSource the original feature source, used for bounds and geometry descriptor information
* @param path the location where the store will be saved
* @param attributeTypes a map of attribute information (name, type) to create the schema
* @return an empty store for writing features
* @throws IOException if the file cannot be created
*/
public static AbstractDataStore featureStore(
FeatureSource originalSource,
String path,
Map<String,Class<?>> attributeTypes
) throws IOException {
// Create store
DataStoreFactorySpi storeFactory = new ShapefileDataStoreFactory();
File file = new java.io.File(path);
HashMap<String, Serializable> createFlags = new HashMap<String, Serializable>();
createFlags.put("url", file.toURI().toURL());
ShapefileDataStore saveStore = (ShapefileDataStore)storeFactory.createNewDataStore(createFlags);
// Set flags and descriptors
saveStore.setStringCharset(Charset.forName("UTF-8"));
FeatureType oldSchema = originalSource.getSchema();
final List<AttributeDescriptor> descriptorList = new java.util.ArrayList<AttributeDescriptor>();
descriptorList.add(oldSchema.getGeometryDescriptor());
// Set attributes
for (Map.Entry<String, Class<?>> entry: attributeTypes.entrySet()) {
AttributeTypeBuilder keyTB = new AttributeTypeBuilder();
keyTB.setName(entry.getKey());
keyTB.setBinding(entry.getValue());
keyTB.setNillable(true);
AttributeDescriptor desc = keyTB.buildDescriptor(entry.getKey());
descriptorList.add(desc);
}
// Finalize schema
SimpleFeatureTypeImpl newSchema = new SimpleFeatureTypeImpl(
new NameImpl(file.getName()),
descriptorList,
oldSchema.getGeometryDescriptor(),
oldSchema.isAbstract(),
oldSchema.getRestrictions(),
oldSchema.getSuper(),
null);
saveStore.createSchema(newSchema);
return saveStore;
}
示例14: ElasticDataStore
import org.geotools.feature.NameImpl; //导入依赖的package包/类
public ElasticDataStore(RestClient restClient, String indexName) throws IOException {
LOGGER.fine("Initializing data store for " + indexName);
this.indexName = indexName;
try {
final Response response = restClient.performRequest("GET", "/", Collections.<String, String>emptyMap());
if (response.getStatusLine().getStatusCode() >= 400) {
throw new IOException();
}
client = new RestElasticClient(restClient);
} catch (Exception e) {
throw new IOException("Unable to create REST client", e);
}
LOGGER.fine("Created REST client: " + client);
final List<String> types = getClient().getTypes(indexName);
if (!types.isEmpty()) {
baseTypeNames = types.stream().map(name -> new NameImpl(name)).collect(Collectors.toList());
} else {
baseTypeNames = new ArrayList<>();
}
layerConfigurations = new ConcurrentHashMap<>();
docTypes = new HashMap<>();
arrayEncoding = ArrayEncoding.JSON;
}
示例15: testSchemaWithoutLayerConfig
import org.geotools.feature.NameImpl; //导入依赖的package包/类
@Test
public void testSchemaWithoutLayerConfig() throws Exception {
init();
ElasticFeatureSource featureSource = new ElasticFeatureSource(new ContentEntry(dataStore, new NameImpl("invalid")),null);
SimpleFeatureType schema = featureSource.getSchema();
assertNotNull(schema);
assertTrue(schema.getAttributeCount()==0);
}