<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body 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
cite="mid:BANLkTinJBxQCeeHszw7-gyioOZbnfD6y8A@mail.gmail.com"
type="cite">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>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Gvsig_internacional mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Gvsig_internacional@listserv.gva.es">Gvsig_internacional@listserv.gva.es</a>
<a class="moz-txt-link-freetext" href="http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional">http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Fran Peñarrubia
Scolab
<a class="moz-txt-link-abbreviated" href="http://www.scolab.es">www.scolab.es</a>
Asociación gvSIG
<a class="moz-txt-link-abbreviated" href="http://www.gvsig.com">www.gvsig.com</a>
</pre>
</body>
</html>