Revision 33587

View differences:

tags/tmp_build/extensions/extAddIDEELayers/.project
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>extAddIDEELayers</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>de.loskutov.FileSync.FSBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
	</buildSpec>
19
	<natures>
20
		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
21
		<nature>org.eclipse.jdt.core.javanature</nature>
22
		<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature>
23
	</natures>
24
</projectDescription>
0 25

  
tags/tmp_build/extensions/extAddIDEELayers/config/text_en.properties
1
#text_en.properties
2
Anyadir_las_capas_del_IDEE=Add the Layers of IDEE
3
Nuevo_Nombre_Capas=IDEE WMS Layers
4
error=Error
0 5

  
tags/tmp_build/extensions/extAddIDEELayers/config/text_ca.properties
1
#text.properties
2
Anyadir_las_capas_del_IDEE=Anyadir les Capes de l'IDEE
3
Nuevo_Nombre_Capas=Capes WMS de l'IDEE
4
error=Error
0 5

  
tags/tmp_build/extensions/extAddIDEELayers/config/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<libraries library-dir="."/>
4
	<depends plugin-name="com.iver.cit.gvsig"/>
5
		<resourceBundle name="text"/>
6
	<extensions>
7
		<extension class-name="com.iver.gvsig.addIDEElayers.AddIDEELayersExtension"
8
			description="AddIDEELayers 0.1RC1  Extensi?n que permite a?adir las capas del IDEE a la vista."
9
			active="true"
10
			priority="20">
11
			<menu text="Vista/Anyadir_las_capas_del_IDEE"
12
			    tooltip="Anyadir_las_capas_del_IDEE"			
13
				icon="images/addIDEElayers.png" />
14
		    <tool-bar name="View" position="2">
15
				<action-tool icon="images/addIDEElayers.png"
16
					tooltip="Anyadir_las_capas_del_IDEE" position="1"/>
17
			</tool-bar>
18
		</extension>
19
	</extensions>
20
</plugin-config>
0 21

  
tags/tmp_build/extensions/extAddIDEELayers/config/text.properties
1
#text.properties
2
Anyadir_las_capas_del_IDEE=A?adir las Capas del IDEE
3
Nuevo_Nombre_Capas=Capas WMS de la IDEE
4
error=Error
0 5

  
tags/tmp_build/extensions/extAddIDEELayers/doc/install.txt
1
Plugin para A?adir las Capas WMS de la IDEE a la Vista. Instrucciones de instalaci?n
2

  
3
- Descomprimir "gvSIGAddIDEELayersPlugin.zip" en el directorio "/bin/gvSIG/extensiones".
4

  
0 5

  
tags/tmp_build/extensions/extAddIDEELayers/doc/version_history.txt
1
Add IDEE WMS Layers Plugin. Version history
2

  
3
This document lists the Change History of release versions of the Add IDEE Layers
4
Plugin for gvSIG
5

  
6

  
7
Version 0.1
8
Release Date: 25-08-2006
9

  
10
- Baseline version
11

  
0 12

  
tags/tmp_build/extensions/extAddIDEELayers/doc/gpl.txt
1
		    GNU GENERAL PUBLIC LICENSE
2
		       Version 2, June 1991
3

  
4
 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
6
 Everyone is permitted to copy and distribute verbatim copies
7
 of this license document, but changing it is not allowed.
8

  
9
			    Preamble
10

  
11
  The licenses for most software are designed to take away your
12
freedom to share and change it.  By contrast, the GNU General Public
13
License is intended to guarantee your freedom to share and change free
14
software--to make sure the software is free for all its users.  This
15
General Public License applies to most of the Free Software
16
Foundation's software and to any other program whose authors commit to
17
using it.  (Some other Free Software Foundation software is covered by
18
the GNU Library General Public License instead.)  You can apply it to
19
your programs, too.
20

  
21
  When we speak of free software, we are referring to freedom, not
22
price.  Our General Public Licenses are designed to make sure that you
23
have the freedom to distribute copies of free software (and charge for
24
this service if you wish), that you receive source code or can get it
25
if you want it, that you can change the software or use pieces of it
26
in new free programs; and that you know you can do these things.
27

  
28
  To protect your rights, we need to make restrictions that forbid
29
anyone to deny you these rights or to ask you to surrender the rights.
30
These restrictions translate to certain responsibilities for you if you
31
distribute copies of the software, or if you modify it.
32

  
33
  For example, if you distribute copies of such a program, whether
34
gratis or for a fee, you must give the recipients all the rights that
35
you have.  You must make sure that they, too, receive or can get the
36
source code.  And you must show them these terms so they know their
37
rights.
38

  
39
  We protect your rights with two steps: (1) copyright the software, and
40
(2) offer you this license which gives you legal permission to copy,
41
distribute and/or modify the software.
42

  
43
  Also, for each author's protection and ours, we want to make certain
44
that everyone understands that there is no warranty for this free
45
software.  If the software is modified by someone else and passed on, we
46
want its recipients to know that what they have is not the original, so
47
that any problems introduced by others will not reflect on the original
48
authors' reputations.
49

  
50
  Finally, any free program is threatened constantly by software
51
patents.  We wish to avoid the danger that redistributors of a free
52
program will individually obtain patent licenses, in effect making the
53
program proprietary.  To prevent this, we have made it clear that any
54
patent must be licensed for everyone's free use or not licensed at all.
55

  
56
  The precise terms and conditions for copying, distribution and
57
modification follow.
58

59
		    GNU GENERAL PUBLIC LICENSE
60
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61

  
62
  0. This License applies to any program or other work which contains
63
a notice placed by the copyright holder saying it may be distributed
64
under the terms of this General Public License.  The "Program", below,
65
refers to any such program or work, and a "work based on the Program"
66
means either the Program or any derivative work under copyright law:
67
that is to say, a work containing the Program or a portion of it,
68
either verbatim or with modifications and/or translated into another
69
language.  (Hereinafter, translation is included without limitation in
70
the term "modification".)  Each licensee is addressed as "you".
71

  
72
Activities other than copying, distribution and modification are not
73
covered by this License; they are outside its scope.  The act of
74
running the Program is not restricted, and the output from the Program
75
is covered only if its contents constitute a work based on the
76
Program (independent of having been made by running the Program).
77
Whether that is true depends on what the Program does.
78

  
79
  1. You may copy and distribute verbatim copies of the Program's
