Revision 42439

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/gui/preferencespage/ViewPage.java
430 430

  
431 431
		// Default back color
432 432
		jccDefaultViewBackColor.setColor(DefaultViewPanel.getDefaultBackColor());
433
		jccDefaultViewBackColor.setAlpha(255);
433

  
434 434
		/*
435 435
		 * Locator's background color, for when we let it be possible
436 436
		 * // Default map overview back color
......
440 440

  
441 441
		// Default selection color
442 442
		jccDefaultSelectionColor.setColor(DefaultProject.getDefaultSelectionColor());
443
		jccDefaultSelectionColor.setAlpha(255);
443

  
444 444
		String[] distanceNames=MapContext.getDistanceNames();
445 445
		// Map units
446 446
		if (DefaultProject.getDefaultMapUnits()<=distanceNames.length && distanceNames.length != jCmbMapUnits.getItemCount()){
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/symbol/CharacterMarkerSymbol.java
232 232
 * @author   jaume dominguez faus - jaume.dominguez@iver.es
233 233
 */
234 234
public class CharacterMarkerSymbol implements IMarkerSymbol {
235
	
235

  
236 236
	private static Logger logger =
237 237
			LoggerFactory.getLogger(CharacterMarkerSymbol.class);
238
	
238

  
239 239
	public static final String CHARACTER_MARKER_SYMBOL_PERSISTENCE_NAME =
240 240
			"CHARACTER_MARKER_SYMBOL_PERSISTENCE_NAME";
241
	
241

  
242 242
	private Font font = new Font("Arial", Font.PLAIN, 20);
243 243
	private int unicode;
244 244
	private ISymbol selectionSymbol;
245 245
	private VisualCorrection visualCorrection;
246 246
	private double size;
247
	
247

  
248 248
	private boolean isShapeVisible = true;
249 249
	private String desc = "";
250
	
250

  
251 251
	private IMask mask;
252 252
	private int unit = -1;
253 253
	private int referenceSystem = CartographicSupport.WORLD;
254
	
254

  
255 255
	private int alpha = 255;
256 256
	private Point2D offset = new Point2D.Double();
257
	
257

  
258 258
	/*
259
	 * 
259
	 *
260 260
	 */
261 261
	private double rotation_radians = 0;
262 262
	private Color color = Color.BLACK;
263
	
263

  
264 264
	private static GeometryManager geoman = GeometryLocator.getGeometryManager();
265 265

  
266 266
	/**
......
308 308
		if (selectionSymbol == null) {
309 309
			selectionSymbol = (ISymbol) LabelClassUtils.clone(this);
310 310
			selectionSymbol.setColor(MapContext.getSelectionColor());
311
		}else{
312
		    selectionSymbol.setColor(MapContext.getSelectionColor());
311 313
		}
312 314
		return selectionSymbol;
313 315
	}
314
	
315
	
316

  
317

  
316 318
	public void draw(Graphics2D g,
317 319
			AffineTransform affineTransform, Geometry geom,
318 320
			Feature feat, Cancellable cancel) {
319
		
321

  
320 322
		g.setColor(getColor());
321 323
		double theta = getRotation();
322 324

  
......
327 329
		if (size < 0.0001) {
328 330
			return;
329 331
		}
330
		
332

  
331 333
		org.gvsig.fmap.geom.primitive.Point cen = null;
332 334
		try {
333 335
			cen = geom.centroid();
334 336
		} catch (Exception e) {
335 337
			logger.error("While getting centroid", e);
336 338
		}
337
		
339

  
338 340
		Point2D p = new Point2D.Double(cen.getX(), cen.getY());
339 341

  
340 342
		if (isVisuallyCorrected()) {
......
369 371

  
370 372

  
371 373

  
372
	
373 374

  
375

  
374 376
	/**
375 377
	 * Sets the unicode for a symbol represented by a character
376 378
	 * @param symbol, int
......
504 506
					}
505 507
				}
506 508
			}
507
			
509

  
508 510
			int realWidth = bi.getWidth() - realRight-realLeft;
509 511
			int realHeight = bi.getHeight() - realBottom - realTop;
510 512

  
511 513
			visualCorrection = new VisualCorrection();
512
			
514

  
513 515
			if (realBottom!=-1 && realTop!=-1 && realLeft!=-1 && realRight != -1) {
514 516
				double correctingSize = Math.max(realHeight, realWidth);
515 517
				visualCorrection.sizeScale = clone.getSize() / correctingSize;
......
525 527
			visualCorrection = null;
526 528
		}
527 529
	}
528
	
529
	
530

  
531

  
530 532
	public Object clone() throws CloneNotSupportedException {
531 533
		return LabelClassUtils.clone(this);
532 534
	}
533
	
534
	
535

  
536

  
535 537
	public void getPixExtentPlus(
536 538
			Geometry geom, float[] distances,
537 539
			ViewPort viewPort, int dpi) {
538
		
540

  
539 541
		float cs = (float) getCartographicSize(viewPort, dpi, geom);
540 542
		distances[0] = cs;
541 543
		distances[1] = cs;
......
572 574
			return onePoint;
573 575
		}
574 576
	}
575
	
577

  
576 578
	public int getOnePointRgb() {
577 579
		return this.getColor().getRGB();
578 580
	}
......
601 603
	public void drawInsideRectangle(Graphics2D g,
602 604
			AffineTransform scaleInstance, Rectangle r,
603 605
			PrintAttributes properties) throws SymbolDrawingException {
604
		
605
		
606

  
607

  
606 608
		org.gvsig.fmap.geom.primitive.Point center = null;
607 609
		try {
608 610
			center = geoman.createPoint(
......
630 632
			print(g, scaleInstance, center, properties);
631 633
			setSize(originalSize);
632 634
		}
633
		
635

  
634 636
	}
635 637

  
636 638

  
......
649 651
		}
650 652
		*/
651 653

  
652
		draw(g,at,geom,null,null);	
654
		draw(g,at,geom,null,null);
653 655
	}
