本文整理汇总了Java中org.opengis.feature.type.Name类的典型用法代码示例。如果您正苦于以下问题:Java Name类的具体用法?Java Name怎么用?Java Name使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Name类属于org.opengis.feature.type包,在下文中一共展示了Name类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFeatureType
import org.opengis.feature.type.Name; //导入依赖的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: afterTransactionInternal
import org.opengis.feature.type.Name; //导入依赖的package包/类
private void afterTransactionInternal(final TransactionType transaction, boolean committed) {
log.fine("Detected change to data, updating bounds of affected featuer types and layer groups");
final Map<Name, Collection<ReferencedEnvelope>> byLayerDirtyRegions = getByLayerDirtyRegions(transaction);
if (byLayerDirtyRegions.isEmpty()) {
return;
}
byLayerDirtyRegions.entrySet().stream().forEach(e->{
FeatureTypeInfo fti = catalog.getFeatureTypeByName(e.getKey());
try{
merge(fti.getNativeBoundingBox(), e.getValue()).ifPresent(dirtyRegion->{
// Update the feature type
updateFeatureType(fti, dirtyRegion);
// Update all the layer groups that use it, directly or indirectly
StreamSupport.stream(getLayerGroupsFor(fti).spliterator(), false)
.forEach(lgi->updateLayerGroup(lgi, dirtyRegion));
});
} catch (Exception ex) {
log.log(Level.WARNING, ex.getMessage(), ex);
return;
}
});
}
示例3: testOnlySourceFieldsWithSourceFiltering
import org.opengis.feature.type.Name; //导入依赖的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.opengis.feature.type.Name; //导入依赖的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.opengis.feature.type.Name; //导入依赖的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: rawSchemaExample
import org.opengis.feature.type.Name; //导入依赖的package包/类
private void rawSchemaExample() throws Exception {
Name typeName = null;
URL schemaLocation = null;
CoordinateReferenceSystem crs = null;
// rawSchemaExample start
// assume we are working from WFS 1.1 / GML3 / etc...
final QName featureName = new QName(typeName.getNamespaceURI(), typeName.getLocalPart());
String namespaceURI = featureName.getNamespaceURI();
String uri = schemaLocation.toExternalForm();
Configuration wfsConfiguration = new org.geotools.gml3.ApplicationSchemaConfiguration(
namespaceURI, uri);
FeatureType parsed = GTXML.parseFeatureType(wfsConfiguration, featureName, crs);
// safely cast down to SimpleFeatureType
SimpleFeatureType schema = DataUtilities.simple(parsed);
// rawSchemaExample end
}
示例7: retypeAttributeValue
import org.opengis.feature.type.Name; //导入依赖的package包/类
@Override
public Object retypeAttributeValue(
Object value,
Name attributeName ) {
Object outValue = value;
final String localName = attributeName.getLocalPart();
final SimpleDateFormat formatForName = fieldToFormatObjMap.get().get(
localName);
if (value != null && formatForName != null) {
try {
outValue = formatForName.parse(value.toString());
}
catch (ParseException e) {
LOGGER.error("Failed to parse: " + localName + ": " + value.toString());
}
}
return outValue;
}
示例8: getNames
import org.opengis.feature.type.Name; //导入依赖的package包/类
/** Get a list of FeatureType Names from the features currently loaded into this collection.
*
* @param sort Sort the list by Name. This is a bit slower, so don't use it if not required
*
* @return FeatureType Names
*/
public final List<Name> getNames(boolean sort) {
List<Name> ret = new ArrayList<Name>();
for (Name tmp : typeNameIndex.keySet()) ret.add(tmp);
if (sort) {
java.util.Collections.sort(ret, new Comparator<Name>() {
@Override
public int compare(Name n1, Name n2) {
return n1.getLocalPart().compareTo(n2.getLocalPart());
}
});
}
return ret;
}
示例9: PropertyDescriptorImpl
import org.opengis.feature.type.Name; //导入依赖的package包/类
protected PropertyDescriptorImpl(PropertyType type, Name name, int min, int max, boolean isNillable) {
this.type = type;
this.name = name;
this.minOccurs = min;
this.maxOccurs = max;
this.isNillable = isNillable;
userData = new HashMap();
if ( type == null ) {
throw new NullPointerException("type");
}
if ( name == null ) {
throw new NullPointerException("name");
}
if (type == null) {
throw new NullPointerException();
}
if (max > 0 && (max < min) ) {
throw new IllegalArgumentException("max must be -1, or >= min");
}
}
示例10: SimpleFeatureTypeImpl
import org.opengis.feature.type.Name; //导入依赖的package包/类
/** Creates default userData values.<p>
* The Geometry field <b>is not</b> added by default even when a defaultGeom is provided,
* therefore ensure it is in the attributeTypes list prior to constructing. defaultGeom
* is used to find the Geometry attribute within setDefaultGeom()
*
* @param id The FeatureType id
* @param name The name implementation to be used for finding and displaying this type
* @param attributeTypes A list of AttributeType's each feature of this type must/ will hold.
* @param defaultGeom Descriptor of the Geometry field
*/
public SimpleFeatureTypeImpl(int id, Name name, List<AttributeType> attributeTypes, GeometryDescriptor defaultGeom) {
this.id = id;
this.name = (NameImpl)name;
this.defaultGeometry = defaultGeom;
/* 17/09/13 - Changed if empty list don't add default geom (for new GML2/3 parsing),
* but if null initialise with an empty list and add the geometry definition */
/* 26/03/15 - Changed so Geometry is no longer a part of the attribute type list */
if (attributeTypes==null) {
this.attributeTypes = new ArrayList<AttributeType>();
} else {
this.attributeTypes = attributeTypes;
}
}
示例11: getDefaultGeometryDescriptor
import org.opengis.feature.type.Name; //导入依赖的package包/类
/** Build a GeometryDescriptor from a JTS {@link Geometry} with the name of 'the_geom'.<p>
* This method will attempt to get a valid SRID from the Geometry. If it can't
* get one then WGS84 (EPSG:4326) will be set on the GeometryDescriptor, therefore it is
* always best to set it first using {@linkplain Geometry#setSRID(int)}
*
* @param geometry
* @return A new {@link GeometryDescriptor}
*/
public static GeometryDescriptor getDefaultGeometryDescriptor(Geometry geometry) {
Name gName = new NameImpl(geometry.getGeometryType());
GeometryType gType = null;
// Does the geometry contain an SRID we can use?
int srid = geometry.getSRID();
if (srid>0) {
CoordinateReferenceSystem crs = new CoordinateReferenceSystemImpl("EPSG:"+srid);
gType = new GeometryTypeImpl(gName, Geometry.class, crs);
} else {
// Create assuming EPSG:4326
gType = new GeometryTypeImpl(gName, Geometry.class);
}
return new GeometryDescriptorImpl(gType, new NameImpl("the_geom"));
}
示例12: indexOf
import org.opengis.feature.type.Name; //导入依赖的package包/类
/** Get the index of an AttributeType based on its name
*
* @param The {@link Name} to search for in the attributeType list
*/
@Override
public int indexOf(Name name) {
if (attributeTypes==null) return -1;
int idx = -1;
for (int i=0;i<attributeTypes.size(); i++) {
if (attributeTypes.get(i).getName().equals(name)) idx = i;
}
// Second attempt to match on local part only
if (idx==-1) {
return indexOf(name.getLocalPart());
} else {
return idx;
}
}
示例13: ComplexTypeImpl
import org.opengis.feature.type.Name; //导入依赖的package包/类
public ComplexTypeImpl(
Name name, Collection<PropertyDescriptor> properties, boolean identified,
boolean isAbstract, List<Filter> restrictions, AttributeType superType,
InternationalString description
) {
super(name, Collection.class, identified, isAbstract, restrictions, superType, description);
List<PropertyDescriptor> localProperties;
Map<Name, PropertyDescriptor> localPropertyMap;
if (properties == null) {
localProperties = Collections.emptyList();
localPropertyMap = Collections.emptyMap();
} else {
localProperties = new ArrayList<PropertyDescriptor>(properties);
localPropertyMap = new HashMap<Name, PropertyDescriptor>();
for (PropertyDescriptor pd : properties) {
if( pd == null ){
// descriptor entry may be null if a request was made for a property that does not exist
throw new NullPointerException("PropertyDescriptor is null - did you request a property that does not exist?");
}
localPropertyMap.put(pd.getName(), pd);
}
}
this.properties = Collections.unmodifiableList(localProperties);
this.propertyMap = Collections.unmodifiableMap(localPropertyMap);
}
示例14: getTypeName
import org.opengis.feature.type.Name; //导入依赖的package包/类
Name getTypeName() {
try{
return new NameImpl(namespaceURI, shpFiles.getTypeName());
}catch(Exception e){
return new NameImpl(namespaceURI,"");
}
}
示例15: dataStoreChangeInternal
import org.opengis.feature.type.Name; //导入依赖的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);
}