svn-gvsig-desktop / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / project / documents / view / DefaultViewDocument.java @ 36443
History | View | Annotate | Download (3.6 KB)
1 | 31496 | jjdelcerro | /* gvSIG. Geographic Information System of the Valencian Government
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2007-2009 Infrastructures and Transports Department
|
||
4 | 31544 | cordinyana | * of the Valencian Government (CIT)
|
5 | 31496 | jjdelcerro | *
|
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 | 29598 | jpiera | package org.gvsig.app.project.documents.view; |
29 | 7304 | caballero | |
30 | 31496 | jjdelcerro | import org.gvsig.app.ApplicationLocator; |
31 | import org.gvsig.app.project.ProjectPreferences; |
||
32 | import org.gvsig.app.project.documents.DocumentManager; |
||
33 | 20994 | jmvivo | import org.gvsig.fmap.mapcontext.MapContext; |
34 | 31496 | jjdelcerro | import org.gvsig.fmap.mapcontext.ViewPort; |
35 | 33275 | jjdelcerro | import org.gvsig.tools.ToolsLocator; |
36 | import org.gvsig.tools.dynobject.DynStruct; |
||
37 | import org.gvsig.tools.persistence.PersistenceManager; |
||
38 | 31496 | jjdelcerro | import org.gvsig.tools.persistence.PersistentState; |
39 | 32880 | jjdelcerro | import org.gvsig.tools.persistence.exception.PersistenceException; |
40 | 20994 | jmvivo | |
41 | 7304 | caballero | |
42 | |||
43 | /**
|
||
44 | * Clase que representa una vista del proyecto
|
||
45 | *
|
||
46 | 31496 | jjdelcerro | * @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 | 7304 | caballero | */
|
52 | |||
53 | 31496 | jjdelcerro | public class DefaultViewDocument extends BaseViewDocument { |
54 | 7304 | caballero | |
55 | /**
|
||
56 | 31496 | jjdelcerro | *
|
57 | 7304 | caballero | */
|
58 | 31496 | jjdelcerro | private static final long serialVersionUID = 676711512482334764L; |
59 | 7304 | caballero | |
60 | 33275 | jjdelcerro | public static final String PERSISTENCE_DEFINITION_NAME = "DefaultViewDocument"; |
61 | |||
62 | |||
63 | 31496 | jjdelcerro | public DefaultViewDocument() {
|
64 | this(null); |
||
65 | 7304 | caballero | } |
66 | 31496 | jjdelcerro | |
67 | public DefaultViewDocument(DocumentManager factory) {
|
||
68 | super(factory);
|
||
69 | 7304 | caballero | |
70 | 31496 | jjdelcerro | 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 | 7304 | caballero | } |
91 | 31496 | jjdelcerro | |
92 | public void saveToState(PersistentState state) throws PersistenceException { |
||
93 | super.saveToState(state);
|
||
94 | 7304 | caballero | } |
95 | 31496 | jjdelcerro | |
96 | public void loadFromState(PersistentState state) throws PersistenceException { |
||
97 | super.loadFromState(state);
|
||
98 | 7304 | caballero | } |
99 | |||
100 | 31496 | jjdelcerro | 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 | 7304 | caballero | } |
107 | |||
108 | 31496 | jjdelcerro | 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 | 7757 | jmvivo | } |
114 | 9532 | caballero | |
115 | 31496 | jjdelcerro | |
116 | 7304 | caballero | } |