[Gvsig_desarrolladores] Persistencia entre proyectos

Jaume Dominguez jaume.dominguez en iver.es
Mie Mayo 25 10:31:27 CEST 2005


Hola, estoy intentando averiguar qué es exactamente lo que se debe de
hacer para guardar las propiedades de una capa cuando guardamos el
proyecto, para posteriormente recuperarla sin tener que pasarse por el
wizard y añadirla.

Estos son los métodos que IMAGINO que tengo que incluir en la clase
FLyrWCS. No se si estoy olvidando algo, que no he entendido el funcionamiento.

	/**
	 * Devuelve el XMLEntity con la información necesaria para reproducir la
	 * capa.
	 * 
	 * @return XMLEntity.
	 * @throws XMLException
	 */
	public XMLEntity getXMLEntity() throws XMLException {
		XMLEntity xml = super.getXMLEntity();

		xml.putProperty("wcs.fullExtent", StringUtilities.rect2String(fullExtent));
		xml.putProperty("wcs.host", host.toExternalForm());
		xml.putProperty("wcs.layerQuery", coverageQuery);
		xml.putProperty("wcs.format", format);
		xml.putProperty("wcs.srs", SRS);
		xml.putProperty("wcs.time", time);
		xml.putProperty("wcs.parameter", parameter);
		xml.putProperty("wcs.label", label);
		xml.putProperty("wcs.name", name);

		return xml;
	}

	/**
	 * A partir del XMLEntity reproduce la capa.
	 * 
 	 * @param xml XMLEntity
	 *
	 * @throws XMLException
	 * @throws DriverException
	 * @throws DriverIOException
	 */
	public void setXMLEntity(XMLEntity xml) throws XMLException {
		super.setXMLEntity(xml);
		fullExtent = StringUtilities.string2Rect(xml
				.getStringProperty("wcs.fullExtent"));

		try {
			host = new URL(xml.getStringProperty("wcs.host"));
		} catch (MalformedURLException e) {
			throw new XMLException(e);
		}

		coverageQuery = xml.getStringProperty("wcs.layerQuery");
		format = xml.getStringProperty("wcs.format");
		SRS = xml.getStringProperty("wcs.srs");
		time = xml.getStringProperty("wcs.time");
		parameter = xml.getStringProperty("wcs.parameter");
		label = xml.getStringProperty("wcs.label");
		name = xml.getStringProperty("wcs.name");
	}

¿Como se ve la cosa?




Más información sobre la lista de distribución gvSIG_desarrolladores