Hi Francisco, <br>in fact in my code I did:<br><br>IProjection viewProj = getView().getProjection();<br>
IProjection layerProj = CRSFactory.getCRS("EPSG:3003");<br><div class="h5">if(viewProj.getAbrev().equals(layerProj.getAbrev()))<br>
layerProj = viewProj;</div><br>but this is somehow strange..<br><br>Thanks for your reply,<br>Flavio<br><br><div class="gmail_quote">2011/5/18 Francisco José Peñarrubia <span dir="ltr"><<a href="mailto:fpenarru@gmail.com">fpenarru@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div text="#000000" bgcolor="#ffffff">
Hi Flavio.<br>
<br>
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.<br>
If you find in some places the test with null, I think is a bug, or
is a source of problems.<br>
<br>
Best regards, and sorry if I can't help more....<br>
<br>
Fran.<br>
<br>
El 18/05/2011 16:54, Flavio Pompermaier escribió:
<blockquote type="cite"><div><div></div><div class="h5">Hi to all,<br>
I've recently faced with a strange problem during the creation of
a layer in gvSIG 1.10.<br>
In my old method, to create a layer there were the following
lines:<br>
<br>
IProjection viewProj = getView().getProjection(); // view's
projection is EPSG:3003<br>
IProjection layerProj = CRSFactory.getCRS("EPSG:3003");<br>
....<br>
layer.setProjection(layerProj);<br>
ICoordTrans ct = layerProj.getCT(viewProj);<br>
layer.setCoordTrans(ct);<br>
<br>
I expected that no transformation were applied to the geometries
of my layer. Instead, on FLayers.addLayer the following code is
executed:<br>
private void doAddLayerSecure(int pos,FLayer layer) {<br>
layers.add(pos,layer);<br>
layer.setParentLayer(this);<br>
if(layer.getProjection() != null && fmap != null)<br>
layer.setCoordTrans(layer.getProjection().getCT(fmap.getProjection()));<br>
this.updateDrawVersion();<br>
}<br>
<br>
and the layer.getProjection().getCT(fmap.getProjection()) returns
something !=null and this was causing troubles (for example during
editing or geoprocessing).<br>
This is strange because, in my case, fmap.getProjection() and
layer.getProjection() refers to the same projection definition
(they are actually 2 different instances) .<br>
To fix the problem I had to write:<br>
<br>
IProjection viewProj = getView().getProjection();<br>
IProjection layerProj = CRSFactory.getCRS("EPSG:3003");<br>
if(viewProj.getAbrev().equals(layerProj.getAbrev()))<br>
layerProj = viewProj;<br>
<br>
Why this behaviour? Is it a bug or there's something that I'm
missing?<br>
<br>
Best regards,<br>
Flavio<br>
</div></div><pre><fieldset></fieldset>
_______________________________________________
Gvsig_internacional mailing list
<a href="mailto:Gvsig_internacional@listserv.gva.es" target="_blank">Gvsig_internacional@listserv.gva.es</a>
<a href="http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional" target="_blank">http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional</a>
</pre>
</blockquote>
<br>
<pre cols="72">--
Fran Peñarrubia
Scolab
<a href="http://www.scolab.es" target="_blank">www.scolab.es</a>
Asociación gvSIG
<a href="http://www.gvsig.com" target="_blank">www.gvsig.com</a>
</pre>
</div>
<br>_______________________________________________<br>
Gvsig_internacional mailing list<br>
<a href="mailto:Gvsig_internacional@listserv.gva.es">Gvsig_internacional@listserv.gva.es</a><br>
<a href="http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional" target="_blank">http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional</a><br>
<br></blockquote></div><br>