Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trivial changes in package 'org.locationtech.udig.project.internal.impl' #656

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* uDig - User Friendly Desktop Internet GIS client
/**
* uDig - User Friendly Desktop Internet GIS client
* http://udig.refractions.net
* (C) 2004, Refractions Research Inc.
*
Expand All @@ -9,37 +10,37 @@
*/
package org.locationtech.udig.project.internal.impl;

import org.geotools.geometry.jts.ReferencedEnvelope;
import org.locationtech.udig.project.interceptor.LayerInterceptor;
import org.locationtech.udig.project.internal.Layer;
import org.locationtech.udig.project.internal.Map;
import org.locationtech.udig.project.internal.render.ViewportModel;
import org.locationtech.udig.project.internal.render.impl.ViewportModelImpl;
import org.locationtech.udig.ui.ProgressManager;

import org.geotools.geometry.jts.ReferencedEnvelope;

/**
* If first layer it sets the viewport bounds to be the bounds of the layer.
*
*
* @author jesse
* @since 1.1.0
*/
public class InitMapBoundsInterceptor implements LayerInterceptor {

public void run( Layer layer ) {
if(layer.getMap()==null ){
@Override
public void run(Layer layer) {
if (layer.getMap() == null) {
// this check is here because we could be doing a copy
return;
}
if(layer.getMap().getProject() == null) {
// this check is here because we are probably loading
return;
if (layer.getMap().getProject() == null) {
// this check is here because we are probably loading
return;
}
Map map = layer.getMapInternal();

ReferencedEnvelope bounds = map.getViewportModelInternal().getBounds();
// If first layer or if the crs has been unchanged from the original BBox
if( map.getMapLayers().size()==1 || bounds == ViewportModelImpl.getDefaultReferencedEnvelope()){
// If first layer or if the CRS has been unchanged from the original BBox
if (map.getMapLayers().size() == 1
|| bounds == ViewportModelImpl.getDefaultReferencedEnvelope()) {
bounds = map.getBounds(ProgressManager.instance().get());
map.getViewportModelInternal().setBounds(bounds);
}
Expand Down
Loading