following up on this:

> so, it seems to me that while the position of the text to be drawn is
> within the image bounds (image bounds being 2666x1751, drawing
> transformation coordinates being 2527, 608), but the selected tile is
> wrong (tileX: 0, tileY: 0, where each tile is 1024x1024 in size - this
> should be tileX:2, tileY:0 instead)
>
>
> it seems, looking at the way maxTileX and maxTileY are calculated, the
> calculation goes astray on the bounds parameter of doDraw(). they are
> calculated in DiskMemImageGraphics.drawGlyphVector(), where
> g.getVisualBounds() returns:
>
> java.awt.geom.Rectangle2D$Float[x=0.59375,y=-5.828125,w=29.140625,h=5.921875]
>
> and the calculated bounds is:
>
> java.awt.geom.Rectangle2D$Float[x=-0.40625,y=-6.828125,w=31.140625,h=7.921875]
>
> while this seems a valid bound for the label if it would be drawn at 0,
> 0, it seems these bounds are not offset for the intended draw location
> (2527, 608)
>
>
comparing how the GlyphVector.getBounds() is interpreted in
MemDiskImageGraphics, vs. the original JAI TiledImageGraphics, there is
a difference in interpretation. the TiledImageGraphics function
transforms these bounds according to the AffineTransform object that is
set for the graphics, while DiskMemImageGraphics does not. see here:
https://svn.java.net/svn/jai-core~svn/trunk/src/share/classes/javax/media/jai/TiledImageGraphics.java

    private boolean doGraphicsOp(int x, int y, int width, int height,
                                 String name, Class[] argTypes,
                                 Object[] args) {

...


        // Transform requested area to obtain actual bounds.
        Rectangle bounds = new Rectangle(x, y, width, height);
        bounds = getTransform().createTransformedShape(bounds).getBounds();



so I guess the fix would be to add a similar transform the
DiskMemImageGraphics.

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to