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 @ 1712

History | View | Annotate | Download (5.61 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
                GCPSynchronizationImpl gcpSyc = new GCPSynchronizationImpl(gpList, listener);
110
                gcpSyc.setViews(views[0], views[1], views[2], views[3], table);
111
                SynchronizationViewImpl syncViews = new SynchronizationViewImpl(gpList);
112
                syncViews.setViews(views[1], views[0], views[3], views[2]);
113
                syncViews.setRequestsManager(viewMan[1], viewMan[0], viewMan[3], viewMan[2]);
114
                syncViews.setGCPSync(gcpSyc);
115
                return syncViews;
116
        }
117

    
118
        public GeorefControlPanel createGeorefControlPanel() {
119
                return new GeorefControlPanelImpl();
120
        }
121

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

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

    
156
}