view src/java/de/intevation/mxd/reader/SimpleMarkerSymbolReader.java @ 30:c34c450edb06

Introduced class reader.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 08 Apr 2011 17:58:37 +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.display.ISymbol;
import com.esri.arcgis.display.SimpleMarkerSymbol;
import com.esri.arcgis.display.esriSimpleMarkerStyle;
import com.esri.arcgis.display.IRgbColor;
import com.esri.arcgis.display.RgbColor;

/**
 * Reads simple marker symbol information.
 *
 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
 */
public class SimpleMarkerSymbolReader implements ISymbolReader{

    //Member
    private static final Logger logger = Logger.getLogger(SimpleMarkerSymbolReader.class);

    private SimpleMarkerSymbol symbol;

    //Constructor
    public SimpleMarkerSymbolReader(ISymbol symbol) throws Exception{
        logger.debug("contructor()");
        if(symbol instanceof SimpleMarkerSymbol)
            this.symbol = (SimpleMarkerSymbol)symbol;
        else
            throw new Exception("Not a SimpleMarkerSymbol!");
    }


    //Methods
    public boolean read() throws IOException{
        logger.debug("read()");
        System.out.println("--------------------");
        System.out.println("Symbol information:");
        System.out.println("Name\t\t = " + symbol.getNameString());

        if(symbol.getStyle() == esriSimpleMarkerStyle.esriSMSCircle)
            System.out.println("Style\t\t = Point");
        if(symbol.getColor() instanceof IRgbColor){
            IRgbColor color = (IRgbColor)symbol.getColor();
            System.out.println("Color\t\t = (" + color.getRed() + 
                               "," + color.getGreen() +
                               "," + color.getBlue() + ")");
            System.out.println("Transparency\t = " + color.getTransparency());
        }
        else{
            System.out.println("Color type unknown! " +
                               symbol.getColor().getClass().toString());
        }
        if(symbol.getOutlineColor() instanceof RgbColor){
            RgbColor color = (RgbColor)symbol.getOutlineColor();
            System.out.println("Outlinecolor\t = (" + color.getRed() +
                               "," + color.getGreen() +
                               "," + color.getBlue() + ")");
            System.out.println("Transparency\t = " + color.getTransparency());
        }
        else{
            System.out.println("Color type unknown! " +
                               symbol.getOutlineColor().getClass().toString());
        }

        System.out.println("Size\t\t = " + symbol.getSize());
        System.out.println("OutlineSize\t\t = " + symbol.getOutlineSize());
        System.out.println("Angle\t\t = " + symbol.getAngle());
        System.out.println("Offset\t\t = " + symbol.getXOffset() +
                           "," + symbol.getYOffset());
        System.out.println("");
        return true;
    }

    public void getSymbol() throws IOException{
        logger.debug("getSymbol() -> 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)