654 656

  
655 657
	public void setUnit(int unitIndex) {
......
670 672

  
671 673
	public double toCartographicSize(ViewPort viewPort, double dpi,
672 674
			Geometry geom) {
673
		
675

  
674 676
		double oldSize = getSize();
675 677
		setCartographicSize(getCartographicSize(viewPort, dpi, geom), geom);
676 678
		return oldSize;	}
......
681 683

  
682 684
	public double getCartographicSize(ViewPort viewPort, double dpi,
683 685
			Geometry geom) {
684
		
686

  
685 687
		return SymbolUtils.getCartographicLength(this,
686 688
									  getSize(),
687 689
									  viewPort,
......
723 725
	public void setMask(IMask m) {
724 726
		mask = m;
725 727
	}
726
	
728

  
727 729
	// =========================================
728
	
730

  
729 731
	public void loadFromState(PersistentState state) throws PersistenceException {
730
		
732

  
731 733
		if (state.hasValue("vc_xOffsetScale")) {
732 734
			this.visualCorrection = new VisualCorrection();
733 735
			this.visualCorrection.xOffsetScale = state.getDouble("vc_xOffsetScale");
......
744 746
		// ==============================================
745 747
		this.color = (Color) state.get("color");
746 748
		this.font = (Font) state.get("font");
747
		
749

  
748 750
		double aux = state.getDouble("size");
749 751
		this.setSize(aux);
750
		
752

  
751 753
		this.unicode = state.getInt("unicode");
752 754
		this.desc = state.getString("desc");
753 755
		this.isShapeVisible = state.getBoolean("isShapeVisible");
754
		
756

  
755 757
		double x = state.getDouble("xOffset");
756 758
		double y = state.getDouble("yOffset");
757 759
		this.offset = new Point2D.Double(x, y);
758
		
760

  
759 761
		this.rotation_radians = state.getDouble("rotation");
760 762
		this.unit = state.getInt("unit");
761
		this.referenceSystem = state.getInt("referenceSystem");		
763
		this.referenceSystem = state.getInt("referenceSystem");
762 764
	}
763 765

  
764 766
	public void saveToState(PersistentState state) throws PersistenceException {
765
		
767

  
766 768
		if (this.visualCorrection != null) {
767 769
			state.set("vc_xOffsetScale", this.visualCorrection.xOffsetScale);
768 770
			state.set("vc_yOffsetScale", this.visualCorrection.yOffsetScale);
......
782 784
		state.set("yOffset", this.offset.getY());
783 785
		state.set("rotation", this.rotation_radians);
784 786
		state.set("unit", this.unit);
785
		state.set("referenceSystem", this.referenceSystem);		
787
		state.set("referenceSystem", this.referenceSystem);
786 788
	}
787
	
789

  
788 790
	public static void registerPersistent() {
789
		
791

  
790 792
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
791 793
		if( manager.getDefinition(CHARACTER_MARKER_SYMBOL_PERSISTENCE_NAME)==null ) {
792 794
			DynStruct definition = manager.addDefinition(
793 795
					CharacterMarkerSymbol.class,
794 796
					CHARACTER_MARKER_SYMBOL_PERSISTENCE_NAME,
795 797
					CHARACTER_MARKER_SYMBOL_PERSISTENCE_NAME+" Persistence definition",
796
					null, 
798
					null,
797 799
					null
798 800
			);
799
			
801

  
800 802
			definition.addDynFieldObject("color").setClassOfValue(Color.class).setMandatory(true);
801 803
			definition.addDynFieldObject("font").setClassOfValue(Font.class).setMandatory(true);
802 804
			definition.addDynFieldDouble("size").setMandatory(true);
......
813 815
			definition.addDynFieldDouble("vc_xOffsetScale").setMandatory(false);
814 816
			definition.addDynFieldDouble("vc_yOffsetScale").setMandatory(false);
815 817
			definition.addDynFieldDouble("vc_sizeScale").setMandatory(false);
816
		}		
818
		}
817 819
	}
818 820

  
819 821

  
......
829 831
		double yOffsetScale = 1;
830 832
		double sizeScale = 1;
831 833
	}
832
		
834

  
833 835
}
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/fill/impl/MultiLayerFillSymbol.java
65 65
    public static final String MULTILAYER_FILL_SYMBOL_PERSISTENCE_DEFINITION_NAME = "MultiLayerFillSymbol";
66 66

  
67 67
    private static final String FIELD_LAYERS = "layers";
68
    
68

  
69 69
	private static final double OPACITY_SELECTION_FACTOR = .8;
70 70
	private IFillSymbol[] layers = new IFillSymbol[0];
71 71
	private MultiLayerFillSymbol selectionSymbol;
......
142 142

  
143 143
	public ISymbol getSymbolForSelection() {
144 144
	    // TODO: revisar
145
	    
146
		if (selectionSymbol == null) {
147
		    	MultiLayerFillSymbol selectionSymbol = 
145
        Color c = MapContext.getSelectionColor();
146
        c = new Color(
147
                c.getRed(),
148
                c.getGreen(),
149
                c.getBlue(),
150
                (int) (c.getAlpha()));//*OPACITY_SELECTION_FACTOR));
151
        if (selectionSymbol == null) {
152
		    	MultiLayerFillSymbol selectionSymbol =
148 153
		    	    new MultiLayerFillSymbol();
149 154
			selectionSymbol.setDescription(getDescription());
150 155
			for (int i = 0; layers != null && i < layers.length; i++) {
151 156
				selectionSymbol.addLayer(layers[i].getSymbolForSelection());
152 157
			}
153
			SimpleFillSymbol selLayer = new SimpleFillSymbol();
154
			Color c = MapContext.getSelectionColor();
155
			c = new Color(
156
					c.getRed(),
157
					c.getGreen(),
158
					c.getBlue(),
159
					(int) (255*OPACITY_SELECTION_FACTOR));
160
			selLayer.setFillColor(c);
161
			selLayer.setOutline(getOutline());
162
			selectionSymbol.addLayer(selLayer);
158
//			SimpleFillSymbol selLayer = new SimpleFillSymbol();
159
//
160
//			selLayer.setFillColor(c);
161
//			selLayer.setOutline(getOutline());
162
//			selectionSymbol.addLayer(selLayer);
163 163
			setSymbolForSelection(selectionSymbol);
164
		}
164
		} else {
165
          for (int i = 0; i < selectionSymbol.getLayerCount(); i++) {
166
                selectionSymbol.setLayer(i, selectionSymbol.getLayer(i).getSymbolForSelection());
167
//                if (i==selectionSymbol.getLayerCount()-1){
168
//                    ((SimpleFillSymbol)selectionSymbol.getLayer(i)).setFillColor(c);
169
//                }
170
            }
171
        }
165 172
		return selectionSymbol;
166 173

  
167 174
	}
......
247 254
		layers = (IFillSymbol[])lst.toArray(new IFillSymbol[0]);
248 255
		return contains;
249 256
	}
250
	
257

  
251 258
	public void setUnit(int unitIndex) {
252 259
		super.setUnit(unitIndex);
253 260
		for (int i = 0; layers != null && i < layers.length; i++) {
......
284 291
		}
285 292
		return size;
286 293
	}
287
	
294

  
288 295
	public Object clone() throws CloneNotSupportedException {
289 296
		MultiLayerFillSymbol copy = (MultiLayerFillSymbol) super.clone();
290 297

  
......
349 356
						MultiLayerFillSymbol.class,
350 357
						MULTILAYER_FILL_SYMBOL_PERSISTENCE_DEFINITION_NAME,
351 358
						MULTILAYER_FILL_SYMBOL_PERSISTENCE_DEFINITION_NAME+" Persistence definition",
352
						null, 
359
						null,
353 360
						null
354 361
				);
355 362

  
......
365 372
			}
