view src/java/de/intevation/mxd/reader/MapReader.java @ 26:3e24fffdf2bb

Moved reader components to reader folder.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 08 Apr 2011 12:26:17 +0200
parents src/java/de/intevation/mxd/MapReader.java@cbd67b1100d8
children e5fdc37f8f94
line wrap: on
line source
//package de.intevation.mxd.reader;

import java.io.IOException;

import org.apache.log4j.Logger;

import com.esri.arcgis.carto.IMap;
import com.esri.arcgis.carto.Map;
import com.esri.arcgis.geometry.ISpatialReference;
import com.esri.arcgis.geometry.ProjectedCoordinateSystem;
import com.esri.arcgis.geometry.GeographicCoordinateSystem;
import com.esri.arcgis.geometry.IProjection;
import com.esri.arcgis.geometry.Projection;
/**
 * Reads map information.
 *
 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
 */
public class MapReader{

    //Member
    IMap map;

    private static final Logger logger = Logger.getLogger(MapReader.class);

    //Constructor
    public MapReader(IMap map){
        logger.debug("constructor()");
        this.map = map;
    }


    //Methods

    /**
     * Reads the Map attributes.
     */
    public void read() throws IOException{
        logger.debug("read()");
        ISpatialReference sr = map.getSpatialReference();
        logger.debug("Instance: " + sr.getClass().toString());
        if(sr instanceof ProjectedCoordinateSystem){
            ProjectedCoordinateSystem pcs = (ProjectedCoordinateSystem)sr;
            Projection p = (Projection)pcs.getProjection();
            System.out.println("Projection       = " + p.getName());
        }
        else if(sr instanceof GeographicCoordinateSystem){
            GeographicCoordinateSystem gcs = (GeographicCoordinateSystem)sr;
            System.out.println("Name             = " + gcs.getName());
        }
    }
}
// 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)