Revision 30003 trunk/extensions/extArcims/src/es/prodevelop/cit/gvsig/arcims/fmap/layers/FFeatureLyrArcIMS.java
FFeatureLyrArcIMS.java | ||
---|---|---|
61 | 61 |
|
62 | 62 |
import org.apache.log4j.Logger; |
63 | 63 |
import org.cresques.cts.ICoordTrans; |
64 |
import org.cresques.cts.IProjection; |
|
64 | 65 |
import org.gvsig.remoteClient.arcims.ArcImsClientP; |
65 | 66 |
import org.gvsig.remoteClient.arcims.ArcImsFeatureClient; |
66 | 67 |
import org.gvsig.remoteClient.arcims.ArcImsVectStatus; |
... | ... | |
77 | 78 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
78 | 79 |
import com.hardcode.gdbms.engine.values.Value; |
79 | 80 |
import com.iver.andami.PluginServices; |
81 |
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException; |
|
80 | 82 |
import com.iver.cit.gvsig.fmap.MapContext; |
81 | 83 |
import com.iver.cit.gvsig.fmap.MapControl; |
82 | 84 |
import com.iver.cit.gvsig.fmap.ViewPort; |
... | ... | |
225 | 227 |
IVectorLegend lgnd = (IVectorLegend) getLegend(); |
226 | 228 |
|
227 | 229 |
// get needed fields |
230 |
String[] _legflds = null; |
|
228 | 231 |
String[] legflds = null; |
229 | 232 |
String[] savedFieldNames = arcimsStatus.getSubfields(); |
230 | 233 |
|
231 | 234 |
if (lgnd instanceof IClassifiedVectorLegend) { |
232 |
legflds = ((IClassifiedVectorLegend) lgnd).getClassifyingFieldNames(); |
|
235 |
|
|
236 |
_legflds = ((IClassifiedVectorLegend) lgnd).getClassifyingFieldNames(); |
|
237 |
legflds = replaceSpecialChars(_legflds); |
|
238 |
// legflds = _legflds; |
|
239 |
|
|
233 | 240 |
if (legflds!=null) { |
234 | 241 |
String[] appended = appendAtringArrays(savedFieldNames, legflds); |
235 | 242 |
arcimsStatus.setSubfields(appended); |
... | ... | |
475 | 482 |
this.setActive(false); |
476 | 483 |
throw e; |
477 | 484 |
} |
478 |
|
|
479 |
|
|
480 | 485 |
} |
481 | 486 |
} |
482 | 487 |
|
483 | 488 |
|
484 | 489 |
|
490 |
private String[] replaceSpecialChars(String[] _legflds) { |
|
491 |
|
|
492 |
int len = _legflds.length; |
|
493 |
String[] resp = new String[len]; |
|
494 |
for (int i=0; i<len; i++) { |
|
495 |
resp[i] = replaceSpecialChars(_legflds[i]); |
|
496 |
} |
|
497 |
return resp; |
|
498 |
} |
|
499 |
|
|
500 |
private String replaceSpecialChars(String str) { |
|
501 |
if (str.compareToIgnoreCase("zIDz") == 0) return "#ID#"; |
|
502 |
if (str.compareToIgnoreCase("zSHAPEz") == 0) return "#SHAPE#"; |
|
503 |
return str; |
|
504 |
} |
|
505 |
|
|
485 | 506 |
private boolean isNotSame(ICoordTrans trans) { |
486 | 507 |
|
487 | 508 |
String from_abb = trans.getPOrig().getAbrev(); |
... | ... | |
1080 | 1101 |
|
1081 | 1102 |
// return getClass().getClassLoader().getResource(path); |
1082 | 1103 |
} |
1104 |
|
|
1105 |
|
|
1106 |
|
|
1107 |
public Rectangle2D getFullExtent() throws ReadDriverException, ExpansionFileReadException { |
|
1108 |
|
|
1109 |
ReadableVectorial rv = getSource(); |
|
1110 |
|
|
1111 |
Rectangle2D rAux; |
|
1112 |
rv.start(); |
|
1113 |
rAux = (Rectangle2D) rv.getFullExtent().clone(); |
|
1114 |
rv.stop(); |
|
1083 | 1115 |
|
1116 |
// Si existe reproyecci?n, reproyectar el extent |
|
1117 |
ICoordTrans ct = getCoordTrans(); |
|
1118 |
try{ |
|
1119 |
if ((ct != null) && (!sourceEqualsTarget(ct))) { |
|
1120 |
Point2D pt1 = new Point2D.Double(rAux.getMinX(), rAux.getMinY()); |
|
1121 |
Point2D pt2 = new Point2D.Double(rAux.getMaxX(), rAux.getMaxY()); |
|
1122 |
pt1 = ct.convert(pt1, null); |
|
1123 |
pt2 = ct.convert(pt2, null); |
|
1124 |
rAux = new Rectangle2D.Double(); |
|
1125 |
rAux.setFrameFromDiagonal(pt1, pt2); |
|
1126 |
} |
|
1127 |
} catch (IllegalStateException e) { |
|
1128 |
// this.setAvailable(false); |
|
1129 |
// this.addError(new ReprojectLayerException(getName(), e)); |
|
1130 |
logger.error("Unable to reproject extent: " + rAux.toString()); |
|
1131 |
logger.error("Transf from CRS: " + ct.getPOrig().getFullCode()); |
|
1132 |
logger.error("Transf to CRS : " + ct.getPDest().getFullCode()); |
|
1133 |
logger.warn("No reprojection made."); |
|
1134 |
} |
|
1135 |
//Esto es para cuando se crea una capa nueva con el fullExtent de ancho y alto 0. |
|
1136 |
if (rAux.getWidth()==0 && rAux.getHeight()==0) { |
|
1137 |
rAux=new Rectangle2D.Double(0,0,100,100); |
|
1138 |
} |
|
1139 |
|
|
1140 |
return rAux; |
|
1141 |
|
|
1142 |
} |
|
1143 |
|
|
1144 |
private boolean sourceEqualsTarget(ICoordTrans ct) { |
|
1145 |
|
|
1146 |
IProjection p1 = ct.getPOrig(); |
|
1147 |
IProjection p2 = ct.getPDest(); |
|
1148 |
String str1 = p1.getFullCode(); |
|
1149 |
String str2 = p2.getFullCode(); |
|
1150 |
return (str1.compareTo(str2) == 0); |
|
1151 |
} |
|
1152 |
|
|
1153 |
|
|
1154 |
|
|
1155 |
|
|
1084 | 1156 |
/** |
1085 | 1157 |
* Keeps the image's height and width or the image's tiles' height and |
1086 | 1158 |
* width, if any. These values are the same as the viewPort's height and |
Also available in: Unified diff