366 373
			return Boolean.TRUE;
367 374
		}
368
		
375

  
369 376
	}
370 377

  
371 378
	public static class RegisterSymbol implements Callable {
......
382 389

  
383 390
			return Boolean.TRUE;
384 391
		}
385
		
392

  
386 393
	}
387 394

  
388 395
}
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/fill/impl/SimpleFillSymbol.java
36 36
import org.gvsig.fmap.geom.GeometryManager;
37 37
import org.gvsig.fmap.geom.exception.CreateGeometryException;
38 38
import org.gvsig.fmap.geom.primitive.GeneralPathX;
39
import org.gvsig.fmap.mapcontext.MapContext;
39 40
import org.gvsig.fmap.mapcontext.MapContextLocator;
40 41
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
41 42
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException;
......
77 78
				selectionSymbol.setHasFill(true);
78 79
				setSymbolForSelection(selectionSymbol);
79 80
			}
81
		} else {
82
		    symbolForSelection.setColor(MapContext.getSelectionColor());
80 83
		}
81 84
		return symbolForSelection;
82 85
	}
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/fill/impl/PictureFillSymbol.java
46 46
import org.gvsig.fmap.geom.exception.CreateGeometryException;
47 47
import org.gvsig.fmap.geom.primitive.GeneralPathX;
48 48
import org.gvsig.fmap.geom.primitive.Surface;
49
import org.gvsig.fmap.mapcontext.MapContext;
49 50
import org.gvsig.fmap.mapcontext.MapContextLocator;
50 51
import org.gvsig.fmap.mapcontext.ViewPort;
51 52
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
......
99 100

  
100 101
	private void draw(Graphics2D g, AffineTransform affineTransform, Geometry geom, Cancellable cancel) {
101 102
 		Color fillColor = getFillColor();
102
 		
103

  
103 104
 		Shape transf_geom = geom.getShape(affineTransform);
104
 		
105

  
105 106
		if (fillColor != null) {
106 107
			g.setColor(fillColor);
107 108
			g.fill(transf_geom);
......
150 151

  
151 152
			g.setPaint(resulPatternFill);
152 153
		}
153
		
154

  
154 155
		if (angle == 0) {
155 156
		    g.fill(transf_geom);
156 157
		} else {
......
161 162
		    Geometry pixels_geom = geom.cloneGeometry();
162 163
		    pixels_geom.transform(affineTransform);
163 164
		    pixels_geom.transform(at);
164
		    
165

  
165 166
		    g.rotate(-angle);
166 167
		    g.fill(pixels_geom.getShape());
167 168
		    g.rotate(angle);
......
240 241
			selectionSym = (PictureFillSymbol) cloneForSelection();
241 242
			selectionSym.selected=true;
242 243
			selectionSym.selectionSym = selectionSym; // avoid too much lazy creations
244
		}else {
245
		    selectionSym.setFillColor(MapContext.getSelectionColor());
243 246
		}
244 247
		return selectionSym;
245 248

  
......
349 352
		return null;
350 353
	}
