view src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java @ 29:77cfa8092611

Write FeatureLayer attributes to XML document.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 08 Apr 2011 17:36:22 +0200
parents 3e24fffdf2bb
children 40c0b4e5f91a
line wrap: on
line source
//package de.intevation.mxd.reader;

import java.io.IOException;

import org.apache.log4j.Logger;

import com.esri.arcgis.carto.IFeatureRenderer;
import com.esri.arcgis.display.ISymbol;
import com.esri.arcgis.carto.UniqueValueRenderer;

/**
 * Reads unique vaule renderer information.
 *
 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
 */
public class UniqueValueRendererReader implements IRendererReader{

    //Member
    private ISymbol symbol;
    private IFeatureRenderer renderer;
    private static final Logger logger = Logger.getLogger(FeatureLayerReader.class);

    //Constructor
    public UniqueValueRendererReader(IFeatureRenderer renderer){
        this.renderer = renderer;
    }


    //Methods
    public boolean read() throws IOException{
        logger.debug("read()");
        if(renderer instanceof UniqueValueRenderer){
            UniqueValueRenderer sr = (UniqueValueRenderer)renderer;
            System.out.println("--------------------");
            System.out.println("Renderer inforamtion:");
            System.out.println("Value count\t\t = " + sr.getValueCount());
            for(int i = 0; i < sr.getValueCount(); i++){
                String val = sr.getValue(i);
                System.out.println("Value\t\t = " + val);
                System.out.println("Label\t\t = " + sr.getLabel(val));
                System.out.println("Description\t\t = " + sr.getDescription(val));
            }
            System.out.println("");
            symbol = sr.getDefaultSymbol();
            try{
                ISymbolReader isr= new SimpleMarkerSymbolReader(symbol);
                isr.read();
                return true;
            }
            catch(Exception e){
                e.printStackTrace();
            }
        }
        return false;
    }

    public void getRenderer() throws IOException{
        logger.debug("getRenderer() -> not implemented jet.");
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)