Statistics
| Revision:

root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / project / documents / view / DefaultViewDocument.java @ 38562

History | View | Annotate | Download (3.6 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2009 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

    
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2004-2009 IVER TI
26
*   
27
*/
28
package org.gvsig.app.project.documents.view;
29

    
30
import org.gvsig.app.ApplicationLocator;
31
import org.gvsig.app.project.ProjectPreferences;
32
import org.gvsig.app.project.documents.DocumentManager;
33
import org.gvsig.fmap.mapcontext.MapContext;
34
import org.gvsig.fmap.mapcontext.ViewPort;
35
import org.gvsig.tools.ToolsLocator;
36
import org.gvsig.tools.dynobject.DynStruct;
37
import org.gvsig.tools.persistence.PersistenceManager;
38
import org.gvsig.tools.persistence.PersistentState;
39
import org.gvsig.tools.persistence.exception.PersistenceException;
40

    
41

    
42

    
43
/**
44
 * Clase que representa una vista del proyecto
45
 *
46
 * @author 2004-2005 Fernando Gonz?lez Cort?s
47
 * @author 2006-2009 Jose Manuel Vivo
48
 * @author 2005-         Vicente Caballero
49
 * @author 2009-         Joaquin del Cerro
50
 * 
51
 */
52

    
53
public class DefaultViewDocument extends BaseViewDocument {
54

    
55
        /**
56
         * 
57
         */
58
        private static final long serialVersionUID = 676711512482334764L;
59

    
60
        public static final String PERSISTENCE_DEFINITION_NAME = "DefaultViewDocument";
61
        
62

    
63
        public DefaultViewDocument() {
64
                this(null);
65
        }
66
        
67
        public DefaultViewDocument(DocumentManager factory) {
68
                super(factory); 
69

    
70
                ViewPort vp;
71
        
72
                ProjectPreferences preferences = (ProjectPreferences) ApplicationLocator.getManager().getPreferences("project");
73
            
74
            MapContext viewMapContext = new MapContext(
75
                                new ViewPort( preferences.getDefaultProjection() )
76
                );
77
                vp = viewMapContext.getViewPort();
78
                vp.setBackColor(preferences.getDefaultViewBackColor());
79
                vp.setDistanceUnits(preferences.getDefaultDistanceUnits());
80
                vp.setDistanceArea(preferences.getDefaultDistanceArea());
81
                vp.setMapUnits(preferences.getDefaultMapUnits());
82
                this.setMapContext(viewMapContext);
83
                
84
                MapContext overviewMapContext = new MapContext(
85
                                new ViewPort( viewMapContext.getProjection() )
86
                );
87
                vp = viewMapContext.getViewPort();
88
                vp.setBackColor(preferences.getDefaultViewBackColor());
89
                this.setMapOverViewContext(overviewMapContext);
90
        }
91
        
92
        public void saveToState(PersistentState state) throws PersistenceException {
93
                super.saveToState(state);
94
        }
95
        
96
        public void loadFromState(PersistentState state) throws PersistenceException {
97
                super.loadFromState(state);
98
        }
99

    
100
        public String exportDocumentAsText() {
101
                // FIXME: jjdc PersistentManager getStateAsText o similar
102
//                 PersistenceManager manager = ToolsLocator.getPersistenceManager();
103
//                 PersistentState state = manager.getState(this);
104
//                 return manager.getStateAsText(state);
105
                return null;
106
        }
107

    
108
        public void setStateFromText(String text) {
109
                // FIXME: jjdc PersistentManager getStateFromText o similar
110
//                 PersistenceManager manager = ToolsLocator.getPersistenceManager();
111
//                 PersistentState state = manager.getStateFromText(text);
112
//                 this.loadFromState(state);
113
        }
114

    
115
        
116
}