Tabnine Logo
RenderHelper
Code IndexAdd Tabnine to your IDE (free)

How to use
RenderHelper
in
org.deegree.rendering.r2d

Best Java code snippets using org.deegree.rendering.r2d.RenderHelper (Showing top 19 results out of 315)

origin: deegree/deegree3

public GetFeatureInfo( List<String> layers, int width, int height, int x, int y, Envelope envelope, ICRS crs,
            int featureCount ) {
  this.layers.addAll( map( layers, FROM_NAMES ) );
  this.width = width;
  this.height = height;
  this.x = x;
  this.y = y;
  this.bbox = envelope;
  this.crs = crs;
  this.featureCount = featureCount;
  scale = RenderHelper.calcScaleWMS130( width, height, bbox, crs, DEFAULT_PIXEL_SIZE );
}
origin: deegree/deegree3

public double getResolution() {
  return RenderHelper.calcResolution( envelope, width, height );
}

origin: deegree/deegree3

/**
 * @param graphics
 * @param width
 * @param height
 * @param bbox
 */
public Java2DRenderer( Graphics2D graphics, int width, int height, Envelope bbox ) {
  this.graphics = graphics;
  this.width = width;
  if ( bbox != null ) {
    Pair<Envelope, DoublePair> p = RenderHelper.getWorldToScreenTransform( worldToScreen, bbox, width, height );
    double scalex = p.second.first;
    double scaley = p.second.second;
    bbox = p.first;
    res = calculateResolution( bbox, width );
    LOG.debug( "For coordinate transformations, scaling by x = {} and y = {}", scalex, -scaley );
    LOG.trace( "Final transformation was {}", worldToScreen );
  } else {
    LOG.warn( "No envelope given, proceeding with a scale of 1." );
  }
  initRenderers( bbox );
}
origin: deegree/deegree3

/**
 * @param graphics
 * @param width
 * @param height
 * @param envelope
 */
public Java2DTileRenderer( Graphics2D graphics, int width, int height, Envelope envelope ) {
  this.graphics = graphics;
  RenderHelper.getWorldToScreenTransform( worldToScreen, envelope, width, height );
}
origin: deegree/deegree3

void applyGraphicFill( Graphic graphic, UOM uom ) {
  BufferedImage img;
  if ( graphic.image == null ) {
    int size = round( uomCalculator.considerUOM( graphic.size, uom ) );
    img = new BufferedImage( size, size, TYPE_INT_ARGB );
    Graphics2D g = img.createGraphics();
    Java2DRenderer renderer = new Java2DRenderer( g );
    renderMark( graphic.mark, graphic.size < 0 ? 6 : size, uom, renderer.rendererContext, 0, 0,
          graphic.rotation );
    g.dispose();
  } else {
    img = graphic.image;
  }
  graphics.setPaint( new TexturePaint( img, getGraphicBounds( graphic, 0, 0, uom ) ) );
}
origin: deegree/deegree3

