[Gvsig_english] Layer's ICoordTrans problem

Francisco José Peñarrubia fpenarru at gmail.com
Wed May 18 21:45:46 CEST 2011


Hi Flavio.

I had simillar problems in other part of gvSIG. I don't understand why 
now getProjection (since 1.10, I think) returns that, but I know you can 
do the check with getAbrev(), and it seems it works.
If you find in some places the test with null, I think is a bug, or is a 
source of problems.

Best regards, and sorry if I can't help more....

Fran.

El 18/05/2011 16:54, Flavio Pompermaier escribió:
> Hi to all,
> I've recently faced with a strange problem during the creation of a 
> layer in gvSIG 1.10.
> In my old method, to create a layer there were the following lines:
>
> IProjection viewProj = getView().getProjection(); // view's projection 
> is EPSG:3003
> IProjection layerProj = CRSFactory.getCRS("EPSG:3003");
> ....
> layer.setProjection(layerProj);
> ICoordTrans ct = layerProj.getCT(viewProj);
> layer.setCoordTrans(ct);
>
> I expected that no transformation were applied to the geometries of my 
> layer. Instead, on FLayers.addLayer the following code is executed:
> private void doAddLayerSecure(int pos,FLayer layer) {
>         layers.add(pos,layer);
>         layer.setParentLayer(this);
>         if(layer.getProjection() != null && fmap != null)
>             
> layer.setCoordTrans(layer.getProjection().getCT(fmap.getProjection()));
>         this.updateDrawVersion();
>     }
>
> and the layer.getProjection().getCT(fmap.getProjection()) returns 
> something !=null and this was causing troubles (for example during 
> editing or geoprocessing).
> This is strange because, in my case, fmap.getProjection() and 
> layer.getProjection() refers to the same projection definition (they 
> are actually 2 different instances) .
> To fix the problem I had to write:
>
> IProjection viewProj = getView().getProjection();
> IProjection layerProj = CRSFactory.getCRS("EPSG:3003");
>  if(viewProj.getAbrev().equals(layerProj.getAbrev()))
>      layerProj = viewProj;
>
> Why this behaviour? Is it a bug or there's something that I'm missing?
>
> Best regards,
> Flavio
>
>
> _______________________________________________
> Gvsig_internacional mailing list
> Gvsig_internacional at listserv.gva.es
> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional

-- 
Fran Peñarrubia
Scolab
www.scolab.es

Asociación gvSIG
www.gvsig.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserv.gva.es/pipermail/gvsig_internacional/attachments/20110518/9a885ee4/attachment.htm 


More information about the Gvsig_internacional mailing list