Revision 16204 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/styling/SimpleLine.java

View differences:

SimpleLine.java
173 173
	private ArrayList<JPanel> tabs = new ArrayList<JPanel>();
174 174
	private ArrowDecorator arrowDecorator;
175 175
	private LineProperties lineProperties;
176
	private JIncrementalNumberField txtOffset;
176 177

  
177 178

  
178 179
	public SimpleLine(SymbolEditor owner) {
......
203 204
		txtWidth = new JIncrementalNumberField("3", 25, 0, Double.POSITIVE_INFINITY, 1);
204 205
		aux.addComponent(PluginServices.getText(this, "width")+":",
205 206
				txtWidth );
207

  
208
		// line offset
209
		txtOffset = new JIncrementalNumberField("0", 25, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 1);
210
		aux.addComponent(PluginServices.getText(this, "offset")+":",
211
				txtOffset );
212

  
213
		
214
		
206 215
		aux.setPreferredSize(new Dimension(300, 300));
207 216
		myTab.add(aux);
208

  
217
		
209 218
		// initialize defaults
210 219
		jccColor.setColor(Color.BLACK);
211 220
		txtWidth.setDouble(1.0);
212 221
		jccColor.addActionListener(this);
213 222
		txtWidth.addActionListener(this);
223
		txtOffset.addActionListener(this);
214 224
		tabs.add(myTab);
215 225

  
216 226
		// Arrow Decorator
......
247 257
		ILineStyle sty = (ILineStyle)SymbologyFactory.createStyleFromXML(simplLine.getXMLEntity(), null);
248 258
		
249 259
		sty.setLineWidth((float) txtWidth.getDouble());
260
		sty.setOffset(-txtOffset.getDouble());
250 261

  
251 262
		ArrowDecoratorStyle ads= arrowDecorator.getArrowDecoratorStyle();
252 263
		if (ads != null) {
......
274 285
				System.err.println(getClass().getName()+":: should be unreachable code");
275 286
				jccColor.setColor(Color.BLACK);
276 287
				txtWidth.setDouble(1.0);
277

  
288
				txtOffset.setDouble(0);
278 289
			} else {
279 290
				sym = (SimpleLineSymbol) layer;
280 291
				jccColor.setColor(sym.getColor());
281
				txtWidth.setDouble(	sym.getLineStyle().getLineWidth());
292
				txtWidth.setDouble(sym.getLineStyle().getLineWidth());
293
				txtOffset.setDouble(sym.getLineStyle().getOffset() == 0 ? 0 : -sym.getLineStyle().getOffset() );
282 294
				arrowDecorator.setArrowDecoratorStyle( sym.getLineStyle().getArrowDecorator());
283 295
				lineProperties.setLinePropertiesStyle((BasicStroke) sym.getLineStyle().getStroke());
284 296
			}

Also available in: Unified diff