本文整理汇总了Java中org.opengis.feature.type.AttributeType类的典型用法代码示例。如果您正苦于以下问题:Java AttributeType类的具体用法?Java AttributeType怎么用?Java AttributeType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AttributeType类属于org.opengis.feature.type包,在下文中一共展示了AttributeType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFixedValueAttributes
import org.opengis.feature.type.AttributeType; //导入依赖的package包/类
@Override
public List<Attribute> getFixedValueAttributes(String datasourceId) {
Iterator<AttributeType> typeIterator;
try {
typeIterator = getAttributesForDatasource(new Datasource(datasourceSpec)).iterator();
} catch (IOException ioe) {
log.error("Could not get the list of fixed value attributes for {}, {}", datasourceId, ioe.getMessage());
return Collections.emptyList();
}
List<Attribute> fixedValueAttributes = new ArrayList<>();
while (typeIterator.hasNext()) {
AttributeType type = typeIterator.next();
String columnName = type.getName().toString();
if (NON_ATTRIBUTE_COLUMNS.contains(columnName)) { continue; }
fixedValueAttributes.add(new Attribute(
getProvider(),
columnName,
null != type.getDescription() ? type.getDescription().toString() : columnName)
);
}
return fixedValueAttributes;
}
示例2: geometryType
import org.opengis.feature.type.AttributeType; //导入依赖的package包/类
/**
* @param type
* @return the class of the given geometry type
*/
private static Class<? extends GM_Object> geometryType(AttributeType type) {
String typeGeometry = type.getBinding().getSimpleName();
LOGGER.log(Level.INFO, "shapeType = " + typeGeometry);
if (typeGeometry.equals("LineString")) {
return GM_MultiCurve.class;
}
if (typeGeometry.equals("MultiLineString")) {
return GM_MultiCurve.class;
}
if (typeGeometry.equals("Point")) {
return GM_Point.class;
}
if (typeGeometry.equals("MultiPoint")) {
return GM_MultiPoint.class;
}
return GM_MultiSurface.class;
}
示例3: getLiteral
import org.opengis.feature.type.AttributeType; //导入依赖的package包/类
private static Literal getLiteral(Object o, AttributeType type) {
Class<?> c = type.getBinding();
Literal l = null;
String s = o.toString();
if (c == java.lang.Double.class)
l = FF.literal(Double.parseDouble(s));
else if (c == java.lang.Integer.class)
l = FF.literal(Integer.parseInt(s));
else if (c == java.lang.Long.class)
l = FF.literal(Long.parseLong(s));
else if (c == java.lang.Character.class)
l = FF.literal(s.charAt(0));
else if (c == java.lang.Boolean.class)
l = FF.literal(Boolean.parseBoolean(s));
else if (c == java.lang.Short.class)
l = FF.literal(Short.parseShort(s));
else if (c == java.lang.String.class)
l = FF.literal(s);
else
l = FF.literal(o);
return l;
}
示例4: SeparateGeometriesDialog
import org.opengis.feature.type.AttributeType; //导入依赖的package包/类
public SeparateGeometriesDialog(Window mainFrame, VectorDataNode vectorDataNode, String helpId, String text) {
super(mainFrame, "Import Geometry", ModalDialog.ID_YES_NO_HELP, helpId);
JPanel content = new JPanel(new BorderLayout());
content.add(new JLabel(text), BorderLayout.NORTH);
List<AttributeType> types = vectorDataNode.getFeatureType().getTypes();
ArrayList<String> names = new ArrayList<String>();
for (AttributeType type : types) {
if (type.getBinding().equals(String.class)) {
names.add(type.getName().getLocalPart());
}
}
comboBox = new JComboBox(names.toArray(new String[names.size()]));
if (names.size() > 0) {
JPanel content2 = new JPanel(new BorderLayout());
content2.add(new JLabel("Attribute for mask/layer naming: "), BorderLayout.WEST);
content2.add(comboBox, BorderLayout.CENTER);
content.add(content2, BorderLayout.SOUTH);
}
setContent(content);
}
示例5: setAttributes
import org.opengis.feature.type.AttributeType; //导入依赖的package包/类
/** Add new attribute values and types to this feature.
* This method ensures that the value order matches the type order,
* even if previous types existed.<p>
*
* @param values The list of attribute values
* @param types The attribute types
*/
public final void setAttributes(List<Object> values, List<AttributeType> types) {
((SimpleFeatureTypeImpl)featureType).addAttributeTypes(types);
this.attrValues = new ArrayList<Object>();
for (int i=0; i<featureType.getAttributeCount()+1; i++) {
attrValues.add("");
}
for (int i=0; i<types.size(); i++) {
int idx = featureType.indexOf(types.get(i).getName().getLocalPart());
if (idx==-1) continue;
attrValues.set(idx, values.get(i) );
}
}
示例6: SimpleFeatureTypeImpl
import org.opengis.feature.type.AttributeType; //导入依赖的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;
}
}
示例7: addAttributeTypes
import org.opengis.feature.type.AttributeType; //导入依赖的package包/类
/** Add an additional set of {@link AttributeType} to this feature
* type, preserving the existing set in order.<p>
* Used, for example, when a getObjectInformation() request returns
* additional attributes to those set as default.
*
* @param newTypes The new AttributeTypes to add
* @param overwrite If False then the existing set of values is preserved,
* otherwise they are replaced with the new set
*/
public void addAttributeTypes(List<AttributeType> newTypes, boolean overwrite) {
if (newTypes==null) return;
// If our list is blank, copy them all
if (attributeTypes==null || overwrite==true) {
attributeTypes = newTypes;
return;
} else if (attributeTypes.size()==0) {
attributeTypes = newTypes;
return;
}
// Add only the new values
for (AttributeType nt : newTypes) {
if ( getType(nt.getName().getLocalPart())==null ) {
attributeTypes.add(nt);
}
}
}
示例8: ComplexTypeImpl
import org.opengis.feature.type.AttributeType; //导入依赖的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);
}
示例9: getPropertyDescriptorList
import org.opengis.feature.type.AttributeType; //导入依赖的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;
}
示例10: getGKBinding
import org.opengis.feature.type.AttributeType; //导入依赖的package包/类
public static int getGKBinding(AttributeType at) {
Class<?> c = at.getBinding();
int binding;
if (c == java.lang.Integer.class || c == java.lang.Long.class)
binding = ValueMetaInterface.TYPE_INTEGER;
else if (c == java.lang.Double.class)
binding = ValueMetaInterface.TYPE_NUMBER;
else if (c == java.util.Date.class)
binding = ValueMetaInterface.TYPE_DATE;
else if (com.vividsolutions.jts.geom.Geometry.class.isAssignableFrom(c))
binding = ValueMetaInterface.TYPE_GEOMETRY;
else
binding = ValueMetaInterface.TYPE_STRING;
return binding;
}
示例11: createSpec
import org.opengis.feature.type.AttributeType; //导入依赖的package包/类
private DataTableSpec createSpec(SimpleFeatureType type) {
List<DataColumnSpec> columns = new ArrayList<>();
Set<String> columnNames = new LinkedHashSet<>();
for (AttributeType t : type.getTypes()) {
String name;
if (t == type.getGeometryDescriptor().getType()) {
name = type.getGeometryDescriptor().getName().toString();
} else {
name = t.getName().toString();
}
if (t == type.getGeometryDescriptor().getType()) {
columns.add(new DataColumnSpecCreator(name, ShapeBlobCell.TYPE).createSpec());
} else if (t.getBinding() == Integer.class) {
columns.add(new DataColumnSpecCreator(name, IntCell.TYPE).createSpec());
} else if (t.getBinding() == Double.class) {
columns.add(new DataColumnSpecCreator(name, DoubleCell.TYPE).createSpec());
} else if (t.getBinding() == Boolean.class) {
columns.add(new DataColumnSpecCreator(name, BooleanCell.TYPE).createSpec());
} else {
columns.add(new DataColumnSpecCreator(name, StringCell.TYPE).createSpec());
}
columnNames.add(name);
}
latitudeColumn = KnimeUtils.createNewValue(LATITUDE_COLUMN, columnNames);
longitudeColumn = KnimeUtils.createNewValue(LONGITUDE_COLUMN, columnNames);
areaColumn = KnimeUtils.createNewValue(AREA_COLUMN, columnNames);
columns.add(new DataColumnSpecCreator(latitudeColumn, DoubleCell.TYPE).createSpec());
columns.add(new DataColumnSpecCreator(longitudeColumn, DoubleCell.TYPE).createSpec());
columns.add(new DataColumnSpecCreator(areaColumn, DoubleCell.TYPE).createSpec());
return new DataTableSpec(columns.toArray(new DataColumnSpec[0]));
}
示例12: getType
import org.opengis.feature.type.AttributeType; //导入依赖的package包/类
/** Returns the AttributeType with the name matching that passed, or null
* if not found.
*
* @param name The string to search for
* @return Null if not found
*/
@Override
public AttributeType getType(String name) {
if (attributeTypes==null) return null;
for (AttributeType at : this.attributeTypes) {
if (at.getName().getLocalPart().equals(name)) return at;
}
return null;
}
示例13: AttributeTypeImpl
import org.opengis.feature.type.AttributeType; //导入依赖的package包/类
public AttributeTypeImpl(
Name name, Class<?> binding, boolean identified, boolean isAbstract,
List<Filter> restrictions, AttributeType superType, InternationalString description
) {
super(name, binding, isAbstract, restrictions, superType, description);
this.identified = identified;
}
示例14: AttributeDescriptorImpl
import org.opengis.feature.type.AttributeType; //导入依赖的package包/类
public AttributeDescriptorImpl(
AttributeType type, Name name, int min, int max, boolean isNillable, Object defaultValue
) {
super(type,name,min,max,isNillable);
this.defaultValue = defaultValue;
}
示例15: getSchema
import org.opengis.feature.type.AttributeType; //导入依赖的package包/类
/** Get a constructed SimpleFeatureType based on all the available
* details for this table.
*
* @return
*/
public SimpleFeatureType getSchema() {
// Build the geometry descriptor for this 'image' SimpleFeatureType.
CoordinateReferenceSystem thisCRS = getBounds().getCoordinateReferenceSystem();
GeometryType gType = new GeometryTypeImpl(
new NameImpl("Envelope"),
Geometry.class,
new CoordinateReferenceSystemImpl( thisCRS.getName().getCode() ) );
// We only have two attributes - The raster data and a bounding box for the tile
ArrayList<AttributeType> attrs = new ArrayList<AttributeType>();
attrs.add(new AttributeTypeImpl(new NameImpl("the_image"), Byte[].class ) );
attrs.add(new AttributeTypeImpl(new NameImpl("the_geom"), Geometry.class) );
attrs.add(new AttributeTypeImpl(new NameImpl("tile_column"), Integer.class) );
attrs.add(new AttributeTypeImpl(new NameImpl("tile_row"), Integer.class) );
attrs.add(new AttributeTypeImpl(new NameImpl("zoom_level"), Integer.class) );
attrs.trimToSize();
// Construct the feature type
SimpleFeatureType featureType = new SimpleFeatureTypeImpl(
new NameImpl( tableName ),
attrs,
new GeometryDescriptorImpl(gType, new NameImpl("the_geom"))
);
return featureType;
}