本文整理汇总了Java中org.geotools.factory.Hints类的典型用法代码示例。如果您正苦于以下问题:Java Hints类的具体用法?Java Hints怎么用?Java Hints使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Hints类属于org.geotools.factory包,在下文中一共展示了Hints类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEncodedNativeTermQuery
import org.geotools.factory.Hints; //导入依赖的package包/类
@Test
public void testEncodedNativeTermQuery() throws Exception {
init("not-active");
Map<String, String> vparams = new HashMap<String, String>();
Map<String,Object> query = ImmutableMap.of("term", ImmutableMap.of("security_ss", "WPA"));
vparams.put("q", URLEncoder.encode(mapper.writeValueAsString(query), "UTF-8"));
Hints hints = new Hints(Hints.VIRTUAL_TABLE_PARAMETERS, vparams);
Query q = new Query(featureSource.getSchema().getTypeName());
q.setHints(hints);
FilterFactory ff = dataStore.getFilterFactory();
PropertyIsEqualTo filter = ff.equals(ff.property("speed_is"), ff.literal("300"));
q.setFilter(filter);
ContentFeatureCollection features = featureSource.getFeatures(q);
assertEquals(1, features.size());
SimpleFeatureIterator fsi = features.features();
assertTrue(fsi.hasNext());
assertEquals(fsi.next().getID(), "active.12");
}
示例2: initialise
import org.geotools.factory.Hints; //导入依赖的package包/类
/**
* Initialise the WKTParser object.
*/
private static void initialise() {
Hints hints = new Hints(Hints.CRS, DefaultGeographicCRS.WGS84);
PositionFactory positionFactory = GeometryFactoryFinder.getPositionFactory(hints);
GeometryFactory geometryFactory = GeometryFactoryFinder.getGeometryFactory(hints);
PrimitiveFactory primitiveFactory = GeometryFactoryFinder.getPrimitiveFactory(hints);
AggregateFactory aggregateFactory = GeometryFactoryFinder.getAggregateFactory(hints);
wktParser = new WKTParser(geometryFactory, primitiveFactory, positionFactory,
aggregateFactory);
wktTypeList.add(new WKTType(WKT_POINT, false, 1, "Point", false, false));
wktTypeList.add(new WKTType(WKT_MULTIPOINT, true, 1, "Point", true, false));
wktTypeList.add(new WKTType(WKT_LINESTRING, false, 2, "Line", false, false));
wktTypeList.add(new WKTType("LINEARRING", false, 2, "Line", false, false));
wktTypeList.add(new WKTType(WKT_MULTILINESTRING, true, 2, "Line", true, false));
wktTypeList.add(new WKTType(WKT_POLYGON, false, -1, "Polygon", false, true));
wktTypeList.add(new WKTType(WKT_MULTIPOLYGON, true, -1, "Polygon", true, true));
for (WKTType wkyType : wktTypeList) {
wktTypeMap.put(wkyType.getName(), wkyType);
}
}
示例3: accepts
import org.geotools.factory.Hints; //导入依赖的package包/类
@Override
public boolean accepts(Object source, Hints hints)
{
File configfile = null;
if (source instanceof URI)
{
configfile = new File((URI) source);
}
else if (source instanceof String)
{
configfile = new File(source.toString());
}
else if (source instanceof File)
{
configfile = (File)source;
}
else
{
return false;
}
return configfile.exists();
}
示例4: loadImage
import org.geotools.factory.Hints; //导入依赖的package包/类
private void loadImage() throws IOException {
File file = new File(path);
GeoTiffReader reader = new GeoTiffReader(file, new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE));
coverage = (GridCoverage2D) reader.read(null);
crs = coverage.getCoordinateReferenceSystem();
env = new ReferencedEnvelope(coverage.getEnvelope2D());
}
示例5: testNativeAggregation
import org.geotools.factory.Hints; //导入依赖的package包/类
@Test
public void testNativeAggregation() throws Exception {
init();
Map<String, String> vparams = new HashMap<String, String>();
Map<String,Object> query = ImmutableMap.of("agg", ImmutableMap.of("geohash_grid",
ImmutableMap.of("field", "geo", "precision", 3)));
vparams.put("a", mapper.writeValueAsString(query));
Hints hints = new Hints(Hints.VIRTUAL_TABLE_PARAMETERS, vparams);
Query q = new Query(featureSource.getSchema().getTypeName());
q.setHints(hints);
ContentFeatureCollection features = featureSource.getFeatures(q);
assertFalse(features.isEmpty());
SimpleFeatureIterator fsi = features.features();
assertTrue(fsi.hasNext());
assertNotNull(fsi.next().getAttribute("_aggregation"));
}
示例6: readAig
import org.geotools.factory.Hints; //导入依赖的package包/类
private void readAig( File mapFile ) throws IllegalArgumentException, IOException {
final ImageLayout l = new ImageLayout();
l.setTileGridXOffset(0).setTileGridYOffset(0).setTileHeight(512).setTileWidth(512);
Hints hints = new Hints();
hints.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT, l));
final URL url = mapFile.toURI().toURL();
final Object source = url;
final BaseGDALGridCoverage2DReader reader = new AIGReader(source, hints);
originalEnvelope = reader.getOriginalEnvelope();
if (!doEnvelope) {
outRaster = (GridCoverage2D) reader.read(generalParameter);
resample();
checkNovalues();
}
}
示例7: SimpleMonetDBFeatureReader
import org.geotools.factory.Hints; //导入依赖的package包/类
public SimpleMonetDBFeatureReader(String sql, Connection conn, SimpleMonetDBFeatureSource featureSource, SimpleFeatureType featureType, Hints hints, int srid )
throws SQLException {
init( featureSource, featureType, hints );
this.srid = srid;
CoordinateReferenceSystem sourceCrs = featureType.getGeometryDescriptor().getCoordinateReferenceSystem();
CoordinateReferenceSystem targetCrs = DefaultGeographicCRS.WGS84;
try {
targetCrs = CRS.decode("EPSG:3857");
boolean lenient = true;
mathTransform = CRS.findMathTransform(sourceCrs, targetCrs, lenient);
} catch (Exception ex) {
Logger.getLogger(SimpleMonetDBFeatureReader.class.getName()).log(Level.SEVERE, null, ex);
}
//create the result set
this.conn = conn;
st = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
rs = st.executeQuery(sql);
}
示例8: createDefaultLineFeatureTypeStyle
import org.geotools.factory.Hints; //导入依赖的package包/类
private FeatureTypeStyle createDefaultLineFeatureTypeStyle(String strokeWidth, String strokeColor, String opacity){
StyleFactory sf = CommonFactoryFinder.getStyleFactory(new Hints(Hints.KEY_RENDERING, Hints.VALUE_RENDER_SPEED));
FilterFactory filterFactory = new FilterFactoryImpl();
Stroke lineStroke = sf.getDefaultStroke();
lineStroke.setWidth(filterFactory.literal(new Integer(strokeWidth)));
lineStroke.setColor(filterFactory.literal(strokeColor));
lineStroke.setOpacity(filterFactory.literal(opacity));
LineSymbolizer lineSymbolizer = sf.createLineSymbolizer();
lineSymbolizer.setStroke(lineStroke);
Rule lineRule = sf.createRule();
lineRule.symbolizers().add(lineSymbolizer);
FeatureTypeStyle lineFeatureTypeStyle = sf.createFeatureTypeStyle(new Rule[]{lineRule});
return lineFeatureTypeStyle;
}
示例9: referencingFactoryContainer
import org.geotools.factory.Hints; //导入依赖的package包/类
void referencingFactoryContainer() {
Object datumFactory = null;
Object csFactory = null;
Object crsFactory = null;
Object mtFactory = null;
// referencingFactoryContainer start
Map<Key, Object> map = new HashMap<Key, Object>();
map.put(Hints.DATUM_FACTORY, datumFactory);
map.put(Hints.CS_FACTORY, csFactory);
map.put(Hints.CRS_FACTORY, crsFactory);
map.put(Hints.MATH_TRANSFORM_FACTORY, mtFactory);
Hints hints = new Hints(map);
ReferencingFactoryContainer container = new ReferencingFactoryContainer(hints);
// referencingFactoryContainer end
}
示例10: getReader
import org.geotools.factory.Hints; //导入依赖的package包/类
@Override
public AbstractGridCoverage2DReader getReader(
final Object source,
final Hints hints ) {
try {
return new GeoWaveRasterReader(
source,
hints);
}
catch (final Exception e) {
LOGGER.warn(
"Cannot create geowave raster reader",
e);
return null;
}
}
示例11: callPipeline
import org.geotools.factory.Hints; //导入依赖的package包/类
private RasterizingContainer callPipeline(ClientMapInfo clientMapInfo, PipelineContext context, String pipelineKey)
throws GeomajasException {
DefaultMapContext mapContext = new DefaultMapContext();
mapContext.setCoordinateReferenceSystem(geoService.getCrs2(clientMapInfo.getCrs()));
MapRasterizingInfo mapInfo = (MapRasterizingInfo) clientMapInfo.getWidgetInfo(MapRasterizingInfo.WIDGET_KEY);
mapContext.setAreaOfInterest(new ReferencedEnvelope(dtoConverterService.toInternal(mapInfo.getBounds()),
mapContext.getCoordinateReferenceSystem()));
RenderingHints renderingHints = new Hints();
renderingHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
RasterizingContainer response = new RasterizingContainer();
context.put(RasterizingPipelineCode.CLIENT_MAP_INFO_KEY, clientMapInfo);
context.put(RasterizingPipelineCode.RENDERING_HINTS, renderingHints);
Map<Object, Object> rendererHints = new HashMap<Object, Object>();
if (mapInfo.getDpi() > 0) {
rendererHints.put(StreamingRenderer.DPI_KEY, mapInfo.getDpi());
}
context.put(RasterizingPipelineCode.RENDERER_HINTS, rendererHints);
context.put(RasterizingPipelineCode.MAP_CONTEXT_KEY, mapContext);
pipelineService.execute(pipelineKey, null, context, response);
mapContext.dispose();
return response;
}
示例12: testGraphics2D
import org.geotools.factory.Hints; //导入依赖的package包/类
@Test
public void testGraphics2D() throws Exception {
ClientMapInfo mapInfo = new ClientMapInfo();
MapRasterizingInfo mapRasterizingInfo = new MapRasterizingInfo();
mapRasterizingInfo.setBounds(new Bbox(-80, -50, 100, 100));
mapInfo.setCrs("EPSG:4326");
mapRasterizingInfo.setScale(1);
mapRasterizingInfo.setTransparent(true);
mapInfo.getWidgetInfo().put(MapRasterizingInfo.WIDGET_KEY, mapRasterizingInfo);
ClientVectorLayerInfo clientBeansPointLayerInfo = new ClientVectorLayerInfo();
clientBeansPointLayerInfo.setServerLayerId(layerBeansPoint.getId());
VectorLayerRasterizingInfo layerRasterizingInfo = new VectorLayerRasterizingInfo();
layerRasterizingInfo.setStyle(layerBeansPointStyleInfo);
clientBeansPointLayerInfo.getWidgetInfo().put(VectorLayerRasterizingInfo.WIDGET_KEY, layerRasterizingInfo);
mapInfo.getLayers().add(clientBeansPointLayerInfo);
BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
RenderingHints renderingHints = new Hints();
renderingHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Graphics2D graphics2d = image.createGraphics();
graphics2d.setRenderingHints(renderingHints);
imageService.writeMap(graphics2d, mapInfo);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
imageService.writeMap(baos, mapInfo);
BufferedImage image2 = ImageIO.read(new ByteArrayInputStream(baos.toByteArray()));
Assert.assertArrayEquals(image2.getRGB(0, 0, 100, 100, null, 0, 100),image.getRGB(0, 0, 100, 100, null, 0, 100));
}
示例13: makeDefinitionQuery
import org.geotools.factory.Hints; //导入依赖的package包/类
/**
* Takes a query and adapts it to match re definitionQuery filter
* configured for a feature type.
*
* @param query Query against this DataStore
* @param schema TODO
*
* @return Query restricted to the limits of definitionQuery
*
* @throws IOException See DataSourceException
* @throws DataSourceException If query could not meet the restrictions of
* definitionQuery
*/
protected Query makeDefinitionQuery(Query query, SimpleFeatureType schema) throws IOException {
if ((query == Query.ALL) || query.equals(Query.ALL)) {
return query;
}
try {
String[] propNames = extractAllowedAttributes(query, schema);
Filter filter = query.getFilter();
filter = makeDefinitionFilter(filter);
Query defQuery = new Query(query);
defQuery.setFilter(filter);
defQuery.setPropertyNames(propNames);
// set sort by
if (query.getSortBy() != null) {
defQuery.setSortBy(query.getSortBy());
}
// tell the data sources about the default linearization tolerance for curved
// geometries they might be reading
if (linearizationTolerance != null) {
query.getHints().put(Hints.LINEARIZATION_TOLERANCE, linearizationTolerance);
}
return defQuery;
} catch (Exception ex) {
throw new DataSourceException(
"Could not restrict the query to the definition criteria: " + ex.getMessage(), ex);
}
}
示例14: createFeature
import org.geotools.factory.Hints; //导入依赖的package包/类
private static SimpleFeature createFeature(final SimpleFeatureType featureType, final Statement statement) throws ParseException {
final String subject = StatementSerializer.writeSubject(statement);
final String predicate = StatementSerializer.writePredicate(statement);
final String object = StatementSerializer.writeObject(statement);
final String context = StatementSerializer.writeContext(statement);
// create the feature
final Object[] noValues = {};
// create the hash
final String statementId = Md5Hash.md5Base64(StatementSerializer.writeStatement(statement));
final SimpleFeature newFeature = SimpleFeatureBuilder.build(featureType, noValues, statementId);
// write the statement data to the fields
final Geometry geom = GeoParseUtils.getGeometry(statement, new GmlParser());
if(geom == null || geom.isEmpty() || !geom.isValid()) {
throw new ParseException("Could not create geometry for statement " + statement);
}
newFeature.setDefaultGeometry(geom);
newFeature.setAttribute(SUBJECT_ATTRIBUTE, subject);
newFeature.setAttribute(PREDICATE_ATTRIBUTE, predicate);
newFeature.setAttribute(OBJECT_ATTRIBUTE, object);
newFeature.setAttribute(CONTEXT_ATTRIBUTE, context);
// GeoWave does not support querying based on a user generated feature ID
// So, we create a separate ID attribute that it can query on.
newFeature.setAttribute(GEO_ID_ATTRIBUTE, statementId);
// preserve the ID that we created for this feature
// (set the hint to FALSE to have GeoTools generate IDs)
newFeature.getUserData().put(Hints.USE_PROVIDED_FID, java.lang.Boolean.TRUE);
return newFeature;
}
示例15: createFeature
import org.geotools.factory.Hints; //导入依赖的package包/类
private static SimpleFeature createFeature(final SimpleFeatureType featureType, final Statement statement) throws ParseException {
final String subject = StatementSerializer.writeSubject(statement);
final String predicate = StatementSerializer.writePredicate(statement);
final String object = StatementSerializer.writeObject(statement);
final String context = StatementSerializer.writeContext(statement);
// create the feature
final Object[] noValues = {};
// create the hash
final String statementId = Md5Hash.md5Base64(StatementSerializer.writeStatement(statement));
final SimpleFeature newFeature = SimpleFeatureBuilder.build(featureType, noValues, statementId);
// write the statement data to the fields
final Geometry geom = GeoParseUtils.getGeometry(statement, new GmlParser());
if(geom == null || geom.isEmpty() || !geom.isValid()) {
throw new ParseException("Could not create geometry for statement " + statement);
}
newFeature.setDefaultGeometry(geom);
newFeature.setAttribute(SUBJECT_ATTRIBUTE, subject);
newFeature.setAttribute(PREDICATE_ATTRIBUTE, predicate);
newFeature.setAttribute(OBJECT_ATTRIBUTE, object);
newFeature.setAttribute(CONTEXT_ATTRIBUTE, context);
// preserve the ID that we created for this feature
// (set the hint to FALSE to have GeoTools generate IDs)
newFeature.getUserData().put(Hints.USE_PROVIDED_FID, java.lang.Boolean.TRUE);
return newFeature;
}