Revision 43510 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/impl/MultiShapeSymbol.java

View differences:

MultiShapeSymbol.java
50 50
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.IMask;
51 51
import org.gvsig.tools.ToolsLocator;
52 52
import org.gvsig.tools.dynobject.DynStruct;
53
import org.gvsig.tools.exception.NotYetImplemented;
53 54
import org.gvsig.tools.persistence.PersistenceManager;
54 55
import org.gvsig.tools.persistence.PersistentState;
55 56
import org.gvsig.tools.persistence.exception.PersistenceException;
......
174 175
	    }
175 176
	}
176 177
	
178
    @Override
177 179
	public boolean isOneDotOrPixel(Geometry geom,
178 180
			double[] positionOfDotOrPixel, ViewPort viewPort, int dpi) {
179
		switch (geom.getType()) {
180
		case Geometry.TYPES.POINT: //Tipo punto
181
		
182
        GeometryType geomType = geom.getGeometryType();
183
        if( geomType.isSubTypeOf(Geometry.TYPES.POINT) ) {
181 184
           	if (marker != null) {
182 185
				return marker.isOneDotOrPixel(geom, positionOfDotOrPixel, viewPort, dpi);
183 186
			}
184
			break;
185
		case Geometry.TYPES.CURVE:
186
		case Geometry.TYPES.ARC:
187
		case Geometry.TYPES.SPLINE:
188
		if (line != null) {
189
				return line.isOneDotOrPixel(geom, positionOfDotOrPixel, viewPort, dpi);
187

  
188
        } else if( geomType.isSubTypeOf(Geometry.TYPES.CURVE) ) {
189
            if (line != null) {
190
                return line.isOneDotOrPixel(geom, positionOfDotOrPixel, viewPort, dpi);
190 191
			}
191
			break;
192

  
193
		case Geometry.TYPES.SURFACE:
194
        case Geometry.TYPES.ELLIPSE:
195
		case Geometry.TYPES.CIRCLE:
192
            
193
        } else if( geomType.isSubTypeOf(Geometry.TYPES.SURFACE) ) {
196 194
			if (fill != null) {
197 195
				return fill.isOneDotOrPixel(geom, positionOfDotOrPixel, viewPort, dpi);
198 196
			}
199
			break;
200
		}
197
            
198
        }
201 199
		if (!geom.isSimple()){
202 200
			Aggregate aggregate = (Aggregate)geom;			
203 201
			for (int i=0 ; i<aggregate.getPrimitivesNumber() ; i++){
......
332 330
		}
333 331
	}
334 332

  
335
//	public String getClassName() {
336
//		return getClass().getName();
337
//	}
338

  
333
    @Override
339 334
	public void print(Graphics2D g, AffineTransform at, Geometry geom, PrintAttributes properties) {
340
		switch (geom.getType()) {
341
		case Geometry.TYPES.POINT: //Tipo punto
335
        GeometryType geomType = geom.getGeometryType();
336
        if( geomType.isTypeOf(Geometry.TYPES.POINT) ) {
342 337
           	if (marker != null) {
343 338
				marker.print(g, at, geom, properties);
344 339
			}
345
			break;
346
		case Geometry.TYPES.CURVE:
347
		case Geometry.TYPES.ARC:
340

  
341
        } else if( geomType.isTypeOf(Geometry.TYPES.CURVE) ) {
348 342
			if (line != null) {
349 343
				line.print(g, at, geom, properties);
350 344
			}
351
			break;
352 345

  
353
		case Geometry.TYPES.SURFACE:
354
		case Geometry.TYPES.ELLIPSE:
355
        case Geometry.TYPES.CIRCLE:
346
        } else if( geomType.isTypeOf(Geometry.TYPES.SURFACE) ) {
356 347
			if (fill != null) {
357 348
				fill.print(g, at, geom, properties);
358 349
			}
359
			break;
360
		}
350

  
351
        }
361 352
	}
362 353

  
354
    @Override
363 355
	public double getRotation() {
364 356
		if (marker != null) {
365 357
			return marker.getRotation();
......
459 451
		}
460 452
	}
461 453

  
454
    @Override
462 455
	public int getUnit() {
463 456
		if (marker != null) {
464 457
			return marker.getUnit();
......
469 462
		return -1;
470 463
	}
471 464

  
465
    @Override
472 466
	public void setMask(IMask mask) {
473
		// TODO Implement it
474
		throw new Error("Not yet implemented!");
467
		throw new NotYetImplemented();
475 468

  
476 469
	}
477 470

  
471
    @Override
478 472
	public int getReferenceSystem() {
479 473
		return this.referenceSystem;
480 474
	}
481 475

  
476
    @Override
482 477
	public void setReferenceSystem(int system) {
483 478
		this.referenceSystem = system;
484 479

  
485 480
	}
486 481

  
482
    @Override
487 483
	public double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom) {
488
		switch (geom.getType()) {
489
		case Geometry.TYPES.POINT: //Tipo punto
484
        GeometryType geomType = geom.getGeometryType();
485
        if( geomType.isTypeOf(Geometry.TYPES.POINT) ) {
490 486
        	if (marker != null) {
491 487
				return marker.toCartographicSize(viewPort, dpi, geom);
492 488
			}
493
		case Geometry.TYPES.CURVE:
494
		case Geometry.TYPES.ARC:
489

  
490
        } else if( geomType.isTypeOf(Geometry.TYPES.CURVE) ) {
495 491
			if (line != null) {
496 492
				return line.toCartographicSize(viewPort, dpi, geom);
497 493
			}
498
		case Geometry.TYPES.SURFACE:
499
		case Geometry.TYPES.ELLIPSE:
500
		case Geometry.TYPES.CIRCLE:
494

  
495
        } else if( geomType.isTypeOf(Geometry.TYPES.SURFACE) ) {
501 496
			LOG.warn("Cartographic size does not have any sense for fill symbols");
502 497

  
503
		}
498
        }
504 499
		return -1;
505 500
	}
506 501

  
502
    @Override
507 503
	public void setCartographicSize(double cartographicSize, Geometry geom) {
508
		switch (geom.getType()) {
509
		case Geometry.TYPES.POINT: //Tipo punto
504
        GeometryType geomType = geom.getGeometryType();
505
        if( geomType.isTypeOf(Geometry.TYPES.POINT) ) {
510 506
        	if (marker != null) {
511 507
				marker.setCartographicSize(cartographicSize, null);
512 508
			}
513
        	break;
514
		case Geometry.TYPES.CURVE:
515
		case Geometry.TYPES.ARC:
509

  
510
        } else if( geomType.isTypeOf(Geometry.TYPES.CURVE) ) {
516 511
			if (line != null) {
517 512
				line.setCartographicSize(cartographicSize, null);
518 513
			}
519
        	break;
520
		case Geometry.TYPES.SURFACE:
521
		case Geometry.TYPES.ELLIPSE:
522
	    case Geometry.TYPES.CIRCLE:
514

  
515
        } else if( geomType.isTypeOf(Geometry.TYPES.SURFACE) ) {
523 516
	    	LOG.warn("Cartographic size does not have any sense for fill symbols");
524
		}
517

  
518
        }
525 519
	}
526 520

  
527 521

  
522
    @Override
528 523
	public double getCartographicSize(ViewPort viewPort, double dpi, Geometry geom) {
529
		switch (geom.getType()) {
530
		case Geometry.TYPES.POINT: //Tipo punto
531
        	return CartographicSupportToolkit.
532
			getCartographicLength(marker,
533
								  getSize(),
534
								  viewPort,
535
								  dpi);
536
		case Geometry.TYPES.CURVE:
537
		case Geometry.TYPES.ARC:
538
			return CartographicSupportToolkit.
539
			getCartographicLength(line,
540
								  getSize(),
541
								  viewPort,
542
								  dpi);
543
		case Geometry.TYPES.SURFACE:
544
     	case Geometry.TYPES.ELLIPSE:
545
	    case Geometry.TYPES.CIRCLE:
524
        GeometryType geomType = geom.getGeometryType();
525
        if( geomType.isTypeOf(Geometry.TYPES.POINT) ) {
526
        	return CartographicSupportToolkit.getCartographicLength(
527
                marker, getSize(), viewPort, dpi
528
            );
529

  
530
        } else if( geomType.isTypeOf(Geometry.TYPES.CURVE) ) {
531
			return CartographicSupportToolkit.getCartographicLength(
532
                line, getSize(), viewPort, dpi
533
            );
534

  
535
        } else if( geomType.isTypeOf(Geometry.TYPES.SURFACE) ) {
546 536
	    	LOG.warn("Cartographic size does not have any sense for fill symbols");
547
		}
537

  
538
        }
548 539
		return -1;
549 540
	}
550 541

  
542
    @Override
551 543
	public IMarkerSymbol getMarkerSymbol() {
552 544
		return marker;
553 545
	}
554 546

  
547
    @Override
555 548
	public ILineSymbol getLineSymbol() {
556 549
		return line;
557 550
	}
558 551

  
552
    @Override
559 553
	public IFillSymbol getFillSymbol() {
560 554
		return fill;
561 555
	}
562 556

  
557
    @Override
563 558
	public void setMarkerSymbol(IMarkerSymbol markerSymbol) {
564 559
		this.marker = markerSymbol;
565 560
	}
566 561

  
562
    @Override
567 563
	public void setLineSymbol(ILineSymbol lineSymbol) {
568 564
		this.line = lineSymbol;
569 565
	}
570 566

  
567
    @Override
571 568
	public void setFillSymbol(IFillSymbol fillFillSymbol) {
572 569
		this.fill = fillFillSymbol;
573 570
	}
574 571

  
572
    @Override
575 573
	public boolean hasFill() {
576 574
	if (fill == null) {
577 575
		return false;
......
579 577
	return fill.hasFill();
580 578
	}
581 579

  
580
    @Override
582 581
	public void setHasFill(boolean hasFill) {
583 582
		if (fill != null) {
584 583
			fill.setHasFill(hasFill);
585
//			this.hasFill = hasFill;
586 584
		}
587 585
	}
588 586

  
587
    @Override
589 588
	public boolean hasOutline() {
590
		// TODO Auto-generated method stub
591 589
		return false;
592 590
	}
593 591

  
592
    @Override
594 593
	public void setHasOutline(boolean hasOutline) {
595
		// TODO Auto-generated method stub
596 594

  
597 595
	}
598 596

  
597
    @Override
599 598
	public Object clone() throws CloneNotSupportedException {
600 599
		MultiShapeSymbol copy = (MultiShapeSymbol) super.clone();
601 600

  
......
622 621
		return copy;
623 622
	}
624 623

  
624
    @Override
625 625
	public void loadFromState(PersistentState state)
626 626
			throws PersistenceException {
627 627
		setDescription(state.getString(FIELD_DESCRIPTION));
......
630 630
		setLineSymbol((ILineSymbol) state.get(FIELD_LINE));
631 631
	}
632 632

  
633
    @Override
633 634
	public void saveToState(PersistentState state) throws PersistenceException {
634 635
		state.set(FIELD_DESCRIPTION, getDescription());
635 636
		state.set(FIELD_FILL, getFillSymbol());
......
639 640

  
640 641
	public static class RegisterPersistence implements Callable {
641 642

  
643
        @Override
642 644
		public Object call() throws Exception {
643 645
			PersistenceManager manager = ToolsLocator.getPersistenceManager();
644 646
			if( manager.getDefinition(MULTI_SHAPE_SYMBOL_PERSISTENCE_DEFINITION_NAME)==null ) {
......
665 667

  
666 668
	public static class RegisterSymbol implements Callable {
667 669

  
670
        @Override
668 671
		public Object call() throws Exception {
669 672
	        int[] shapeTypes;
670 673
	        SymbolManager manager = MapContextLocator.getSymbolManager();

Also available in: Unified diff