Statistics
| Revision:

gvsig-raster / org.gvsig.raster.georeferencing / trunk / org.gvsig.raster.georeferencing / org.gvsig.raster.georeferencing.swing / org.gvsig.raster.georeferencing.swing.impl / src / main / java / org / gvsig / raster / georeferencing / swing / impl / DefaultGeoreferencingSwingManager.java @ 1717

History | View | Annotate | Download (5.46 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.raster.georeferencing.swing.impl;
23

    
24
import java.util.List;
25

    
26
import org.gvsig.fmap.dal.coverage.datastruct.GeoPointList;
27
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
28
import org.gvsig.raster.georeferencing.swing.GeoreferencingLauncher;
29
import org.gvsig.raster.georeferencing.swing.GeoreferencingOptions;
30
import org.gvsig.raster.georeferencing.swing.GeoreferencingOptionsDataModel;
31
import org.gvsig.raster.georeferencing.swing.GeoreferencingSwingManager;
32
import org.gvsig.raster.georeferencing.swing.control.GeorefControlPanel;
33
import org.gvsig.raster.georeferencing.swing.impl.control.GeorefControlPanelImpl;
34
import org.gvsig.raster.georeferencing.swing.impl.launcher.GeorefLauncherDialog;
35
import org.gvsig.raster.georeferencing.swing.impl.option.GeorefOptionsDataModelImpl;
36
import org.gvsig.raster.georeferencing.swing.impl.option.GeorefOptionsDialog;
37
import org.gvsig.raster.georeferencing.swing.impl.view.ViewPanelImpl;
38
import org.gvsig.raster.georeferencing.swing.impl.view.ZoomPanelImpl;
39
import org.gvsig.raster.georeferencing.swing.impl.view.synchronize.GCPSynchronizationImpl;
40
import org.gvsig.raster.georeferencing.swing.impl.view.synchronize.SynchronizationViewImpl;
41
import org.gvsig.raster.georeferencing.swing.view.GeoreferencingView;
42
import org.gvsig.raster.georeferencing.swing.view.IViewRequestManager;
43
import org.gvsig.raster.georeferencing.swing.view.SynchronizedViews;
44
import org.gvsig.raster.georeferencing.swing.view.ToolListener;
45
import org.gvsig.raster.swing.pagedtable.PagedTable;
46
import org.gvsig.tools.ToolsLocator;
47
import org.gvsig.tools.i18n.I18nManager;
48
import org.slf4j.Logger;
49
import org.slf4j.LoggerFactory;
50

    
51
/**
52
 * Default implementation of the {@link CartociudadSwingManager}.
53
 * 
54
 * @author gvSIG Team
55
 * @version $Id$
56
 */
57
public class DefaultGeoreferencingSwingManager implements GeoreferencingSwingManager {
58
        private static final Logger            logger        = LoggerFactory.getLogger(DefaultGeoreferencingSwingManager.class);
59
    private I18nManager                    i18nmanager   = null;
60
        private GeoreferencingOptionsDataModel dataModel     = null;
61

    
62
    public DefaultGeoreferencingSwingManager() {
63
        this.i18nmanager = ToolsLocator.getI18nManager();       
64
    }
65
    
66
    public GeoreferencingOptionsDataModel getDataModel() {
67
            if(dataModel == null)
68
                    dataModel = new GeorefOptionsDataModelImpl();
69
            return dataModel;
70
    }
71

    
72
    public String getTranslation(String key) {
73
        return this.i18nmanager.getTranslation(key);
74
    }
75
    
76
        /**
77
         * Obtiene la traducci?n de la cadena de texto
78
         * @param parent Ventana padre
79
         * @param text Cadena a traducir
80
         * @return Cadena de texto traducida
81
         */
82
        public static String getText(Object parent, String key) {
83
                 if (key == null)
84
                    return null;
85
                String translation = org.gvsig.i18n.Messages.getText(key, false);
86
                if (translation != null)
87
                    return translation;
88
                else {
89
                    logger.debug("Can't find translation for ''{1}''.", key);
90
                    return key;
91
                }
92
        }
93

    
94
        /**
95
         * Builds the synchronization between views. The arrays contains this order
96
         * (view map, view raster, zoom map, zoom raster)
97
         * @param views
98
         * @param viewMan
99
         * @param table
100
         * @param listener
101
         * @return
102
         */
103
        public SynchronizedViews createSyncViews(
104
                        GeoreferencingView[] views, 
105
                        IViewRequestManager[] viewMan,
106
                        GeoPointList gpList,
107
                        PagedTable table, 
108
                        ToolListener listener) {
109
                SynchronizationViewImpl syncViews = new SynchronizationViewImpl(gpList, listener);
110
                syncViews.setRequestsManager(viewMan[1], viewMan[0], viewMan[3], viewMan[2]);
111
                syncViews.setViews(views[1], views[0], views[3], views[2], table);
112
                return syncViews;
113
        }
114

    
115
        public GeorefControlPanel createGeorefControlPanel() {
116
                return new GeorefControlPanelImpl();
117
        }
118

    
119
        public GeoreferencingView createView(
120
                        boolean showInfo, 
121
                        boolean minMaxUL,
122
                        boolean rightSideButtons,
123
                        ToolListener toolListener) {
124
                ViewPanelImpl v = new ViewPanelImpl(toolListener, rightSideButtons);
125
                //v.setMinxMaxyUL(minMaxUL);
126
                v.setShowInfo(showInfo);
127
                return v;
128
        }
129

    
130
        public GeoreferencingView createZoom(
131
                        boolean showInfo, 
132
                        boolean minMaxUL) {
133
                ZoomPanelImpl v = new ZoomPanelImpl();
134
                //v.setMinxMaxyUL(minMaxUL);
135
                v.setShowInfo(showInfo);
136
                return v;
137
        }
138
        
139
        public GeoreferencingLauncher createWindowLauncher(
140
                        List<String> viewList, 
141
                        int polynomialDegree) {
142
                return new GeorefLauncherDialog(viewList, polynomialDegree); 
143
        }
144
        
145
        public GeoreferencingOptions createWindowOptions(
146
                        int polynomialDegree, 
147
                        ButtonsPanelListener listener) {
148
                return new GeorefOptionsDialog(polynomialDegree, listener); 
149
        }
150
        
151
        
152

    
153
}