351 354

  
352
	
353 355

  
356

  
354 357
	@Override
355 358
	public double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom) {
356 359
		return super.toCartographicSize(viewPort, dpi, geom);
......
360 363
	public void draw(Graphics2D g, AffineTransform affineTransform,
361 364
			Geometry geom, Feature f, Cancellable cancel) {
362 365
		draw(g, affineTransform, geom, cancel);
363
		
366

  
364 367
	}
365
	
368

  
366 369
    public Object clone() throws CloneNotSupportedException {
367 370
    	PictureFillSymbol copy = (PictureFillSymbol) super.clone();
368 371

  
......
387 390
        }
388 391

  
389 392
        // FIXME: clone properties
390
        
393

  
391 394
        return copy;
392 395
    }
393 396

  
......
401 404
        this.bgSelImage =
402 405
            (BackgroundFileStyle) state.get(BACKGROUND_SELECTION_IMAGE);
403 406

  
404
    
407

  
405 408
        this.angle = (Double) state.get(ANGLE);
406 409
        this.xScale = (Double) state.get(X_SCALE);
407 410
        this.yScale = (Double) state.get(Y_SCALE);
408 411
        this.markerFillProperties = (IMarkerFillPropertiesStyle) state.get(MARKER_FILL_PROPERTIES);
409 412

  
410
    
413

  
411 414
    }