80
source code as you receive it, in any medium, provided that you
81
conspicuously and appropriately publish on each copy an appropriate
82
copyright notice and disclaimer of warranty; keep intact all the
83
notices that refer to this License and to the absence of any warranty;
84
and give any other recipients of the Program a copy of this License
85
along with the Program.
86

  
87
You may charge a fee for the physical act of transferring a copy, and
88
you may at your option offer warranty protection in exchange for a fee.
89

  
90
  2. You may modify your copy or copies of the Program or any portion
91
of it, thus forming a work based on the Program, and copy and
92
distribute such modifications or work under the terms of Section 1
93
above, provided that you also meet all of these conditions:
94

  
95
    a) You must cause the modified files to carry prominent notices
96
    stating that you changed the files and the date of any change.
97

  
98
    b) You must cause any work that you distribute or publish, that in
99
    whole or in part contains or is derived from the Program or any
100
    part thereof, to be licensed as a whole at no charge to all third
101
    parties under the terms of this License.
102

  
103
    c) If the modified program normally reads commands interactively
104
    when run, you must cause it, when started running for such
105
    interactive use in the most ordinary way, to print or display an
106
    announcement including an appropriate copyright notice and a
107
    notice that there is no warranty (or else, saying that you provide
108
    a warranty) and that users may redistribute the program under
109
    these conditions, and telling the user how to view a copy of this
110
    License.  (Exception: if the Program itself is interactive but
111
    does not normally print such an announcement, your work based on
112
    the Program is not required to print an announcement.)
113

114
These requirements apply to the modified work as a whole.  If
115
identifiable sections of that work are not derived from the Program,
116
and can be reasonably considered independent and separate works in
117
themselves, then this License, and its terms, do not apply to those
118
sections when you distribute them as separate works.  But when you
119
distribute the same sections as part of a whole which is a work based
120
on the Program, the distribution of the whole must be on the terms of
121
this License, whose permissions for other licensees extend to the
122
entire whole, and thus to each and every part regardless of who wrote it.
123

  
124
Thus, it is not the intent of this section to claim rights or contest
125
your rights to work written entirely by you; rather, the intent is to
126
exercise the right to control the distribution of derivative or
127
collective works based on the Program.
128

  
129
In addition, mere aggregation of another work not based on the Program
130
with the Program (or with a work based on the Program) on a volume of
131
a storage or distribution medium does not bring the other work under
132
the scope of this License.
133

  
134
  3. You may copy and distribute the Program (or a work based on it,
135
under Section 2) in object code or executable form under the terms of
136
Sections 1 and 2 above provided that you also do one of the following:
137

  
138
    a) Accompany it with the complete corresponding machine-readable
139
    source code, which must be distributed under the terms of Sections
140
    1 and 2 above on a medium customarily used for software interchange; or,
141

  
142
    b) Accompany it with a written offer, valid for at least three
143
    years, to give any third party, for a charge no more than your
144
    cost of physically performing source distribution, a complete
145
    machine-readable copy of the corresponding source code, to be
146
    distributed under the terms of Sections 1 and 2 above on a medium
147
    customarily used for software interchange; or,
148

  
149
    c) Accompany it with the information you received as to the offer
150
    to distribute corresponding source code.  (This alternative is
151
    allowed only for noncommercial distribution and only if you
152
    received the program in object code or executable form with such
153
    an offer, in accord with Subsection b above.)
154

  
155
The source code for a work means the preferred form of the work for
156
making modifications to it.  For an executable work, complete source
157
code means all the source code for all modules it contains, plus any
158
associated interface definition files, plus the scripts used to
159
control compilation and installation of the executable.  However, as a
160
special exception, the source code distributed need not include
161
anything that is normally distributed (in either source or binary
162
form) with the major components (compiler, kernel, and so on) of the
163
operating system on which the executable runs, unless that component
164
itself accompanies the executable.
165

  
166
If distribution of executable or object code is made by offering
167
access to copy from a designated place, then offering equivalent
168
access to copy the source code from the same place counts as
169
distribution of the source code, even though third parties are not
170
compelled to copy the source along with the object code.
171

172
  4. You may not copy, modify, sublicense, or distribute the Program
173
except as expressly provided under this License.  Any attempt
174
otherwise to copy, modify, sublicense or distribute the Program is
175
void, and will automatically terminate your rights under this License.
176
However, parties who have received copies, or rights, from you under
177
this License will not have their licenses terminated so long as such
178
parties remain in full compliance.
179

  
180
  5. You are not required to accept this License, since you have not
181
signed it.  However, nothing else grants you permission to modify or
182
distribute the Program or its derivative works.  These actions are
183
prohibited by law if you do not accept this License.  Therefore, by
184
modifying or distributing the Program (or any work based on the
185
Program), you indicate your acceptance of this License to do so, and
186
all its terms and conditions for copying, distributing or modifying
187
the Program or works based on it.
188

  
189
  6. Each time you redistribute the Program (or any work based on the
190
Program), the recipient automatically receives a license from the
191
original licensor to copy, distribute or modify the Program subject to
192
these terms and conditions.  You may not impose any further
193
restrictions on the recipients' exercise of the rights granted herein.
194
You are not responsible for enforcing compliance by third parties to
195
this License.
196

  
197
  7. If, as a consequence of a court judgment or allegation of patent
