Revision 1362
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.277/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.AbstractDynMethod; |
|
35 |
import org.gvsig.tools.dynobject.DynClass; |
|
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 extends AbstractDynMethod { |
|
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 |
|
|
55 |
public DGNGetLabeling() { |
|
56 |
super(LegendBuilder.DYNMETHOD_GETLABELING_NAME,"DGN Labeling"); |
|
57 |
} |
|
58 |
|
|
59 |
@Override |
|
60 |
public int getCode() throws DynMethodNotSupportedException { |
|
61 |
return code; |
|
62 |
} |
|
63 |
|
|
64 |
@Override |
|
65 |
public Object invoke(DynObject self, Object[] args) |
|
66 |
throws DynMethodException { |
|
67 |
try { |
|
68 |
return ((DGNStoreProvider) self).getLabeling(); |
|
69 |
} catch (OpenException e) { |
|
70 |
//FIXME |
|
71 |
throw new RuntimeException(e); |
|
72 |
} |
|
73 |
} |
|
74 |
|
|
75 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.277/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.AbstractDynMethod; |
|
35 |
import org.gvsig.tools.dynobject.DynClass; |
|
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 extends AbstractDynMethod { |
|
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 |
|
|
55 |
public DGNGetLegend() { |
|
56 |
super(LegendBuilder.DYNMETHOD_GETLEGEND_NAME,"DGN Legend"); |
|
57 |
} |
|
58 |
|
|
59 |
@Override |
|
60 |
public int getCode() throws DynMethodNotSupportedException { |
|
61 |
return code; |
|
62 |
} |
|
63 |
|
|
64 |
@Override |
|
65 |
public Object invoke(DynObject self, Object[] args) |
|
66 |
throws DynMethodException { |
|
67 |
try { |
|
68 |
return ((DGNStoreProvider) self).getLegend(); |
|
69 |
} catch (OpenException e) { |
|
70 |
throw new RuntimeException(e); |
|
71 |
} |
|
72 |
} |
|
73 |
|
|
74 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.277/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.277/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.AbstractDynMethod; |
|
33 |
import org.gvsig.tools.dynobject.DynClass; |
|
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 extends AbstractDynMethod { |
|
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 DGNGetLegendBuilder() { |
|
54 |
super(LegendBuilder.DYNMETHOD_BUILDER_NAME,"DGN LegendBuilder creator"); |
|
55 |
} |
|
56 |
|
|
57 |
@Override |
|
58 |
public int getCode() throws DynMethodNotSupportedException { |
|
59 |
return code; |
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public Object invoke(DynObject self, Object[] args) |
|
64 |
throws DynMethodException { |
|
65 |
return new DGNLegendBuilder(); |
|
66 |
} |
|
67 |
|
|
68 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.277/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 |
|
|
83 |
labelingStragegy = SymbologyLocator.getSymbologyManager().createAttrInTableLabelingStrategy(); |
|
84 |
labelingStragegy.setTextField(DGNStoreProvider.NAME_FIELD_TEXT); |
|
85 |
labelingStragegy |
|
86 |
.setRotationField(DGNStoreProvider.NAME_FIELD_ROTATIONTEXT); |
|
87 |
labelingStragegy.setHeightField(DGNStoreProvider.NAME_FIELD_HEIGHTTEXT); |
|
88 |
labelingStragegy.setUnit(1); // MapContext.NAMES[1] (meters) |
|
89 |
return this; |
|
90 |
} |
|
91 |
|
|
92 |
public void process(FeatureProvider feature, DGNReader dgnReader) { |
|
93 |
Integer clave = (Integer) feature.get("Color"); |
|
94 |
if (clave == null) { |
|
95 |
return; |
|
96 |
} |
|
97 |
|
|
98 |
defaultLegend.useDefaultSymbol(false); |
|
99 |
if (defaultLegend.getSymbolByValue(clave) == null) { |
|
100 |
ISymbol theSymbol; |
|
101 |
Color color = dgnReader.DGNLookupColor(clave.intValue()); |
|
102 |
if( color == null ) { |
|
103 |
color = Color.BLACK; |
|
104 |
} |
|
105 |
theSymbol = mapContextManager.getSymbolManager().createSymbol( |
|
106 |
Geometry.TYPES.GEOMETRY, color); |
|
107 |
|
|
108 |
theSymbol.setDescription(clave.toString()); |
|
109 |
|
|
110 |
if (theSymbol instanceof IMarkerSymbol) { |
|
111 |
((IMarkerSymbol) theSymbol).setSize(1); |
|
112 |
} |
|
113 |
|
|
114 |
if (theSymbol instanceof ILineSymbol) { |
|
115 |
ILineSymbol lineSymbol = (ILineSymbol) theSymbol; |
|
116 |
lineSymbol.setLineWidth(1); |
|
117 |
lineSymbol.setLineColor(color); |
|
118 |
} |
|
119 |
|
|
120 |
if (theSymbol instanceof IFillSymbol) { |
|
121 |
IFillSymbol fillSymbol = (IFillSymbol) theSymbol; |
|
122 |
fillSymbol.getOutline().setLineColor(color); |
|
123 |
fillSymbol.getOutline().setLineWidth(1); |
|
124 |
fillSymbol.setFillColor(null); |
|
125 |
} |
|
126 |
if (theSymbol != null) { |
|
127 |
defaultLegend.addSymbol(clave, theSymbol); |
|
128 |
} |
|
129 |
} |
|
130 |
defaultLegend.useDefaultSymbol(true); |
|
131 |
} |
|
132 |
|
|
133 |
public Object getLabeling() { |
|
134 |
return labelingStragegy; |
|
135 |
} |
|
136 |
|
|
137 |
|
|
138 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.277/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.277</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 |
<!-- |
|
99 |
<dependency> |
|
100 |
<groupId>org.gvsig</groupId> |
|
101 |
<artifactId>org.gvsig.fmap.geometry.generalpath</artifactId> |
|
102 |
<scope>test</scope> |
|
103 |
</dependency> |
|
104 |
--> |
|
105 |
<dependency> |
|
106 |
<groupId>org.gvsig</groupId> |
|
107 |
<artifactId>org.gvsig.projection.cresques.impl</artifactId> |
|
108 |
<scope>test</scope> |
|
109 |
</dependency> |
|
110 |
<dependency> |
|
111 |
<groupId>org.gvsig</groupId> |
|
112 |
<artifactId>org.gvsig.timesupport.lib.impl</artifactId> |
|
113 |
<scope>test</scope> |
|
114 |
</dependency> |
|
115 |
|
|
116 |
|
|
117 |
</dependencies> |
|
118 |
|
|
119 |
</project> |
|
0 | 120 |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.277/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 |
import java.net.URL; |
|
32 |
import org.gvsig.fmap.dal.DALLocator; |
|
33 |
import org.gvsig.fmap.dal.DataManager; |
|
34 |
|
|
35 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
36 |
import org.gvsig.fmap.dal.exception.DataException; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
38 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
39 |
|
|
40 |
import static junit.framework.Assert.assertNotNull; |
|
41 |
|
|
42 |
public class TestDGN extends AbstractLibraryAutoInitTestCase { |
|
43 |
|
|
44 |
private File file_prueba = null; |
|
45 |
private DataManager dataManager = null; |
|
46 |
|
|
47 |
@Override |
|
48 |
protected void doSetUp() throws Exception { |
|
49 |
URL res = TestDGN.class.getResource("data/prueba.dgn"); |
|
50 |
this.file_prueba = new File(res.getFile()); |
|
51 |
this.dataManager = DALLocator.getDataManager(); |
|
52 |
} |
|
53 |
|
|
54 |
|
|
55 |
/* |
|
56 |
* (non-Javadoc) |
|
57 |
* |
|
58 |
* @see |
|
59 |
* org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters |
|
60 |
* () |
|
61 |
*/ |
|
62 |
public DataStoreParameters getDefaultDataStoreParameters() |
|
63 |
throws DataException { |
|
64 |
|
|
65 |
DGNOpenStoreParameters dgnParameters = null; |
|
66 |
|
|
67 |
dgnParameters = (DGNOpenStoreParameters) dataManager |
|
68 |
.createStoreParameters(DGNStoreProvider.NAME); |
|
69 |
|
|
70 |
dgnParameters.setFile(file_prueba.getAbsolutePath()); |
|
71 |
dgnParameters.setCRS("EPSG:23030"); |
|
72 |
return dgnParameters; |
|
73 |
} |
|
74 |
|
|
75 |
/* |
|
76 |
* (non-Javadoc) |
|
77 |
* |
|
78 |
* @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#hasExplorer() |
|
79 |
*/ |
|
80 |
public boolean hasExplorer() { |
|
81 |
// TODO Auto-generated method stub |
|
82 |
return false; |
|
83 |
} |
|
84 |
|
|
85 |
public boolean usesResources() { |
|
86 |
return true; |
|
87 |
} |
|
88 |
|
|
89 |
|
|
90 |
public void testLegendAndLabeling() throws Exception { |
|
91 |
FeatureStore store = (FeatureStore) dataManager.openStore( |
|
92 |
DGNStoreProvider.NAME, |
|
93 |
getDefaultDataStoreParameters() |
|
94 |
); |
|
95 |
|
|
96 |
assertNotNull(store.invokeDynMethod("getLegend", null)); |
|
97 |
assertNotNull(store.invokeDynMethod("getLabeling", null)); |
|
98 |
store.dispose(); |
|
99 |
} |
|
100 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.277/org.gvsig.dgn.provider/src/main/java/org/gvsig/fmap/dal/store/dgn/LegendBuilder.java | ||
---|---|---|
1 |
package org.gvsig.fmap.dal.store.dgn; |
|
2 |
|
|
3 |
import org.gvsig.fmap.dal.feature.spi.FeatureProvider; |
|
4 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider; |
|
5 |
import org.gvsig.fmap.dal.store.dgn.lib.DGNReader; |
|
6 |
|
|
7 |
|
|
8 |
public interface LegendBuilder { |
|
9 |
|
|
10 |
final public static String DYNMETHOD_BUILDER_NAME = "getLegendBuilder"; |
|
11 |
final public static String DYNMETHOD_GETLEGEND_NAME = "getLegend"; |
|
12 |
final public static String DYNMETHOD_GETLABELING_NAME = "getLabeling"; |
|
13 |
|
|
14 |
public LegendBuilder initialize(FeatureStoreProvider store); |
|
15 |
|
|
16 |
public void begin(); |
|
17 |
|
|
18 |
public void process(FeatureProvider feature, DGNReader dgnReader); |
|
19 |
|
|
20 |
public void end(); |
|
21 |
|
|
22 |
public Object getLegend(); |
|
23 |
public Object getLabeling(); |
|
24 |
|
|
25 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.277/org.gvsig.dgn.provider/src/main/java/org/gvsig/fmap/dal/store/dgn/lib/DGNElemComplexHeader.java | ||
---|---|---|
1 |
|
|
2 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
3 |
* |
|
4 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
*/ |
|
21 |
package org.gvsig.fmap.dal.store.dgn.lib; |
|
22 |
|
|
23 |
/** |
|
24 |
* Clase utilizada para guardar un elemento de tipo ComplexHeader. |
|
25 |
* |
|
26 |
* @author Vicente Caballero Navarro |
|
27 |
*/ |
|
28 |
public class DGNElemComplexHeader extends DGNElemCore { |
|
29 |
public int totlength; /*!< Total length of surface */ |
|
30 |
public int numelems; /*!< # of elements in surface */ |
|
31 |
|
|
32 |
public DGNElemComplexHeader(DGNReader dgnreader) { |
|
33 |
super(dgnreader); |
|
34 |
} |
|
35 |
|
|
36 |
public int getNumElements() { |
|
37 |
return this.numelems; |
|
38 |
} |
|
39 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.277/org.gvsig.dgn.provider/src/main/java/org/gvsig/fmap/dal/store/dgn/lib/DGNViewInfo.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 17-jul-2003 |
|
3 |
* |
|
4 |
* Copyright (c) 2003 |
|
5 |
* Francisco José Peñarrubia Martínez |
|
6 |
* IVER Tecnologías de la Información S.A. |
|
7 |
* Salamanca 50 |
|
8 |
* 46005 Valencia ( SPAIN ) |
|
9 |
* +34 963163400 |
|
10 |
* mailto:fran@iver.es |
|
11 |
* http://www.iver.es |
|
12 |
*/ |
|
13 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
14 |
* |
|
15 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
16 |
* |
|
17 |
* This program is free software; you can redistribute it and/or |
|
18 |
* modify it under the terms of the GNU General Public License |
|
19 |
* as published by the Free Software Foundation; either version 2 |
|
20 |
* of the License, or (at your option) any later version. |
|
21 |
* |
|
22 |
* This program is distributed in the hope that it will be useful, |
|
23 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
24 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
25 |
* GNU General Public License for more details. |
|
26 |
* |
|
27 |
* You should have received a copy of the GNU General Public License |
|
28 |
* along with this program; if not, write to the Free Software |
|
29 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
30 |
* |
|
31 |
* For more information, contact: |
|
32 |
* |
|
33 |
* Generalitat Valenciana |
|
34 |
* Conselleria d'Infraestructures i Transport |
|
35 |
* Av. Blasco Ib??ez, 50 |
|
36 |
* 46010 VALENCIA |
|
37 |
* SPAIN |
|
38 |
* |
|
39 |
* +34 963862235 |
|
40 |
* gvsig@gva.es |
|
41 |
* www.gvsig.gva.es |
|
42 |
* |
|
43 |
* or |
|
44 |
* |
|
45 |
* IVER T.I. S.A |
|
46 |
* Salamanca 50 |
|
47 |
* 46005 Valencia |
|
48 |
* Spain |
|
49 |
* |
|
50 |
* +34 963163400 |
|
51 |
* dac@iver.es |
|
52 |
*/ |
|
53 |
package org.gvsig.fmap.dal.store.dgn.lib; |
|
54 |
|
|
55 |
/** |
|
56 |
* Informaci?n sobre la vista. |
|
57 |
* |
|
58 |
* @author Vicente Caballero Navarro |
|
59 |
*/ |
|
60 |
public class DGNViewInfo { |
|
61 |
public int flags; |
|
62 |
public short[] levels = new short[8]; //8 |
|
63 |
public DGNPoint origin = new DGNPoint(); |
|
64 |
public DGNPoint delta = new DGNPoint(); |
|
65 |
public double[] transmatrx = new double[9]; //9 |
|
66 |
public double conversion; |
|
67 |
public double activez; |
|
68 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.277/org.gvsig.dgn.provider/src/main/java/org/gvsig/fmap/dal/store/dgn/lib/DGNElemText.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 17-jul-2003 |
|
3 |
* |
|
4 |
* Copyright (c) 2003 |
|
5 |
* Francisco José Peñarrubia Martínez |
|
6 |
* IVER Tecnologías de la Información S.A. |
|
7 |
* Salamanca 50 |
|
8 |
* 46005 Valencia ( SPAIN ) |
|
9 |
* +34 963163400 |
|
10 |
* mailto:fran@iver.es |
|
11 |
* http://www.iver.es |
|
12 |
*/ |
|
13 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
14 |
* |
|
15 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
16 |
* |
|
17 |
* This program is free software; you can redistribute it and/or |
|
18 |
* modify it under the terms of the GNU General Public License |
|
19 |
* as published by the Free Software Foundation; either version 2 |
|
20 |
* of the License, or (at your option) any later version. |
|
21 |
* |
|
22 |
* This program is distributed in the hope that it will be useful, |
|
23 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
24 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
25 |
* GNU General Public License for more details. |
|
26 |
* |
|
27 |
* You should have received a copy of the GNU General Public License |
|
28 |
* along with this program; if not, write to the Free Software |
|
29 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
30 |
* |
|
31 |
* For more information, contact: |
|
32 |
* |
|
33 |
* Generalitat Valenciana |
|
34 |
* Conselleria d'Infraestructures i Transport |
|
35 |
* Av. Blasco Ib??ez, 50 |
|
36 |
* 46010 VALENCIA |
|
37 |
* SPAIN |
|
38 |
* |
|
39 |
* +34 963862235 |
|
40 |
* gvsig@gva.es |
|
41 |
* www.gvsig.gva.es |
|
42 |
* |
|
43 |
* or |
|
44 |
* |
|
45 |
* IVER T.I. S.A |
|
46 |
* Salamanca 50 |
|
47 |
* 46005 Valencia |
|
48 |
* Spain |
|
49 |
* |
|
50 |
* +34 963163400 |
|
51 |
* dac@iver.es |
|
52 |
*/ |
|
53 |
package org.gvsig.fmap.dal.store.dgn.lib; |
|
54 |
|
|
55 |
/** |
|
56 |
* Clase utilizada para guardar un elemento de tipo Text. |
|
57 |
* |
|
58 |
* @author Vicente Caballero Navarro |
|
59 |
*/ |
|
60 |
public class DGNElemText extends DGNElemCore { |
|
61 |
public int font_id; /*!< Microstation font id, no list available*/ |
|
62 |
public int justification; /*!< Justification, see DGNJ_* */ |
|
63 |
public double length_mult; /*!< Char width in master (if square) */ |
|
64 |
public double height_mult; /*!< Char height in master units */ |
|
65 |
public double height_raw; |
|
66 |
public double rotation; /*!< Counterclockwise rotation in degrees */ |
|
67 |
public DGNPoint origin = new DGNPoint(); // Bottom left corner of text. |
|
68 |
public String string; //Actual text (length varies, \0 terminated |
|
69 |
|
|
70 |
public DGNElemText(DGNReader dgnreader) { |
|
71 |
super(dgnreader); |
|
72 |
} |
|
73 |
|
|
74 |
public DGNPoint getPoint() { |
|
75 |
return this.origin; |
|
76 |
} |
|
77 |
|
|
78 |
public double getHeight() { |
|
79 |
return this.height_mult; |
|
80 |
} |
|
81 |
|
|
82 |
public double getRawHeight() { |
|
83 |
return this.height_raw; |
|
84 |
} |
|
85 |
|
|
86 |
public double getRotation() { |
|
87 |
return this.rotation; |
|
88 |
} |
|
89 |
|
|
90 |
public String getText() { |
|
91 |
return this.string; |
|
92 |
} |
|
93 |
} |
|
94 |
|
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.277/org.gvsig.dgn.provider/src/main/java/org/gvsig/fmap/dal/store/dgn/lib/DGNFileHeader.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 16-jul-2003 |
|
3 |
* |
|
4 |
* Copyright (c) 2003 |
|
5 |
* Francisco José Peñarrubia Martínez |
|
6 |
* IVER Tecnologías de la Información S.A. |
|
7 |
* Salamanca 50 |
|
8 |
* 46005 Valencia ( SPAIN ) |
|
9 |
* +34 963163400 |
|
10 |
* mailto:fran@iver.es |
|
11 |
* http://www.iver.es |
|
12 |
*/ |
|
13 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
14 |
* |
|
15 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
16 |
* |
|
17 |
* This program is free software; you can redistribute it and/or |
|
18 |
* modify it under the terms of the GNU General Public License |
|
19 |
* as published by the Free Software Foundation; either version 2 |
|
20 |
* of the License, or (at your option) any later version. |
|
21 |
* |
|
22 |
* This program is distributed in the hope that it will be useful, |
|
23 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
24 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
25 |
* GNU General Public License for more details. |
|
26 |
* |
|
27 |
* You should have received a copy of the GNU General Public License |
|
28 |
* along with this program; if not, write to the Free Software |
|
29 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
30 |
* |
|
31 |
* For more information, contact: |
|
32 |
* |
|
33 |
* Generalitat Valenciana |
|
34 |
* Conselleria d'Infraestructures i Transport |
|
35 |
* Av. Blasco Ib??ez, 50 |
|
36 |
* 46010 VALENCIA |
|
37 |
* SPAIN |
|
38 |
* |
|
39 |
* +34 963862235 |
|
40 |
* gvsig@gva.es |
|
41 |
* www.gvsig.gva.es |
|
42 |
* |
|
43 |
* or |
|
44 |
* |
|
45 |
* IVER T.I. S.A |
|
46 |
* Salamanca 50 |
|
47 |
* 46005 Valencia |
|
48 |
* Spain |
|
49 |
* |
|
50 |
* +34 963163400 |
|
51 |
* dac@iver.es |
|
52 |
*/ |
|
53 |
package org.gvsig.fmap.dal.store.dgn.lib; |
|
54 |
|
|
55 |
import java.nio.MappedByteBuffer; |
|
56 |
|
|
57 |
|
|
58 |
/** |
|
59 |
* Clase Header del DGN. |
|
60 |
* |
|
61 |
* @author Vicente Caballero Navarro |
|
62 |
*/ |
|
63 |
public class DGNFileHeader { |
|
64 |
/** DGNElemCore style: Element uses DGNElemCore structure */ |
|
65 |
public static final int DGNST_CORE = 1; |
|
66 |
|
|
67 |
/** DGNElemCore style: Element uses DGNElemMultiPoint structure */ |
|
68 |
public static final int DGNST_MULTIPOINT = 2; |
|
69 |
|
|
70 |
/** DGNElemCore style: Element uses DGNElemColorTable structure */ |
|
71 |
public static final int DGNST_COLORTABLE = 3; |
|
72 |
|
|
73 |
/** DGNElemCore style: Element uses DGNElemTCB structure */ |
|
74 |
public static final int DGNST_TCB = 4; |
|
75 |
|
|
76 |
/** DGNElemCore style: Element uses DGNElemArc structure */ |
|
77 |
public static final int DGNST_ARC = 5; |
|
78 |
|
|
79 |
/** DGNElemCore style: Element uses DGNElemText structure */ |
|
80 |
public static final int DGNST_TEXT = 6; |
|
81 |
|
|
82 |
/** DGNElemCore style: Element uses DGNElemComplexHeader structure */ |
|
83 |
public static final int DGNST_COMPLEX_HEADER = 7; |
|
84 |
|
|
85 |
/** DGNElemCore style: Element uses DGNElemCellHeader structure */ |
|
86 |
public static final int DGNST_CELL_HEADER = 8; |
|
87 |
|
|
88 |
/** DGNElemCore style: Element uses DGNElemTagValue structure */ |
|
89 |
public static final int DGNST_TAG_VALUE = 9; |
|
90 |
|
|
91 |
/** DGNElemCore style: Element uses DGNElemTagSet structure */ |
|
92 |
public static final int DGNST_TAG_SET = 10; |
|
93 |
|
|
94 |
/** DGNElemCore style: Element uses DGNElemCellLibrary structure */ |
|
95 |
public static final int DGNST_CELL_LIBRARY = 11; |
|
96 |
|
|
97 |
/** DGNElemCore style: Element uses DGNElemGroup structure */ |
|
98 |
public static final int DGNST_GROUP_DATA = 12; |
|
99 |
public static final int DGNST_SHARED_CELL_DEFN = 13; |
|
100 |
|
|
101 |
/* -------------------------------------------------------------------- */ |
|
102 |
/* Element types */ |
|
103 |
/* -------------------------------------------------------------------- */ |
|
104 |
public static final int DGNT_NULL = 0; |
|
105 |
public static final int DGNT_CELL_LIBRARY = 1; |
|
106 |
public static final int DGNT_CELL_HEADER = 2; |
|
107 |
public static final int DGNT_LINE = 3; |
|
108 |
public static final int DGNT_LINE_STRING = 4; |
|
109 |
public static final int DGNT_GROUP_DATA = 5; |
|
110 |
public static final int DGNT_SHAPE = 6; |
|
111 |
public static final int DGNT_TEXT_NODE = 7; |
|
112 |
public static final int DGNT_DIGITIZER_SETUP = 8; |
|
113 |
public static final int DGNT_TCB = 9; |
|
114 |
public static final int DGNT_LEVEL_SYMBOLOGY = 10; |
|
115 |
public static final int DGNT_CURVE = 11; |
|
116 |
public static final int DGNT_COMPLEX_CHAIN_HEADER = 12; |
|
117 |
public static final int DGNT_COMPLEX_SHAPE_HEADER = 14; |
|
118 |
public static final int DGNT_ELLIPSE = 15; |
|
119 |
public static final int DGNT_ARC = 16; |
|
120 |
public static final int DGNT_TEXT = 17; |
|
121 |
public static final int DGNT_BSPLINE = 21; |
|
122 |
public static final int DGNT_SHARED_CELL_DEFN = 34; |
|
123 |
public static final int DGNT_SHARED_CELL_ELEM = 35; // REVISAR |
|
124 |
public static final int DGNT_TAG_VALUE = 37; |
|
125 |
public static final int DGNT_APPLICATION_ELEM = 66; |
|
126 |
|
|
127 |
/* -------------------------------------------------------------------- */ |
|
128 |
/* Line Styles */ |
|
129 |
/* -------------------------------------------------------------------- */ |
|
130 |
public static final int DGNS_SOLID = 0; |
|
131 |
public static final int DGNS_DOTTED = 1; |
|
132 |
public static final int DGNS_MEDIUM_DASH = 2; |
|
133 |
public static final int DGNS_LONG_DASH = 3; |
|
134 |
public static final int DGNS_DOT_DASH = 4; |
|
135 |
public static final int DGNS_SHORT_DASH = 5; |
|
136 |
public static final int DGNS_DASH_DOUBLE_DOT = 6; |
|
137 |
public static final int DGNS_LONG_DASH_SHORT_DASH = 7; |
|
138 |
|
|
139 |
/* -------------------------------------------------------------------- */ |
|
140 |
/* Class */ |
|
141 |
/* -------------------------------------------------------------------- */ |
|
142 |
public static final int DGNC_PRIMARY = 0; |
|
143 |
public static final int DGNC_PATTERN_COMPONENT = 1; |
|
144 |
public static final int DGNC_CONSTRUCTION_ELEMENT = 2; |
|
145 |
public static final int DGNC_DIMENSION_ELEMENT = 3; |
|
146 |
public static final int DGNC_PRIMARY_RULE_ELEMENT = 4; |
|
147 |
public static final int DGNC_LINEAR_PATTERNED_ELEMENT = 5; |
|
148 |
public static final int DGNC_CONSTRUCTION_RULE_ELEMENT = 6; |
|
149 |
|
|
150 |
/* -------------------------------------------------------------------- */ |
|
151 |
/* Group Data level numbers. */ |
|
152 |
/* */ |
|
153 |
/* These are symbolic values for the typ 5 (DGNT_GROUP_DATA) */ |
|
154 |
/* level values that have special meanings. */ |
|
155 |
/* -------------------------------------------------------------------- */ |
|
156 |
public static final int DGN_GDL_COLOR_TABLE = 1; |
|
157 |
public static final int DGN_GDL_NAMED_VIEW = 3; |
|
158 |
public static final int DGN_GDL_REF_FILE = 9; |
|
159 |
|
|
160 |
/* -------------------------------------------------------------------- */ |
|
161 |
/* Word 17 property flags. */ |
|
162 |
/* -------------------------------------------------------------------- */ |
|
163 |
public static final int DGNPF_HOLE = 0x8000; |
|
164 |
public static final int DGNPF_SNAPPABLE = 0x4000; |
|
165 |
public static final int DGNPF_PLANAR = 0x2000; |
|
166 |
public static final int DGNPF_ORIENTATION = 0x1000; |
|
167 |
public static final int DGNPF_ATTRIBUTES = 0x0800; |
|
168 |
public static final int DGNPF_MODIFIED = 0x0400; |
|
169 |
public static final int DGNPF_NEW = 0x0200; |
|
170 |
public static final int DGNPF_LOCKED = 0x0100; |
|
171 |
public static final int DGNPF_CLASS = 0x000f; |
|
172 |
|
|
173 |
/* -------------------------------------------------------------------- */ |
|
174 |
/* DGNElementInfo flag values. */ |
|
175 |
/* -------------------------------------------------------------------- */ |
|
176 |
public static final int DGNEIF_DELETED = 0x01; |
|
177 |
public static final int DGNEIF_COMPLEX = 0x02; |
|
178 |
|
|
179 |
/* -------------------------------------------------------------------- */ |
|
180 |
/* Justifications */ |
|
181 |
/* -------------------------------------------------------------------- */ |
|
182 |
public static final int DGNJ_LEFT_TOP = 0; |
|
183 |
public static final int DGNJ_LEFT_CENTER = 1; |
|
184 |
public static final int DGNJ_LEFT_BOTTOM = 2; |
|
185 |
public static final int DGNJ_LEFTMARGIN_TOP = 3; |
|
186 |
|
|
187 |
/* text node header only */ |
|
188 |
public static final int DGNJ_LEFTMARGIN_CENTER = 4; |
|
189 |
|
|
190 |
/* text node header only */ |
|
191 |
public static final int DGNJ_LEFTMARGIN_BOTTOM = 5; |
|
192 |
|
|
193 |
/* text node header only */ |
|
194 |
public static final int DGNJ_CENTER_TOP = 6; |
|
195 |
public static final int DGNJ_CENTER_CENTER = 6; |
|
196 |
public static final int DGNJ_CENTER_BOTTOM = 8; |
|
197 |
public static final int DGNJ_RIGHTMARGIN_TOP = 9; |
|
198 |
|
|
199 |
/* text node header only */ |
|
200 |
public static final int DGNJ_RIGHTMARGIN_CENTER = 10; |
|
201 |
|
|
202 |
/* text node header only */ |
|
203 |
public static final int DGNJ_RIGHTMARGIN_BOTTOM = 11; |
|
204 |
|
|
205 |
/* text node header only */ |
|
206 |
public static final int DGNJ_RIGHT_TOP = 12; |
|
207 |
public static final int DGNJ_RIGHT_CENTER = 13; |
|
208 |
public static final int DGNJ_RIGHT_BOTTOM = 14; |
|
209 |
|
|
210 |
/* -------------------------------------------------------------------- */ |
|
211 |
/* DGN file reading options. */ |
|
212 |
/* -------------------------------------------------------------------- */ |
|
213 |
public static final int DGNO_CAPTURE_RAW_DATA = 0x01; |
|
214 |
|
|
215 |
/* -------------------------------------------------------------------- */ |
|
216 |
/* Known attribute linkage types, including my synthetic ones. */ |
|
217 |
/* -------------------------------------------------------------------- */ |
|
218 |
public static final int DGNLT_DMRS = 0x0000; |
|
219 |
public static final int DGNLT_INFORMIX = 0x3848; |
|
220 |
public static final int DGNLT_ODBC = 0x5e62; |
|
221 |
public static final int DGNLT_ORACLE = 0x6091; |
|
222 |
public static final int DGNLT_RIS = 0x71FB; |
|
223 |
public static final int DGNLT_SYBASE = 0x4f58; |
|
224 |
public static final int DGNLT_XBASE = 0x1971; |
|
225 |
public static final int DGNLT_SHAPE_FILL = 0x0041; |
|
226 |
public static final int DGNLT_ASSOC_ID = 0x7D2F; |
|
227 |
|
|
228 |
/* -------------------------------------------------------------------- */ |
|
229 |
/* File creation options. */ |
|
230 |
/* -------------------------------------------------------------------- */ |
|
231 |
public static final int DGNCF_USE_SEED_UNITS = 0x01; |
|
232 |
public static final int DGNCF_USE_SEED_ORIGIN = 0x02; |
|
233 |
public static final int DGNCF_COPY_SEED_FILE_COLOR_TABLE = 0x04; |
|
234 |
public static final int DGNCF_COPY_WHOLE_SEED_FILE = 0x08; |
|
235 |
public static final int SIZE_LONG = 4; |
|
236 |
|
|
237 |
|
|
238 |
public static final String DGNT_CELL_LIBRARY_NAME = "Cell Library"; |
|
239 |
public static final String DGNT_CELL_HEADER_NAME = "Cell Header"; |
|
240 |
public static final String DGNT_POINT_NAME = "Point"; |
|
241 |
public static final String DGNT_LINE_NAME = "Line"; |
|
242 |
public static final String DGNT_LINE_STRING_NAME = "Line String"; |
|
243 |
public static final String DGNT_GROUP_DATA_NAME = "Group Data"; |
|
244 |
public static final String DGNT_SHAPE_NAME = "Shape"; |
|
245 |
public static final String DGNT_TEXT_NODE_NAME = "Text Node"; |
|
246 |
public static final String DGNT_DIGITIZER_SETUP_NAME = "Digitizer Setup"; |
|
247 |
public static final String DGNT_TCB_NAME = "TCB"; |
|
248 |
public static final String DGNT_LEVEL_SYMBOLOGY_NAME = "Level Symbology"; |
|
249 |
public static final String DGNT_CURVE_NAME = "Curve"; |
|
250 |
public static final String DGNT_COMPLEX_CHAIN_HEADER_NAME = "Complex Chain Header"; |
|
251 |
public static final String DGNT_COMPLEX_SHAPE_HEADER_NAME = "Complex Shape Header"; |
|
252 |
public static final String DGNT_ELLIPSE_NAME = "Ellipse"; |
|
253 |
public static final String DGNT_ARC_NAME = "Arc"; |
|
254 |
public static final String DGNT_TEXT_NAME ="Text"; |
|
255 |
public static final String DGNT_BSPLINE_NAME = "B-Spline"; |
|
256 |
public static final String DGNT_APPLICATION_ELEM_NAME = "Application Element"; |
|
257 |
public static final String DGNT_SHARED_CELL_DEFN_NAME = "Shared Cell Definition"; |
|
258 |
public static final String DGNT_SHARED_CELL_ELEM_NAME = "Shared Cell Element"; |
|
259 |
public static final String DGNT_TAG_VALUE_NAME = "Tag Value"; |
|
260 |
public static final String DGNT_UNKNOWN_NAME = "Unknown"; |
|
261 |
|
|
262 |
/* |
|
263 |
int offset; |
|
264 |
int size; |
|
265 |
int element_id; |
|
266 |
int stype; |
|
267 |
int level; |
|
268 |
int type; |
|
269 |
int complex; |
|
270 |
int deleted; |
|
271 |
int graphic_group; |
|
272 |
int properties; |
|
273 |
int color; |
|
274 |
int weight; |
|
275 |
int style; |
|
276 |
int attr_bytes; |
|
277 |
byte attr_data; |
|
278 |
int raw_bytes; |
|
279 |
byte raw_data; |
|
280 |
//} DGNElemCore; |
|
281 |
*/ |
|
282 |
|
|
283 |
/** File Length; */ |
|
284 |
int myFileLength = 0; |
|
285 |
|
|
286 |
/** Version of the file. */ |
|
287 |
int myVersion = 1000; |
|
288 |
|
|
289 |
/* |
|
290 |
public static final int SHAPE_NULL = 0; |
|
291 |
public static final int SHAPE_POINT = 1; |
|
292 |
public static final int SHAPE_POLYLINE = 3; |
|
293 |
public static final int SHAPE_POLYGON = 5; |
|
294 |
public static final int SHAPE_MULTIPOINT = 8; |
|
295 |
public static final int SHAPE_POINTZ = 11; |
|
296 |
public static final int SHAPE_POLYLINEZ = 13; |
|
297 |
public static final int SHAPE_POLYGONZ = 15; |
|
298 |
public static final int SHAPE_MULTIPOINTZ = 18; |
|
299 |
public static final int SHAPE_POINTM = 21; |
|
300 |
public static final int SHAPE_POLYLINEM = 23; |
|
301 |
public static final int SHAPE_POLYGONM = 25; |
|
302 |
public static final int SHAPE_MULTIPOINTM = 28; |
|
303 |
public static final int SHAPE_MULTIPATCH = 31; |
|
304 |
*/ |
|
305 |
int myDGNType = 0; |
|
306 |
double myXmin = 0; |
|
307 |
double myYmin = 0; |
|
308 |
double myXmax = 0; |
|
309 |
double myYmax = 0; |
|
310 |
double myZmin = 0; |
|
311 |
double myZmax = 0; |
|
312 |
double myMmin = 0; |
|
313 |
double myMmax = 0; |
|
314 |
|
|
315 |
// notify about warnings. |
|
316 |
private boolean myWarning = true; |
|
317 |
|
|
318 |
/** |
|
319 |
* ShapeFileHeader constructor comment. |
|
320 |
*/ |
|
321 |
public DGNFileHeader() { |
|
322 |
super(); |
|
323 |
} |
|
324 |
|
|
325 |
/** |
|
326 |
* Return the version of the file. |
|
327 |
* |
|
328 |
* @return DOCUMENT ME! |
|
329 |
*/ |
|
330 |
public int getVersion() { |
|
331 |
return myVersion; |
|
332 |
} |
|
333 |
|
|
334 |
/** |
|
335 |
* Devuelve el rect?ngulo del fichero. |
|
336 |
* |
|
337 |
* @return DOCUMENT ME! |
|
338 |
*/ |
|
339 |
public java.awt.geom.Rectangle2D.Double getFileExtents() { |
|
340 |
return new java.awt.geom.Rectangle2D.Double(myXmin, myYmin, |
|
341 |
myXmax - myXmin, myYmax - myYmin); |
|
342 |
} |
|
343 |
|
|
344 |
/** |
|
345 |
* Print warnings to system.out. |
|
346 |
* |
|
347 |
* @param inWarning DOCUMENT ME! |
|
348 |
*/ |
|
349 |
public void setWarnings(boolean inWarning) { |
|
350 |
myWarning = inWarning; |
|
351 |
} |
|
352 |
|
|
353 |
/** |
|
354 |
* Return the length of the header in 16 bit words.. |
|
355 |
* |
|
356 |
* @return DOCUMENT ME! |
|
357 |
*/ |
|
358 |
public int getHeaderLength() { |
|
359 |
return 50; |
|
360 |
} |
|
361 |
|
|
362 |
/** |
|
363 |
* Return the number of 16 bit words in the shape file as recorded in the |
|
364 |
* header |
|
365 |
* |
|
366 |
* @return DOCUMENT ME! |
|
367 |
*/ |
|
368 |
public int getFileLength() { |
|
369 |
return myFileLength; |
|
370 |
} |
|
371 |
|
|
372 |
/** |
|
373 |
* Read the header from the shape file. |
|
374 |
* |
|
375 |
* @param in DOCUMENT ME! |
|
376 |
*/ |
|
377 |
public void readHeader(MappedByteBuffer in) { |
|
378 |
//in.order(ByteOrder.BIG_ENDIAN); |
|
379 |
|
|
380 |
/* |
|
381 |
offset=in.getInt(); |
|
382 |
System.out.println("offset "+offset); |
|
383 |
size=in.getInt(); |
|
384 |
System.out.println("size "+size); |
|
385 |
element_id=in.getInt(); |
|
386 |
System.out.println("element_id "+element_id); |
|
387 |
stype=in.getInt(); |
|
388 |
System.out.println("stype "+stype); |
|
389 |
level=in.getInt(); |
|
390 |
System.out.println("level "+level); |
|
391 |
type=in.getInt(); |
|
392 |
System.out.println("type "+type); |
|
393 |
complex=in.getInt(); |
|
394 |
System.out.println("complex "+complex); |
|
395 |
deleted=in.getInt(); |
|
396 |
System.out.println("deleted "+deleted); |
|
397 |
graphic_group=in.getInt(); |
|
398 |
System.out.println("graphic_group "+graphic_group); |
|
399 |
properties=in.getInt(); |
|
400 |
System.out.println("properties "+properties); |
|
401 |
color=in.getInt(); |
|
402 |
System.out.println("color "+color); |
|
403 |
weight=in.getInt(); |
|
404 |
System.out.println("weight "+weight); |
|
405 |
style=in.getInt(); |
|
406 |
System.out.println("style "+style); |
|
407 |
attr_bytes=in.getInt(); |
|
408 |
System.out.println("attr_bytes "+attr_bytes); |
|
409 |
//attr_data=in.get(attr_bytes); |
|
410 |
//System.out.println("attr_data "+attr_data); |
|
411 |
raw_bytes=in.getInt(); |
|
412 |
System.out.println("raw_bytes "+raw_bytes); |
|
413 |
//raw_data=in.get(raw_bytes); |
|
414 |
//System.out.println("raw_data "+raw_data); |
|
415 |
*/ |
|
416 |
|
|
417 |
// the first four bytes are integers |
|
418 |
// in.setLittleEndianMode(false); |
|
419 |
|
|
420 |
/* in.order(ByteOrder.BIG_ENDIAN); |
|
421 |
myFileCode = in.getInt(); |
|
422 |
if (myFileCode != 9994) warn("File Code = "+myFileCode+" Not equal to 9994"); |
|
423 |
// From 4 to 8 are unused. |
|
424 |
myUnused1 = in.getInt(); |
|
425 |
// From 8 to 12 are unused. |
|
426 |
myUnused2 = in.getInt(); |
|
427 |
// From 12 to 16 are unused. |
|
428 |
myUnused3 = in.getInt(); |
|
429 |
// From 16 to 20 are unused. |
|
430 |
myUnused4 = in.getInt(); |
|
431 |
// From 20 to 24 are unused. |
|
432 |
myUnused5 = in.getInt(); |
|
433 |
// From 24 to 28 are the file length. |
|
434 |
myFileLength = in.getInt(); |
|
435 |
// From 28 to 32 are the File Version. |
|
436 |
in.order(ByteOrder.LITTLE_ENDIAN); |
|
437 |
myVersion = in.getInt(); |
|
438 |
// From 32 to 36 are the Shape Type. |
|
439 |
myShapeType = in.getInt(); |
|
440 |
// From 36 to 44 are Xmin. |
|
441 |
myXmin = in.getDouble(); // Double.longBitsToDouble(in.getLong()); |
|
442 |
// From 44 to 52 are Ymin. |
|
443 |
myYmin = in.getDouble(); |
|
444 |
// From 52 to 60 are Xmax. |
|
445 |
myXmax = in.getDouble(); |
|
446 |
// From 60 to 68 are Ymax. |
|
447 |
myYmax = in.getDouble(); |
|
448 |
// From 68 to 76 are Zmin. |
|
449 |
myZmin = in.getDouble(); |
|
450 |
// From 76 to 84 are Zmax. |
|
451 |
myZmax = in.getDouble(); |
|
452 |
// From 84 to 92 are Mmin. |
|
453 |
myMmin = in.getDouble(); |
|
454 |
// From 92 to 100 are Mmax. |
|
455 |
myMmax = in.getDouble(); |
|
456 |
// that is all 100 bytes of the header. |
|
457 |
*/ |
|
458 |
} |
|
459 |
|
|
460 |
/** |
|
461 |
* Muestra por consola el warning. |
|
462 |
* |
|
463 |
* @param inWarn DOCUMENT ME! |
|
464 |
*/ |
|
465 |
private void warn(String inWarn) { |
|
466 |
if (myWarning) { |
|
467 |
System.out.print("WARNING: "); |
|
468 |
System.out.println(inWarn); |
|
469 |
} |
|
470 |
} |
|
471 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.277/org.gvsig.dgn.provider/src/main/java/org/gvsig/fmap/dal/store/dgn/lib/tagValueUnion.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 21-jul-2003 |
|
3 |
* |
|
4 |
* Copyright (c) 2003 |
|
5 |
* Francisco José Peñarrubia Martínez |
|
6 |
* IVER Tecnologías de la Información S.A. |
|
7 |
* Salamanca 50 |
|
8 |
* 46005 Valencia ( SPAIN ) |
|
9 |
* +34 963163400 |
|
10 |
* mailto:fran@iver.es |
|
11 |
* http://www.iver.es |
|
12 |
*/ |
|
13 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
14 |
* |
|
15 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
16 |
* |
|
17 |
* This program is free software; you can redistribute it and/or |
|
18 |
* modify it under the terms of the GNU General Public License |
|
19 |
* as published by the Free Software Foundation; either version 2 |
|
20 |
* of the License, or (at your option) any later version. |
|
21 |
* |
|
22 |
* This program is distributed in the hope that it will be useful, |
|
23 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
24 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
25 |
* GNU General Public License for more details. |
|
26 |
* |
|
27 |
* You should have received a copy of the GNU General Public License |
|
28 |
* along with this program; if not, write to the Free Software |
|
29 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
30 |
* |
|
31 |
* For more information, contact: |
|
32 |
* |
|
33 |
* Generalitat Valenciana |
|
34 |
* Conselleria d'Infraestructures i Transport |
|
35 |
* Av. Blasco Ib??ez, 50 |
|
36 |
* 46010 VALENCIA |
|
37 |
* SPAIN |
|
38 |
* |
|
39 |
* +34 963862235 |
|
40 |
* gvsig@gva.es |
|
41 |
* www.gvsig.gva.es |
|
42 |
* |
|
43 |
* or |
|
44 |
* |
|
45 |
* IVER T.I. S.A |
|
46 |
* Salamanca 50 |
|
47 |
* 46005 Valencia |
|
48 |
* Spain |
|
49 |
* |
|
50 |
* +34 963163400 |
|
51 |
* dac@iver.es |
|
52 |
*/ |
|
53 |
package org.gvsig.fmap.dal.store.dgn.lib; |
|
54 |
|
|
55 |
/** |
|
56 |
* Uni?n del valor del tag. |
|
57 |
* |
|
58 |
* @author Vicente Caballero Navarro |
|
59 |
*/ |
|
60 |
public class tagValueUnion { |
|
61 |
public char[] string; |
|
62 |
public long integer; |
|
63 |
public double real; |
|
64 |
} |
org.gvsig.dgn/tags/org.gvsig.dgn-2.0.277/org.gvsig.dgn.provider/src/main/java/org/gvsig/fmap/dal/store/dgn/lib/DGNPoint.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 17-jul-2003 |
|
3 |
* |
|
4 |
* Copyright (c) 2003 |
|
5 |
* Francisco José Peñarrubia Martínez |
|
6 |
* IVER Tecnologías de la Información S.A. |
|
7 |
* Salamanca 50 |
|
8 |
* 46005 Valencia ( SPAIN ) |
Also available in: Unified diff