412 415

  
413 416
    public void saveToState(PersistentState state) throws PersistenceException {
......
462 465

  
463 466
		public Object call() throws Exception {
464 467
	        SymbolManager manager = MapContextLocator.getSymbolManager();
465
	        
468

  
466 469
	        manager.registerSymbol(PICTURE_FILL_SYMBOL_PERSISTENCE_DEFINITION_NAME,
467 470
	            PictureFillSymbol.class);
468 471

  
469 472
			return Boolean.TRUE;
470 473
		}
471
		
474

  
472 475
	}
473 476

  
474 477
	public IBackgroundFileStyle getBackgroundFileStyle() {
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/fill/impl/MarkerFillSymbol.java
177 177
 */
178 178
public class MarkerFillSymbol extends AbstractFillSymbol implements IMarkerFillSymbol {
179 179
	private static final Logger logger = LoggerFactory.getLogger(MarkerFillSymbol.class);
180
	
180

  
181 181
    public static final String MARK_FILL_SYMBOL_PERSISTENCE_DEFINITION_NAME =
182 182
        "MarkerFillSymbol";
183 183
    private static final String MARKER_SYMBOL = "markerSymbol";
......
200 200
		if (selectionSymbol == null) {
201 201
			selectionSymbol = (MarkerFillSymbol) cloneForSelection();
202 202
			selectionSymbol.setFillColor(MapContext.getSelectionColor());
203
		}
203
		}else {
204
            selectionSymbol.setColor(MapContext.getSelectionColor());
205
        }
204 206

  
205 207
		return selectionSymbol;
206 208
	}
......
512 514
	}
513 515

  
514 516
	public void setCartographicSize(double cartographicSize, Geometry geom) {
515
		
517

  
516 518
		super.setCartographicSize(cartographicSize, geom);
517 519
		IMarkerSymbol marker = getMarker();
518 520
		if (marker!=null) {
519 521
				marker.setCartographicSize(previousMarkerSize, geom);
520 522
			}
521
		
523

  
522 524
		super.setCartographicSize(cartographicSize, geom);
523 525

  
524 526
	}
......
532 534
		}
533 535
		double s = super.toCartographicSize(viewPort, dpi, geom);
534 536
		return s;
535
		
537

  
536 538
	}
537
	
538
	
539

  
540

  
539 541
    public Object clone() throws CloneNotSupportedException {
540 542
    	MarkerFillSymbol copy = (MarkerFillSymbol) super.clone();
541 543

  
......
555 557
        }
556 558

  
557 559
        // FIXME: clone properties
558
        
560

  
559 561
        return copy;
560 562
    }
561 563

  
......
613 615
		public Object call() throws Exception {
614 616
	        int[] shapeTypes;
615 617
	        SymbolManager manager = MapContextLocator.getSymbolManager();
616
	        
618

  
617 619
	        shapeTypes =
618 620
	            new int[] { Geometry.TYPES.SURFACE, Geometry.TYPES.CIRCLE,
619 621
	                Geometry.TYPES.ELLIPSE, Geometry.TYPES.MULTISURFACE };
620 622
	        manager.registerMultiLayerSymbol(IFillSymbol.SYMBOL_NAME,
621 623
	            shapeTypes,
622 624
	            MarkerFillSymbol.class);
623
	        
625

  
624 626
			return Boolean.TRUE;
625 627
		}
626
		
628

  
627 629
	}
