Revision 96
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.26/org.gvsig.dgn.provider.legend/src/main/java/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLabeling.java | ||
---|---|---|
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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.fmap.dal.store.dgn.legend; |
|
29 |
|
|
30 |
import org.gvsig.fmap.dal.exception.OpenException; |
|
31 |
import org.gvsig.fmap.dal.store.dgn.DGNStoreProvider; |
|
32 |
import org.gvsig.fmap.dal.store.dgn.LegendBuilder; |
|
33 |
import org.gvsig.tools.ToolsLocator; |
|
34 |
import org.gvsig.tools.dynobject.DynClass; |
|
35 |
import org.gvsig.tools.dynobject.DynMethod; |
|
36 |
import org.gvsig.tools.dynobject.DynObject; |
|
37 |
import org.gvsig.tools.dynobject.DynObjectManager; |
|
38 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
|
39 |
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException; |
|
40 |
|
|
41 |
public class DGNGetLabeling implements DynMethod { |
|
42 |
private static int code = DynObjectManager.NULLCODE; |
|
43 |
|
|
44 |
static void register(DynClass DGNDynClass) { |
|
45 |
if (code != DynObjectManager.NULLCODE) { |
|
46 |
return; |
|
47 |
} |
|
48 |
code = ToolsLocator.getDynObjectManager().registerDynMethod( |
|
49 |
DGNDynClass, |
|
50 |
new DGNGetLabeling() |
|
51 |
); |
|
52 |
|
|
53 |
} |
|
54 |
public int getCode() throws DynMethodNotSupportedException { |
|
55 |
return code; |
|
56 |
} |
|
57 |
|
|
58 |
public String getDescription() { |
|
59 |
return "DGN Labeling"; |
|
60 |
} |
|
61 |
|
|
62 |
public String getName() { |
|
63 |
return LegendBuilder.DYNMETHOD_GETLABELING_NAME; |
|
64 |
} |
|
65 |
|
|
66 |
public Object invoke(Object self, DynObject context) |
|
67 |
throws DynMethodException { |
|
68 |
try { |
|
69 |
return ((DGNStoreProvider) self).getLabeling(); |
|
70 |
} catch (OpenException e) { |
|
71 |
//FIXME |
|
72 |
throw new RuntimeException(e); |
|
73 |
} |
|
74 |
} |
|
75 |
|
|
76 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.26/org.gvsig.dgn.provider.legend/src/main/java/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLegend.java | ||
---|---|---|
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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.fmap.dal.store.dgn.legend; |
|
29 |
|
|
30 |
import org.gvsig.fmap.dal.exception.OpenException; |
|
31 |
import org.gvsig.fmap.dal.store.dgn.DGNStoreProvider; |
|
32 |
import org.gvsig.fmap.dal.store.dgn.LegendBuilder; |
|
33 |
import org.gvsig.tools.ToolsLocator; |
|
34 |
import org.gvsig.tools.dynobject.DynClass; |
|
35 |
import org.gvsig.tools.dynobject.DynMethod; |
|
36 |
import org.gvsig.tools.dynobject.DynObject; |
|
37 |
import org.gvsig.tools.dynobject.DynObjectManager; |
|
38 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
|
39 |
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException; |
|
40 |
|
|
41 |
public class DGNGetLegend implements DynMethod { |
|
42 |
private static int code = DynObjectManager.NULLCODE; |
|
43 |
|
|
44 |
static void register(DynClass DGNDynClass) { |
|
45 |
if (code != DynObjectManager.NULLCODE) { |
|
46 |
return; |
|
47 |
} |
|
48 |
code = ToolsLocator.getDynObjectManager().registerDynMethod( |
|
49 |
DGNDynClass, |
|
50 |
new DGNGetLegend() |
|
51 |
); |
|
52 |
|
|
53 |
} |
|
54 |
public int getCode() throws DynMethodNotSupportedException { |
|
55 |
return code; |
|
56 |
} |
|
57 |
|
|
58 |
public String getDescription() { |
|
59 |
return "DGN Legend"; |
|
60 |
} |
|
61 |
|
|
62 |
public String getName() { |
|
63 |
return LegendBuilder.DYNMETHOD_GETLEGEND_NAME; |
|
64 |
} |
|
65 |
|
|
66 |
public Object invoke(Object self, DynObject context) |
|
67 |
throws DynMethodException { |
|
68 |
try { |
|
69 |
return ((DGNStoreProvider) self).getLegend(); |
|
70 |
} catch (OpenException e) { |
|
71 |
throw new RuntimeException(e); |
|
72 |
} |
|
73 |
} |
|
74 |
|
|
75 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.26/org.gvsig.dgn.provider.legend/src/main/java/org/gvsig/fmap/dal/store/dgn/legend/DGNLegendLibrary.java | ||
---|---|---|
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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
/** |
|
29 |
* |
|
30 |
*/ |
|
31 |
package org.gvsig.fmap.dal.store.dgn.legend; |
|
32 |
|
|
33 |
import org.gvsig.fmap.dal.DALLibrary; |
|
34 |
import org.gvsig.fmap.dal.store.dgn.DGNLibrary; |
|
35 |
import org.gvsig.fmap.dal.store.dgn.DGNStoreProvider; |
|
36 |
import org.gvsig.metadata.MetadataLibrary; |
|
37 |
import org.gvsig.metadata.MetadataLocator; |
|
38 |
import org.gvsig.tools.dynobject.DynClass; |
|
39 |
import org.gvsig.tools.library.AbstractLibrary; |
|
40 |
import org.gvsig.tools.library.LibraryException; |
|
41 |
|
|
42 |
/** |
|
43 |
* @author jmvivo |
|
44 |
* |
|
45 |
*/ |
|
46 |
public class DGNLegendLibrary extends AbstractLibrary { |
|
47 |
|
|
48 |
@Override |
|
49 |
public void doRegistration() { |
|
50 |
registerAsServiceOf(DALLibrary.class); |
|
51 |
require(DGNLibrary.class); |
|
52 |
require(MetadataLibrary.class); |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
protected void doInitialize() throws LibraryException { |
|
57 |
} |
|
58 |
|
|
59 |
@Override |
|
60 |
protected void doPostInitialize() throws LibraryException { |
|
61 |
DynClass metadataDefinition = (DynClass) MetadataLocator.getMetadataManager() |
|
62 |
.getDefinition(DGNStoreProvider.METADATA_DEFINITION_NAME); |
|
63 |
DGNGetLegendBuilder.register(metadataDefinition); |
|
64 |
DGNGetLegend.register(metadataDefinition); |
|
65 |
DGNGetLabeling.register(metadataDefinition); |
|
66 |
} |
|
67 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.26/org.gvsig.dgn.provider.legend/src/main/java/org/gvsig/fmap/dal/store/dgn/legend/DGNGetLegendBuilder.java | ||
---|---|---|
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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.fmap.dal.store.dgn.legend; |
|
29 |
|
|
30 |
import org.gvsig.fmap.dal.store.dgn.LegendBuilder; |
|
31 |
import org.gvsig.tools.ToolsLocator; |
|
32 |
import org.gvsig.tools.dynobject.DynClass; |
|
33 |
import org.gvsig.tools.dynobject.DynMethod; |
|
34 |
import org.gvsig.tools.dynobject.DynObject; |
|
35 |
import org.gvsig.tools.dynobject.DynObjectManager; |
|
36 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
|
37 |
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException; |
|
38 |
|
|
39 |
public class DGNGetLegendBuilder implements DynMethod { |
|
40 |
private static int code = DynObjectManager.NULLCODE; |
|
41 |
|
|
42 |
static void register(DynClass DGNDynClass) { |
|
43 |
if (code != DynObjectManager.NULLCODE) { |
|
44 |
return; |
|
45 |
} |
|
46 |
code = ToolsLocator.getDynObjectManager().registerDynMethod( |
|
47 |
DGNDynClass, |
|
48 |
new DGNGetLegendBuilder() |
|
49 |
); |
|
50 |
|
|
51 |
} |
|
52 |
|
|
53 |
public int getCode() throws DynMethodNotSupportedException { |
|
54 |
return code; |
|
55 |
} |
|
56 |
|
|
57 |
public String getDescription() { |
|
58 |
return "DGN LegendBuilder creator"; |
|
59 |
} |
|
60 |
|
|
61 |
public String getName() { |
|
62 |
return LegendBuilder.DYNMETHOD_BUILDER_NAME; |
|
63 |
} |
|
64 |
|
|
65 |
public Object invoke(Object self, DynObject context) |
|
66 |
throws DynMethodException { |
|
67 |
return new DGNLegendBuilder(); |
|
68 |
} |
|
69 |
|
|
70 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.26/org.gvsig.dgn.provider.legend/src/main/java/org/gvsig/fmap/dal/store/dgn/legend/DGNLegendBuilder.java | ||
---|---|---|
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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.fmap.dal.store.dgn.legend; |
|
29 |
|
|
30 |
import java.awt.Color; |
|
31 |
|
|
32 |
import org.gvsig.fmap.dal.DataTypes; |
|
33 |
import org.gvsig.fmap.dal.feature.spi.FeatureProvider; |
|
34 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider; |
|
35 |
import org.gvsig.fmap.dal.store.dgn.DGNStoreProvider; |
|
36 |
import org.gvsig.fmap.dal.store.dgn.LegendBuilder; |
|
37 |
import org.gvsig.fmap.dal.store.dgn.lib.DGNReader; |
|
38 |
import org.gvsig.fmap.geom.Geometry; |
|
39 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
40 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
|
41 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorialUniqueValueLegend; |
|
42 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
43 |
import org.gvsig.symbology.SymbologyLocator; |
|
44 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.IAttrInTableLabelingStrategy; |
|
45 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol; |
|
46 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol; |
|
47 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.IMarkerSymbol; |
|
48 |
|
|
49 |
public class DGNLegendBuilder implements LegendBuilder { |
|
50 |
|
|
51 |
private MapContextManager mapContextManager = MapContextLocator |
|
52 |
.getMapContextManager(); |
|
53 |
|
|
54 |
private IVectorialUniqueValueLegend defaultLegend = null; |
|
55 |
private IAttrInTableLabelingStrategy labelingStragegy = null; |
|
56 |
|
|
57 |
public void begin() { |
|
58 |
// Nothing to do |
|
59 |
} |
|
60 |
|
|
61 |
public void end() { |
|
62 |
// Nothing to do |
|
63 |
} |
|
64 |
|
|
65 |
public Object getLegend() { |
|
66 |
return defaultLegend; |
|
67 |
} |
|
68 |
|
|
69 |
public LegendBuilder initialize(FeatureStoreProvider store) { |
|
70 |
defaultLegend = (IVectorialUniqueValueLegend) mapContextManager.createLegend( |
|
71 |
IVectorialUniqueValueLegend.LEGEND_NAME); |
|
72 |
defaultLegend.setShapeType(Geometry.TYPES.GEOMETRY); |
|
73 |
defaultLegend |
|
74 |
.setClassifyingFieldNames(new String[] { DGNStoreProvider.NAME_FIELD_COLOR }); |
|
75 |
defaultLegend.setClassifyingFieldTypes(new int[] { DataTypes.INT }); |
|
76 |
|
|
77 |
ISymbol myDefaultSymbol = |
|
78 |
mapContextManager.getSymbolManager() |
|
79 |
.createSymbol(Geometry.TYPES.GEOMETRY); |
|
80 |
|
|
81 |
defaultLegend.setDefaultSymbol(myDefaultSymbol); |
|
82 |
defaultLegend.useDefaultSymbol(true); |
|
83 |
|
|
84 |
labelingStragegy = SymbologyLocator.getSymbologyManager().createAttrInTableLabelingStrategy(); |
|
85 |
labelingStragegy.setTextField(DGNStoreProvider.NAME_FIELD_TEXT); |
|
86 |
labelingStragegy |
|
87 |
.setRotationField(DGNStoreProvider.NAME_FIELD_ROTATIONTEXT); |
|
88 |
labelingStragegy.setHeightField(DGNStoreProvider.NAME_FIELD_HEIGHTTEXT); |
|
89 |
labelingStragegy.setUnit(1); // MapContext.NAMES[1] (meters) |
|
90 |
return this; |
|
91 |
} |
|
92 |
|
|
93 |
public void process(FeatureProvider feature, DGNReader dgnReader) { |
|
94 |
Integer clave = (Integer) feature.get("Color"); |
|
95 |
if (clave == null) { |
|
96 |
return; |
|
97 |
} |
|
98 |
|
|
99 |
defaultLegend.useDefaultSymbol(false); |
|
100 |
if (defaultLegend.getSymbolByValue(clave) == null) { |
|
101 |
ISymbol theSymbol; |
|
102 |
Color color = dgnReader.DGNLookupColor(clave.intValue()); |
|
103 |
theSymbol = |
|
104 |
mapContextManager.getSymbolManager().createSymbol( |
|
105 |
Geometry.TYPES.GEOMETRY, color); |
|
106 |
|
|
107 |
theSymbol.setDescription(clave.toString()); |
|
108 |
|
|
109 |
if (theSymbol instanceof IMarkerSymbol) { |
|
110 |
((IMarkerSymbol) theSymbol).setSize(1); |
|
111 |
} |
|
112 |
|
|
113 |
if (theSymbol instanceof ILineSymbol) { |
|
114 |
ILineSymbol lineSymbol = (ILineSymbol) theSymbol; |
|
115 |
lineSymbol.setLineWidth(1); |
|
116 |
lineSymbol.setLineColor(color); |
|
117 |
} |
|
118 |
|
|
119 |
if (theSymbol instanceof IFillSymbol) { |
|
120 |
IFillSymbol fillSymbol = (IFillSymbol) theSymbol; |
|
121 |
fillSymbol.getOutline().setLineColor(color); |
|
122 |
fillSymbol.getOutline().setLineWidth(1); |
|
123 |
fillSymbol.setFillColor(null); |
|
124 |
} |
|
125 |
if (theSymbol != null) { |
|
126 |
defaultLegend.addSymbol(clave, theSymbol); |
|
127 |
} |
|
128 |
} |
|
129 |
} |
|
130 |
|
|
131 |
public Object getLabeling() { |
|
132 |
return labelingStragegy; |
|
133 |
} |
|
134 |
|
|
135 |
|
|
136 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.26/org.gvsig.dgn.provider.legend/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.dgn.provider.legend</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>${project.artifactId}</name> |
|
7 |
<description>DAL provider for DGN files</description> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.dgn</artifactId> |
|
11 |
<version>2.0.26</version> |
|
12 |
</parent> |
|
13 |
|
|
14 |
<dependencies> |
|
15 |
|
|
16 |
<dependency> |
|
17 |
<groupId>org.gvsig</groupId> |
|
18 |
<artifactId>org.gvsig.dgn.provider</artifactId> |
|
19 |
<scope>compile</scope> |
|
20 |
</dependency> |
|
21 |
|
|
22 |
<dependency> |
|
23 |
<groupId>commons-io</groupId> |
|
24 |
<artifactId>commons-io</artifactId> |
|
25 |
<scope>compile</scope> |
|
26 |
</dependency> |
|
27 |
|
|
28 |
<dependency> |
|
29 |
<groupId>org.gvsig</groupId> |
|
30 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
31 |
<scope>compile</scope> |
|
32 |
</dependency> |
|
33 |
<dependency> |
|
34 |
<groupId>org.gvsig</groupId> |
|
35 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
36 |
<scope>compile</scope> |
|
37 |
</dependency> |
|
38 |
<dependency> |
|
39 |
<groupId>org.gvsig</groupId> |
|
40 |
<artifactId>org.gvsig.fmap.dal.api</artifactId> |
|
41 |
<scope>compile</scope> |
|
42 |
</dependency> |
|
43 |
<dependency> |
|
44 |
<groupId>org.gvsig</groupId> |
|
45 |
<artifactId>org.gvsig.fmap.dal.spi</artifactId> |
|
46 |
<scope>compile</scope> |
|
47 |
</dependency> |
|
48 |
<dependency> |
|
49 |
<groupId>org.gvsig</groupId> |
|
50 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
51 |
<scope>compile</scope> |
|
52 |
</dependency> |
|
53 |
<dependency> |
|
54 |
<groupId>org.gvsig</groupId> |
|
55 |
<artifactId>org.gvsig.fmap.geometry.api</artifactId> |
|
56 |
<scope>compile</scope> |
|
57 |
</dependency> |
|
58 |
<dependency> |
|
59 |
<groupId>org.gvsig</groupId> |
|
60 |
<artifactId>org.gvsig.fmap.mapcontext.api</artifactId> |
|
61 |
<scope>compile</scope> |
|
62 |
</dependency> |
|
63 |
|
|
64 |
<dependency> |
|
65 |
<groupId>org.gvsig</groupId> |
|
66 |
<artifactId>org.gvsig.symbology.lib.api</artifactId> |
|
67 |
<scope>compile</scope> |
|
68 |
</dependency> |
|
69 |
<dependency> |
|
70 |
<groupId>org.gvsig</groupId> |
|
71 |
<artifactId>org.gvsig.timesupport.lib.api</artifactId> |
|
72 |
<scope>compile</scope> |
|
73 |
</dependency> |
|
74 |
<dependency> |
|
75 |
<groupId>org.gvsig</groupId> |
|
76 |
<artifactId>org.gvsig.utils</artifactId> |
|
77 |
<scope>compile</scope> |
|
78 |
</dependency> |
|
79 |
|
|
80 |
|
|
81 |
<!-- TESTS --> |
|
82 |
<dependency> |
|
83 |
<groupId>org.gvsig</groupId> |
|
84 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
85 |
<type>test-jar</type> |
|
86 |
<scope>test</scope> |
|
87 |
</dependency> |
|
88 |
<dependency> |
|
89 |
<groupId>org.gvsig</groupId> |
|
90 |
<artifactId>org.gvsig.compat.se</artifactId> |
|
91 |
<scope>test</scope> |
|
92 |
</dependency> |
|
93 |
<dependency> |
|
94 |
<groupId>org.gvsig</groupId> |
|
95 |
<artifactId>org.gvsig.fmap.dal.impl</artifactId> |
|
96 |
<scope>test</scope> |
|
97 |
</dependency> |
|
98 |
<dependency> |
|
99 |
<groupId>org.gvsig</groupId> |
|
100 |
<artifactId>org.gvsig.fmap.geometry.generalpath</artifactId> |
|
101 |
<scope>test</scope> |
|
102 |
</dependency> |
|
103 |
<dependency> |
|
104 |
<groupId>org.gvsig</groupId> |
|
105 |
<artifactId>org.gvsig.projection.cresques.impl</artifactId> |
|
106 |
<scope>test</scope> |
|
107 |
</dependency> |
|
108 |
<dependency> |
|
109 |
<groupId>org.gvsig</groupId> |
|
110 |
<artifactId>org.gvsig.timesupport.lib.impl</artifactId> |
|
111 |
<scope>test</scope> |
|
112 |
</dependency> |
|
113 |
|
|
114 |
|
|
115 |
</dependencies> |
|
116 |
|
|
117 |
</project> |
|
0 | 118 |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.26/org.gvsig.dgn.provider/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
4 |
|
|
5 |
<modelVersion>4.0.0</modelVersion> |
|
6 |
<artifactId>org.gvsig.dgn.provider</artifactId> |
|
7 |
<packaging>jar</packaging> |
|
8 |
<name>${project.artifactId}</name> |
|
9 |
<description>DAL provider for DGN files</description> |
|
10 |
<parent> |
|
11 |
<groupId>org.gvsig</groupId> |
|
12 |
<artifactId>org.gvsig.dgn</artifactId> |
|
13 |
<version>2.0.26</version> |
|
14 |
</parent> |
|
15 |
|
|
16 |
<dependencies> |
|
17 |
|
|
18 |
<dependency> |
|
19 |
<groupId>commons-io</groupId> |
|
20 |
<artifactId>commons-io</artifactId> |
|
21 |
<scope>compile</scope> |
|
22 |
</dependency> |
|
23 |
<dependency> |
|
24 |
<groupId>org.apache.commons</groupId> |
|
25 |
<artifactId>commons-lang3</artifactId> |
|
26 |
<scope>compile</scope> |
|
27 |
</dependency> |
|
28 |
<dependency> |
|
29 |
<groupId>org.gvsig</groupId> |
|
30 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
31 |
<scope>compile</scope> |
|
32 |
</dependency> |
|
33 |
<dependency> |
|
34 |
<groupId>org.gvsig</groupId> |
|
35 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
36 |
<scope>compile</scope> |
|
37 |
</dependency> |
|
38 |
<dependency> |
|
39 |
<groupId>org.gvsig</groupId> |
|
40 |
<artifactId>org.gvsig.fmap.dal.api</artifactId> |
|
41 |
<scope>compile</scope> |
|
42 |
</dependency> |
|
43 |
<dependency> |
|
44 |
<groupId>org.gvsig</groupId> |
|
45 |
<artifactId>org.gvsig.fmap.dal.file.lib</artifactId> |
|
46 |
<scope>compile</scope> |
|
47 |
</dependency> |
|
48 |
<dependency> |
|
49 |
<groupId>org.gvsig</groupId> |
|
50 |
<artifactId>org.gvsig.fmap.dal.spi</artifactId> |
|
51 |
<scope>compile</scope> |
|
52 |
</dependency> |
|
53 |
<dependency> |
|
54 |
<groupId>org.gvsig</groupId> |
|
55 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
56 |
<scope>compile</scope> |
|
57 |
</dependency> |
|
58 |
<dependency> |
|
59 |
<groupId>org.gvsig</groupId> |
|
60 |
<artifactId>org.gvsig.fmap.geometry.api</artifactId> |
|
61 |
<scope>compile</scope> |
|
62 |
</dependency> |
|
63 |
<dependency> |
|
64 |
<groupId>org.gvsig</groupId> |
|
65 |
<artifactId>org.gvsig.timesupport.lib.api</artifactId> |
|
66 |
<scope>compile</scope> |
|
67 |
</dependency> |
|
68 |
<dependency> |
|
69 |
<groupId>org.gvsig</groupId> |
|
70 |
<artifactId>org.gvsig.utils</artifactId> |
|
71 |
<scope>compile</scope> |
|
72 |
</dependency> |
|
73 |
|
|
74 |
|
|
75 |
<!-- TESTS --> |
|
76 |
<dependency> |
|
77 |
<groupId>org.gvsig</groupId> |
|
78 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
79 |
<type>test-jar</type> |
|
80 |
<scope>test</scope> |
|
81 |
</dependency> |
|
82 |
<dependency> |
|
83 |
<groupId>org.gvsig</groupId> |
|
84 |
<artifactId>org.gvsig.compat.se</artifactId> |
|
85 |
<scope>test</scope> |
|
86 |
</dependency> |
|
87 |
<dependency> |
|
88 |
<groupId>org.gvsig</groupId> |
|
89 |
<artifactId>org.gvsig.fmap.dal.impl</artifactId> |
|
90 |
<type>test-jar</type> |
|
91 |
<scope>test</scope> |
|
92 |
</dependency> |
|
93 |
<dependency> |
|
94 |
<groupId>org.gvsig</groupId> |
|
95 |
<artifactId>org.gvsig.fmap.geometry.generalpath</artifactId> |
|
96 |
<scope>test</scope> |
|
97 |
</dependency> |
|
98 |
<dependency> |
|
99 |
<groupId>org.gvsig</groupId> |
|
100 |
<artifactId>org.gvsig.projection.cresques.impl</artifactId> |
|
101 |
<scope>test</scope> |
|
102 |
</dependency> |
|
103 |
<dependency> |
|
104 |
<groupId>org.gvsig</groupId> |
|
105 |
<artifactId>org.gvsig.timesupport.lib.impl</artifactId> |
|
106 |
<scope>test</scope> |
|
107 |
</dependency> |
|
108 |
|
|
109 |
|
|
110 |
</dependencies> |
|
111 |
|
|
112 |
<build> |
|
113 |
<plugins> |
|
114 |
<plugin> |
|
115 |
<!-- Skip compilation tests --> |
|
116 |
<groupId>org.apache.maven.plugins</groupId> |
|
117 |
<artifactId>maven-compiler-plugin</artifactId> |
|
118 |
<executions> |
|
119 |
<execution> |
|
120 |
<id>default-testCompile</id> |
|
121 |
<phase>process-test-sources</phase> |
|
122 |
<goals> |
|
123 |
<goal>testCompile</goal> |
|
124 |
</goals> |
|
125 |
<configuration> |
|
126 |
<skip>true</skip> |
|
127 |
</configuration> |
|
128 |
</execution> |
|
129 |
</executions> |
|
130 |
</plugin> |
|
131 |
</plugins> |
|
132 |
</build> |
|
133 |
|
|
134 |
</project> |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.26/org.gvsig.dgn.provider/src/test/java/org/gvsig/fmap/dal/store/dgn/TestDGN.java | ||
---|---|---|
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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.fmap.dal.store.dgn; |
|
29 |
|
|
30 |
import java.io.File; |
|
31 |
|
|
32 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
33 |
import org.gvsig.fmap.dal.exception.DataException; |
|
34 |
import org.gvsig.fmap.dal.feature.BaseTestFeatureStore; |
|
35 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
36 |
|
|
37 |
public class TestDGN extends BaseTestFeatureStore { |
|
38 |
|
|
39 |
public static final File file_prueba = new File(TestDGN.class.getResource( |
|
40 |
"data/prueba.dgn").getFile()); |
|
41 |
|
|
42 |
/* |
|
43 |
* (non-Javadoc) |
|
44 |
* |
|
45 |
* @see |
|
46 |
* org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters |
|
47 |
* () |
|
48 |
*/ |
|
49 |
public DataStoreParameters getDefaultDataStoreParameters() |
|
50 |
throws DataException { |
|
51 |
DGNStoreParameters dgnParameters = null; |
|
52 |
|
|
53 |
dgnParameters = (DGNStoreParameters) dataManager |
|
54 |
.createStoreParameters(DGNStoreProvider.NAME); |
|
55 |
|
|
56 |
dgnParameters.setFile(file_prueba.getAbsolutePath()); |
|
57 |
dgnParameters.setCRS("EPSG:23030"); |
|
58 |
return dgnParameters; |
|
59 |
} |
|
60 |
|
|
61 |
/* |
|
62 |
* (non-Javadoc) |
|
63 |
* |
|
64 |
* @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer() |
|
65 |
*/ |
|
66 |
public boolean hasExplorer() { |
|
67 |
// TODO Auto-generated method stub |
|
68 |
return false; |
|
69 |
} |
|
70 |
|
|
71 |
public boolean usesResources() { |
|
72 |
return true; |
|
73 |
} |
|
74 |
|
|
75 |
|
|
76 |
public void testLegendAndLabeling() throws Exception { |
|
77 |
FeatureStore store = (FeatureStore) dataManager |
|
78 |
.createStore(getDefaultDataStoreParameters()); |
|
79 |
|
|
80 |
assertNotNull(store.invokeDynMethod("getLegend", null)); |
|
81 |
assertNotNull(store.invokeDynMethod("getLabeling", null)); |
|
82 |
store.dispose(); |
|
83 |
} |
|
84 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.26/org.gvsig.dgn.provider/src/main/resources/org/gvsig/fmap/dal/store/dgn/DGNMetadata.xml | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<!-- |
|
3 |
Definitions of metadata fields of a shp file. |
|
4 |
--> |
|
5 |
<definitions> |
|
6 |
<version>1.0.0</version> |
|
7 |
<classes> |
|
8 |
|
|
9 |
<class name="DGN" namespace="Metadata"> |
|
10 |
<extends> |
|
11 |
<class namespace="Metadata" name="SpatialProvider"/> |
|
12 |
</extends> |
|
13 |
<description>Metadata of a DGN store</description> |
|
14 |
<fields> |
|
15 |
</fields> |
|
16 |
</class> |
|
17 |
|
|
18 |
</classes> |
|
19 |
</definitions> |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.26/org.gvsig.dgn.provider/src/main/resources/org/gvsig/fmap/dal/store/dgn/DGNParameters.xml | ||
---|---|---|
1 |
<?xml version= "1.0 "?> |
|
2 |
<definitions> |
|
3 |
<version>1.0.0</version> |
|
4 |
<classes> |
|
5 |
<class name="DGN"> |
|
6 |
<extends> |
|
7 |
<class namespace="dal" name="ProviderParameters"/> |
|
8 |
</extends> |
|
9 |
<description>Store the parameters need to open a dgn file</description> |
|
10 |
<fields> |
|
11 |
|
|
12 |
<!-- General --> |
|
13 |
<field name="file" type="file" mandatory="true"> |
|
14 |
<description>dgn file</description> |
|
15 |
</field> |
|
16 |
<field name="CRS" type="crs" mandatory="true"> |
|
17 |
<description>The coordinate reference system used in this dgn file</description> |
|
18 |
</field> |
|
19 |
<field name="LoadMode" label="Load mode" defaultValue="0" type="integer" mandatory="false"> |
|
20 |
<description>Set the strategy to use for loading DGN elements</description> |
|
21 |
<availableValues> |
|
22 |
<value label="Plain">0</value> |
|
23 |
<value label="Group elements (1)">1</value> |
|
24 |
</availableValues> |
|
25 |
</field> |
|
26 |
<field name="sortByGeometryType" label="Sort by geometry type" type="Boolean" defaultValue="true" mandatory="false"> |
|
27 |
<description>If checked sort the rows of table by the geometry type (none,suface,curve,point)</description> |
|
28 |
</field> |
|
29 |
<field name="ignoreZ" label="Ignore Z" type="Boolean" defaultValue="false" mandatory="false"> |
|
30 |
<description>If checked and DGN has Z dimension, set all Zs to 0.</description> |
|
31 |
</field> |
|
32 |
<field name="Reload" label="Reload" type="Boolean" defaultValue="false" mandatory="false"> |
|
33 |
<description>Reload an already loaded DGN as a new layer</description> |
|
34 |
</field> |
|
35 |
<field name="groupby" label="Field for group" type="String" defaultValue="" mandatory="false"> |
|
36 |
<description>The field name to use for grouping rows</description> |
|
37 |
</field> |
|
38 |
<field name="GroupGeometriesOperation" label="Group geometries as" type="integer" defaultValue="0" mandatory="false"> |
|
39 |
<description>If a 'group by' is applied, apply this operation to the resultant geometries</description> |
|
40 |
<availableValues> |
|
41 |
<value label="None, return the agregate">0</value> |
|
42 |
<value label="Convexhull">1</value> |
|
43 |
<value label="Union">2</value> |
|
44 |
<value label="Intersection">3</value> |
|
45 |
<value label="Convert to points">4</value> |
|
46 |
<value label="Convert to line">5</value> |
|
47 |
<value label="Convert to poligon">7</value> |
|
48 |
<value label="Convert to poligon and fix it">7</value> |
|
49 |
</availableValues> |
|
50 |
</field> |
|
51 |
|
|
52 |
<!-- Advanced --> |
|
53 |
<field name="useZAsElevation" label="Use Z as elevation" type="Boolean" defaultValue="false" mandatory="false" group="Advanced"> |
|
54 |
<description>If set, use the Z value to fill the field elevation.</description> |
|
55 |
</field> |
|
56 |
<field name="elevationFactor" label="Elevation factor" type="Double" defaultValue="1" mandatory="false" group="Advanced"> |
|
57 |
<description>Factor to apply to elevation when is retrived from the Z coordinate.</description> |
|
58 |
</field> |
|
59 |
<field name="roundElevation" label="Round elevation" type="Boolean" defaultValue="false" mandatory="false" group="Advanced"> |
|
60 |
<description>If set, round the elevation to a integer value. This only apply when get elevation from the coordinete Z.</description> |
|
61 |
</field> |
|
62 |
<field name="LinkFilterIndex" label="Link filter index" type="integer" defaultValue="0" mandatory="false" group="Advanced"> |
|
63 |
<description>If set, return the link with this index</description> |
|
64 |
</field> |
|
65 |
<field name="LinkFilterType" label="Link filter type" type="integer" defaultValue="" mandatory="false" group="Advanced"> |
|
66 |
<description>If set, return the link with this type</description> |
|
67 |
</field> |
|
68 |
<field name="LinkFilterEntity" label="Link filter entity" type="integer" defaultValue="" mandatory="false" group="Advanced"> |
|
69 |
<description>If set, return the link with this entity</description> |
|
70 |
</field> |
|
71 |
<field name="LinkFilterMS" label="Link filter MSLink" type="integer" defaultValue="" mandatory="false" group="Advanced"> |
|
72 |
<description>If set, return the link with this MSLink</description> |
|
73 |
</field> |
|
74 |
<field name="LinkFilterData" label="Link filter Data" type="string" defaultValue="" mandatory="false" group="Advanced"> |
|
75 |
<description>This is a regular expresion. If set, return the link that match this regular expresion in the data of link represented in hexadecimal value</description> |
|
76 |
</field> |
|
77 |
|
|
78 |
<!-- Filter --> |
|
79 |
<field name="levelFilter" label="Level" group="Filter" type="String" defaultValue="" mandatory="false"> |
|
80 |
<description>If specified load only elements with this level. Can use regular expresion to specify the filter.</description> |
|
81 |
</field> |
|
82 |
<field name="colorFilter" label="Color" group="Filter" type="String" defaultValue="" mandatory="false"> |
|
83 |
<description>If specified load only elements with this color. Can use regular expresion to specify the filter.</description> |
|
84 |
</field> |
|
85 |
<field name="styleFilter" label="Style" group="Filter" type="String" defaultValue="" mandatory="false"> |
|
86 |
<description>If specified load only elements with this style. Can use regular expresion to specify the filter.</description> |
|
87 |
</field> |
|
88 |
<field name="weightFilter" label="Weight" group="Filter" type="String" defaultValue="" mandatory="false"> |
|
89 |
<description>If specified load only elements with this weight. Can use regular expresion to specify the filter.</description> |
|
90 |
</field> |
|
91 |
<field name="typeFilter" label="Type" group="Filter" type="String" defaultValue="" mandatory="false"> |
|
92 |
<description>If specified load only elements with this type</description> |
|
93 |
</field> |
|
94 |
<field name="stypeFilter" label="SType" group="Filter" type="String" defaultValue="" mandatory="false"> |
|
95 |
<description>If specified load only elements with this stype</description> |
|
96 |
</field> |
|
97 |
<field name="groupFilter" label="Group" group="Filter" type="String" defaultValue="" mandatory="false"> |
|
98 |
<description>If specified load only elements with this group</description> |
|
99 |
</field> |
|
100 |
<field name="idFilter" label="Id" group="Filter" type="String" defaultValue="" mandatory="false"> |
|
101 |
<description>If specified load only elements with this id</description> |
|
102 |
</field> |
|
103 |
<field name="textFilter" label="Text" group="Filter" type="String" defaultValue="" mandatory="false"> |
|
104 |
<description>If specified load only elements that match this text</description> |
|
105 |
</field> |
|
106 |
<field name="geomtypeFilter" label="Geometry type" group="Filter" defaultValue="0" type="Integer" mandatory="false"> |
|
107 |
<description>If specified load only elements with this type of geometry</description> |
|
108 |
<availableValues> |
|
109 |
<value label="All">0</value> |
|
110 |
<value label="Points">1</value> |
|
111 |
<value label="Lines">2</value> |
|
112 |
<value label="Poligons">3</value> |
|
113 |
</availableValues> |
|
114 |
</field> |
|
115 |
<field name="skipCorruptGeometries" label="Skip corrupt geometries" group="Filter" type="Boolean" defaultValue="false" mandatory="false"> |
|
116 |
<description>If specified skip corrupt geometries</description> |
|
117 |
</field> |
|
118 |
<field name="cropOperationFilter" label="Crop operation" group="Filter" defaultValue="1" type="Integer" mandatory="false"> |
|
119 |
<description>If specified load only elements with this type of geometry</description> |
|
120 |
<availableValues> |
|
121 |
<value label="None">0</value> |
|
122 |
<value label="Contains">1</value> |
|
123 |
<value label="Covered by">2</value> |
|
124 |
<value label="Covers">3</value> |
|
125 |
<value label="Crosses">4</value> |
|
126 |
<value label="Disjoint">5</value> |
|
127 |
<value label="Intersect">6</value> |
|
128 |
<value label="Overlaps">7</value> |
|
129 |
<value label="Touches">8</value> |
|
130 |
<value label="With in">9</value> |
|
131 |
</availableValues> |
|
132 |
</field> |
|
133 |
<field name="cropFilter" label="Crop to" group="Filter" type="Geometry" defaultValue="" mandatory="false"> |
|
134 |
<description>Crop the result to this value</description> |
|
135 |
</field> |
|
136 |
|
|
137 |
|
|
138 |
<!-- Debug --> |
|
139 |
<field name="XMLFile" label="Output XML file" type="file" group="Debug" mandatory="false"> |
|
140 |
<description>Generate XML file with DGN dump in this file</description> |
|
141 |
</field> |
|
142 |
<!-- |
|
143 |
<field name="debugOptions" label="Debug options" type="String" group="Debug" mandatory="false"> |
|
144 |
<description></description> |
|
145 |
</field> |
|
146 |
--> |
|
147 |
<field name="logErrors" label="log errors" group="Debug" type="Boolean" defaultValue="false" mandatory="false"> |
|
148 |
<description>If checked the log of errors are enabled</description> |
|
149 |
</field> |
|
150 |
|
|
151 |
</fields> |
|
152 |
</class> |
|
153 |
</classes> |
|
154 |
</definitions> |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.26/org.gvsig.dgn.provider/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.fmap.dal.store.dgn.DGNLibrary |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.26/org.gvsig.dgn.provider/src/main/java/org/gvsig/fmap/dal/store/dgn/DGNLibrary.java | ||
---|---|---|
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 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 IVER T.I. S.A. {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.fmap.dal.store.dgn; |
|
29 |
|
|
30 |
import java.util.ArrayList; |
|
31 |
import java.util.List; |
|
32 |
|
|
33 |
import org.gvsig.fmap.dal.DALFileLibrary; |
|
34 |
import org.gvsig.fmap.dal.DALFileLocator; |
|
35 |
import org.gvsig.fmap.dal.DALLibrary; |
|
36 |
import org.gvsig.fmap.dal.DALLocator; |
|
37 |
import org.gvsig.fmap.dal.FileHelper; |
|
38 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
|
39 |
import org.gvsig.metadata.MetadataLibrary; |
|
40 |
import org.gvsig.metadata.exceptions.MetadataException; |
|
41 |
import org.gvsig.tools.library.AbstractLibrary; |
|
42 |
import org.gvsig.tools.library.LibraryException; |
|
43 |
|
|
44 |
public class DGNLibrary extends AbstractLibrary { |
|
45 |
|
|
46 |
@Override |
|
47 |
public void doRegistration() { |
|
48 |
registerAsServiceOf(DALLibrary.class); |
|
49 |
require(DALFileLibrary.class); |
|
50 |
require(MetadataLibrary.class); |
|
51 |
} |
|
52 |
|
|
53 |
@Override |
|
54 |
protected void doInitialize() throws LibraryException { |
|
55 |
} |
|
56 |
|
|
57 |
@Override |
|
58 |
protected void doPostInitialize() throws LibraryException { |
|
59 |
List<Throwable> exs = new ArrayList<Throwable>(); |
|
60 |
|
|
61 |
FileHelper.registerParametersDefinition( |
|
62 |
DGNStoreParameters.PARAMETERS_DEFINITION_NAME, |
|
63 |
DGNStoreParameters.class, |
|
64 |
"DGNParameters.xml" |
|
65 |
); |
|
66 |
try { |
|
67 |
FileHelper.registerMetadataDefinition( |
|
68 |
DGNStoreProvider.METADATA_DEFINITION_NAME, |
|
69 |
DGNStoreProvider.class, |
|
70 |
"DGNMetadata.xml" |
|
71 |
); |
|
72 |
} catch (MetadataException e) { |
|
73 |
exs.add(e); |
|
74 |
} |
|
75 |
|
|
76 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator |
|
77 |
.getDataManager(); |
|
78 |
|
|
79 |
try { |
|
80 |
if (!dataman.getStoreProviders().contains(DGNStoreProvider.NAME)) { |
|
81 |
dataman.registerStoreProviderFactory(new DGNStoreProviderFactory(DGNStoreProvider.NAME, DGNStoreProvider.DESCRIPTION)); |
|
82 |
} |
|
83 |
} catch (RuntimeException e) { |
|
84 |
exs.add(e); |
|
85 |
} |
|
86 |
|
|
87 |
try { |
|
88 |
DALFileLocator.getFilesystemServerExplorerManager() |
|
89 |
.registerProvider(DGNStoreProvider.NAME, |
|
90 |
DGNStoreProvider.DESCRIPTION, |
|
91 |
DGNFilesystemServerProvider.class); |
|
92 |
} catch (RuntimeException e) { |
|
93 |
exs.add(e); |
|
94 |
} |
|
95 |
|
|
96 |
if( exs.size()>0 ) { |
|
97 |
throw new LibraryException(this.getClass(), exs); |
|
98 |
} |
|
99 |
} |
|
100 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.26/org.gvsig.dgn.provider/src/main/java/org/gvsig/fmap/dal/store/dgn/DGNFilesystemServerProvider.java | ||
---|---|---|
1 |
package org.gvsig.fmap.dal.store.dgn; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import org.gvsig.fmap.dal.DALLocator; |
|
6 |
import org.gvsig.fmap.dal.DataManager; |
|
7 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
8 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
9 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
|
10 |
import org.gvsig.fmap.dal.exception.CreateException; |
|
11 |
import org.gvsig.fmap.dal.exception.DataException; |
|
12 |
import org.gvsig.fmap.dal.exception.FileNotFoundException; |
|
13 |
import org.gvsig.fmap.dal.exception.RemoveException; |
|
14 |
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer; |
|
15 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
|
16 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider; |
|
17 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider; |
|
18 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices; |
|
19 |
|
|
20 |
public class DGNFilesystemServerProvider extends AbstractFilesystemServerExplorerProvider |
|
21 |
implements FilesystemServerExplorerProvider, ResourceConsumer { |
|
22 |
|
|
23 |
// private FilesystemServerExplorerProviderServices serverExplorer; |
|
24 |
|
|
25 |
public String getDataStoreProviderName() { |
|
26 |
return DGNStoreProvider.NAME; |
|
27 |
} |
|
28 |
|
|
29 |
public int getMode() { |
|
30 |
return DataServerExplorer.MODE_FEATURE | DataServerExplorer.MODE_GEOMETRY; |
|
31 |
} |
|
32 |
|
|
33 |
public boolean accept(File pathname) { |
|
34 |
return (pathname.getName().toLowerCase().endsWith(".dgn")); |
|
35 |
} |
|
36 |
|
|
37 |
public String getDescription() { |
|
38 |
return DGNStoreProvider.DESCRIPTION; |
|
39 |
} |
|
40 |
|
|
41 |
public DataStoreParameters getParameters(File file) throws DataException { |
|
42 |
DataManager manager = DALLocator.getDataManager(); |
|
43 |
DGNStoreParameters params = (DGNStoreParameters) manager |
|
44 |
.createStoreParameters(this |
|
45 |
.getDataStoreProviderName()); |
|
46 |
params.setFile(file); |
|
47 |
return params; |
|
48 |
} |
|
49 |
|
|
50 |
public boolean canCreate() { |
|
51 |
return false; |
|
52 |
} |
|
53 |
|
|
54 |
public boolean canCreate(NewDataStoreParameters parameters) { |
|
55 |
return this.canCreate(); |
|
56 |
} |
|
57 |
|
|
58 |
public void create(NewDataStoreParameters parameters, boolean overwrite) |
|
59 |
throws CreateException { |
|
60 |
throw new UnsupportedOperationException(); |
|
61 |
} |
|
62 |
|
|
63 |
public NewDataStoreParameters getCreateParameters() throws DataException { |
|
64 |
return null; |
|
65 |
} |
|
66 |
|
|
67 |
public void initialize( |
|
68 |
FilesystemServerExplorerProviderServices serverExplorer) { |
|
69 |
// this.serverExplorer = serverExplorer; |
|
70 |
} |
|
71 |
|
|
72 |
public void remove(DataStoreParameters parameters) throws RemoveException { |
|
73 |
File file = new File(((DGNStoreParameters) parameters).getFileName()); |
|
74 |
if (!file.exists()) { |
|
75 |
throw new RemoveException(this.getDataStoreProviderName(), |
|
76 |
new FileNotFoundException(file)); |
|
77 |
} |
|
78 |
if (!file.delete()) { |
|
79 |
// FIXME throws ??? |
|
80 |
} |
|
81 |
|
|
82 |
} |
|
83 |
|
|
84 |
public boolean closeResourceRequested(ResourceProvider resource) { |
|
85 |
// while it is using a resource anyone can't close it |
|
86 |
return false; |
|
87 |
} |
|
88 |
|
|
89 |
/* |
|
90 |
* (non-Javadoc) |
|
91 |
* |
|
92 |
* @see |
|
93 |
* org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org. |
|
94 |
* gvsig.fmap.dal.resource.spi.ResourceProvider) |
|
95 |
*/ |
|
96 |
public void resourceChanged(ResourceProvider resource) { |
|
97 |
//Do nothing |
|
98 |
|
|
99 |
} |
|
100 |
|
|
101 |
|
|
102 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.26/org.gvsig.dgn.provider/src/main/java/org/gvsig/fmap/dal/store/dgn/DGNStoreProvider.java | ||
---|---|---|
1 |
package org.gvsig.fmap.dal.store.dgn; |
|
2 |
|
|
3 |
import java.awt.geom.AffineTransform; |
|
4 |
import java.awt.geom.Arc2D; |
|
5 |
import java.io.BufferedWriter; |
|
6 |
import java.io.File; |
|
7 |
import java.io.FileWriter; |
|
8 |
import java.io.IOException; |
|
9 |
import java.util.ArrayList; |
|
10 |
import java.util.Collections; |
|
11 |
import java.util.Comparator; |
|
12 |
import java.util.HashMap; |
|
13 |
import java.util.Iterator; |
|
14 |
import java.util.List; |
|
15 |
import java.util.Map; |
|
16 |
import java.util.regex.Pattern; |
|
17 |
import org.apache.commons.io.IOUtils; |
|
18 |
import org.apache.commons.lang3.StringUtils; |
|
19 |
|
|
20 |
import org.cresques.cts.IProjection; |
|
21 |
import org.gvsig.fmap.dal.DALLocator; |
|
22 |
import org.gvsig.fmap.dal.DataManager; |
|
23 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
24 |
import org.gvsig.fmap.dal.DataStoreNotification; |
|
25 |
import org.gvsig.fmap.dal.DataTypes; |
|
26 |
import org.gvsig.fmap.dal.FileHelper; |
|
27 |
import org.gvsig.fmap.dal.exception.DataException; |
|
28 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
29 |
import org.gvsig.fmap.dal.exception.LoadException; |
|
30 |
import org.gvsig.fmap.dal.exception.OpenException; |
|
31 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
32 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
33 |
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor; |
|
34 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
35 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
36 |
import org.gvsig.fmap.dal.feature.exception.PerformEditingException; |
|
37 |
import org.gvsig.fmap.dal.feature.spi.FeatureProvider; |
|
38 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices; |
|
39 |
import org.gvsig.fmap.dal.feature.spi.memory.AbstractMemoryStoreProvider; |
|
40 |
import org.gvsig.fmap.dal.resource.ResourceAction; |
|
41 |
import org.gvsig.fmap.dal.resource.exception.AccessResourceException; |
|
42 |
import org.gvsig.fmap.dal.resource.file.FileResource; |
|
43 |
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer; |
|
44 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
|
45 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer; |
|
46 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters; |
|
47 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
|
48 |
import org.gvsig.fmap.dal.store.dgn.lib.DGNElemArc; |
|
49 |
import org.gvsig.fmap.dal.store.dgn.lib.DGNElemComplexHeader; |
|
50 |
import org.gvsig.fmap.dal.store.dgn.lib.DGNElemCore; |
|
51 |
import org.gvsig.fmap.dal.store.dgn.lib.DGNElemMultiPoint; |
|
52 |
import org.gvsig.fmap.dal.store.dgn.lib.DGNElemText; |
|
53 |
import org.gvsig.fmap.dal.store.dgn.lib.DGNFileHeader; |
|
54 |
import org.gvsig.fmap.dal.store.dgn.lib.DGNLink; |
|
55 |
import org.gvsig.fmap.dal.store.dgn.lib.DGNPoint; |
|
56 |
import org.gvsig.fmap.dal.store.dgn.lib.DGNReader; |
|
57 |
import org.gvsig.fmap.geom.Geometry; |
|
58 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
59 |
import org.gvsig.fmap.geom.GeometryManager; |
|
60 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
61 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
|
62 |
import org.gvsig.fmap.geom.aggregate.Aggregate; |
|
63 |
import org.gvsig.fmap.geom.aggregate.MultiCurve; |
|
64 |
import org.gvsig.fmap.geom.aggregate.MultiLine; |
|
65 |
import org.gvsig.fmap.geom.aggregate.MultiPolygon; |
|
66 |
import org.gvsig.fmap.geom.aggregate.MultiPrimitive; |
|
67 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
|
68 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
69 |
import org.gvsig.fmap.geom.primitive.Curve; |
|
70 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
71 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
|
72 |
import org.gvsig.fmap.geom.primitive.Line; |
|
73 |
import org.gvsig.fmap.geom.primitive.OrientablePrimitive; |
|
74 |
import org.gvsig.fmap.geom.primitive.Point; |
|
75 |
import org.gvsig.fmap.geom.primitive.Polygon; |
|
76 |
import org.gvsig.fmap.geom.primitive.Primitive; |
|
77 |
import org.gvsig.fmap.geom.primitive.Surface; |
|
78 |
import org.gvsig.fmap.geom.type.GeometryType; |
|
79 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
|
80 |
import org.gvsig.tools.logger.FilteredLogger; |
|
81 |
import org.slf4j.Logger; |
|
82 |
import org.slf4j.LoggerFactory; |
|
83 |
|
|
84 |
public class DGNStoreProvider extends AbstractMemoryStoreProvider implements |
|
85 |
ResourceConsumer { |
|
86 |
|
|
87 |
private static final Logger logger = LoggerFactory.getLogger(DGNStoreProvider.class); |
|
88 |
|
|
89 |
public static final String NAME = "DGN"; |
|
90 |
public static final String DESCRIPTION = "DGN file"; |
|
91 |
|
|
92 |
public static final String METADATA_DEFINITION_NAME = NAME; |
|
93 |
public static final String METADATA_DEFINITION_DESCRIPTION = "DGN File Store"; |
|
94 |
|
|
95 |
public static final int LOAD_MODE_PLAIN = 0; |
|
96 |
public static final int LOAD_MODE_GROUP1 = 1; |
|
97 |
|
|
98 |
public static final int CROP_OPERATION_NONE = 0; |
|
99 |
public static final int CROP_OPERATION_CONTAINS = 1; |
|
100 |
public static final int CROP_OPERATION_COVERS = 2; |
|
101 |
public static final int CROP_OPERATION_COVEREDBY = 3; |
|
102 |
public static final int CROP_OPERATION_CROSSES = 4; |
|
103 |
public static final int CROP_OPERATION_DISJOINT = 5; |
|
104 |
public static final int CROP_OPERATION_INTERSECT = 6; |
|
105 |
public static final int CROP_OPERATION_OVERLAPS = 7; |
|
106 |
public static final int CROP_OPERATION_TOUCHES = 8; |
|
107 |
public static final int CROP_OPERATION_WITHIN = 9; |
|
108 |
|
|
109 |
public static final int GROUP_GEOMETRIES_NONE = 0; |
|
110 |
public static final int GROUP_GEOMETRIES_CONVEXHULL = 1; |
|
111 |
public static final int GROUP_GEOMETRIES_UNION = 2; |
|
112 |
public static final int GROUP_GEOMETRIES_INTERSECTION = 3; |
|
113 |
public static final int GROUP_GEOMETRIES_TOPOINTS = 4; |
|
114 |
public static final int GROUP_GEOMETRIES_TOLINES = 5; |
|
115 |
public static final int GROUP_GEOMETRIES_TOPOLYGONS = 6; |
|
116 |
public static final int GROUP_GEOMETRIES_TOPOLYGONS_FIX = 7; |
|
117 |
|
|
118 |
public static final String NAME_FIELD_ID = "ID"; |
|
119 |
public static final String NAME_FIELD_GEOMETRY = "Geometry"; |
|
120 |
public static final String NAME_FIELD_TYPE = "Type"; |
|
121 |
public static final String NAME_FIELD_STYPE = "SType"; |
|
122 |
public static final String NAME_FIELD_ENTITY = "Entity"; |
|
123 |
public static final String NAME_FIELD_LEVEL = "Layer"; |
|
124 |
public static final String NAME_FIELD_COLOR = "Color"; |
|
125 |
public static final String NAME_FIELD_FILLCOLOR = "FillColor"; |
|
126 |
public static final String NAME_FIELD_ELEVATION = "Elevation"; |
|
127 |
public static final String NAME_FIELD_WEIGHT = "Weight"; |
|
128 |
public static final String NAME_FIELD_TEXT = "Text"; |
|
129 |
public static final String NAME_FIELD_HEIGHTTEXT = "HeightText"; |
|
130 |
public static final String NAME_FIELD_HEIGHTTEXTRAW = "HeightTextRaw"; |
|
131 |
public static final String NAME_FIELD_ROTATIONTEXT = "Rotation"; |
|
132 |
public static final String NAME_FIELD_STYLE = "Style"; |
|
133 |
public static final String NAME_FIELD_GROUP = "Group"; |
|
134 |
public static final String NAME_FIELD_ISSHAPE = "IsShape"; |
|
135 |
public static final String NAME_FIELD_ISCOMPLEXSHAPEHEADER = "IsComplexShapeHeader"; |
|
136 |
public static final String NAME_FIELD_ISHOLE = "IsHole"; |
|
137 |
public static final String NAME_FIELD_ISCOMPLEX = "IsComplex"; |
|
138 |
public static final String NAME_FIELD_PARENTID = "ParentId"; |
|
139 |
public static final String NAME_FIELD_SCALE = "Scale"; |
|
140 |
public static final String NAME_FIELD_LINKS_COUNT = "LinksCount"; |
|
141 |
public static final String NAME_FIELD_LINK_INDEX = "LinkIndex"; |
|
142 |
public static final String NAME_FIELD_LINK_TYPE = "LinkType"; |
|
143 |
public static final String NAME_FIELD_LINK_ENTITY = "LinkEntity"; |
|
144 |
public static final String NAME_FIELD_LINK_MS = "LinkMS"; |
|
145 |
public static final String NAME_FIELD_LINK_LENGTH = "LinkLength"; |
|
146 |
public static final String NAME_FIELD_LINK_DATA = "LinkData"; |
|
147 |
|
|
148 |
private int ID_FIELD_ID; |
|
149 |
private int ID_FIELD_TYPE; |
|
150 |
private int ID_FIELD_STYPE; |
|
151 |
private int ID_FIELD_ENTITY; |
|
152 |
private int ID_FIELD_LEVEL; |
|
153 |
private int ID_FIELD_COLOR; |
|
154 |
private int ID_FIELD_FILLCOLOR; |
|
155 |
private int ID_FIELD_ELEVATION; |
|
156 |
private int ID_FIELD_WEIGHT; |
|
157 |
private int ID_FIELD_TEXT; |
|
158 |
private int ID_FIELD_HEIGHTTEXT; |
|
159 |
private int ID_FIELD_HEIGHTTEXTRAW; |
|
160 |
private int ID_FIELD_ROTATIONTEXT; |
|
161 |
private int ID_FIELD_STYLE; |
|
162 |
private int ID_FIELD_GROUP; |
|
163 |
private int ID_FIELD_LAYER; |
|
164 |
private int ID_FIELD_ISCOMPLEXSHAPEHEADER; |
|
165 |
private int ID_FIELD_ISSHAPE; |
|
166 |
private int ID_FIELD_ISHOLE; |
|
167 |
private int ID_FIELD_ISCOMPLEX; |
|
168 |
private int ID_FIELD_PARENT; |
|
169 |
private int ID_FIELD_SCALE; |
|
170 |
private int ID_FIELD_LINKS_COUNT; |
|
171 |
private int ID_FIELD_LINK_INDEX; |
|
172 |
private int ID_FIELD_LINK_TYPE; |
|
173 |
private int ID_FIELD_LINK_ENTITY; |
|
174 |
private int ID_FIELD_LINK_MS; |
|
175 |
private int ID_FIELD_LINK_LENGTH; |
|
176 |
private int ID_FIELD_LINK_DATA; |
|
177 |
private int ID_FIELD_GEOMETRY; |
|
178 |
private int MAX_FIELD_ID; |
|
179 |
|
|
180 |
private IProjection projection; |
|
181 |
private ResourceProvider resource; |
|
182 |
private LegendBuilder legendBuilder; |
|
183 |
|
|
184 |
private long counterNewsOIDs = 0; |
|
185 |
protected GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
186 |
|
|
187 |
private int groupByFieldIndex = -2; |
|
188 |
private Map<Object, FeatureProvider> groupedFeatures = null; |
|
189 |
|
|
190 |
DGNData dgndata = null; |
|
191 |
|
|
192 |
public DGNStoreProvider(DGNStoreParameters parameters, |
|
193 |
DataStoreProviderServices storeServices) throws InitializeException { |
|
194 |
super( |
|
195 |
parameters, |
|
196 |
storeServices, |
|
197 |
FileHelper.newMetadataContainer(METADATA_DEFINITION_NAME) |
|
198 |
); |
|
199 |
|
|
200 |
counterNewsOIDs = 0; |
|
201 |
// projection = CRSFactory.getCRS(getParameters().getSRSID()); |
|
202 |
|
|
203 |
File file = getDGNParameters().getFile(); |
|
204 |
resource = this.createResource( |
|
205 |
FileResource.NAME, |
|
206 |
new Object[]{file.getAbsolutePath()} |
|
207 |
); |
|
208 |
|
|
209 |
resource.addConsumer(this); |
|
210 |
|
|
211 |
this.projection = this.getDGNParameters().getCRS(); |
|
212 |
|
|
213 |
try { |
|
214 |
legendBuilder = (LegendBuilder) this.invokeDynMethod( |
|
215 |
LegendBuilder.DYNMETHOD_BUILDER_NAME, null); |
|
216 |
} catch (DynMethodException e) { |
|
217 |
legendBuilder = null; |
|
218 |
} catch (Exception e) { |
|
219 |
throw new InitializeException(e); |
|
220 |
} |
|
221 |
|
|
222 |
this.initializeFeatureTypes(); |
|
223 |
|
|
224 |
} |
|
225 |
|
|
226 |
private DGNStoreParameters getDGNParameters() { |
|
227 |
return (DGNStoreParameters) this.getParameters(); |
|
228 |
} |
|
229 |
|
|
230 |
public String getProviderName() { |
|
231 |
return NAME; |
|
232 |
} |
|
233 |
|
|
234 |
public boolean allowWrite() { |
|
235 |
// not yet |
|
236 |
return false; |
|
237 |
} |
|
238 |
|
|
239 |
public Object getLegend() throws OpenException { |
|
240 |
this.open(); |
|
241 |
if (legendBuilder == null) { |
|
242 |
return null; |
|
243 |
} |
|
244 |
return legendBuilder.getLegend(); |
|
245 |
} |
|
246 |
|
|
247 |
public Object getLabeling() throws OpenException { |
|
248 |
this.open(); |
|
249 |
if (legendBuilder == null) { |
|
250 |
return null; |
|
251 |
} |
|
252 |
return legendBuilder.getLabeling(); |
|
253 |
} |
|
254 |
|
|
255 |
private class DGNData { |
|
256 |
|
|
257 |
public List data = null; |
|
258 |
public FeatureType defaultFType = null; |
|
259 |
public List fTypes = null; |
|
260 |
public Envelope envelope = null; |
|
261 |
public IProjection projection; |
|
262 |
public LegendBuilder legendBuilder; |
|
263 |
|
|
264 |
public Envelope getEnvelopeCopy() throws CreateEnvelopeException { |
|
265 |
if (envelope == null) { |
|
266 |
return null; |
|
267 |
} |
|
268 |
try { |
|
269 |
return (Envelope) envelope.clone(); |
|
270 |
} catch (CloneNotSupportedException ex) { |
|
271 |
logger.warn("Can't clone envelope.", ex); |
|
272 |
return null; |
|
273 |
} |
|
274 |
} |
Also available in: Unified diff