static double calculateResolution( final Envelope bbox, int width ) {
  double res;
  try {
    if ( isXyOrdered( bbox.getCoordinateSystem() ) ) {
origin: deegree/deegree3

reqEnv = new GeometryTransformer( srs ).transform( bbox );
double scale = RenderHelper.calcScaleWMS111( width, height, bbox, bbox.getCoordinateSystem() );
double newScale = RenderHelper.calcScaleWMS111( width, height, reqEnv, CRSManager.getCRSRef( srs ) );
double ratio = scale / newScale;
origin: deegree/deegree3

/**
 * @param graphics
 * @param width
 * @param height
 * @param bbox
 */
public Java2DRasterRenderer( Graphics2D graphics, int width, int height, Envelope bbox ) {
  this.graphics = graphics;
  this.width = width;
  this.height = height;
  this.envelope = bbox;
  if ( bbox != null ) {
    Pair<Envelope, DoublePair> p = RenderHelper.getWorldToScreenTransform( worldToScreen, bbox, width, height );
    double scalex = p.second.first;
    double scaley = p.second.second;
    bbox = p.first;
    resx = abs( 1 / scalex );
    resy = abs( 1 / scaley );
    // we have to flip horizontally, so invert y scale and add the screen height
    worldToScreen.translate( -bbox.getMin().get0() * scalex, bbox.getMin().get1() * scaley + height );
    worldToScreen.scale( scalex, -scaley );
    LOG.debug( "For coordinate transformations, scaling by x = {} and y = {}", scalex, -scaley );
    LOG.trace( "Final transformation was {}", worldToScreen );
  } else {
    LOG.warn( "No envelope given, proceeding with a scale of 1." );
  }
}
origin: deegree/deegree3

void render( PointStyling styling, double x, double y ) {
  Point2D.Double p = (Point2D.Double) worldToScreen.transform( new Point2D.Double( x, y ), null );
  x = p.x;
  y = p.y;
  Graphic g = styling.graphic;
  Rectangle2D.Double rect = rendererContext.fillRenderer.getGraphicBounds( g, x, y, styling.uom );
  if ( g.image == null && g.imageURL == null ) {
    renderMark( g.mark, g.size < 0 ? 6
                   : round( rendererContext.uomCalculator.considerUOM( g.size, styling.uom ) ),
          styling.uom, rendererContext, rect.getMinX(), rect.getMinY(), g.rotation );
    return;
  }
  BufferedImage img = g.image;
  // try if it's an svg
  if ( img == null && g.imageURL != null ) {
    img = rendererContext.svgRenderer.prepareSvg( rect, g );
  }
  if ( img != null ) {
    // TODO: fix rotation if anchor point is not 0.5,0.5 - see org.deegree.rendering.r2d.Java2DRendererTest.testPointStyling()
    AffineTransform t = rendererContext.graphics.getTransform();
    if ( !isZero( g.rotation ) ) {
      int rotationPointX = round( rect.x + rect.getWidth() * g.anchorPointX );
      int rotationPointY = round( rect.y + rect.getHeight() * g.anchorPointY );
      rendererContext.graphics.rotate( toRadians( g.rotation ), rotationPointX, rotationPointY );
    }
    rendererContext.graphics.drawImage( img, round( rect.x ), round( rect.y ), round( rect.width ),
                      round( rect.height ), null );
    rendererContext.graphics.setTransform( t );
  }
}
origin: deegree/deegree3

public static Pair<Envelope, DoublePair> getWorldToScreenTransform( AffineTransform worldToScreen, Envelope bbox,
                                  int width, int height ) {
  // we have to flip horizontally, so invert y-axis and move y-axis with screen height
  worldToScreen.scale( 1, -1 );
  worldToScreen.translate( 0, -height );
  // calculate scalex, scaley and swap axis if necessary
  final double scalex, scaley;
  final ICRS crs = bbox.getCoordinateSystem();
  if ( isXyOrdered( crs ) ) {
    scalex = width / bbox.getSpan0();
    scaley = height / bbox.getSpan1();
  } else {
    worldToScreen.scale( -1, 1 );
    worldToScreen.rotate( Math.PI / 2 );
    scalex = height / bbox.getSpan0();
    scaley = width / bbox.getSpan1();
  }
  worldToScreen.scale( scalex, scaley );
  worldToScreen.translate( -bbox.getMin().get0(), -bbox.getMin().get1() );
  return new Pair<Envelope, DoublePair>( bbox, new DoublePair( scalex, scaley ) );
}
origin: deegree/deegree3

public double getScale() {
  return calcScaleWMS130( width, height, envelope, envelope.getCoordinateSystem(), pixelSize );
}
origin: deegree/deegree3

public GetFeatureInfo( List<LayerRef> layers, List<StyleRef> styles, List<String> queryLayers, int width,
            int height, int x, int y, Envelope envelope, ICRS crs, int featureCount, String infoFormat,
            HashMap<String, String> parameterMap, Map<String, List<?>> dimensions ) throws OWSException {
  this.layers.addAll( layers );
  this.styles.addAll( styles );
  cleanUpLayers( queryLayers );
  this.width = width;
  this.height = height;
  this.x = x;
  this.y = y;
  this.bbox = envelope;
  this.crs = crs;
  this.featureCount = featureCount;
  this.infoFormat = infoFormat;
  this.dimensions.putAll( dimensions );
  this.parameterMap.putAll( parameterMap );
  this.scale = RenderHelper.calcScaleWMS130( width, height, bbox, crs, DEFAULT_PIXEL_SIZE );
}
origin: deegree/deegree3

public LayerQuery( Envelope envelope, int width, int height, int x, int y, int featureCount, OperatorFilter filter,
          StyleRef style, Map<String, String> parameters, Map<String, List<?>> dimensions,
          MapOptionsMaps options, Envelope queryBox, int layerRadius ) {
  this.envelope = envelope;
  this.width = width;
  this.height = height;
  this.x = x;
  this.y = y;
  this.featureCount = featureCount;
  this.filter = filter;
  this.style = style;
  this.parameters = parameters;
  this.dimensions = dimensions;
  this.options = options;
  this.queryBox = queryBox;
  this.layerRadius = layerRadius;
  this.scale = RenderHelper.calcScaleWMS130( width, height, envelope, envelope.getCoordinateSystem(),
                        DEFAULT_PIXEL_SIZE );
  this.resolution = Utils.calcResolution( envelope, width, height );
}
origin: deegree/deegree3

/**
 * @param envelope
 * @param width
 * @param height
 * @param style
 * @param filters
 * @param parameters
 * @param dimensions
 * @param pixelSize
 *            must be in meter, not mm
 * @param options
 * @param layerRadius
 */
public LayerQuery( Envelope envelope, int width, int height, StyleRef style, OperatorFilter filter,
          Map<String, String> parameters, Map<String, List<?>> dimensions, double pixelSize,
          MapOptionsMaps options, Envelope queryBox ) {
  this.envelope = envelope;
  this.width = width;
  this.height = height;
  this.style = style;
  this.filter = filter;
  this.parameters = parameters;
  this.dimensions = dimensions;
  this.options = options;
  this.queryBox = queryBox;
  this.scale = RenderHelper.calcScaleWMS130( width, height, envelope, envelope.getCoordinateSystem(), pixelSize );
  this.resolution = Utils.calcResolution( envelope, width, height );
}
origin: deegree/deegree3

handleVSPs( new HashMap<String, String>(), exts );
try {
  scale = RenderHelper.calcScaleWMS130( width, height, bbox, crs, pixelSize );
  LOG.debug( "GetMap request has a WMS 1.3.0/SLD scale of '{}' (adapted to pixel size of {}).", scale,
        pixelSize );
origin: deegree/deegree3

public GetMap( List<Pair<String, String>> layers, int width, int height, Envelope boundingBox, String format,
        boolean transparent ) throws OWSException {
  for ( Pair<String, String> layer : layers ) {
    this.layers.add( new LayerRef( layer.first ) );
    this.styles.add( layer.second != null ? new StyleRef( layer.second ) : null );
  }
  this.width = width;
  this.height = height;
  this.bbox = boundingBox;
  this.crs = boundingBox.getCoordinateSystem();
  this.bgcolor = white;
  this.format = format;
  this.transparent = transparent;
  try {
    scale = RenderHelper.calcScaleWMS130( width, height, bbox, crs, pixelSize );
    LOG.debug( "GetMap request has a WMS 1.3.0/SLD scale of '{}' (adapted to pixel size of {}).", scale,
          pixelSize );
    resolution = max( bbox.getSpan0() / width, bbox.getSpan1() / height );
    LOG.debug( "Resolution per pixel is {}.", resolution );
  } catch ( ReferenceResolvingException e ) {
    LOG.trace( "Stack trace:", e );
    throw new OWSException( e.getLocalizedMessage(), "InvalidParameterValue" );
  }
}
origin: deegree/deegree3

/**
 * @param map
 * @param version
 * @param service
 * @throws OWSException
 */
public GetFeatureInfo( Map<String, String> map, Version version ) throws OWSException {
  if ( version.equals( VERSION_111 ) ) {
    parse111( map );
  }
  if ( version.equals( VERSION_130 ) ) {
    parse130( map );
  }
  parameterMap.putAll( map );
  scale = RenderHelper.calcScaleWMS130( width, height, bbox, crs, DEFAULT_PIXEL_SIZE );
}
origin: deegree/deegree3

/**
 * @param map
 * @param version
 * @param service
 * @throws OWSException
 */
public GetMap( Map<String, String> map, Version version, MapOptionsMaps exts ) throws OWSException {
  if ( version.equals( VERSION_111 ) ) {
    parse111( map, exts );
  }
  if ( version.equals( VERSION_130 ) ) {
    parse130( map, exts );
  }
  parameterMap.putAll( map );
  try {
    scale = RenderHelper.calcScaleWMS130( width, height, bbox, crs, pixelSize );
    LOG.debug( "GetMap request has a WMS 1.3.0/SLD scale of '{}' (adapted to pixel size of {}).", scale,
          pixelSize );
    resolution = max( bbox.getSpan0() / width, bbox.getSpan1() / height );
    LOG.debug( "Resolution per pixel is {}.", resolution );
  } catch ( ReferenceResolvingException e ) {
    LOG.trace( "Stack trace:", e );
    LOG.warn( "The scale of a GetMap request could not be calculated: '{}'.", e.getLocalizedMessage() );
  }
}
origin: deegree/deegree3

List<LayerData> list = new ArrayList<LayerData>();
double scale = calcScaleWMS130( gfi.getWidth(), gfi.getHeight(), gfi.getEnvelope(), gfi.getCoordinateSystem(),
                DEFAULT_PIXEL_SIZE );
org.deegree.rendering.r2dRenderHelper

Javadoc

RenderHelper

Most used methods

  • calcScaleWMS130
  • calcResolution
  • calcScaleWMS111
  • calculateResolution
  • getWorldToScreenTransform
  • isXyOrdered
  • renderMark

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSharedPreferences (Context)
  • getExternalFilesDir (Context)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • JCheckBox (javax.swing)
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now