198
infringement or for any other reason (not limited to patent issues),
199
conditions are imposed on you (whether by court order, agreement or
200
otherwise) that contradict the conditions of this License, they do not
201
excuse you from the conditions of this License.  If you cannot
202
distribute so as to satisfy simultaneously your obligations under this
203
License and any other pertinent obligations, then as a consequence you
204
may not distribute the Program at all.  For example, if a patent
205
license would not permit royalty-free redistribution of the Program by
206
all those who receive copies directly or indirectly through you, then
207
the only way you could satisfy both it and this License would be to
208
refrain entirely from distribution of the Program.
209

  
210
If any portion of this section is held invalid or unenforceable under
211
any particular circumstance, the balance of the section is intended to
212
apply and the section as a whole is intended to apply in other
213
circumstances.
214

  
215
It is not the purpose of this section to induce you to infringe any
216
patents or other property right claims or to contest validity of any
217
such claims; this section has the sole purpose of protecting the
218
integrity of the free software distribution system, which is
219
implemented by public license practices.  Many people have made
220
generous contributions to the wide range of software distributed
221
through that system in reliance on consistent application of that
222
system; it is up to the author/donor to decide if he or she is willing
223
to distribute software through any other system and a licensee cannot
224
impose that choice.
225

  
226
This section is intended to make thoroughly clear what is believed to
227
be a consequence of the rest of this License.
228

229
  8. If the distribution and/or use of the Program is restricted in
230
certain countries either by patents or by copyrighted interfaces, the
231
original copyright holder who places the Program under this License
232
may add an explicit geographical distribution limitation excluding
233
those countries, so that distribution is permitted only in or among
234
countries not thus excluded.  In such case, this License incorporates
235
the limitation as if written in the body of this License.
236

  
237
  9. The Free Software Foundation may publish revised and/or new versions
238
of the General Public License from time to time.  Such new versions will
239
be similar in spirit to the present version, but may differ in detail to
240
address new problems or concerns.
241

  
242
Each version is given a distinguishing version number.  If the Program
243
specifies a version number of this License which applies to it and "any
244
later version", you have the option of following the terms and conditions
245
either of that version or of any later version published by the Free
246
Software Foundation.  If the Program does not specify a version number of
247
this License, you may choose any version ever published by the Free Software
248
Foundation.
249

  
250
  10. If you wish to incorporate parts of the Program into other free
251
programs whose distribution conditions are different, write to the author
252
to ask for permission.  For software which is copyrighted by the Free
253
Software Foundation, write to the Free Software Foundation; we sometimes
254
make exceptions for this.  Our decision will be guided by the two goals
255
of preserving the free status of all derivatives of our free software and
256
of promoting the sharing and reuse of software generally.
257

  
258
			    NO WARRANTY
259

  
260
  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
262
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
266
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
267
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
REPAIR OR CORRECTION.
269

  
270
  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
POSSIBILITY OF SUCH DAMAGES.
279

  
280
		     END OF TERMS AND CONDITIONS
281

282
	    How to Apply These Terms to Your New Programs
283

  
284
  If you develop a new program, and you want it to be of the greatest
285
possible use to the public, the best way to achieve this is to make it
286
free software which everyone can redistribute and change under these terms.
287

  
288
  To do so, attach the following notices to the program.  It is safest
289
to attach them to the start of each source file to most effectively
290
convey the exclusion of warranty; and each file should have at least
291
the "copyright" line and a pointer to where the full notice is found.
292

  
293
    <one line to give the program's name and a brief idea of what it does.>
294
    Copyright (C) <year>  <name of author>
295

  
296
    This program is free software; you can redistribute it and/or modify
297
    it under the terms of the GNU General Public License as published by
298
    the Free Software Foundation; either version 2 of the License, or
299
    (at your option) any later version.
300

  
301
    This program is distributed in the hope that it will be useful,
302
    but WITHOUT ANY WARRANTY; without even the implied warranty of
303
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
304
    GNU General Public License for more details.
305

  
306
    You should have received a copy of the GNU General Public License
307
    along with this program; if not, write to the Free Software
308
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
309

  
310

  
311
Also add information on how to contact you by electronic and paper mail.
312

  
313
If the program is interactive, make it output a short notice like this
314
when it starts in an interactive mode:
315

  
316
    Gnomovision version 69, Copyright (C) year name of author
317
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
318
    This is free software, and you are welcome to redistribute it
319
    under certain conditions; type `show c' for details.
320

  
321
The hypothetical commands `show w' and `show c' should show the appropriate
322
parts of the General Public License.  Of course, the commands you use may
323
be called something other than `show w' and `show c'; they could even be
324
mouse-clicks or menu items--whatever suits your program.
325

  
326
You should also get your employer (if you work as a programmer) or your
327
school, if any, to sign a "copyright disclaimer" for the program, if
328
necessary.  Here is a sample; alter the names:
329

  
330
  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
