[Gvsig_english] Layer's ICoordTrans problem

Flavio Pompermaier fla83tn at gmail.com
Thu May 19 08:58:08 CEST 2011


Hi Francisco,
in fact in my code I did:

IProjection viewProj = getView().getProjection();
IProjection layerProj = CRSFactory.getCRS("EPSG:3003");
if(viewProj.getAbrev().equals(layerProj.getAbrev()))
     layerProj = viewProj;

but this is somehow strange..

Thanks for your reply,
Flavio

2011/5/18 Francisco José Peñarrubia <fpenarru at gmail.com>

>  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 listGvsig_internacional at listserv.gva.eshttp://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>
>
> --
> Fran Peñarrubia
> Scolabwww.scolab.es
>
> Asociación gvSIGwww.gvsig.com
>
>
> _______________________________________________
> Gvsig_internacional mailing list
> Gvsig_internacional at listserv.gva.es
> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserv.gva.es/pipermail/gvsig_internacional/attachments/20110519/24241ffd/attachment.htm 


More information about the Gvsig_internacional mailing list