gvsig-raster / org.gvsig.raster.wmts / trunk / org.gvsig.raster.wmts / org.gvsig.raster.wmts.app.wmtsclient / src / main / java / org / gvsig / raster / wmts / app / wmtsclient / layer / DynObjectSetWMTSInfo.java @ 1944
History | View | Annotate | Download (3.74 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.wmts.app.wmtsclient.layer; |
23 |
|
24 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
25 |
import org.gvsig.tools.ToolsLocator; |
26 |
import org.gvsig.tools.dispose.DisposableIterator; |
27 |
import org.gvsig.tools.dynobject.DynClass; |
28 |
import org.gvsig.tools.dynobject.DynObject; |
29 |
import org.gvsig.tools.dynobject.DynObjectManager; |
30 |
import org.gvsig.tools.dynobject.DynObjectSet; |
31 |
import org.gvsig.tools.exception.BaseException; |
32 |
import org.gvsig.tools.observer.Observable; |
33 |
import org.gvsig.tools.observer.Observer; |
34 |
import org.gvsig.tools.observer.impl.BaseWeakReferencingObservable; |
35 |
import org.gvsig.tools.visitor.Visitor; |
36 |
|
37 |
/**
|
38 |
* {@link DynObject} implementation to facade of a {@link FeatureSet} and allow
|
39 |
* to be used as a {@link DynObjectSet}.
|
40 |
*
|
41 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
42 |
* @version $Id$
|
43 |
*/
|
44 |
public class DynObjectSetWMTSInfo extends BaseWeakReferencingObservable |
45 |
implements DynObjectSet, Observer { |
46 |
public static final int TYPE_TEXT = 0; |
47 |
public static final int TYPE_HTML = 1; |
48 |
public static final int TYPE_XML = 2; |
49 |
private DynObjectIteratorWMTSInfo ite = null; |
50 |
|
51 |
public static void registerDynClass() { |
52 |
DynObjectManager manager = ToolsLocator.getDynObjectManager(); |
53 |
DynClass dynClass = manager.add("WMTSInfoByPoint", "WMTS InfoByPoint"); |
54 |
dynClass.setNamespace("InfoByPoint");
|
55 |
dynClass.addDynFieldString("info");
|
56 |
} |
57 |
|
58 |
/**
|
59 |
* Creates a new facade over a given info, with fast dynobject
|
60 |
* iteration.
|
61 |
*/
|
62 |
public DynObjectSetWMTSInfo(String txt, int type) { |
63 |
DynObjectManager manager = ToolsLocator.getDynObjectManager(); |
64 |
DynObject dynObject = manager.createDynObject("WMTSInfoByPoint");
|
65 |
dynObject.setDynValue("info", txt);
|
66 |
ite = new DynObjectIteratorWMTSInfo(dynObject);
|
67 |
} |
68 |
|
69 |
public void dispose() { |
70 |
|
71 |
} |
72 |
|
73 |
public void accept(final Visitor visitor, long firstValueIndex) throws BaseException { |
74 |
while(ite.hasNext()) {
|
75 |
visitor.visit(ite.next()); |
76 |
} |
77 |
} |
78 |
|
79 |
public void accept(final Visitor visitor) throws BaseException { |
80 |
while(ite.hasNext()) {
|
81 |
visitor.visit(ite.next()); |
82 |
} |
83 |
} |
84 |
|
85 |
public long getSize() throws BaseException { |
86 |
return ite.getSize();
|
87 |
} |
88 |
|
89 |
public DisposableIterator iterator(long index) throws BaseException { |
90 |
return iterator();
|
91 |
} |
92 |
|
93 |
public DisposableIterator iterator() throws BaseException { |
94 |
return ite;
|
95 |
} |
96 |
|
97 |
public boolean isEmpty() throws BaseException { |
98 |
return (getSize() == 0); |
99 |
} |
100 |
|
101 |
public boolean isDeleteEnabled() { |
102 |
return true; |
103 |
} |
104 |
|
105 |
public void delete(DynObject dynObject) throws BaseException { |
106 |
|
107 |
} |
108 |
|
109 |
public boolean isUpdateEnabled() { |
110 |
return true; |
111 |
} |
112 |
|
113 |
public void update(DynObject dynObject) throws BaseException { |
114 |
System.out.println();
|
115 |
} |
116 |
|
117 |
public void update(Observable observable, Object notification) { |
118 |
System.out.println();
|
119 |
} |
120 |
} |