Revision 5057
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrRaster.java | ||
---|---|---|
64 | 64 |
import com.iver.cit.gvsig.fmap.ViewPort; |
65 | 65 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
66 | 66 |
import com.iver.cit.gvsig.fmap.drivers.GeorreferencedRasterDriver; |
67 |
import com.iver.cit.gvsig.fmap.drivers.RasterDriver;
|
|
67 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.StringXMLItem;
|
|
68 | 68 |
import com.iver.cit.gvsig.fmap.operations.Cancellable; |
69 | 69 |
import com.iver.utiles.XMLEntity; |
70 |
import com.iver.utiles.xmlViewer.XMLItem; |
|
70 | 71 |
|
71 | 72 |
|
72 | 73 |
/** |
... | ... | |
348 | 349 |
return data; |
349 | 350 |
} |
350 | 351 |
|
351 |
public String getInfo(Point p, double tolerance) throws DriverException { |
|
352 |
public XMLItem[] getInfo(Point p, double tolerance) throws DriverException { |
|
353 |
|
|
354 |
StringXMLItem[] item = new StringXMLItem[1]; |
|
352 | 355 |
String data = "<file:"+normalizeAsXMLTag(getName())+">\n"; |
353 | 356 |
|
354 | 357 |
ArrayList attr = source.getAttributes(); |
... | ... | |
369 | 372 |
data += " />\n"; |
370 | 373 |
|
371 | 374 |
data += "</file:"+normalizeAsXMLTag(getName())+">\n"; |
372 |
//System.out.println(data); |
|
373 |
return data; |
|
375 |
|
|
376 |
item[0] = new StringXMLItem(data); |
|
377 |
return item; |
|
378 |
|
|
374 | 379 |
} |
375 | 380 |
|
376 | 381 |
/** |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrVect.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig.fmap.layers; |
42 | 42 |
|
43 |
import java.awt.Color; |
|
44 | 43 |
import java.awt.Graphics2D; |
45 | 44 |
import java.awt.Point; |
46 | 45 |
import java.awt.geom.Point2D; |
... | ... | |
58 | 57 |
import com.hardcode.gdbms.engine.instruction.FieldNotFoundException; |
59 | 58 |
import com.iver.cit.gvsig.fmap.DriverException; |
60 | 59 |
import com.iver.cit.gvsig.fmap.ViewPort; |
61 |
import com.iver.cit.gvsig.fmap.MapControl.CancelDraw; |
|
62 |
import com.iver.cit.gvsig.fmap.core.Handler; |
|
63 | 60 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
64 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
|
65 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
|
66 | 61 |
import com.iver.cit.gvsig.fmap.drivers.BoundedShapes; |
67 | 62 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
68 | 63 |
import com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver; |
69 | 64 |
import com.iver.cit.gvsig.fmap.drivers.VectorialDriver; |
70 | 65 |
import com.iver.cit.gvsig.fmap.edition.AnnotationEditableAdapter; |
71 |
import com.iver.cit.gvsig.fmap.edition.EditableAdapter; |
|
72 | 66 |
import com.iver.cit.gvsig.fmap.edition.EditionException; |
73 | 67 |
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter; |
74 | 68 |
import com.iver.cit.gvsig.fmap.edition.VectorialEditableDBAdapter; |
... | ... | |
79 | 73 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.RandomVectorialData; |
80 | 74 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.SingleLayer; |
81 | 75 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.VectorialData; |
76 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.VectorialXMLItem; |
|
82 | 77 |
import com.iver.cit.gvsig.fmap.operations.Cancellable; |
83 | 78 |
import com.iver.cit.gvsig.fmap.operations.CancellableMonitorable; |
84 |
import com.iver.cit.gvsig.fmap.operations.DefaultCancellableMonitorable; |
|
85 |
import com.iver.cit.gvsig.fmap.operations.Monitorable; |
|
86 | 79 |
import com.iver.cit.gvsig.fmap.operations.strategies.FeatureVisitor; |
87 | 80 |
import com.iver.cit.gvsig.fmap.operations.strategies.Strategy; |
88 | 81 |
import com.iver.cit.gvsig.fmap.operations.strategies.StrategyManager; |
... | ... | |
101 | 94 |
import com.iver.utiles.IPersistance; |
102 | 95 |
import com.iver.utiles.PostProcessSupport; |
103 | 96 |
import com.iver.utiles.XMLEntity; |
104 |
import com.iver.utiles.swing.threads.IMonitorableTask; |
|
105 |
import com.vividsolutions.jts.geom.Coordinate; |
|
106 |
import com.vividsolutions.jts.geom.Envelope; |
|
97 |
import com.iver.utiles.xmlViewer.XMLItem; |
|
107 | 98 |
import com.vividsolutions.jts.index.SpatialIndex; |
108 |
import com.vividsolutions.jts.index.quadtree.Quadtree; |
|
109 | 99 |
|
110 |
|
|
111 | 100 |
/** |
112 | 101 |
* Capa b?sica Vectorial. |
113 | 102 |
* |
... | ... | |
574 | 563 |
return s.queryByShape(g, relationship); |
575 | 564 |
} |
576 | 565 |
|
577 |
public String getInfo(Point p, double tolerance) throws DriverException
|
|
566 |
public XMLItem[] getInfo(Point p, double tolerance) throws DriverException
|
|
578 | 567 |
{ |
579 |
FBitSet bs = queryByPoint(p, tolerance); |
|
580 |
//Convert FBitSet to String or custom type |
|
581 |
return ""; |
|
568 |
Point2D pReal = this.getFMap().getViewPort().toMapPoint(p); |
|
569 |
FBitSet bs = queryByPoint(pReal, tolerance); |
|
570 |
VectorialXMLItem[] item = new VectorialXMLItem[1]; |
|
571 |
item[0] = new VectorialXMLItem(bs, this); |
|
572 |
|
|
573 |
return item; |
|
582 | 574 |
} |
583 | 575 |
/** |
584 | 576 |
* @throws DriverException |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/layerOperations/StringXMLItem.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.fmap.layers.layerOperations; |
|
2 |
|
|
3 |
import org.xml.sax.Attributes; |
|
4 |
import org.xml.sax.ContentHandler; |
|
5 |
import org.xml.sax.Locator; |
|
6 |
import org.xml.sax.SAXException; |
|
7 |
|
|
8 |
import com.iver.utiles.xmlViewer.TextXMLContent; |
|
9 |
import com.iver.utiles.xmlViewer.XMLItem; |
|
10 |
|
|
11 |
public class StringXMLItem extends TextXMLContent implements XMLItem { |
|
12 |
|
|
13 |
/** |
|
14 |
* @param text |
|
15 |
*/ |
|
16 |
public StringXMLItem(String text) { |
|
17 |
super(text); |
|
18 |
|
|
19 |
} |
|
20 |
|
|
21 |
/** |
|
22 |
* @see com.iver.cit.gvsig.gui.toolListeners.InfoListener.XMLItem#parse(org.xml.sax.ContentHandler) |
|
23 |
*/ |
|
24 |
public void parse(ContentHandler handler) throws SAXException { |
|
25 |
setContentHandler(new FilterContentHandler(handler)); |
|
26 |
parse(); |
|
27 |
} |
|
28 |
|
|
29 |
private class FilterContentHandler implements ContentHandler { |
|
30 |
|
|
31 |
private ContentHandler handler; |
|
32 |
|
|
33 |
public FilterContentHandler(ContentHandler handler) { |
|
34 |
this.handler = handler; |
|
35 |
} |
|
36 |
|
|
37 |
/** |
|
38 |
* @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator) |
|
39 |
*/ |
|
40 |
public void setDocumentLocator(Locator arg0) { |
|
41 |
} |
|
42 |
|
|
43 |
/** |
|
44 |
* @see org.xml.sax.ContentHandler#startDocument() |
|
45 |
*/ |
|
46 |
public void startDocument() throws SAXException { |
|
47 |
} |
|
48 |
|
|
49 |
/** |
|
50 |
* @see org.xml.sax.ContentHandler#endDocument() |
|
51 |
*/ |
|
52 |
public void endDocument() throws SAXException { |
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String, |
|
57 |
* java.lang.String) |
|
58 |
*/ |
|
59 |
public void startPrefixMapping(String arg0, String arg1) |
|
60 |
throws SAXException { |
|
61 |
} |
|
62 |
|
|
63 |
/** |
|
64 |
* @see org.xml.sax.ContentHandler#endPrefixMapping(java.lang.String) |
|
65 |
*/ |
|
66 |
public void endPrefixMapping(String arg0) throws SAXException { |
|
67 |
} |
|
68 |
|
|
69 |
/** |
|
70 |
* @see org.xml.sax.ContentHandler#startElement(java.lang.String, |
|
71 |
* java.lang.String, java.lang.String, org.xml.sax.Attributes) |
|
72 |
*/ |
|
73 |
public void startElement(String arg0, String arg1, String arg2, |
|
74 |
Attributes arg3) throws SAXException { |
|
75 |
handler.startElement(arg0, arg1, arg2, arg3); |
|
76 |
} |
|
77 |
|
|
78 |
/** |
|
79 |
* @see org.xml.sax.ContentHandler#endElement(java.lang.String, |
|
80 |
* java.lang.String, java.lang.String) |
|
81 |
*/ |
|
82 |
public void endElement(String arg0, String arg1, String arg2) |
|
83 |
throws SAXException { |
|
84 |
handler.endElement(arg0, arg1, arg2); |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* @see org.xml.sax.ContentHandler#characters(char[], int, int) |
|
89 |
*/ |
|
90 |
public void characters(char[] arg0, int arg1, int arg2) |
|
91 |
throws SAXException { |
|
92 |
handler.characters(arg0, arg1, arg2); |
|
93 |
} |
|
94 |
|
|
95 |
/** |
|
96 |
* @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, |
|
97 |
* int) |
|
98 |
*/ |
|
99 |
public void ignorableWhitespace(char[] arg0, int arg1, int arg2) |
|
100 |
throws SAXException { |
|
101 |
} |
|
102 |
|
|
103 |
/** |
|
104 |
* @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, |
|
105 |
* java.lang.String) |
|
106 |
*/ |
|
107 |
public void processingInstruction(String arg0, String arg1) |
|
108 |
throws SAXException { |
|
109 |
} |
|
110 |
|
|
111 |
/** |
|
112 |
* @see org.xml.sax.ContentHandler#skippedEntity(java.lang.String) |
|
113 |
*/ |
|
114 |
public void skippedEntity(String arg0) throws SAXException { |
|
115 |
} |
|
116 |
|
|
117 |
} |
|
118 |
} |
|
0 | 119 |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/layerOperations/VectorialXMLItem.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.fmap.layers.layerOperations; |
|
2 |
|
|
3 |
import java.util.BitSet; |
|
4 |
|
|
5 |
import org.xml.sax.ContentHandler; |
|
6 |
import org.xml.sax.SAXException; |
|
7 |
import org.xml.sax.helpers.AttributesImpl; |
|
8 |
|
|
9 |
import com.hardcode.gdbms.engine.data.DataSource; |
|
10 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
11 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
12 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData; |
|
13 |
import com.iver.utiles.xmlViewer.XMLItem; |
|
14 |
|
|
15 |
|
|
16 |
public class VectorialXMLItem implements XMLItem { |
|
17 |
|
|
18 |
private BitSet bitset; |
|
19 |
|
|
20 |
private FLayer layer; |
|
21 |
|
|
22 |
public VectorialXMLItem(BitSet bitset, FLayer layer) { |
|
23 |
this.bitset = bitset; |
|
24 |
this.layer = layer; |
|
25 |
} |
|
26 |
|
|
27 |
/** |
|
28 |
* @see com.iver.cit.gvsig.gui.toolListeners.InfoListener.XMLItem#parse(org.xml.sax.ContentHandler) |
|
29 |
*/ |
|
30 |
public void parse(ContentHandler handler) throws SAXException { |
|
31 |
AttributesImpl aii = new AttributesImpl(); |
|
32 |
handler.startElement("", "", ((FLayer) layer).getName(), aii); |
|
33 |
try { |
|
34 |
|
|
35 |
DataSource ds = ((AlphanumericData) layer).getRecordset(); |
|
36 |
ds.start(); |
|
37 |
|
|
38 |
for (int j = bitset.nextSetBit(0); j >= 0; j = bitset |
|
39 |
.nextSetBit(j + 1)) { |
|
40 |
AttributesImpl ai = new AttributesImpl(); |
|
41 |
|
|
42 |
for (int k = 0; k < ds.getFieldCount(); k++) { |
|
43 |
ai.addAttribute("", ds.getFieldName(k), "", |
|
44 |
"xs:string", ds.getFieldValue(j, k).toString()); |
|
45 |
} |
|
46 |
handler.startElement("", "", String.valueOf(j), ai); |
|
47 |
handler.endElement("", "", String.valueOf(j)); |
|
48 |
} |
|
49 |
|
|
50 |
ds.stop(); |
|
51 |
|
|
52 |
} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) { |
|
53 |
throw new SAXException(e); |
|
54 |
} catch (DriverException e) { |
|
55 |
throw new SAXException(e); |
|
56 |
} |
|
57 |
handler.endElement("", "", ((FLayer) layer).getName()); |
|
58 |
} |
|
59 |
} |
|
60 |
|
|
0 | 61 |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/layerOperations/InfoByPoint.java | ||
---|---|---|
41 | 41 |
package com.iver.cit.gvsig.fmap.layers.layerOperations; |
42 | 42 |
|
43 | 43 |
import java.awt.Point; |
44 |
|
|
45 | 44 |
import com.iver.cit.gvsig.fmap.DriverException; |
45 |
import com.iver.utiles.xmlViewer.XMLItem; |
|
46 | 46 |
|
47 | 47 |
|
48 | 48 |
/** |
... | ... | |
60 | 60 |
* @return String con el resultado en texto plano o en XML |
61 | 61 |
* @throws DriverException |
62 | 62 |
*/ |
63 |
public String getInfo(Point p, double tolerance) throws DriverException;
|
|
63 |
public XMLItem[] getInfo(Point p, double tolerance) throws DriverException;
|
|
64 | 64 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLayers.java | ||
---|---|---|
50 | 50 |
import java.util.ConcurrentModificationException; |
51 | 51 |
import java.util.Iterator; |
52 | 52 |
import java.util.List; |
53 |
import java.util.Vector; |
|
53 | 54 |
|
54 | 55 |
import org.apache.log4j.Logger; |
55 | 56 |
import org.cresques.cts.ICoordTrans; |
... | ... | |
77 | 78 |
import com.iver.cit.gvsig.fmap.rendering.VectorialLegend; |
78 | 79 |
import com.iver.utiles.IPersistance; |
79 | 80 |
import com.iver.utiles.XMLEntity; |
81 |
import com.iver.utiles.xmlViewer.XMLItem; |
|
80 | 82 |
|
81 | 83 |
/** |
82 | 84 |
* Representa un nodo interno en el ?rbol de capas |
... | ... | |
1076 | 1078 |
return true; |
1077 | 1079 |
} |
1078 | 1080 |
|
1079 |
public String getInfo(Point p, double tolerance) throws DriverException {
|
|
1081 |
public XMLItem[] getInfo(Point p, double tolerance) throws DriverException {
|
|
1080 | 1082 |
int i; |
1081 |
StringBuffer sb = new StringBuffer(); |
|
1082 |
|
|
1083 |
Vector items = new Vector(); |
|
1084 |
FLayer layer; |
|
1085 |
XMLItem[] aux; |
|
1083 | 1086 |
for (i = 0; i < this.layers.size(); i++){ |
1084 |
FLayer laCapa = (FLayer) layers.get(i); |
|
1085 |
if (laCapa instanceof FLyrVect){ |
|
1086 |
//FLyrVect layer = (FLyrVect) laCapa; |
|
1087 |
//FBitSet newBitSet = layer.queryByPoint(p, tol); |
|
1088 |
//TODO: |
|
1089 |
// Transformar el BitSet en un texto/dialogo para que el usuario lo visualice. |
|
1090 |
//sb.append(new VectorialXMLItem(newBitSet, laCapa)); |
|
1091 |
} |
|
1092 |
else if (laCapa instanceof RasterOperations) { |
|
1093 |
try { |
|
1094 |
RasterOperations layer = (RasterOperations) laCapa; |
|
1095 |
sb.append(layer.getInfo(p, tolerance)); |
|
1096 |
} catch (DriverException e) { |
|
1097 |
e.printStackTrace(); |
|
1098 |
} |
|
1099 |
} |
|
1100 |
else if (laCapa instanceof InfoByPoint) { |
|
1101 |
try { |
|
1102 |
InfoByPoint layer = (InfoByPoint) laCapa; |
|
1103 |
sb.append(layer.getInfo(p, tolerance)); |
|
1104 |
} catch (DriverException e) { |
|
1105 |
e.printStackTrace(); |
|
1087 |
layer = (FLayer)layers.get(i); |
|
1088 |
if (layer instanceof InfoByPoint){ |
|
1089 |
InfoByPoint queryable_layer = (InfoByPoint) layer; |
|
1090 |
aux = queryable_layer.getInfo(p, tolerance); |
|
1091 |
for(int j = 0; j < aux.length; j++){ |
|
1092 |
items.add(aux[j]); |
|
1106 | 1093 |
} |
1107 |
} |
|
1108 |
} |
|
1109 |
return sb.toString(); |
|
1094 |
} |
|
1095 |
} |
|
1096 |
return (XMLItem[])items.toArray(new XMLItem[0]); |
|
1097 |
|
|
1098 |
// for (i = 0; i < this.layers.size(); i++){ |
|
1099 |
// FLayer laCapa = (FLayer) layers.get(i); |
|
1100 |
// if (laCapa instanceof FLyrVect){ |
|
1101 |
// } |
|
1102 |
// else if (laCapa instanceof RasterOperations) { |
|
1103 |
// try { |
|
1104 |
// RasterOperations layer = (RasterOperations) laCapa; |
|
1105 |
// sb.append(layer.getInfo(p, tolerance)); |
|
1106 |
// } catch (DriverException e) { |
|
1107 |
// e.printStackTrace(); |
|
1108 |
// } |
|
1109 |
// } |
|
1110 |
// else if (laCapa instanceof InfoByPoint) { |
|
1111 |
// try { |
|
1112 |
// InfoByPoint layer = (InfoByPoint) laCapa; |
|
1113 |
// sb.append(layer.getInfo(p, tolerance)); |
|
1114 |
// } catch (DriverException e) { |
|
1115 |
// e.printStackTrace(); |
|
1116 |
// } |
|
1117 |
// } |
|
1118 |
// } |
|
1119 |
|
|
1110 | 1120 |
} |
1111 | 1121 |
|
1112 | 1122 |
|
Also available in: Unified diff