rrenkert@25: //package de.intevation.mxd; rrenkert@25: rrenkert@25: import java.io.IOException; rrenkert@25: rrenkert@25: import org.apache.log4j.Logger; rrenkert@25: rrenkert@25: import com.esri.arcgis.carto.IMap; rrenkert@25: import com.esri.arcgis.carto.Map; rrenkert@25: import com.esri.arcgis.geometry.ISpatialReference; rrenkert@25: import com.esri.arcgis.geometry.ProjectedCoordinateSystem; rrenkert@25: import com.esri.arcgis.geometry.GeographicCoordinateSystem; rrenkert@25: import com.esri.arcgis.geometry.IProjection; rrenkert@25: import com.esri.arcgis.geometry.Projection; rrenkert@25: /** rrenkert@25: * Reads map information. rrenkert@25: * rrenkert@25: * @author Raimund Renkert rrenkert@25: */ rrenkert@25: public class MapReader{ rrenkert@25: rrenkert@25: //Member rrenkert@25: IMap map; rrenkert@25: rrenkert@25: private static final Logger logger = Logger.getLogger(MapReader.class); rrenkert@25: rrenkert@25: //Constructor rrenkert@25: public MapReader(IMap map){ rrenkert@25: logger.debug("constructor()"); rrenkert@25: this.map = map; rrenkert@25: } rrenkert@25: rrenkert@25: rrenkert@25: //Methods rrenkert@25: rrenkert@25: /** rrenkert@25: * Reads the Map attributes. rrenkert@25: */ rrenkert@25: public void read() throws IOException{ rrenkert@25: logger.debug("read()"); rrenkert@25: ISpatialReference sr = map.getSpatialReference(); rrenkert@25: logger.debug("Instance: " + sr.getClass().toString()); rrenkert@25: if(sr instanceof ProjectedCoordinateSystem){ rrenkert@25: ProjectedCoordinateSystem pcs = (ProjectedCoordinateSystem)sr; rrenkert@25: Projection p = (Projection)pcs.getProjection(); rrenkert@25: System.out.println("Projection = " + p.getName()); rrenkert@25: } rrenkert@25: else if(sr instanceof GeographicCoordinateSystem){ rrenkert@25: GeographicCoordinateSystem gcs = (GeographicCoordinateSystem)sr; rrenkert@25: System.out.println("Name = " + gcs.getName()); rrenkert@25: } rrenkert@25: } rrenkert@25: } rrenkert@25: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :