Revision 1342
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/shp/DemoSHPDriver.java | ||
---|---|---|
90 | 90 |
*/ |
91 | 91 |
public void close() throws IOException { |
92 | 92 |
IOException ret = null; |
93 |
|
|
93 |
bb = null; |
|
94 | 94 |
try { |
95 | 95 |
channel.close(); |
96 | 96 |
} catch (IOException e) { |
... | ... | |
106 | 106 |
if (ret != null) { |
107 | 107 |
throw ret; |
108 | 108 |
} |
109 |
else // Si todo ha ido bien, preparamos para liberar memoria. |
|
110 |
bb = null; |
|
111 | 109 |
} |
112 | 110 |
|
113 | 111 |
/** |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/ModifyGeometryCommand.java | ||
---|---|---|
1 | 1 |
/* Generated by Together */ |
2 |
|
|
3 | 2 |
package com.iver.cit.gvsig.fmap.edition; |
4 | 3 |
|
5 | 4 |
/** |
6 |
* Modifica una geometr?a del EditableFeatureSource
|
|
5 |
* Modifica una geometr?a del EditableFeatureSource |
|
7 | 6 |
*/ |
8 | 7 |
public class ModifyGeometryCommand implements Command { |
9 |
|
|
10 | 8 |
/** |
11 | 9 |
* @see com.iver.cit.gvsig.fmap.edition.Command#execute() |
12 | 10 |
*/ |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/AddGeometryCommand.java | ||
---|---|---|
1 | 1 |
/* Generated by Together */ |
2 |
|
|
3 | 2 |
package com.iver.cit.gvsig.fmap.edition; |
4 | 3 |
|
5 | 4 |
/** |
6 |
* A?ade una geometr?a nueva al EditableFeatureSource
|
|
5 |
* A?ade una geometr?a nueva al EditableFeatureSource |
|
7 | 6 |
*/ |
8 | 7 |
public class AddGeometryCommand implements Command { |
9 |
|
|
10 | 8 |
/** |
11 | 9 |
* @see com.iver.cit.gvsig.fmap.edition.Command#execute() |
12 | 10 |
*/ |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/MemoryCommandRecord.java | ||
---|---|---|
1 | 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 |
*/ |
|
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 | 41 |
package com.iver.cit.gvsig.fmap.edition; |
42 | 42 |
|
43 | 43 |
import java.util.ArrayList; |
44 | 44 |
|
45 | 45 |
|
46 |
public class MemoryCommandRecord implements CommandRecord{ |
|
47 |
ArrayList commands=new ArrayList(); |
|
46 |
/** |
|
47 |
* DOCUMENT ME! |
|
48 |
* |
|
49 |
* @author Fernando Gonz?lez Cort?s |
|
50 |
*/ |
|
51 |
public class MemoryCommandRecord implements CommandRecord { |
|
52 |
ArrayList commands = new ArrayList(); |
|
53 |
|
|
48 | 54 |
/** |
49 | 55 |
* @see com.iver.cit.gvsig.fmap.edition.CommandRecord#addCommand(com.iver.cit.gvsig.fmap.edition.Command) |
50 | 56 |
*/ |
51 | 57 |
public boolean addCommand(Command command) { |
52 | 58 |
commands.add(command); |
59 |
|
|
53 | 60 |
return true; |
54 | 61 |
} |
55 | 62 |
|
... | ... | |
58 | 65 |
*/ |
59 | 66 |
public boolean delCommand(Command command) { |
60 | 67 |
commands.remove(command); |
68 |
|
|
61 | 69 |
return true; |
62 | 70 |
} |
63 | 71 |
|
... | ... | |
66 | 74 |
*/ |
67 | 75 |
public boolean clear() { |
68 | 76 |
commands.clear(); |
77 |
|
|
69 | 78 |
return true; |
70 | 79 |
} |
71 | 80 |
|
... | ... | |
73 | 82 |
* @see com.iver.cit.gvsig.fmap.edition.CommandRecord#execute() |
74 | 83 |
*/ |
75 | 84 |
public boolean execute() { |
76 |
for (int i=0;i<commands.size();i++){
|
|
77 |
((Command)commands.get(i)).execute(); |
|
85 |
for (int i = 0; i < commands.size(); i++) {
|
|
86 |
((Command) commands.get(i)).execute();
|
|
78 | 87 |
} |
88 |
|
|
79 | 89 |
return true; |
80 | 90 |
} |
81 | 91 |
|
... | ... | |
92 | 102 |
public boolean stop() { |
93 | 103 |
return true; |
94 | 104 |
} |
95 |
|
|
96 | 105 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/EditableFeatureSourceProxy.java | ||
---|---|---|
1 | 1 |
package com.iver.cit.gvsig.fmap.edition; |
2 | 2 |
|
3 |
import java.io.IOException; |
|
4 |
|
|
5 | 3 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
6 | 4 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
7 | 5 |
|
6 |
import java.io.IOException; |
|
8 | 7 |
|
8 |
|
|
9 | 9 |
/** |
10 | 10 |
* Clase proxy que implementa los m?todos de EditableFeatureSource apilando los |
11 | 11 |
* comandos correspondientes en el fichero dietario. Estos comandos al |
... | ... | |
15 | 15 |
public class EditableFeatureSourceProxy implements EditableFeatureSource { |
16 | 16 |
private DefaultEditableFeatureSource defs; |
17 | 17 |
private CommandRecord cr; |
18 |
|
|
19 |
public EditableFeatureSourceProxy(DefaultEditableFeatureSource defs,CommandRecord cr){ |
|
20 |
this.defs=defs; |
|
21 |
this.cr=cr; |
|
18 |
|
|
19 |
/** |
|
20 |
* Crea un nuevo EditableFeatureSourceProxy. |
|
21 |
* |
|
22 |
* @param defs DOCUMENT ME! |
|
23 |
* @param cr DOCUMENT ME! |
|
24 |
*/ |
|
25 |
public EditableFeatureSourceProxy(DefaultEditableFeatureSource defs, |
|
26 |
CommandRecord cr) { |
|
27 |
this.defs = defs; |
|
28 |
this.cr = cr; |
|
22 | 29 |
} |
30 |
|
|
23 | 31 |
/** |
32 |
* DOCUMENT ME! |
|
33 |
* |
|
24 | 34 |
* @throws EditionException |
35 |
* |
|
25 | 36 |
* @see com.iver.cit.gvsig.fmap.edition.EditableFeatureSource#startEdition() |
26 | 37 |
*/ |
27 | 38 |
public void startEdition() throws EditionException { |
... | ... | |
30 | 41 |
} |
31 | 42 |
|
32 | 43 |
/** |
44 |
* DOCUMENT ME! |
|
45 |
* |
|
33 | 46 |
* @throws EditionException |
47 |
* |
|
34 | 48 |
* @see com.iver.cit.gvsig.fmap.edition.EditableFeatureSource#stopEdition() |
35 | 49 |
*/ |
36 | 50 |
public void stopEdition() throws EditionException { |
... | ... | |
39 | 53 |
} |
40 | 54 |
|
41 | 55 |
/** |
56 |
* DOCUMENT ME! |
|
57 |
* |
|
58 |
* @param index DOCUMENT ME! |
|
59 |
* |
|
60 |
* @return DOCUMENT ME! |
|
61 |
* |
|
62 |
* @throws IOException |
|
42 | 63 |
* @throws DriverIOException |
43 |
* @throws IOException
|
|
64 |
* |
|
44 | 65 |
* @see com.iver.cit.gvsig.fmap.edition.EditableFeatureSource#getGeometry(int) |
45 | 66 |
*/ |
46 |
public IGeometry getGeometry(int index) throws IOException, DriverIOException { |
|
67 |
public IGeometry getGeometry(int index) |
|
68 |
throws IOException, DriverIOException { |
|
47 | 69 |
return defs.getGeometry(index); |
48 | 70 |
} |
49 | 71 |
|
... | ... | |
55 | 77 |
} |
56 | 78 |
|
57 | 79 |
/** |
80 |
* DOCUMENT ME! |
|
81 |
* |
|
82 |
* @param g DOCUMENT ME! |
|
83 |
* |
|
84 |
* @throws DriverIOException |
|
58 | 85 |
* @throws IOException |
59 |
* @throws DriverIOException
|
|
86 |
* |
|
60 | 87 |
* @see com.iver.cit.gvsig.fmap.edition.EditableFeatureSource#addGeometry(com.iver.cit.gvsig.fmap.core.FGeometry) |
61 | 88 |
*/ |
62 | 89 |
public void addGeometry(IGeometry g) throws DriverIOException, IOException { |
63 | 90 |
defs.addGeometry(g); |
91 |
|
|
64 | 92 |
//cr.addCommand(new AddGeometryCommand()); |
65 | 93 |
} |
66 | 94 |
|
... | ... | |
69 | 97 |
*/ |
70 | 98 |
public void removeGeometry(int index) { |
71 | 99 |
defs.removeGeometry(index); |
100 |
|
|
72 | 101 |
//cr.addCommand(new RemoveGeometryCommand()); |
73 | 102 |
} |
74 | 103 |
|
75 | 104 |
/** |
105 |
* DOCUMENT ME! |
|
106 |
* |
|
107 |
* @param index DOCUMENT ME! |
|
108 |
* @param g DOCUMENT ME! |
|
109 |
* |
|
76 | 110 |
* @throws IOException |
111 |
* |
|
77 | 112 |
* @see com.iver.cit.gvsig.fmap.edition.EditableFeatureSource#modifyGeometry(int, |
78 | 113 |
* com.iver.cit.gvsig.fmap.core.FGeometry) |
79 | 114 |
*/ |
80 |
public void modifyGeometry(int index, IGeometry g) throws IOException { |
|
81 |
defs.modifyGeometry(index,g); |
|
115 |
public void modifyGeometry(int index, IGeometry g) |
|
116 |
throws IOException { |
|
117 |
defs.modifyGeometry(index, g); |
|
118 |
|
|
82 | 119 |
//cr.addCommand(new ModifyGeometryCommand()); |
83 | 120 |
} |
121 |
|
|
84 | 122 |
/** |
85 | 123 |
* @see com.iver.cit.gvsig.fmap.edition.EditableFeatureSource#compact() |
86 | 124 |
*/ |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/EditionException.java | ||
---|---|---|
1 | 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 |
*/ |
|
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 | 41 |
package com.iver.cit.gvsig.fmap.edition; |
42 | 42 |
|
43 |
|
|
43 |
/** |
|
44 |
* DOCUMENT ME! |
|
45 |
* |
|
46 |
* @author Fernando Gonz?lez Cort?s |
|
47 |
*/ |
|
44 | 48 |
public class EditionException extends Exception { |
45 |
|
|
46 | 49 |
/** |
47 |
*
|
|
50 |
* |
|
48 | 51 |
*/ |
49 | 52 |
public EditionException() { |
50 | 53 |
super(); |
54 |
} |
|
51 | 55 |
|
52 |
} |
|
53 | 56 |
/** |
57 |
* DOCUMENT ME! |
|
58 |
* |
|
54 | 59 |
* @param arg0 |
55 | 60 |
*/ |
56 | 61 |
public EditionException(String arg0) { |
57 | 62 |
super(arg0); |
63 |
} |
|
58 | 64 |
|
59 |
} |
|
60 | 65 |
/** |
66 |
* DOCUMENT ME! |
|
67 |
* |
|
61 | 68 |
* @param arg0 |
62 | 69 |
* @param arg1 |
63 | 70 |
*/ |
64 | 71 |
public EditionException(String arg0, Throwable arg1) { |
65 | 72 |
super(arg0, arg1); |
73 |
} |
|
66 | 74 |
|
67 |
} |
|
68 | 75 |
/** |
76 |
* DOCUMENT ME! |
|
77 |
* |
|
69 | 78 |
* @param arg0 |
70 | 79 |
*/ |
71 | 80 |
public EditionException(Throwable arg0) { |
72 | 81 |
super(arg0); |
73 |
|
|
74 | 82 |
} |
75 | 83 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/CommandRecord.java | ||
---|---|---|
46 | 46 |
* @author Vicente Caballero Navarro |
47 | 47 |
*/ |
48 | 48 |
public interface CommandRecord { |
49 |
/** |
|
50 |
* DOCUMENT ME! |
|
51 |
* |
|
52 |
* @return DOCUMENT ME! |
|
53 |
*/ |
|
49 | 54 |
boolean start(); |
55 |
|
|
56 |
/** |
|
57 |
* DOCUMENT ME! |
|
58 |
* |
|
59 |
* @return DOCUMENT ME! |
|
60 |
*/ |
|
50 | 61 |
boolean stop(); |
62 |
|
|
63 |
/** |
|
64 |
* DOCUMENT ME! |
|
65 |
* |
|
66 |
* @param command DOCUMENT ME! |
|
67 |
* |
|
68 |
* @return DOCUMENT ME! |
|
69 |
*/ |
|
51 | 70 |
boolean addCommand(Command command); |
71 |
|
|
72 |
/** |
|
73 |
* DOCUMENT ME! |
|
74 |
* |
|
75 |
* @param command DOCUMENT ME! |
|
76 |
* |
|
77 |
* @return DOCUMENT ME! |
|
78 |
*/ |
|
52 | 79 |
boolean delCommand(Command command); |
80 |
|
|
81 |
/** |
|
82 |
* DOCUMENT ME! |
|
83 |
* |
|
84 |
* @return DOCUMENT ME! |
|
85 |
*/ |
|
53 | 86 |
boolean clear(); |
87 |
|
|
88 |
/** |
|
89 |
* DOCUMENT ME! |
|
90 |
* |
|
91 |
* @return DOCUMENT ME! |
|
92 |
*/ |
|
54 | 93 |
boolean execute(); |
55 | 94 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/DeleteGeometryCommand.java | ||
---|---|---|
1 | 1 |
/* Generated by Together */ |
2 |
|
|
3 | 2 |
package com.iver.cit.gvsig.fmap.edition; |
4 | 3 |
|
5 | 4 |
/** |
6 |
* Elimina una geometria del EditablFeatureSource
|
|
5 |
* Elimina una geometria del EditablFeatureSource |
|
7 | 6 |
*/ |
8 | 7 |
public class DeleteGeometryCommand implements Command { |
9 |
|
|
10 | 8 |
/** |
11 | 9 |
* @see com.iver.cit.gvsig.fmap.edition.Command#execute() |
12 | 10 |
*/ |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/Command.java | ||
---|---|---|
1 | 1 |
/* Generated by Together */ |
2 |
|
|
3 | 2 |
package com.iver.cit.gvsig.fmap.edition; |
4 | 3 |
|
4 |
/** |
|
5 |
* DOCUMENT ME! |
|
6 |
* |
|
7 |
* @author $author$ |
|
8 |
*/ |
|
5 | 9 |
public interface Command { |
6 |
void execute(); |
|
10 |
/** |
|
11 |
* DOCUMENT ME! |
|
12 |
*/ |
|
13 |
void execute(); |
|
7 | 14 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/prueba.java | ||
---|---|---|
1 | 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 |
*/ |
|
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 | 41 |
package com.iver.cit.gvsig.fmap.edition; |
42 | 42 |
|
43 |
import java.io.File; |
|
44 |
import java.io.IOException; |
|
45 |
|
|
46 |
import org.cresques.cts.IProjection; |
|
47 |
import org.cresques.cts.ProjectionPool; |
|
48 |
|
|
49 | 43 |
import com.hardcode.driverManager.Driver; |
50 | 44 |
import com.hardcode.driverManager.DriverLoadException; |
51 | 45 |
import com.hardcode.driverManager.DriverManager; |
46 |
|
|
52 | 47 |
import com.hardcode.gdbms.engine.instruction.FieldNotFoundException; |
48 |
|
|
53 | 49 |
import com.iver.cit.gvsig.fmap.DriverException; |
54 | 50 |
import com.iver.cit.gvsig.fmap.core.ShapeFactory; |
55 | 51 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
... | ... | |
63 | 59 |
import com.iver.cit.gvsig.fmap.rendering.LegendFactory; |
64 | 60 |
import com.iver.cit.gvsig.fmap.rendering.VectorialLegend; |
65 | 61 |
|
62 |
import org.cresques.cts.IProjection; |
|
63 |
import org.cresques.cts.ProjectionPool; |
|
66 | 64 |
|
65 |
import java.io.File; |
|
66 |
import java.io.IOException; |
|
67 |
|
|
68 |
|
|
69 |
/** |
|
70 |
* DOCUMENT ME! |
|
71 |
* |
|
72 |
* @author Fernando Gonz?lez Cort?s |
|
73 |
*/ |
|
67 | 74 |
public class prueba { |
68 |
|
|
69 |
public FLayer createLayer(String layerName, VectorialFileDriver d, |
|
70 |
File f, IProjection proj) throws DriverException { |
|
71 |
//TODO Comprobar si hay un adaptador ya |
|
72 |
VectorialFileAdapter adapter = new VectorialFileAdapter(f); |
|
73 |
adapter.setDriver((VectorialDriver) d); |
|
74 |
FileEditableFeatureSource fefs=new FileEditableFeatureSource((VectorialFileAdapter)adapter); |
|
75 |
MemoryExpansionFile mef=new MemoryExpansionFile(); |
|
76 |
DefaultEditableFeatureSource defs=new DefaultEditableFeatureSource(mef,fefs); |
|
77 |
try { |
|
78 |
defs.addGeometry(ShapeFactory.createPoint2D(1,3)); |
|
79 |
defs.addGeometry(ShapeFactory.createPoint2D(2,2)); |
|
80 |
defs.addGeometry(ShapeFactory.createPoint2D(3,1)); |
|
81 |
defs.addGeometry(ShapeFactory.createPoint2D(4,0)); |
|
82 |
} catch (DriverIOException e1) { |
|
83 |
e1.printStackTrace(); |
|
84 |
} catch (IOException e1) { |
|
85 |
e1.printStackTrace(); |
|
86 |
} |
|
87 |
FLyrVect capa = new FLyrVect(); |
|
88 |
capa.setName(layerName); |
|
75 |
/** |
|
76 |
* DOCUMENT ME! |
|
77 |
* |
|
78 |
* @param layerName DOCUMENT ME! |
|
79 |
* @param d DOCUMENT ME! |
|
80 |
* @param f DOCUMENT ME! |
|
81 |
* @param proj DOCUMENT ME! |
|
82 |
* |
|
83 |
* @return DOCUMENT ME! |
|
84 |
* |
|
85 |
* @throws DriverException DOCUMENT ME! |
|
86 |
*/ |
|
87 |
public FLayer createLayer(String layerName, VectorialFileDriver d, File f, |
|
88 |
IProjection proj) throws DriverException { |
|
89 |
//TODO Comprobar si hay un adaptador ya |
|
90 |
VectorialFileAdapter adapter = new VectorialFileAdapter(f); |
|
91 |
adapter.setDriver((VectorialDriver) d); |
|
89 | 92 |
|
90 |
//TODO Meter esto dentro de la comprobaci?n de si hay memoria |
|
91 |
if (false) { |
|
93 |
FileEditableFeatureSource fefs = new FileEditableFeatureSource((VectorialFileAdapter) adapter); |
|
94 |
MemoryExpansionFile mef = new MemoryExpansionFile(); |
|
95 |
DefaultEditableFeatureSource defs = new DefaultEditableFeatureSource(mef, |
|
96 |
fefs); |
|
97 |
|
|
98 |
try { |
|
99 |
defs.addGeometry(ShapeFactory.createPoint2D(1, 3)); |
|
100 |
defs.addGeometry(ShapeFactory.createPoint2D(2, 2)); |
|
101 |
defs.addGeometry(ShapeFactory.createPoint2D(3, 1)); |
|
102 |
defs.addGeometry(ShapeFactory.createPoint2D(4, 0)); |
|
103 |
} catch (DriverIOException e1) { |
|
104 |
e1.printStackTrace(); |
|
105 |
} catch (IOException e1) { |
|
106 |
e1.printStackTrace(); |
|
107 |
} |
|
108 |
|
|
109 |
FLyrVect capa = new FLyrVect(); |
|
110 |
capa.setName(layerName); |
|
111 |
|
|
112 |
//TODO Meter esto dentro de la comprobaci?n de si hay memoria |
|
113 |
if (false) { |
|
114 |
} else { |
|
115 |
capa.setSource(adapter); |
|
116 |
capa.setProjection(proj); |
|
117 |
} |
|
118 |
|
|
119 |
try { |
|
120 |
// Le asignamos tambi?n una legenda por defecto acorde con |
|
121 |
// el tipo de shape que tenga. Tampoco s? si es aqu? el |
|
122 |
// sitio adecuado, pero en fin.... |
|
123 |
if (d instanceof WithDefaultLegend) { |
|
124 |
WithDefaultLegend aux = (WithDefaultLegend) d; |
|
125 |
adapter.start(); |
|
126 |
capa.setLegend((VectorialLegend) aux.getDefaultLegend()); |
|
127 |
adapter.stop(); |
|
92 | 128 |
} else { |
93 |
capa.setSource(adapter);
|
|
94 |
capa.setProjection(proj);
|
|
129 |
capa.setLegend(LegendFactory.createSingleSymbolLegend(
|
|
130 |
capa.getShapeType()));
|
|
95 | 131 |
} |
132 |
} catch (FieldNotFoundException e) { |
|
133 |
//Esta no puede saltar |
|
134 |
} catch (DriverIOException e) { |
|
135 |
throw new DriverException(e); |
|
136 |
} |
|
96 | 137 |
|
97 |
try { |
|
98 |
// Le asignamos tambi?n una legenda por defecto acorde con |
|
99 |
// el tipo de shape que tenga. Tampoco s? si es aqu? el |
|
100 |
// sitio adecuado, pero en fin.... |
|
101 |
if (d instanceof WithDefaultLegend) { |
|
102 |
WithDefaultLegend aux = (WithDefaultLegend) d; |
|
103 |
adapter.start(); |
|
104 |
capa.setLegend((VectorialLegend) aux.getDefaultLegend()); |
|
105 |
adapter.stop(); |
|
106 |
} else { |
|
107 |
capa.setLegend(LegendFactory.createSingleSymbolLegend( |
|
108 |
capa.getShapeType())); |
|
109 |
} |
|
110 |
} catch (FieldNotFoundException e) { |
|
111 |
//Esta no puede saltar |
|
112 |
} catch (DriverIOException e) { |
|
113 |
throw new DriverException(e); |
|
114 |
} |
|
138 |
return capa; |
|
139 |
} |
|
115 | 140 |
|
116 |
return capa; |
|
117 |
} |
|
141 |
/** |
|
142 |
* DOCUMENT ME! |
|
143 |
* |
|
144 |
* @param args DOCUMENT ME! |
|
145 |
*/ |
|
118 | 146 |
public static void main(String[] args) { |
119 | 147 |
DriverManager driverManager = new DriverManager(); |
120 | 148 |
driverManager.loadDrivers(new File("../FMap 03/drivers")); |
121 |
prueba prueba=new prueba(); |
|
122 |
FLayer layer=null; |
|
149 |
|
|
150 |
prueba prueba = new prueba(); |
|
151 |
FLayer layer = null; |
|
152 |
|
|
123 | 153 |
try { |
124 |
layer=prueba.createLayer("prueba", (VectorialFileDriver)driverManager.getDriver("gvSIG shp driver"),new File("c:/Layers/puntosPrueba.shp"),ProjectionPool.get("EPSG:23030")); |
|
154 |
layer = prueba.createLayer("prueba", |
|
155 |
(VectorialFileDriver) driverManager.getDriver( |
|
156 |
"gvSIG shp driver"), |
|
157 |
new File("c:/Layers/puntosPrueba.shp"), |
|
158 |
ProjectionPool.get("EPSG:23030")); |
|
125 | 159 |
} catch (DriverException e) { |
126 | 160 |
e.printStackTrace(); |
127 | 161 |
} catch (DriverLoadException e) { |
128 | 162 |
e.printStackTrace(); |
129 | 163 |
} |
130 |
|
|
131 | 164 |
} |
132 | 165 |
} |
Also available in: Unified diff