本文整理汇总了Java中org.geotools.renderer.lite.StreamingRenderer类的典型用法代码示例。如果您正苦于以下问题:Java StreamingRenderer类的具体用法?Java StreamingRenderer怎么用?Java StreamingRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StreamingRenderer类属于org.geotools.renderer.lite包,在下文中一共展示了StreamingRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FeatureLayer
import org.geotools.renderer.lite.StreamingRenderer; //导入依赖的package包/类
public FeatureLayer(LayerType layerType, final FeatureCollection<SimpleFeatureType, SimpleFeature> fc,
PropertySet configuration) {
super(layerType, configuration);
crs = fc.getSchema().getGeometryDescriptor().getCoordinateReferenceSystem();
if (crs == null) {
// todo - check me! Why can this happen??? (nf)
crs = DefaultGeographicCRS.WGS84;
}
final ReferencedEnvelope envelope = new ReferencedEnvelope(fc.getBounds(), crs);
modelBounds = new Rectangle2D.Double(envelope.getMinX(), envelope.getMinY(),
envelope.getWidth(), envelope.getHeight());
mapContext = new DefaultMapContext(crs);
final Style style = (Style) configuration.getValue(FeatureLayerType.PROPERTY_NAME_SLD_STYLE);
mapContext.addLayer(fc, style);
renderer = new StreamingRenderer();
workaroundLabelCacheBug();
style.accept(new RetrievingStyleVisitor());
renderer.setContext(mapContext);
}
示例2: getRenderer
import org.geotools.renderer.lite.StreamingRenderer; //导入依赖的package包/类
private static GTRenderer getRenderer(File shapeFilesFolder) {
File[] shpFiles = shapeFilesFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".shp");
}
});
MapContent mapContent = new MapContent();
for (File shpFile : shpFiles) {
try {
SimpleFeatureCollection readFC = NwwUtilities.readAndReproject(shpFile.getAbsolutePath());
ReferencedEnvelope tmpBounds = readFC.getBounds();
if (tmpBounds.getWidth() == 0 || tmpBounds.getHeight() == 0) {
System.err.println("Ignoring: " + shpFile);
continue;
}
// if (bounds == null) {
// bounds = new ReferencedEnvelope(tmpBounds);
// } else {
// bounds.expandToInclude(tmpBounds);
// }
Style style = SldUtilities.getStyleFromFile(shpFile);
if (style == null)
style = SLD.createSimpleStyle(readFC.getSchema());
FeatureLayer layer = new FeatureLayer(readFC, style);
mapContent.addLayer(layer);
} catch (Exception e) {
e.printStackTrace();
}
}
GTRenderer renderer = new StreamingRenderer();
renderer.setMapContent(mapContent);
return renderer;
}
示例3: getRenderer
import org.geotools.renderer.lite.StreamingRenderer; //导入依赖的package包/类
private static GTRenderer getRenderer( File rasterFile ) {
AbstractGridFormat format = GridFormatFinder.findFormat(rasterFile);
AbstractGridCoverage2DReader coverageReader = format.getReader(rasterFile);
MapContent mapContent = new MapContent();
try {
Style rasterStyle = SldUtilities.getStyleFromFile(rasterFile);
if (rasterStyle == null) {
RasterSymbolizer sym = SldUtilities.sf.getDefaultRasterSymbolizer();
rasterStyle = SLD.wrapSymbolizers(sym);
}
GridReaderLayer layer = new GridReaderLayer(coverageReader, rasterStyle);
mapContent.addLayer(layer);
mapContent.getViewport().setCoordinateReferenceSystem(CrsUtilities.WGS84);
} catch (Exception e) {
e.printStackTrace();
}
GTRenderer renderer = new StreamingRenderer();
renderer.setMapContent(mapContent);
return renderer;
}
示例4: callPipeline
import org.geotools.renderer.lite.StreamingRenderer; //导入依赖的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;
}
示例5: getRenderer
import org.geotools.renderer.lite.StreamingRenderer; //导入依赖的package包/类
/**
* Gets the renderer, creating a default one if required.
*
* @return the renderer
*/
public GTRenderer getRenderer() {
if (renderer == null) {
doSetRenderer(new StreamingRenderer());
}
return renderer;
}
示例6: drawMap
import org.geotools.renderer.lite.StreamingRenderer; //导入依赖的package包/类
private void drawMap(GraphicsContext gc) {
if (!repaint) {
return;
}
repaint = false;
StreamingRenderer draw = new StreamingRenderer();
draw.setMapContent(map);
FXGraphics2D graphics = new FXGraphics2D(gc);
graphics.setBackground(java.awt.Color.WHITE);
graphics.clearRect(0, 0, (int) canvas.getWidth(), (int) canvas.getHeight());
Rectangle rectangle = new Rectangle((int) canvas.getWidth(), (int) canvas.getHeight());
draw.paint(graphics, rectangle, map.getViewport().getBounds());
}
示例7: createPartControl
import org.geotools.renderer.lite.StreamingRenderer; //导入依赖的package包/类
@Override
public void createPartControl(final Composite composite) {
final Composite parent = GamaToolbarFactory.createToolbars(this, composite);
displayInfoString();
pane = new SwtMapPane(parent, SWT.NO_BACKGROUND, new StreamingRenderer(), content);
pane.setBackground(GamaColors.system(SWT.COLOR_WHITE));
pane.setCursorTool(new DragTool());
pane.redraw();
}
示例8: createPartControl
import org.geotools.renderer.lite.StreamingRenderer; //导入依赖的package包/类
@Override
public void createPartControl(final Composite composite) {
final Composite parent = GamaToolbarFactory.createToolbars(this, composite);
final SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL | SWT.NULL);
displayInfoString();
mapLayerTable = new MapLayerComposite(sashForm, SWT.BORDER);
pane = new SwtMapPane(sashForm, SWT.BORDER | SWT.NO_BACKGROUND, new StreamingRenderer(), content);
pane.setBackground(GamaColors.system(SWT.COLOR_WHITE));
pane.setCursorTool(newDragTool());
mapLayerTable.setMapPane(pane);
sashForm.setWeights(new int[] { 1, 4 });
pane.redraw();
}
示例9: RenderingTask
import org.geotools.renderer.lite.StreamingRenderer; //导入依赖的package包/类
public RenderingTask(Point aTilePoint) throws NoninvertibleTransformException {
super();
tilePoint = new Point(aTilePoint);
tileCenter = expandPointFromCell(tilePoint);
calcAoi();
taskRenderer = archieveRenderer();
Map<Object, Object> hints = new HashMap<>();
hints.put(StreamingRenderer.ADVANCED_PROJECTION_HANDLING_KEY, Boolean.TRUE);
taskRenderer.setRendererHints(hints);
tileTransform = new AffineTransform(cartesian2ScreenTransform);
}
示例10: getRenderer
import org.geotools.renderer.lite.StreamingRenderer; //导入依赖的package包/类
private static GTRenderer getRenderer( SimpleFeatureCollection featureCollectionLL, Style style ) {
MapContent mapContent = new MapContent();
try {
FeatureLayer layer = new FeatureLayer(featureCollectionLL, style);
mapContent.addLayer(layer);
} catch (Exception e) {
e.printStackTrace();
}
GTRenderer renderer = new StreamingRenderer();
renderer.setMapContent(mapContent);
return renderer;
}
示例11: getRenderer
import org.geotools.renderer.lite.StreamingRenderer; //导入依赖的package包/类
private static GTRenderer getRenderer( ASpatialDb db, String tableName, int featureLimit, Style style ) {
MapContent mapContent = new MapContent();
// read data and convert it to featurecollection
try {
long t1 = System.currentTimeMillis();
System.out.println("STARTED READING: " + tableName);
String databasePath = db.getDatabasePath();
File dbFile = new File(databasePath);
File parentFolder = dbFile.getParentFile();
if (style == null) {
File sldFile = new File(parentFolder, tableName + ".sld");
if (sldFile.exists()) {
style = SldUtilities.getStyleFromFile(sldFile);
}
}
DefaultFeatureCollection fc = SpatialDbsImportUtils.tableToFeatureFCollection(db, tableName, featureLimit,
NwwUtilities.GPS_CRS_SRID);
long t2 = System.currentTimeMillis();
System.out.println("FINISHED READING: " + tableName + " -> " + ((t2 - t1) / 1000) + "sec");
if (style == null) {
style = SLD.createSimpleStyle(fc.getSchema());
}
FeatureLayer layer = new FeatureLayer(fc, style);
long t3 = System.currentTimeMillis();
System.out.println("FINISHED BUILDING: " + tableName + " -> " + ((t3 - t2) / 1000) + "sec");
mapContent.addLayer(layer);
} catch (Exception e) {
e.printStackTrace();
}
GTRenderer renderer = new StreamingRenderer();
renderer.setMapContent(mapContent);
return renderer;
}
示例12: execute
import org.geotools.renderer.lite.StreamingRenderer; //导入依赖的package包/类
public void execute() {
StreamingRenderer renderer = new StreamingRenderer();
renderer.setContext(mapContext);
renderer.setThreadPool(threadPool);
// we use OGC scale for predictable conversion between pix/m scale and relative scale
if (!hints.containsKey(StreamingRenderer.SCALE_COMPUTATION_METHOD_KEY)) {
hints.put(StreamingRenderer.SCALE_COMPUTATION_METHOD_KEY, StreamingRenderer.SCALE_OGC);
}
renderer.setRendererHints(hints);
renderer.paint(graphics, mapContext.getViewport().getScreenArea(), mapContext.getViewport().getBounds());
mapContext.dispose();
}
示例13: renderToFile
import org.geotools.renderer.lite.StreamingRenderer; //导入依赖的package包/类
private void renderToFile( int imageWidth, int imageHeight, File imageFolderFile, File vesselFile,
ReferencedEnvelope referencedEnvelope, StreamingRenderer renderer, String fileEnding ) throws IOException {
Rectangle imageBounds = new Rectangle(0, 0, imageWidth, imageHeight);
BufferedImage dumpImage = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = dumpImage.createGraphics();
g2d.fillRect(0, 0, imageWidth, imageHeight);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
renderer.paint(g2d, imageBounds, referencedEnvelope);
ImageIO.write(dumpImage, "png", new File(imageFolderFile, vesselFile.getName() + fileEnding)); //$NON-NLS-1$
}
示例14: internal_renderMap
import org.geotools.renderer.lite.StreamingRenderer; //导入依赖的package包/类
/**
* Internal_render map.
*
* @param layers the layers
* @param bounds the bounds
* @param imageSize the image size
* @param hasGeometry the has geometry
* @param dpi the dpi
*/
private void internal_renderMap(List<Layer> layers, ReferencedEnvelope bounds,
Rectangle imageSize, boolean hasGeometry, int dpi) {
MapContent map = new MapContent();
map.addLayers(layers);
try {
Map<Object, Object> hints = new HashMap<Object, Object>();
if (OVERRIDE_DPI) {
hints.put(StreamingRenderer.DPI_KEY, dpi);
}
// This ensures all the labelling is cleared
hints.put(StreamingRenderer.LABEL_CACHE_KEY, new LabelCacheImpl());
renderer.setRendererHints(hints);
renderer.setMapContent(map);
BufferedImage image = new BufferedImage(imageSize.width, imageSize.height,
BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = image.createGraphics();
if (useAntiAlias) {
graphics.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON));
}
try {
if (!hasGeometry) {
graphics.setColor(Color.BLACK);
int y = imageSize.height / 2;
Font font = new Font(Font.SERIF, Font.BOLD, 14);
graphics.setFont(font);
graphics.drawString(
Localisation.getString(RenderPanelImpl.class, "RenderPanelImpl.error1"),
10, y - 14);
} else {
renderer.paint(graphics, imageSize, bounds);
this.bImage = image;
}
} finally {
graphics.dispose();
}
} finally {
map.dispose();
}
}
示例15: archieveRenderer
import org.geotools.renderer.lite.StreamingRenderer; //导入依赖的package包/类
@Override
protected GTRenderer archieveRenderer() {
return new StreamingRenderer();
}