Revision 26523 tmp/trunk/cliente/WorkSpace_WPSClient/extWPSCallejero/src/es/logex/gvsig/fmap/layers/FLyrWPS.java

View differences:

FLyrWPS.java
15 15

  
16 16
import com.hardcode.gdbms.engine.instruction.FieldNotFoundException;
17 17
import com.iver.andami.PluginServices;
18
import com.iver.cit.gvsig.ProjectExtension;
18 19
import com.iver.cit.gvsig.fmap.DriverException;
19 20
import com.iver.cit.gvsig.fmap.ViewPort;
20 21
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
21 22
import com.iver.cit.gvsig.fmap.drivers.VectorialDriver;
23
import com.iver.cit.gvsig.fmap.drivers.WithDefaultLegend;
22 24
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
25
import com.iver.cit.gvsig.fmap.rendering.Legend;
23 26
import com.iver.cit.gvsig.fmap.rendering.LegendFactory;
27
import com.iver.cit.gvsig.project.ProjectFactory;
28
import com.iver.cit.gvsig.project.documents.table.ProjectTable;
29
import com.iver.cit.gvsig.project.documents.table.ProjectTableFactory;
30
import com.iver.utiles.extensionPoints.ExtensionPoint;
31
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
24 32
import com.iver.utiles.swing.threads.Cancellable;
25 33

  
26 34
import es.logex.gvsig.fmap.drivers.wps.FMapWPSDriver;
27 35
import es.logex.gvsig.streetsmap.core.SMLayerInfo;
28 36
import es.logex.xml.utils.LegendManager;
29 37

  
30
public class FLyrWPS extends FLyrVect {
38
public class FLyrWPS extends FLyrVect implements WithDefaultLegend {
31 39

  
32 40
	private URL host = null; // va incluido el nombre de la operaciĆ³n.
33 41
	private String processName = null; /*
......
40 48
	private String srs = null;
41 49
	private Log logger = LogFactory.getLog(this.getClass());
42 50
	private SMLayerInfo smlInfo = null;
51
//	WPSAdapter adapter = null;
52
	public FLyrWPS(SMLayerInfo smlInfo) {
53
		super();
43 54

  
44
	public FLyrWPS(SMLayerInfo smlInfo) {
45 55
		this.layerId = smlInfo.getId();
46 56
		this.layerName = smlInfo.getName();
47 57
		this.srs = smlInfo.getDefaultSRS();
......
57 67
	}
58 68

  
59 69
	public void load(Rectangle2D extent, IProjection projection) {
60
		WPSAdapter adapter = new WPSAdapter();
61 70

  
71

  
62 72
		try {
63 73
			if (logger.isTraceEnabled()) {
64 74
				logger.trace(this);
65 75
			}
66 76

  
67
			driver.loadGeometries(extent, projection, this.layerId, "0");
77
			driver.loadGeometries(extent, projection, this.layerId,  "0");
78
//			ProjectExtension ext = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class);
79
//
80
//			ProjectTable projectTable = ext.getProject().getTable(this);
81
//			if (projectTable == null) {
82
//				projectTable = ProjectFactory.createTable(PluginServices.getText(this, "Tabla_de_Atributos") + ": " + this.getName(),
83
//						
84
//				);
85
//				projectTable.setProjectDocumentFactory(new ProjectTableFactory());
86
//				projectTable.setAssociatedTable(co);
87
//				ext.getProject().addDocument(projectTable);
88
//			}
89
//			adapter.setDriver((VectorialDriver) driver);
90
//			setSource(adapter);
68 91

  
69
			adapter.setDriver((VectorialDriver) driver);
70
			setSource(adapter);
71

  
72 92
			if (getLegend() == null) {
73 93

  
74 94
				setLegend(LegendFactory
75 95
						.createSingleSymbolLegend(getShapeType()));
76
//				if (driver.getFieldCount() > 0)
77
//					setDefaultLegend();
96
				if (driver.getFieldCount() > 0)
97
					setDefaultLegend();
78 98
			}
79 99

  
80 100
		} catch (FieldNotFoundException e) {
......
83 103
		} catch (DriverException e) {
84 104
			// TODO Auto-generated catch block
85 105
			e.printStackTrace();
106
		
107
		} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
108
			// TODO Auto-generated catch block
109
			e.printStackTrace();
86 110
		}
87
//		} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
88
//			// TODO Auto-generated catch block
89
//			e.printStackTrace();
90
//		}
91 111
	}
92 112

  
93 113
	public String getSrs() {
......
165 185

  
166 186
		Rectangle2D newExtent = viewPort.getExtent();
167 187
		try {
168
			if(driver.getFullExtent() == null  || !driver.getFullExtent().contains(newExtent))
169
				load(newExtent, viewPort.getProjection());
188
			if(isWithinScale(scale))
189
			{
190
				if(driver.getFullExtent() == null  || !driver.getFullExtent().contains(newExtent))
191
					load(newExtent, viewPort.getProjection());
192
			}
170 193
		} catch (IOException e) {
171 194
			// TODO Auto-generated catch block
172 195
			e.printStackTrace();
......
197 220
		this.load(((ViewPort)PluginServices.getMDIManager().getActiveWindow()).getExtent(), 
198 221
				((ViewPort)PluginServices.getMDIManager().getActiveWindow()).getProjection());
199 222
	}
223

  
224
	public Legend getDefaultLegend() {
225
		// TODO Auto-generated method stub
226
		return null;
227
	}
200 228
}

Also available in: Unified diff