[Gvsig_english] Code Question - raster layers

Aldo Stracquadanio aldo.strac at gmail.com
Thu Sep 17 09:24:49 CEST 2009


Thank you for these advices,

I will try to put them in practice soon; just for completeness I'm
sending you the gvm project that is causing me troubles. If I'll write
some code to deal with transforms of jpg/gif/png images I'll send it
too. However I don't think I will be able to use IBM J9 in production
environment, since if I'm not wrong it should be protected by licences
and we should pay to use it in a commercial application.

Regards,
Aldo Stracquadanio.

2009/9/16 Juan Lucas Dominguez Rubio <jldominguez at prodevelop.es>:
> Hello, Aldo.
>
> Yes, we know that the VM sometimes (I think J9 doesn't) uses a new thread
> when dealing with images (reading or resampling), that's why we wrote this
> method:
>
> public static Image getScaled(Image img, int newwidth, int newheight);
>
> in the ResourceReader class, but I think we forgot to use it in the draw
> method of the WKFRasterDriver class :-/
>
> So I think you have these three options:
>
> - Use the J9 version (as I said, I think J9 loads/resamples images in the
> main thread)
> - Edit the code, use that method and compile
> - Convert your JPG/PNG/GIF images to ECW with Gdal (
> http://fwtools.maptools.org )
>
> Even if you use J9 or fix the bug yourself, I recommend using ECW because
> the other formats are a great bother. After loading one of those images, the
> application becomes more unstable.
>
> Thanks for reporting this problem.
>
> As for the rotation, we simply ignore it. The second and third parameters of
> the world file (*.WLD) are not used at all, sorry. Again, with Gdal you can
> convert a rotated image (PNG/JPG/GIF + WLD file with non-zero values in
> second and third line) into a ECW file which will obviously have black
> triangles by the margins. In this case, you need two steps:
>
> gdalwarp image.jpg image.tif
> gdal_translate -of ecw image.tif image.ecw
>
>
>
> Regards,
>
> Juan Lucas Domínguez Rubio
> ---
> Prodevelop SL, Valencia (España)
> 0° 22' 49.62" W, 39° 28' 25.45" N
> Tlf.: 96.351.06.12 -- Fax: 96.351.09.68
> http://www.prodevelop.es
> ---
> ________________________________
> De: gvsig_internacional-bounces at listserv.gva.es en nombre de Aldo
> Stracquadanio
> Enviado el: mié 16/09/2009 13:00
> Para: Users and Developers mailing list
> Asunto: Re: [Gvsig_english] Code Question - raster layers
>
> Hi Juan,
>
> I know about the limitation of 400k pixels, I will send you the
> exported project I'm working on as soon as I will be in my office. The
> problem with resampling of the image is that a
> clipping-translating-composition can't resolve the rotation part of a
> generic affine transform (and I think in my image it's needed a little
> rotation too).
>
> Moreover I see that you use the getScaledInstance method to get a
> scaled instance of the image and immediatly after this you check for
> width. This often gives me -1 (causing an exception) because this
> method (like the most of the graphics methods of CDC) can exibit an
> asynchronus behavior; have you ever had such problems?
>
> Regards,
> Aldo Stracquadanio.
>
> 2009/9/15 Juan Lucas Dominguez Rubio <jldominguez at prodevelop.es>:
>> Hello, Aldo.
>>
>> As you say, the Graphics2D class in CDC knows nothing about affine
>> transforms, so you always have to provide 'final' coordinates, that is,
>> screen coordinates.
>>
>> The Image class has a resample method and of course there are ways to clip
>> an image, so all you have to do is clipping and resizing the image until
>> you
>> have the final image, and then paste it in the correct coordinates on the
>> screen, that's what the WKRasterDriver does.
>>
>> These images (we're talking about JPG, PNG and GIF images; the ECW driver
>> is
>> totally different) are very memory-consuming and can only be loaded if the
>> have less than 400,000 pixels. If we tried to open larger images, the
>> virtual machine itself would be at risk.
>>
>> We tried to do the clipping and resampling in such a way that we never
>> need
>> to instantiate a large image, but maybe this is not always possible.
>>
>> Can you send us the log files under \gvSIGMobile\log\ or even the image
>> itself?
>>
>>
>> Regards,
>> Juan Lucas Domínguez Rubio
>> ---
>> Prodevelop SL, Valencia (España)
>> 0° 22' 49.62" W, 39° 28' 25.45" N
>> Tlf.: 96.351.06.12 -- Fax: 96.351.09.68
>> http://www.prodevelop.es
>> ---
>>
>>
>>
>> -----Mensaje original-----
>> De: gvsig_internacional-bounces at listserv.gva.es en nombre de Aldo
>> Stracquadanio
>> Enviado el: mar 15/09/2009 18:32
>> Para: gvsig_internacional at listserv.gva.es
>> Asunto: [Gvsig_english] Code Question - raster layers
>>
>> Hi everybody,
>>
>> I'm reading the phoneME Mobile source code, but I can't understand
>> something about the WKFRasterDriver: if there is no support for
>> AffineTransform in CDC, how do you obtain a "shear" effect using only
>> scaling-translation operations? I can't figure it out and, as well,
>> the raster layer visualization is not working at all on my
>> installation: in my opinion there is some problem with the asynchronus
>> behaviour of the Image.getScaledInstance method since I get a "Cannot
>> resample (down)".
>>
>> Can someone help me understanding?
>> Thank's all, Aldo Stracquadanio.
>> _______________________________________________
>> Gvsig_internacional mailing list
>> Gvsig_internacional at listserv.gva.es
>> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>>
>>
>> _______________________________________________
>> Gvsig_internacional mailing list
>> Gvsig_internacional at listserv.gva.es
>> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>>
>>
> _______________________________________________
> Gvsig_internacional mailing list
> Gvsig_internacional at listserv.gva.es
> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>
> _______________________________________________
> Gvsig_internacional mailing list
> Gvsig_internacional at listserv.gva.es
> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ct-centro.rar
Type: application/octet-stream
Size: 104998 bytes
Desc: not available
Url : http://listserv.gva.es/pipermail/gvsig_internacional/attachments/20090917/7c5227a7/attachment.obj 


More information about the Gvsig_internacional mailing list