Package org.locationtech.udig.project.render

Examples of org.locationtech.udig.project.render.IViewportModel


    private void displayFeaturesUnderBBox(Point xyMouse, ILayer selectedLayer, MergeView mergeView) {

        Filter filterSelectedFeatures;
        Envelope bound;
        // select features using the drawn bbox
        IViewportModel viewportModel = getContext().getMap().getViewportModel();
        Coordinate startPoint = viewportModel.pixelToWorld(mergeContext.getBBoxStartPoint().x,
                mergeContext.getBBoxStartPoint().y);
        Coordinate endPoint = viewportModel.pixelToWorld(xyMouse.x, xyMouse.y);

        if (startPoint.equals2D(endPoint)) {
            // when it was a click(start and end coordinates are equal)
            // get a little bbox around this point.
            bound = getContext().getBoundingBox(xyMouse, 3);
View Full Code Here


     * Calculates the scale of the map taking into account the paper size.
     *
     * @return the scale of the map on the current paper type.
     */
    private double calculateScale() {
        IViewportModel viewportModel = getMapBoxPrinter().getMap().getViewportModel();
        // get page size in pixels and in mm
        Page page = getMapBoxPrinter().getBox().getPage();
        org.eclipse.draw2d.geometry.Dimension pageSize = page.getSize();
        org.eclipse.draw2d.geometry.Dimension paperSize = page.getPaperSize();
        // map box size in pixels
        org.eclipse.draw2d.geometry.Dimension mapSize = owner.getBoxPrinter().getBox().getSize();
        // map box size in points and then in meters on paper
        float mapPaperWidthPoints = (float) paperSize.width * (float) mapSize.width
                / (float) pageSize.width;
        float mapPaperWidthMeters = AbstractBoxPrinter.point2cm(mapPaperWidthPoints) / 100f;
        // map bounds in meters
        ReferencedEnvelope mapEnvelope = (ReferencedEnvelope) viewportModel.getBounds();
        double mapWorldWidthMeters = mapEnvelope.getWidth();

        double thescale = mapWorldWidthMeters / mapPaperWidthMeters;
        return thescale;
    }
View Full Code Here

  public static CoordinateReferenceSystem getCrs(ILayer sourceLayer) {
    assert sourceLayer != null;
    CoordinateReferenceSystem crs = sourceLayer.getCRS();
    if (ILayer.UNKNOWN_CRS == crs) {
      IMap map = sourceLayer.getMap();
      IViewportModel viewportModel = map.getViewportModel();
      crs = viewportModel.getCRS();
    }
    return crs;
  }
View Full Code Here

     * @return the Coordinate Reference System of map
     */
    public static CoordinateReferenceSystem getCRS( IMap map ) {
        assert map != null;
       
        IViewportModel viewportModel = map.getViewportModel();
        CoordinateReferenceSystem mapCrs = viewportModel.getCRS();
        return mapCrs;
    }
View Full Code Here

  }

 
    /** MUST BE LAT LONG */
    public Envelope getExtent() {
        IViewportModel model = getProjectElement().getViewportModel();
        Envelope bounds = model.getBounds();
        CoordinateReferenceSystem crs = model.getCRS();
        ReferencedEnvelope extent = new ReferencedEnvelope(bounds, crs);
        try {
            return extent.transform(DefaultGeographicCRS.WGS84, true);
        } catch (Exception e) {
            return new Envelope(-180, 180, -90, 90);
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.render.IViewportModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.