Revision 29791
branches/v2_0_0_prep/extensions/extDalTransformEventTheme/src/org/gvsig/app/eventtheme/daltransform/EventThemeTransformPanel.java | ||
---|---|---|
86 | 86 |
setLayout(new BorderLayout()); |
87 | 87 |
northPanel.setLayout(new java.awt.GridBagLayout()); |
88 | 88 |
|
89 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
90 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
|
91 |
gridBagConstraints.insets = new Insets(5,2,2,2); |
|
92 |
northPanel.add(featureTypeLabel, gridBagConstraints); |
|
93 |
|
|
94 |
featureTypeCombo.setModel(new javax.swing.DefaultComboBoxModel()); |
|
95 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
96 |
gridBagConstraints.gridx = 0; |
|
97 |
gridBagConstraints.gridy = 1; |
|
98 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
99 |
gridBagConstraints.weightx = 1.0; |
|
100 |
gridBagConstraints.insets = new Insets(2,2,5,2); |
|
101 |
northPanel.add(featureTypeCombo, gridBagConstraints); |
|
89 |
// gridBagConstraints = new java.awt.GridBagConstraints();
|
|
90 |
// gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
|
|
91 |
// gridBagConstraints.insets = new Insets(5,2,2,2);
|
|
92 |
// northPanel.add(featureTypeLabel, gridBagConstraints);
|
|
93 |
// |
|
94 |
// featureTypeCombo.setModel(new javax.swing.DefaultComboBoxModel());
|
|
95 |
// gridBagConstraints = new java.awt.GridBagConstraints();
|
|
96 |
// gridBagConstraints.gridx = 0;
|
|
97 |
// gridBagConstraints.gridy = 1;
|
|
98 |
// gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
|
|
99 |
// gridBagConstraints.weightx = 1.0;
|
|
100 |
// gridBagConstraints.insets = new Insets(2,2,5,2);
|
|
101 |
// northPanel.add(featureTypeCombo, gridBagConstraints);
|
|
102 | 102 |
|
103 | 103 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
104 | 104 |
gridBagConstraints.gridx = 0; |
105 |
gridBagConstraints.gridy = 2;
|
|
105 |
gridBagConstraints.gridy = 0;
|
|
106 | 106 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
107 | 107 |
gridBagConstraints.insets = new Insets(5,2,2,2); |
108 | 108 |
northPanel.add(xLabel, gridBagConstraints); |
... | ... | |
110 | 110 |
xCombo.setModel(new javax.swing.DefaultComboBoxModel()); |
111 | 111 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
112 | 112 |
gridBagConstraints.gridx = 0; |
113 |
gridBagConstraints.gridy = 3;
|
|
113 |
gridBagConstraints.gridy = 1;
|
|
114 | 114 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
115 | 115 |
gridBagConstraints.insets = new Insets(2,2,5,2); |
116 | 116 |
gridBagConstraints.weightx = 1.0; |
... | ... | |
118 | 118 |
|
119 | 119 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
120 | 120 |
gridBagConstraints.gridx = 0; |
121 |
gridBagConstraints.gridy = 4;
|
|
121 |
gridBagConstraints.gridy = 2;
|
|
122 | 122 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
123 | 123 |
gridBagConstraints.insets = new Insets(5,2,2,2); |
124 | 124 |
northPanel.add(yLabel, gridBagConstraints); |
... | ... | |
126 | 126 |
yCombo.setModel(new javax.swing.DefaultComboBoxModel()); |
127 | 127 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
128 | 128 |
gridBagConstraints.gridx = 0; |
129 |
gridBagConstraints.gridy = 5;
|
|
129 |
gridBagConstraints.gridy = 3;
|
|
130 | 130 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
131 | 131 |
gridBagConstraints.weightx = 1.0; |
132 | 132 |
gridBagConstraints.insets = new Insets(2,2,5,2); |
... | ... | |
134 | 134 |
|
135 | 135 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
136 | 136 |
gridBagConstraints.gridx = 0; |
137 |
gridBagConstraints.gridy = 6;
|
|
137 |
gridBagConstraints.gridy = 4;
|
|
138 | 138 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; |
139 | 139 |
gridBagConstraints.insets = new Insets(5,2,2,2); |
140 | 140 |
northPanel.add(nameLabel, gridBagConstraints); |
141 | 141 |
|
142 | 142 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
143 | 143 |
gridBagConstraints.gridx = 0; |
144 |
gridBagConstraints.gridy = 7;
|
|
144 |
gridBagConstraints.gridy = 5;
|
|
145 | 145 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
146 | 146 |
gridBagConstraints.weightx = 1.0; |
147 | 147 |
gridBagConstraints.insets = new Insets(2,2,5,2); |
branches/v2_0_0_prep/extensions/extDalTransformEventTheme/src/org/gvsig/app/eventtheme/daltransform/EventThemeTransformGui.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
package org.gvsig.app.eventtheme.daltransform; |
29 | 29 |
|
30 |
import java.awt.Dimension; |
|
30 | 31 |
import java.util.ArrayList; |
31 | 32 |
import java.util.List; |
32 | 33 |
|
... | ... | |
72 | 73 |
* @see java.awt.Component#toString() |
73 | 74 |
*/ |
74 | 75 |
public String toString() { |
75 |
return PluginServices.getText(this, "events_layer");
|
|
76 |
return getName();
|
|
76 | 77 |
} |
77 | 78 |
|
78 | 79 |
/* (non-Javadoc) |
... | ... | |
95 | 96 |
public String getName() { |
96 | 97 |
return PluginServices.getText(this, "events_layer"); |
97 | 98 |
} |
99 |
|
|
100 |
/* (non-Javadoc) |
|
101 |
* @see org.gvsig.app.daltransform.gui.DataTransformGui#getMinDimension() |
|
102 |
*/ |
|
103 |
public Dimension getMinDimension() { |
|
104 |
// TODO Auto-generated method stub |
|
105 |
return null; |
|
106 |
} |
|
98 | 107 |
} |
99 | 108 |
|
branches/v2_0_0_prep/extensions/extDalTransformEventTheme/src/org/gvsig/app/eventtheme/dal/feature/EventThemeTransform.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import java.util.Arrays; |
31 | 31 |
|
32 |
import org.gvsig.fmap.crs.CRSFactory; |
|
32 | 33 |
import org.gvsig.fmap.dal.DataStore; |
33 | 34 |
import org.gvsig.fmap.dal.DataTypes; |
34 | 35 |
import org.gvsig.fmap.dal.exception.DataException; |
... | ... | |
63 | 64 |
private String yFieldName = null; |
64 | 65 |
private String geometryFieldName = null; |
65 | 66 |
private FeatureType originalFeatureType; |
66 |
private static final GeometryManager geometryManager = GeometryLocator.getGeometryManager();
|
|
67 |
private GeometryManager geometryManager = GeometryLocator.getGeometryManager(); |
|
67 | 68 |
|
68 | 69 |
public EventThemeTransform() { |
69 | 70 |
super(); |
71 |
geometryManager = GeometryLocator.getGeometryManager(); |
|
70 | 72 |
} |
71 | 73 |
|
72 | 74 |
/** |
... | ... | |
94 | 96 |
this.originalFeatureType = this.getFeatureStore() |
95 | 97 |
.getDefaultFeatureType(); |
96 | 98 |
|
97 |
EditableFeatureType type = this.getFeatureStore().getDefaultFeatureType().getEditable();
|
|
99 |
EditableFeatureType type = originalFeatureType.getEditable();
|
|
98 | 100 |
if (type.get(this.geometryFieldName) == null){ |
99 | 101 |
EditableFeatureAttributeDescriptor attributeDescriptor = type.add(this.geometryFieldName, DataTypes.GEOMETRY); |
100 | 102 |
attributeDescriptor.setGeometryType(TYPES.POINT); |
101 |
attributeDescriptor.setGeometrySubType(SUBTYPES.GEOM2D); |
|
103 |
attributeDescriptor.setGeometrySubType(SUBTYPES.GEOM2D); |
|
104 |
attributeDescriptor.setSRS(CRSFactory.getCRS("EPSG:23030")); |
|
102 | 105 |
} |
103 | 106 |
|
104 | 107 |
type.setDefaultGeometryAttributeName(this.geometryFieldName); |
... | ... | |
112 | 115 |
public void applyTransform(Feature source, EditableFeature target) |
113 | 116 |
throws DataException { |
114 | 117 |
this.copySourceToTarget(source, target); |
115 |
|
|
116 |
Object x = source.get(xFieldName); |
|
117 |
Object y = source.get(yFieldName); |
|
118 |
Double dx = Double.valueOf(x.toString()); |
|
119 |
Double dy = Double.valueOf(y.toString()); |
|
118 |
|
|
120 | 119 |
try { |
121 |
Point point = geometryManager.createPoint(dx, dy, SUBTYPES.GEOM2D); |
|
120 |
Point point = geometryManager.createPoint(source.getDouble(xFieldName), |
|
121 |
source.getDouble(yFieldName), |
|
122 |
SUBTYPES.GEOM2D); |
|
122 | 123 |
target.set(geometryFieldName, point); |
123 | 124 |
target.setDefaultGeometry(point); |
124 | 125 |
} catch (CreateGeometryException e) { |
Also available in: Unified diff