628 630

  
629 631

  
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/line/impl/MultiLayerLineSymbol.java
61 61
		ILineSymbol, IMultiLayerSymbol, IMultiLayerLineSymbol {
62 62

  
63 63
    public static final String MULTILAYER_LINE_SYMBOL_PERSISTENCE_DEFINITION_NAME = "MultiLayerLineSymbol";
64
    
64

  
65 65
    private static final String FIELD_LAYERS = "layers";
66
    
66

  
67 67
    private ILineSymbol[] layers = new ILineSymbol[0];
68 68
	private MultiLayerLineSymbol selectionSymbol;
69
	
69

  
70 70
	// Cached greatest line width from all the layers
71 71
	private double lineWidth;
72 72

  
73 73
	public MultiLayerLineSymbol() {
74 74
		super();
75 75
	}
76
	
76

  
77 77
	public Color getColor() {
78 78
		/*
79 79
		 * a multilayer symbol does not define any color, the color
......
103 103
//	return myLineWidth;
104 104
//    }
105 105

  
106
    public void setLineWidth(double width) {	
106
    public void setLineWidth(double width) {
107 107
	if (width > 0 && width != lineWidth) {
108 108
	    this.lineWidth = width;
109 109
	    double scaleFactor = width / lineWidth;
......
169 169
			for (int i = 0; layers != null && i < layers.length; i++) {
170 170
				selectionSymbol.addLayer(layers[i].getSymbolForSelection());
171 171
			}
172
		}
172
		} else {
173
	          for (int i = 0; i < selectionSymbol.getLayerCount(); i++) {
174
	                selectionSymbol.setLayer(i, selectionSymbol.getLayer(i).getSymbolForSelection());
175
	            }
176
	        }
173 177
		return selectionSymbol;
174 178
	}
175 179

  
......
362 366
		// Save own properties
363 367
		state.set(FIELD_LAYERS, layers);
364 368
	}
365
	
369

  
366 370
	public static class RegisterPersistence implements Callable {
367 371

  
368 372
		public Object call() throws Exception {
......
372 376
						MultiLayerLineSymbol.class,
373 377
						MULTILAYER_LINE_SYMBOL_PERSISTENCE_DEFINITION_NAME,
374 378
						MULTILAYER_LINE_SYMBOL_PERSISTENCE_DEFINITION_NAME+" Persistence definition",
375
						null, 
379
						null,
376 380
						null
377 381
				);
378 382
				// Extend the LineSymbol base definition
......
383 387
			}
384 388
			return Boolean.TRUE;
385 389
		}
386
		
390

  
387 391
	}
388 392

  
389 393
	public static class RegisterSymbol implements Callable {
......
400 404

  
401 405
			return Boolean.TRUE;
402 406
		}
403
		
407

  
404 408
	}
405 409

  
406 410
}
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/line/impl/SimpleLineSymbol.java
34 34
import org.gvsig.fmap.geom.GeometryLocator;
35 35
import org.gvsig.fmap.geom.GeometryManager;
36 36
import org.gvsig.fmap.geom.exception.CreateGeometryException;
37
import org.gvsig.fmap.mapcontext.MapContext;
37 38
import org.gvsig.fmap.mapcontext.MapContextLocator;
38 39
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
39 40
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException;
......
78 79
	public ISymbol getSymbolForSelection() {
79 80
		if (symbolForSelection == null) {
80 81
			symbolForSelection = (SimpleLineSymbol) cloneForSelection();
82
		}else{
83
		    symbolForSelection.setColor(MapContext.getSelectionColor());
81 84
		}
82 85
		return symbolForSelection;
83 86
	}
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/line/impl/PictureLineSymbol.java
38 38
import org.gvsig.compat.print.PrintAttributes;
39 39
import org.gvsig.fmap.dal.feature.Feature;
40 40
import org.gvsig.fmap.geom.Geometry;
41
import org.gvsig.fmap.mapcontext.MapContext;
41 42
import org.gvsig.fmap.mapcontext.MapContextLocator;
42 43
import org.gvsig.fmap.mapcontext.ViewPort;
43 44
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
......
141 142
			selectionSym = (PictureLineSymbol) cloneForSelection();
142 143
			selectionSym.selected=true;
143 144
			selectionSym.selectionSym = selectionSym; // avoid too much lazy creations
144

  
145
		}else{
146
		    selectionSym.setColor(MapContext.getSelectionColor());
145 147
		}
146 148
		return selectionSym;
147 149

  
......
158 160
	    }
159 161

  
160 162
	    float csWidth = getLineStyle().getLineWidth();
161
		
163

  
162 164
		BasicStroke bs = new BasicStroke(
163 165
		    (float) csWidth,
164 166
		    BasicStroke.CAP_ROUND,
165 167
		    BasicStroke.CAP_ROUND);
166
		
168

  
167 169
		Shape geom_transf_clip = geom.getShape(affineTransform);
168 170
		g.setClip(bs.createStrokedShape(geom_transf_clip));
169
		
171

  
170 172
		BackgroundFileStyle bg = (!selected) ? bgImage : bgSelImage ;
171 173

  
172 174
		Rectangle bounds = bg.getBounds();
......
281 283
        this.properties=null;
282 284

  
283 285
	}
284
	
286

  
285 287
	/**
286 288
	 * Returns the URL of the image that is used as a picture line symbol (when it
287 289
	 * is selected in the map)
......
297 299
	public URL getSource() {
298 300
		return bgImage.getSource();
299 301
	}
300
	
302

  
301 303
	/**
302 304
	 * Returns the xscale for the picture line symbol
303 305
	 * @param xScale
......
328 330
				getCartographicLength(this, width, viewPort, dpi), geom);
329 331
		return s;
330 332
	}
331
	
332
	
333

  
334

  
333 335
    public Object clone() throws CloneNotSupportedException {
334 336
        PictureLineSymbol copy = (PictureLineSymbol) super.clone();
335 337

  
......
354 356
        }
355 357

  
356 358
        // FIXME: clone properties
357
        
359

  
358 360
        return copy;
359 361
    }
360 362

  
......
405 407
                    .setClassOfValue(BackgroundFileStyle.class).setMandatory(false);
406 408
                definition.addDynFieldObject(BACKGROUND_SELECTION_IMAGE)
407 409
                    .setClassOfValue(BackgroundFileStyle.class).setMandatory(false);
408
                
410

  
409 411
                definition.addDynFieldObject(WIDTH)
410 412
                    .setClassOfValue(Double.class).setMandatory(true);
411 413
            }
412 414
            return Boolean.TRUE;
413 415
        }
414 416
    }
415
    
417

  
416 418
	public static class RegisterSymbol implements Callable {
417 419

  
418 420
		public Object call() throws Exception {
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/marker/impl/MultiLayerMarkerSymbol.java
61 61
public class MultiLayerMarkerSymbol extends AbstractMarkerSymbol implements IMarkerSymbol, IMultiLayerSymbol, IMultiLayerMarkerSymbol {
62 62

  
63 63
    public static final String MULTILAYER_MARKER_SYMBOL_PERSISTENCE_DEFINITION_NAME = "MultiLayerMarkerSymbol";
64
    
64

  
65 65
    private static final String FIELD_LAYERS = "layers";
66 66
    private static final String FIELD_ROTATION = "rotation";
67 67

  
......
69 69
	private MultiLayerMarkerSymbol selectionSymbol;
70 70
	private double markerSize;
71 71
	private double rotation;
72
	
72

  
73 73
	public MultiLayerMarkerSymbol() {
74 74
		super();
75 75
	}
76
	
76

  
77 77
	public Color getColor() {
78 78
		/*
79 79
		 * a multilayer symbol does not define any color, the color
......
169 169
			for (int i = 0; layers != null && i < layers.length; i++) {
170 170
				selectionSymbol.addLayer(layers[i].getSymbolForSelection());
171 171
			}
172
		}
172
		}else {
173
            for (int i = 0; i < selectionSymbol.getLayerCount(); i++) {
174
                selectionSymbol.setLayer(i, selectionSymbol.getLayer(i).getSymbolForSelection());
175
            }
176
        }
173 177
		return selectionSymbol;
174 178

  
175 179
	}
......
373 377
						MultiLayerMarkerSymbol.class,
374 378
						MULTILAYER_MARKER_SYMBOL_PERSISTENCE_DEFINITION_NAME,
375 379
						MULTILAYER_MARKER_SYMBOL_PERSISTENCE_DEFINITION_NAME+" Persistence definition",
376
						null, 
380
						null,
377 381
						null
378 382
				);
379 383
				// Extend the MarkerSymbol base definition
......
386 390
			}
387 391
			return Boolean.TRUE;
388 392
		}
389
		
393

  
390 394
	}
391 395

  
392 396
	public static class RegisterSymbol implements Callable {
......
403 407

  
404 408
			return Boolean.TRUE;
405 409
		}
406
		
410

  
407 411
	}
408 412

  
409 413
}
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/marker/impl/SimpleMarkerSymbol.java
31 31
import org.gvsig.fmap.dal.feature.Feature;
32 32
import org.gvsig.fmap.geom.Geometry;
33 33
import org.gvsig.fmap.geom.primitive.GeneralPathX;
34
import org.gvsig.fmap.mapcontext.MapContext;
34 35
import org.gvsig.fmap.mapcontext.MapContextLocator;
35 36
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
36 37
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager;
......
73 74
	public ISymbol getSymbolForSelection() {
74 75
		if (selectionSymbol == null) {
75 76
			selectionSymbol = (SimpleMarkerSymbol) cloneForSelection();
77
		}else {
78
		    selectionSymbol.setColor(MapContext.getSelectionColor());
76 79
		}
77 80
		return selectionSymbol;
78 81
	}
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/marker/impl/ArrowMarkerSymbol.java
50 50
public class ArrowMarkerSymbol extends AbstractMarkerSymbol implements CartographicSupport, IArrowMarkerSymbol {
51 51

  
52 52
	public static final String ARROW_MARKER_SYMBOL_DYNCLASS_NAME = "ArrowMarkerSymbol";
53
	
54
	private static final String FIELD_SHARPNESS = "sharpness"; 
55 53

  
54
	private static final String FIELD_SHARPNESS = "sharpness";
55

  
56 56
	private ArrowMarkerSymbol symSel;
57 57
	private double sharpeness;
58 58

  
59 59
	public ISymbol getSymbolForSelection() {
60 60
		if (symSel == null) {
61
			symSel = new ArrowMarkerSymbol();
61
			//symSel = new ArrowMarkerSymbol();
62
		    symSel = (ArrowMarkerSymbol)this.cloneForSelection();
62 63
			symSel.setColor(MapContext.getSelectionColor());
63

  
64
		}else{
65
		    symSel.setColor(MapContext.getSelectionColor());
64 66
		}
65 67

  
66 68
		return symSel;
......
105 107
		g.setStroke(new BasicStroke());
106 108

  
107 109
		AffineTransform newAf = (AffineTransform)affineTransform.clone();
108
		
110

  
109 111
		newAf.translate(p.getX(), p.getY());
110 112
		newAf.rotate(theta);
111
		
113

  
112 114
		GeneralPathX gp = new GeneralPathX();
113 115
		gp.moveTo(0, 0);
114 116
		gp.lineTo(size, -halfHeight);
......
116 118
		gp.closePath();
117 119

  
118 120
		gp.transform(newAf);
119
		
121

  
120 122
		g.fill(gp);
121 123
	}
122
	
124

  
123 125
	public Object clone() throws CloneNotSupportedException {
124 126
		ArrowMarkerSymbol copy  = (ArrowMarkerSymbol) super.clone();
125
		
127

  
126 128
		// Clone the selection symbol
127 129
		if (symSel != null) {
128 130
			copy.symSel = (ArrowMarkerSymbol) symSel.clone();
......
156 158
						ArrowMarkerSymbol.class,
157 159
						ARROW_MARKER_SYMBOL_DYNCLASS_NAME,
158 160
						ARROW_MARKER_SYMBOL_DYNCLASS_NAME+" Persistence definition",
159
						null, 
161
						null,
160 162
						null
161 163
				);
162 164
				// Extend the FillSymbol base definition
......
167 169
			}
168 170
			return Boolean.TRUE;
169 171
		}
170
		
172

  
171 173
	}
172 174

  
173 175
}
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/marker/impl/PictureMarkerSymbol.java
101 101
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
102 102
import org.gvsig.fmap.geom.Geometry.TYPES;
103 103
import org.gvsig.fmap.geom.exception.CreateGeometryException;
104
import org.gvsig.fmap.mapcontext.MapContext;
104 105
import org.gvsig.fmap.mapcontext.MapContextLocator;
105 106
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
106 107
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException;
......
135 136
    private static final String BACKGROUND_SELECTION_IMAGE = "bgSelImage";
136 137

  
137 138
//    private static final float SELECTION_OPACITY_FACTOR = .3F;
138
    
139

  
139 140
    private boolean selected;
140 141
    private PictureMarkerSymbol selectionSym;
141 142

  
......
152 153

  
153 154
    /**
154 155
     * Constructor method
155
     * 
156
     *
156 157
     * @param imageURL
157 158
     *            , URL of the normal image
158 159
     * @param selImageURL
......
170 171

  
171 172
    /**
172 173
     * Sets the file for the image to be used as a marker symbol
173
     * 
174
     *
174 175
     * @param imageFile
175 176
     *            , File
176 177
     * @throws IOException
......
183 184
    /**
184 185
     * Sets the file for the image to be used as a marker symbol (when it is
185 186
     * selected in the map)
186
     * 
187
     *
187 188
     * @param imageFile
188 189
     *            , File
189 190
     * @throws IOException
......
204 205
            selectionSym.selected = true;
205 206
            selectionSym.selectionSym = selectionSym; // avoid too much lazy
206 207
                                                      // creations
208
        }else{
209
            selectionSym.setColor(MapContext.getSelectionColor());
207 210
        }
208 211
        return selectionSym;
209 212
    }
......
249 252
        }
250 253

  
251 254
    }
252
    
253
    
255

  
256

  
254 257
    public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r, PrintAttributes properties) throws SymbolDrawingException {
255 258

  
256 259
        /*
257 260
         * Marker symbols which are not simple (images, etc)
258
         * are resized when drawn inside a rectangle 
261
         * are resized when drawn inside a rectangle
259 262
         */
260 263
        double saved_size = this.getSize();
261 264
        this.setSize(r.getHeight());
......
264 267

  
265 268
        // =================== Restoring size
266 269
        this.setSize(saved_size);
267
    }    
268
    
270
    }
269 271

  
272

  
270 273
    public String getClassName() {
271 274
        return getClass().getName();
272 275
    }
......
367 370
            return Boolean.TRUE;
368 371
        }
369 372
    }
370
    
373

  
371 374
	public static class RegisterSymbol implements Callable {
372 375

  
373 376
		public Object call() throws Exception {
......
378 381

  
379 382
			return Boolean.TRUE;
380 383
		}
381
		
384

  
382 385
	}
383 386

  
384 387
}

Also available in: Unified diff