331
  `Gnomovision' (which makes passes at compilers) written by James Hacker.
332

  
333
  <signature of Ty Coon>, 1 April 1989
334
  Ty Coon, President of Vice
335

  
336
This General Public License does not permit incorporating your program into
337
proprietary programs.  If your program is a subroutine library, you may
338
consider it more useful to permit linking proprietary applications with the
339
library.  If this is what you want to do, use the GNU Library General
340
Public License instead of this License.
0 341

  
tags/tmp_build/extensions/extAddIDEELayers/src/com/iver/gvsig/addIDEElayers/AddIDEELayersExtension.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.gvsig.addIDEElayers;
42

  
43
import java.util.HashMap;
44

  
45
import javax.swing.JOptionPane;
46

  
47
import com.iver.andami.PluginServices;
48
import com.iver.andami.plugins.Extension;
49
import com.iver.andami.ui.mdiManager.IWindow;
50
import com.iver.cit.gvsig.fmap.MapControl;
51
import com.iver.cit.gvsig.fmap.layers.FLyrWMS;
52
import com.iver.cit.gvsig.project.documents.view.gui.View;
53

  
54
/**
55
 * Adds all the layers of the IDEE to the current active View
56
 * 
57
 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
58
 */
59
public class AddIDEELayersExtension extends Extension {
60
    private String sName = "Nuevo_Nombre_Capas";
61
    private String sHost = "http://www.idee.es/wms/IDEE-Base/IDEE-Base";
62
    private String sLayers = "Todas";
63
    private String sSRS = "EPSG:4230"; // Sistema de referencia
64
    private String sFormat = "image/gif";
65

  
66
	/* (non-Javadoc)
67
     * @see com.iver.andami.plugins.Extension#inicializar()
68
     */
69
    public void initialize() {
70
    }
71

  
72
    /* (non-Javadoc)
73
     * @see com.iver.andami.plugins.Extension#execute(java.lang.String)
74
     */
75
    public void execute(String actionCommand) {
76
		View theView = (View) PluginServices.getMDIManager().getActiveWindow();
77
		
78
		this.addIDEELayers(theView.getMapControl());
79
		return;
80
    }
81
    
82
	/**
83
	 * Downloads the IDEE layers and adds them to the View
84
	 * 
85
	 * Returns false if there has been any error, else return true
86
	 */	
87
	public boolean addIDEELayers(MapControl mapControl) {
88
		 try
89
		 {
90
			 // Create a hash map for the properties of the layer to load
91
			 HashMap<String, String> info = new HashMap<String, String>();
92
			
93
			 info.put("name", PluginServices.getText(this, sName));
94
			 info.put("selectedLayers", sLayers);
95
			 info.put("host", sHost);
96
			 info.put("SRS", sSRS);
97
			 info.put("Format", sFormat);
98
			 info.put("layer", sLayers);
99
	       
100
			 /* Gets-Download the IDEE WMS layer from IDEE */
101
			 FLyrWMS ideeLayer = new FLyrWMS(info);
102
			
103
			 /* Adds the layers to the View */
104
			 // To prevent that events that take place (are produced) could be a nuisance to the load of the layers
105
			 mapControl.getMapContext().beginAtomicEvent();
106

  
107
			 int numberOfLayers = mapControl.getMapContext().getLayers().getLayersCount();
108
			 
109
			 // Adds the layers
110
			 mapControl.getMapContext().getLayers().addLayer(ideeLayer);
111
			 
112
			 // Changes the name of the layers into more intuitive other one
113
			 mapControl.getMapContext().getLayers().getLayer(numberOfLayers).setName((String)info.get("name"));
114
				
115
			 // End To prevent that events that take place(are produced) could be a nuisance to the load of the layers		 
116
			 mapControl.getMapContext().endAtomicEvent();
117
		    
118
			 // Refresh the view
119
			 mapControl.getMapContext().invalidate();
120
			 
121
		 } catch (Exception ex) {
122
			 // Notify the problem to the user
123
			 ex.printStackTrace();
124
			 JOptionPane.showMessageDialog(null, PluginServices.getText(null, "error") + ":\n" + ex.getMessage(), PluginServices.getText(null, "error"), JOptionPane.ERROR_MESSAGE);
125
			 return false;
126
		 }
127
        
128
      return true;
129
    }
130
   
131
    /* (non-Javadoc)
132
     * @see com.iver.andami.plugins.Extension#isEnabled()
133
     */
134
    public boolean isEnabled() {
135
		return true; // By default is enabled
136
    }
137

  
138
    /* (non-Javadoc)
139
     * @see com.iver.andami.plugins.Extension#isVisible()
140
     */
141
    public boolean isVisible() {
142
		IWindow window = PluginServices.getMDIManager().getActiveWindow();
143

  
144
		if (window == null) {
145
			return false;
146
		}
147
		
148
		return (window instanceof View);
149
    }
150

  
151
}
0 152

  
tags/tmp_build/extensions/extAddIDEELayers/build.xml
1
<project name="Generar extension en Andami" default="generate-without-source" basedir=".">
2
    <description>
3
        Instala el plugin de Añadir las capas del IDEE a la vista.
4
    </description>
5
  <!-- set global properties for this build -->
6
  <property name="extensions-dir" location="../_fwAndami/gvSIG/extensiones"/>
7
  <property name="src" location="src"/>
8
  <property name="build" location="bin"/>
9
  <property name="doc"  location="doc"/>
10
  <property name="dist"  location="dist"/>
11
  <property name="without_src"  location="without_src"/>
12
  <property name="plugin" value="com.iver.gvsig.addIDEElayers"/>
13
	<property name="jarName" value="com.iver.gvsig.addIDEElayers.jar"/>
14
	<property name="andami" location="../_fwAndami"/>
15
	<property name="extensionsDir" location="${andami}/gvSIG/extensiones"/>
16
	<property name="fmapLibs" location="../libFMap/lib" />
17
	<property name="andamiLibs" location="${andami}/lib" />
18
	<property name="compile-classpath" value="${andamiLibs}/beans.jar:${fmapLibs}/cms.jar"/>
19
	<property name="installBaseDir" location="${andami}"/>
20
	<property name="installDir" location="${installBaseDir}/gvSIG/extensiones/${plugin}"/>
21

  
22
  <target name="init">
23
    <!-- Create the time stamp -->
24
    <tstamp/>
25
  </target>
26

  
27
  <target name="dist" depends="init"
28
	description="generate the distribution" >
29
    <!-- Remove previous distribution directory -->
30
    <delete dir="${dist}"/>
31
    <!-- Create the distribution directory structure -->
32
    <mkdir dir="${dist}"/>
33
    <mkdir dir="${dist}/src"/>
34
  <!--  <mkdir dir="${dist}/doc"/> -->
35
    <mkdir dir="${dist}/bin"/>
36
    <mkdir dir="${dist}/bin/com"/>
37
    <mkdir dir="${dist}/bin/com/iver"/>
38
    <mkdir dir="${dist}/bin/com/iver/gvsig"/>
39
    <mkdir dir="${dist}/bin/com/iver/gvsig/addIDEElayers"/>
40
    <mkdir dir="${dist}/bin/com/iver/gvsig/addIDEElayers/images"/>
41
    <mkdir dir="${dist}/images"/>
42
    <mkdir dir="${dist}/config"/>
43
    <!-- Copy necessary distribution files to dist dir -->
44
    <copy todir="${dist}/src">
45
      <fileset dir="${src}"/>
46
    </copy>
47
    <copy todir="${dist}/doc">
48
      <fileset dir="${doc}"/>
49
    </copy>
50
    <copy todir="${dist}/images">
51
      <fileset dir="images"/>
52
    </copy>
53
    <copy file="config/config.xml" todir="${dist}/config"/>
54
    <copy todir="${dist}">
55
    	<fileset dir="config" includes="text*.properties"/>
56
    </copy>
57
    <copy file="build.xml" todir="${dist}"/>
58

  
59
    <!-- <copy todir="${dist}">
60
    	<fileset dir="." includes="text*.properties"/>
61
    </copy>
62
    <copy todir="${dist}/bin/com/iver/gvsig/addIDEElayers">
63
    	<fileset dir="." includes="text*.properties"/>
64
    </copy> -->
65
    <jar jarfile="${dist}/bin/com/iver/gvsig/addIDEElayers/${plugin}.jar" basedir="${build}"/>
66
    <copy file="config/config.xml" todir="${dist}/bin/com/iver/gvsig/addIDEElayers"/>
67
    <copy todir="${dist}/bin/com/iver/gvsig/addIDEElayers/images">
68
      <fileset dir="images"/>
69
    </copy>
70
    <!-- Zip distribution -->
71
    <zip destfile="${dist}/gvSIGAddIDEELayersPlugin.zip"
72
         basedir="${dist}"
73
         update="true"
74
    />
75
  </target>
76

  
77
  <target name="clean"
78
		description="clean dist directory" >
79
    <!-- Clean the distribution directory -->
80
    <delete dir="${dist}/src"/>
81
    <delete dir="${dist}/doc"/>
82
    <delete dir="${dist}/bin"/>
83
    <delete dir="${dist}/images"/>
84
    <delete dir="${dist}/config"/>
85
  	<delete file="${dist}/build.xml"/>
86
  	<delete>
87
        <fileset dir="${dist}" includes="**/*.properties"/>
88
    </delete>
89
  </target>
90
	
91
  <target name="generate-without-source" depends="clean" description="generate the distribution without the source file" >
92
    <!-- Create the distribution directory -->
93
    <mkdir dir="${without_src}"/>
94

  
95
    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
96
    <jar jarfile="${without_src}/${plugin}.jar" basedir="${build}"/>
97
    <copy file="config/config.xml" todir="${without_src}"/>
98
    <copy todir="${without_src}">
99
    	<fileset dir="config" includes="text*.properties"/>
100
    </copy>
101
    <!-- <copy todir="${without_src}">
102
    	<fileset dir="." includes="text*.properties"/>
103
    </copy> -->
104
    <copy todir="${without_src}/images">
105
    	<fileset dir="images/" includes="*"/>
106
    </copy>
107
    <move todir="${extensions-dir}/${plugin}/">
108
    	<fileset dir="${without_src}" includes="**/**"/>
109
    </move>
110
  </target>
111
	
112

  
113
	<target name="batch-build"
114
			description="compile the sources, create the jar file"
115
			depends="compile,create-jar,copy-data-files,move-to-installDir">
116
	</target>
117

  
118
	<target name="compile" description="compile the source" >
119
		<!-- Compile the Java code from ${src} to ${build} -->
120
		<mkdir dir="${build}" />
121
		<javac  srcdir="${src}"
122
			destdir="${build}"
123
			debug="${debug}"
124
			debuglevel="${debuglevel}"
125
			classpath="${compile-classpath}"/>
126
	</target>
127
	
128
	<target name="create-jar"
129
			description="Creates the plugin jar">
130
		<mkdir dir="${dist}"/>
131
	    <jar jarfile="${dist}/${jarName}" basedir="${build}" />
132
	</target>
133

  
134
	<target name="copy-data-files">
135
	    <copy file="config/config.xml" todir="${dist}"/>
136
		<copy todir="${dist}">
137
			<fileset dir="config" includes="text*.properties"/>
138
		</copy>
139
		<copy todir="${dist}/images">
140
			<fileset dir="images/" includes="*"/>
141
		</copy>
142
	</target>
143
	
144
	<target name="move-to-installDir">
145
		<move todir="${installDir}">
146
			<fileset dir="${dist}" includes="**/**"/>
147
		</move>
148
	</target>
149

  
150
</project>
151

  
0 152

  
tags/tmp_build/extensions/extAddIDEELayers/.classpath
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5
	<classpathentry kind="src" path="/_fwAndami"/>
6
	<classpathentry kind="src" path="/libFMap"/>
7
	<classpathentry kind="src" path="/appgvSIG"/>
8
	<classpathentry combineaccessrules="false" kind="src" path="/extWMS"/>
9
	<classpathentry kind="lib" path="/libFMap/lib/org.gvsig.fmap.raster.jar" sourcepath="/extRasterTools-SE"/>
10
	<classpathentry kind="lib" path="/libFMap/lib/org.gvsig.raster.jar" sourcepath="/libRaster/src"/>
11
	<classpathentry kind="lib" path="/libFMap/lib/org.cresques.cts.jar"/>
12
	<classpathentry kind="lib" path="/_fwAndami/lib/org.gvsig.ui.jar" sourcepath="/libUIComponent/src"/>
13
	<classpathentry kind="lib" path="/_fwAndami/lib/org.gvsig.exceptions.jar"/>
14
	<classpathentry kind="output" path="bin"/>
15
</classpath>
0 16

  
tags/tmp_build/extensions/extWFS/.cvsignore
1
bin
0 2

  
tags/tmp_build/extensions/extWFS/build.xml
1
<project name="Generar extension en Andami" default="generate-without-source" basedir=".">
2
    <description>
3
        Instala el plugin en Andami
4
    </description>
5
  <!-- set global properties for this build -->
6
  <property name="src" location="src"/>
7
  <property name="build" location="bin"/>
8
  <property name="dist"  location="dist"/>
9
  <property name="mainplugin" value="com.iver.cit.gvsig"/>
10
  <property name="plugin" value="com.iver.cit.gvsig.wfs"/>
11
  <property name="gvsiglibjar" value="gvsig-wfsclient"/>
12
  <property name="catalogPlugin" value="es.gva.cit.gvsig.catalogClient"/>
13
  <property name="fmapjar" value="fmap-wfsclient"/>
14
  <property name="driverjar" value="wfs"/>
15
  <property name="extensionDir" location="../_fwAndami/gvSIG/extensiones"/>
16
	
17
  <property name="drivers-dir" location="${extensionDir}/${mainplugin}/drivers" />
18

  
19
  <target name="init">
20
    <!-- Create the time stamp -->
21
    <tstamp/>
22
    <!-- Create the build directory structure used by compile -->
23
    <mkdir dir="${build}"/>
24
    <mkdir dir="${dist}"/>
25
  	<!-- Creamos un fichero con el timeStamp para que lo lea el FPanelAbout -->
26
  	<buildnumber/> 
27
  	
28
  </target>
29

  
30
  <target name="generate-without-source"
31
  		description="generate the distribution without the source file">
32
  		<!-- depends="wfs-driver" -->
33
    <!-- Create the distribution directory -->
34
    <mkdir dir="${dist}"/>
35
  	 <mkdir dir="${dist}/lib"/>
36
		
37
    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
38
    <jar jarfile="${dist}/lib/${plugin}.jar" basedir="${build}" includes="com/iver/cit/gvsig/wfs/**"/>
39
    <jar jarfile="${dist}/lib/wfsLoader.jar" basedir="${build}" includes="es/gva/cit/gvsig/wfs/loader/**"/>
40
  	<jar jarfile="${dist}/${gvsiglibjar}.jar" basedir="${build}" includes="com/iver/cit/gvsig/gui/**"/>
41
  	<jar jarfile="${dist}/${fmapjar}.jar" basedir="${build}"
42
  		includes="com/iver/cit/gvsig/fmap/**,es/uji/lsi/wfs/**,org/cresques/io/rasterOld/**" />
43
  		<!-- excludes="com/iver/cit/gvsig/fmap/drivers/wfs/**" /-->
44
  	<copy file="config/config.xml" todir="${dist}"/>
45
    <copy file="config/plugin.dtd" todir="${dist}"/>
46
  	<!--
47
  	<copy todir="${dist}/lib">
48
  	  	<fileset dir="./lib" includes="gt2-wfs.jar"/>
49
  	</copy>
50
  	-->
51
  	<copy todir="${dist}">
52
    	<fileset dir="." includes="text*.properties"/>
53
    </copy>  	
54
  	
55
  	<move todir="${extensionDir}/${mainplugin}/lib">
56
  		<fileset dir="${dist}" includes="${gvsiglibjar}.jar"/>
57
 		<fileset dir="${dist}" includes="${fmapjar}.jar"/>
58
  	</move>  	
59
    <move todir="${extensionDir}/${plugin}/">
60
    	<fileset dir="${dist}" includes="**/**"/>
61
    </move>
62
  	<copy todir="${extensionDir}/${mainplugin}/lib">
63
  		<fileset dir="./lib" includes="gt2-wfs.jar"/>
64
  	</copy>	
65
  	<!--
66
    <move todir="${extensionDir}/${catalogPlugin}/lib/">
67
      	<fileset dir="${extensionDir}/${plugin}/lib" includes="**/**"/>
68
    </move>-->
69
 	
70
  </target>
71

  
72
	<target name="wfs-driver" depends="" description="Genera el jar de wfs">
73
		<mkdir dir="${drivers-dir}/wfs" />
74
		<jar jarfile="${drivers-dir}/wfs/${driverjar}.jar" basedir="${build}" includes="com/iver/cit/gvsig/fmap/drivers/wfs/**" />
75
	</target>
76

  
77
  <target name="generate-with-source" description="generate the distribution with the source file" >
78
    <!-- Create the distribution directory -->
79
    <mkdir dir="${dist}"/>
80

  
81
    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
82
    <jar jarfile="${dist}/${plugin}.jar" basedir="${build}"/>
83
    <copy file="config/config.xml" todir="${dist}"/>
84
    <copy file="config/plugin.dtd" todir="${dist}"/>
85
    <copy todir="${dist}">
86
    	<fileset dir="." includes="text*.properties"/>
87
    </copy>
88
    <copy todir="${dist}">
89
    	<fileset dir="." includes="${src}"/>
90
    </copy>
91
    <copy todir="${dist}/images">
92
    	<fileset dir="images/" includes="*"/>
93
    </copy>
94
    <!--copy todir="${dist}">
95
    	<fileset dir="./lib" includes="*.jar,*.zip"/>
96
    </copy-->
97
    <move todir="${extension-dir}/${plugin}/">
98
    	<fileset dir="${dist}" includes="**/**"/>
99
    </move>
100
  </target>
101

  
102
  <target name="clean"
103
        description="clean up" >
104
    <!-- Delete the ${build} and ${dist} directory trees -->
105
    <delete dir="${dist}"/>
106
  </target>
107
</project>
0 108

  
tags/tmp_build/extensions/extWFS/text.properties
1
cadena_de_conexion=Cadena de conexi?n
2
anterior=Anterior
3
siguiente=Siguiente
0 4

  
tags/tmp_build/extensions/extWFS/.project
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>extWFS</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>de.loskutov.FileSync.FSBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
	</buildSpec>
19
	<natures>
20
		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
21
		<nature>org.eclipse.jdt.core.javanature</nature>
22
		<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature>
23
	</natures>
24
</projectDescription>
0 25

  
tags/tmp_build/extensions/extWFS/config/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	
4
	<depends plugin-name="com.iver.cit.gvsig" />
5
	<libraries library-dir="./lib"/>
6
	<extensions>
7
		<extension class-name="com.iver.cit.gvsig.wfs.ExtWFS"
8
			description="Support to access WFS"
9
			active="true"
10
			priority="1">
11
		</extension>		
12
	</extensions>
13
</plugin-config>
0 14

  
tags/tmp_build/extensions/extWFS/config/plugin.dtd
1
<?xml version="1.0" encoding="ISO_8859-1"?>
2
<!ELEMENT class EMPTY >
3
<!ATTLIST class name NMTOKEN #REQUIRED >
4

  
5
<!ELEMENT extension ( class | menu | toolBar | toolBoxItem | popupMenu)* >
6
<!ATTLIST extension enabled NMTOKEN #IMPLIED >
7
<!ATTLIST extension position NMTOKEN #IMPLIED >
8

  
9
<!ELEMENT fileExtension ( class ) >
10
<!ATTLIST fileExtension description CDATA #REQUIRED >
11
<!ATTLIST fileExtension enabled NMTOKEN #IMPLIED >
12
<!ATTLIST fileExtension endsWith CDATA #REQUIRED >
13
<!ATTLIST fileExtension dialog CDATA #REQUIRED >
14

  
15
<!ELEMENT import EMPTY >
16
<!ATTLIST import plugin NMTOKEN #REQUIRED >
17

  
18
<!ELEMENT libraries ( library+ ) >
19

  
20
<!ELEMENT library EMPTY >
21
<!ATTLIST library file NMTOKEN #REQUIRED >
22

  
23
<!ELEMENT menu EMPTY >
24
<!ATTLIST menu actionCommand NMTOKEN #IMPLIED >
25
<!ATTLIST menu enableText CDATA #IMPLIED >
26
<!ATTLIST menu key NMTOKEN #IMPLIED >
27
<!ATTLIST menu mnemonic NMTOKEN #IMPLIED >
28
<!ATTLIST menu icon CDATA #IMPLIED >
29
<!ATTLIST menu text CDATA #REQUIRED >
30
<!ATTLIST menu tooltip CDATA #IMPLIED >
31

  
32
<!ELEMENT plugin ( import*, libraries, resourceBundle, labelSet*, extension*, fileExtension*, icon*) >
33

  
34
<!ELEMENT icon EMPTY >
35
<!ATTLIST icon src CDATA #REQUIRED >
36
<!ATTLIST icon text CDATA #REQUIRED >
37

  
38
<!ELEMENT resourceBundle EMPTY >
39
<!ATTLIST resourceBundle name NMTOKEN #REQUIRED >
40

  
41
<!ELEMENT tool EMPTY >
42
<!ATTLIST tool actionCommand NMTOKEN #IMPLIED >
43
<!ATTLIST tool enableText CDATA #IMPLIED >
44
<!ATTLIST tool icon CDATA #IMPLIED >
45
<!ATTLIST tool text NMTOKEN #IMPLIED >
46
<!ATTLIST tool tooltip CDATA #IMPLIED >
47

  
48
<!ELEMENT toolBar ( tool+ ) >
49
<!ATTLIST toolBar name NMTOKEN #IMPLIED >
50

  
51
<!ELEMENT entry EMPTY >
52
<!ATTLIST entry text CDATA #IMPLIED >
53
<!ATTLIST entry enableText CDATA #IMPLIED >
54
<!ATTLIST entry tooltip CDATA #IMPLIED >
55
<!ATTLIST entry actionCommand NMTOKEN #IMPLIED >
56

  
57
<!ELEMENT popupMenu ( entry+ ) >
58
<!ATTLIST popupMenu name NMTOKEN #IMPLIED >
59

  
60
<!ELEMENT labelSet ( label+ ) >
61
<!ATTLIST labelSet class NMTOKEN #REQUIRED >
62

  
63
<!ELEMENT label EMPTY >
64
<!ATTLIST label text NMTOKEN #REQUIRED >
65
<!ATTLIST label size NMTOKEN #IMPLIED>
66

  
67
<!ELEMENT toolBoxItem EMPTY >
68
<!ATTLIST toolBoxItem default NMTOKEN #IMPLIED >
69
<!ATTLIST toolBoxItem actionCommand NMTOKEN #IMPLIED >
70
<!ATTLIST toolBoxItem icon CDATA #IMPLIED >
71
<!ATTLIST toolBoxItem text CDATA #IMPLIED >
72
<!ATTLIST toolBoxItem tooltip CDATA #IMPLIED >
0 73

  
tags/tmp_build/extensions/extWFS/src/com/iver/cit/gvsig/fmap/drivers/wfs/IWFSdriver.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*
19
* For more information, contact:
20
*
21
*  Generalitat Valenciana
22
*   Conselleria d'Infraestructures i Transport
23
*   Av. Blasco Ib??ez, 50
24
*   46010 VALENCIA
25
*   SPAIN
26
*
27
*      +34 963862235
28
*   gvsig@gva.es
29
*      www.gvsig.gva.es
30
*
31
*    or
32
*
33
*   IVER T.I. S.A
34
*   Salamanca 50
35
*   46005 Valencia
36
*   Spain
37
*
38
*   +34 963163400
39
*   dac@iver.es
40
*/
41
package com.iver.cit.gvsig.fmap.drivers.wfs;
42
import java.awt.geom.Rectangle2D;
43
import java.io.IOException;
44
import java.net.URL;
45

  
46
import com.iver.cit.gvsig.fmap.DriverException;
47
import com.iver.cit.gvsig.fmap.core.IFeature;
48
import com.iver.cit.gvsig.fmap.core.IGeometry;
49
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator;
50
import com.iver.cit.gvsig.fmap.drivers.VectorialDriver;
51

  
52
public interface IWFSdriver extends  VectorialDriver {
53
    /**
54
     * @param conn
55
     * @param tableName
56
     * @param fields (Todos los campos, el primero ha de ser el de las geometr?as
57
     * @param whereClause
58
     * @param id_FID_field El identificador del campo que contiene una clave ?nica. 1=> primer campo, 2 => segundo campo, etc
59
     * @throws IOException 
60
     * 
61
     */
62
    public void setData(String url,String user,String pwd,String[] layers,boolean protocol,int numFeatures,int timeout,int id_FID_field) throws IOException;
63
    public Rectangle2D getFullExtent();
64
    // public int getShapeType();
65
    public IGeometry getShape(int index);
66
    public URL getHost();
67
    //public IFeatureIterator getFeatureIterator(String sql) throws DriverException;
68
    public IFeatureIterator getFeatureIterator(Rectangle2D r, String strEPSG) throws DriverException,IOException;
69
	//public String getFields();
70
	//public String getWhereClause();
71
	public void close();
72
    public void open() throws com.iver.cit.gvsig.fmap.DriverException; 
73
    /**
74
     * @param FID
75
     * @return el n?mero de registro asociado a ese FID. Se usa dentro
76
     * del DBStrategy para averig?ar si un Feature est? seleccionado
77
     * o no.
78
     */
79
    public int getRowIndexByFID(IFeature FID);
80
    
81
    
82
}
0 83

  
tags/tmp_build/extensions/extWFS/src/com/iver/cit/gvsig/fmap/drivers/wfs/WFSFeatureIterator.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*
19
* For more information, contact:
20
*
21
*  Generalitat Valenciana
22
*   Conselleria d'Infraestructures i Transport
23
*   Av. Blasco Ib??ez, 50
24
*   46010 VALENCIA
25
*   SPAIN
26
*
27
*      +34 963862235
28
*   gvsig@gva.es
29
*      www.gvsig.gva.es
30
*
31
*    or
32
*
33
*   IVER T.I. S.A
34
*   Salamanca 50
35
*   46005 Valencia
36
*   Spain
37
*
38
*   +34 963163400
39
*   dac@iver.es
40
*/
41
package com.iver.cit.gvsig.fmap.drivers.wfs;
42

  
43
import java.io.IOException;
44
import java.sql.SQLException;
45
import java.util.Date;
46
import java.util.NoSuchElementException;
47

  
48
import org.geotools.data.FeatureReader;
49
import org.geotools.feature.Feature;
50
import org.geotools.feature.IllegalAttributeException;
51

  
52
import com.hardcode.gdbms.engine.values.Value;
53
import com.hardcode.gdbms.engine.values.ValueFactory;
54
import com.iver.cit.gvsig.fmap.DriverException;
55
import com.iver.cit.gvsig.fmap.core.IFeature;
56
import com.iver.cit.gvsig.fmap.core.IGeometry;
57
import com.iver.cit.gvsig.fmap.core.ShapeFactory;
58
import com.iver.cit.gvsig.fmap.core.v02.FConverter;
59
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator;
60

  
61
public class WFSFeatureIterator implements IFeatureIterator{
62
	//private IFeature[] features=null;
63
	private FeatureReader featureReader;
64
	//private ArrayList features;
65
	//private int index=-1;
66
	//private int pos=0;
67
	public WFSFeatureIterator(FeatureReader fr){
68
		featureReader=fr;
69
	}
70
	/*public WFSFeatureIterator(ArrayList l){
71
		features=l;
72
	}*/
73
	public boolean hasNext(){
74
		/*if (features !=null){
75
			if (index<features.size()-1)
76
				return true;
77
			else{
78
				index=-1;
79
				features=null;
80
				return false;
81
			}
82
		}*/
83
		try {
84
			if (featureReader.hasNext()){
85
				return true;
86
			}else{
87
				featureReader.close();
88
				
89
				return false;
90
			}
91
		} catch (IOException e) {
92
			e.printStackTrace();
93
		}
94
		return false;
95
	}
96

  
97
	public IFeature next() throws DriverException {
98
	/*	if (features !=null){
99
			return (IFeature)features.get(++index);
100
		}*/
101
		Feature feature=null;
102
		try {
103
			feature = featureReader.next();
104
		} catch (NoSuchElementException e) {
105
			e.printStackTrace();
106
		} catch (IOException e) {
107
			e.printStackTrace();
108
		} catch (IllegalAttributeException e) {
109
			e.printStackTrace();
110
		}
111
		Object[] attr=null;
112
		attr=feature.getAttributes(attr);
113
		Value[] values=getValues(attr);
114
        
115
		
116
		IGeometry g=ShapeFactory.createGeometry(FConverter.jts_to_java2d(feature.getDefaultGeometry()));
117
		return new com.iver.cit.gvsig.fmap.core.DefaultFeature(g,values,feature.getID());
118
	}
119
	private Value[] getValues(Object[] attr) {
120
		Value[] values=new Value[attr.length];
121
		for (int i=1;i<attr.length;i++){
122
			if (attr[i]!=null){
123
				if (attr[i] instanceof Double){
124
					values[i]=ValueFactory.createValue(((Double)attr[i]).doubleValue());
125
				}else if (attr[i] instanceof String){
126
					values[i]=ValueFactory.createValue(String.valueOf(attr[i]));
127
				}else if (attr[i] instanceof Long){
128
					values[i]=ValueFactory.createValue(((Long)attr[i]).longValue());
129
				}else if (attr[i] instanceof Integer){
130
					values[i]=ValueFactory.createValue(((Integer)attr[i]).intValue());
131
				}else if (attr[i] instanceof Float){
132
					values[i]=ValueFactory.createValue(((Float)attr[i]).floatValue());
133
				}else if (attr[i] instanceof Short){
134
					values[i]=ValueFactory.createValue(((Short)attr[i]).shortValue());
135
				}else if (attr[i] instanceof Boolean){
136
					values[i]=ValueFactory.createValue(((Boolean)attr[i]).booleanValue());
137
				}else if (attr[i] instanceof Date){
138
					values[i]=ValueFactory.createValue(((Date)attr[i]));
139
				}
140
			//	System.out.println("class = "+attr[i].getClass());
141
					
142
			}else{
143
				values[i]=ValueFactory.createValue("");
144
			}
145
		}
146
		return values;
147
	}
148
    public void closeIterator() throws DriverException {
149
        // TODO Auto-generated method stub
150
        
151
    }
152
	
153
}
0 154

  
tags/tmp_build/extensions/extWFS/src/com/iver/cit/gvsig/fmap/drivers/wfs/WFSDataStore2.java
1
/*
2
 * Created on 23-nov-2005
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 * 
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 * 
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff