Revision 47430

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/SpatialCache.java
187 187
    }
188 188
    
189 189
    public synchronized void refresh(String name, FeatureStore store, Envelope envelope, IProjection projection) {
190
        if( store == null  
191
                || envelope == null || envelope.isEmpty() || envelope.isCollapsed() 
192
                || projection == null ) {
193
            return;
194
        }
190 195
        removeAll();
191 196
        this.refreshTask = new AbstractCancellableTask("SpatialCacheRefresh_"+name) {
192 197
            @Override
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/MapContext.java
1038 1038
     * @see #reProject(ICoordTrans)
1039 1039
     */
1040 1040
    public IProjection getProjection() {
1041
        return getViewPort().getProjection();
1041
        ViewPort vp = this.getViewPort();
1042
        if( vp == null ) {
1043
            return null;
1044
        }
1045
        return vp.getProjection();
1042 1046
    }
1043 1047

  
1044 1048
    /**
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/BaseViewDocument.java
213 213
    }
214 214

  
215 215
    public IProjection getProjection() {
216
        if( this.mapContext == null ) {
217
            return null;
218
        }
216 219
        return mapContext.getProjection();
217 220
    }
218 221

  
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/geometriespalette/GeometriesPaletteExtension.java
5 5
import org.apache.commons.lang3.StringUtils;
6 6
import org.gvsig.andami.PluginServices;
7 7
import org.gvsig.andami.plugins.Extension;
8
import org.gvsig.app.ApplicationLocator;
9
import org.gvsig.app.ApplicationManager;
8 10
import org.gvsig.app.addlayer.AddLayerDialog;
9 11
import static org.gvsig.app.extension.AddLayer.createAddLayerDialog;
10 12
import org.gvsig.app.gui.WizardPanel;
13
import org.gvsig.app.project.documents.Document;
14
import org.gvsig.app.project.documents.view.ViewDocument;
15
import org.gvsig.app.project.documents.view.ViewManager;
11 16
import org.gvsig.fmap.crs.CRSFactory;
12 17
import org.gvsig.fmap.dal.DALLocator;
13 18
import org.gvsig.fmap.dal.DataManager;
......
72 77
        final MapContext mapContext = mapContextManager.createMapContext();
73 78
        MapControl mapControl = null;
74 79
        try {
75
            mapContext.setProjection(CRSFactory.getCRS("EPSG:4326"));
80
            ApplicationManager application = ApplicationLocator.getApplicationManager();
81
            ViewDocument view = (ViewDocument) application.getCurrentProject().getFirstDocument(ViewDocument.class);
82
            if( view == null || view.getProjection()==null ) {
83
                mapContext.setProjection(CRSFactory.getCRS("EPSG:4326"));
84
            } else {
85
                mapContext.setProjection(view.getProjection());
86
            }
76 87
            mapControl = mapControlManager.createJMapControlPanel(mapContext);
77 88
            
78 89
            addLayerDialog = createAddLayerDialog(mapControl, mapContext, null);
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/geometriespalette/GeometriesPalettePanel.java
88 88
            JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
89 89
            try {
90 90
                LabeledValue<List<Feature>> x = (LabeledValue<List<Feature>>) value;
91
                if ( x!=null && x.getValue() != null && attributeLabel!=null && symbol!=null ) {
91
                if ( x!=null && x.getValue() != null && symbol!=null ) {
92 92
                    Image img = drawGeometry(x.getValue());
93 93
                    label.setHorizontalAlignment(SwingConstants.CENTER);
94 94
                    label.setHorizontalTextPosition(JLabel.CENTER);
95 95
                    label.setVerticalTextPosition(JLabel.BOTTOM);
96 96
                    label.setIcon(new ImageIcon(img));
97
                    label.setText(x.getLabel());
97
                    if( StringUtils.isBlank(x.getLabel()) ) {
98
                        label.setText("(Configure label)");
99
                    } else {
100
                        label.setText(x.getLabel());
101
                    }
98 102
                }
99 103
            } catch(Throwable th) {
100 104
                label.setText("Error");
......
267 271
                @Override
268 272
                public LabeledValue<List<Feature>> get(int index) {
269 273
                    Feature feature = features.get(index);
270
                    String label = "???";
274
                    String label = "";
271 275
                    if( attributeLabel!=null ) {
272 276
                        label = feature.getLabelOfValue(attributeLabel.getName());
273 277
                    }

Also available in: Unified diff