Revision 43524

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/rendering/symbols/impl/DefaultSymbolManager.java
100 100

  
101 101
    private Map symbolsByShapeType = Collections.synchronizedMap(new HashMap());
102 102

  
103
    private Map multiLineSymbolsByName
103
    private Map multiLayerSymbolsByName
104 104
            = Collections.synchronizedMap(new HashMap());
105 105

  
106
    private Map multiLineSymbolsByShapeType
106
    private Map multiLayerSymbolsByShapeType
107 107
            = Collections.synchronizedMap(new HashMap());
108 108

  
109 109
    private IWarningSymbol warningSymbol;
......
385 385
    public IMultiLayerSymbol createMultiLayerSymbol(String symbolName)
386 386
            throws MapContextRuntimeException {
387 387
        return (IMultiLayerSymbol) createSymbol(symbolName,
388
                (Class) multiLineSymbolsByName.get(symbolName),
388
                (Class) multiLayerSymbolsByName.get(symbolName),
389 389
                IMultiLayerSymbol.class);
390 390
    }
391 391

  
392 392
    public IMultiLayerSymbol createMultiLayerSymbol(int shapeType)
393 393
            throws MapContextRuntimeException {
394
        String symbolName = getSymbolName(multiLineSymbolsByShapeType, shapeType);
394
        String symbolName = getSymbolName(multiLayerSymbolsByShapeType, shapeType);
395 395

  
396 396
        return symbolName == null ? null : createMultiLayerSymbol(symbolName);
397 397
    }
......
406 406
        if (symbolName == null) {
407 407
            GeometryManager geomManager = GeometryLocator.getGeometryManager();
408 408
            GeometryType shapeGeometryType;
409
            try {
410
                shapeGeometryType = geomManager.getGeometryType(shapeType, Geometry.SUBTYPES.UNKNOWN);
411 409
                Iterator it = symbols.keySet().iterator();
412 410
                while (it.hasNext()) {
413 411
                    Integer geomType = (Integer) it.next();
414
                    GeometryType geomGeometryType =
415
                        geomManager.getGeometryType(geomType.intValue(), Geometry.SUBTYPES.UNKNOWN);
416
                    if (shapeGeometryType.isSubTypeOf(geomGeometryType)) {
417
                        symbolName = (String) symbols.get(geomType);
418
                        break;
419
                    }
412
                  if (geomManager.isSubtype(geomType, shapeType)) {
413
                      symbolName = (String) symbols.get(geomType);
414
                      break;
415
                  }
420 416
                }
421
            } catch (GeometryTypeNotSupportedException e) {
422
                // do nothing
423
            } catch (GeometryTypeNotValidException e) {
424
                // do nothing
425
            }
426 417
        }
427 418
        return symbolName;
428 419
    }
......
454 445
                    symbolClass, symbolName);
455 446
        }
456 447

  
457
        multiLineSymbolsByName.put(symbolName, symbolClass);
448
        multiLayerSymbolsByName.put(symbolName, symbolClass);
458 449
    }
459 450

  
460 451
    public void registerMultiLayerSymbol(String symbolName, int[] shapeTypes,
......
462 453
        registerMultiLayerSymbol(symbolName, symbolClass);
463 454
        if (shapeTypes != null) {
464 455
            for (int i = 0; i < shapeTypes.length; i++) {
465
                multiLineSymbolsByShapeType.put(new Integer(shapeTypes[i]),
456
                multiLayerSymbolsByShapeType.put(new Integer(shapeTypes[i]),
466 457
                        symbolName);
467 458
            }
468 459
        }
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/DefaultGeometryManager.java
855 855
            return geomTypeChild==Geometry.TYPES.MULTIPOINT ;
856 856

  
857 857
        case Geometry.TYPES.CURVE:
858
            return 
858
            return
859
                geomTypeChild == Geometry.TYPES.CURVE ||
859 860
                geomTypeChild == Geometry.TYPES.LINE ||
860
                geomTypeChild == Geometry.TYPES.CIRCLE ||
861 861
                geomTypeChild == Geometry.TYPES.ARC ||
862
                geomTypeChild == Geometry.TYPES.ELLIPSE ||
863
                geomTypeChild == Geometry.TYPES.ELLIPTICARC ||
864
                geomTypeChild == Geometry.TYPES.SPLINE 
862
                geomTypeChild == Geometry.TYPES.SPLINE ||
863
                geomTypeChild == Geometry.TYPES.CIRCUMFERENCE ||
864
                geomTypeChild == Geometry.TYPES.PERIELLIPSE
865 865
                ;
866 866
        case Geometry.TYPES.SURFACE:
867
            return geomTypeChild==Geometry.TYPES.POLYGON ;
867
            return
868
            geomTypeChild==Geometry.TYPES.SURFACE ||
869
            geomTypeChild==Geometry.TYPES.POLYGON ||
870
            geomTypeChild == Geometry.TYPES.CIRCLE ||
871
            geomTypeChild == Geometry.TYPES.ELLIPSE ||
872
            geomTypeChild == Geometry.TYPES.RING ||
873
            geomTypeChild == Geometry.TYPES.FILLEDSPLINE ||
874
            geomTypeChild == Geometry.TYPES.ELLIPTICARC
875
            ;
868 876
        case Geometry.TYPES.POINT:
869 877
            return geomTypeChild==Geometry.TYPES.POINT ;
870 878
        }
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/PointPlacementConstraints.java
89 89
 *
90 90
 */
91 91
public class PointPlacementConstraints extends AbstractPlacementConstraints {
92
	
92

  
93 93
	public static final String POINT_PLACEM_CONSTRAINTS_PERSIST_NAME =
94 94
			"POINT_PLACEM_CONSTRAINTS_PERSIST_NAME";
95 95
	private PointLabelPositioner positioner = null;
......
107 107
	public void setPositioner(PointLabelPositioner pos) {
108 108
		this.positioner = pos;
109 109
	}
110
	
110

  
111 111
	public void saveToState(PersistentState state) throws PersistenceException {
112 112

  
113 113
		super.saveToState(state);
......
117 117
	}
118 118

  
119 119
	public void loadFromState(PersistentState state) throws PersistenceException {
120
		
120

  
121 121
		super.loadFromState(state);
122 122
		if (state.hasValue("pointPositioner")) {
123 123
			positioner = (PointLabelPositioner) state.get("pointPositioner");
......
125 125
	}
126 126

  
127 127
	public static void registerPersistent() {
128
		
128

  
129 129
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
130 130
		if( manager.getDefinition(POINT_PLACEM_CONSTRAINTS_PERSIST_NAME) == null) {
131
			
131

  
132 132
			DynStruct definition = manager.addDefinition(
133 133
					PointPlacementConstraints.class,
134 134
					POINT_PLACEM_CONSTRAINTS_PERSIST_NAME,
135 135
					POINT_PLACEM_CONSTRAINTS_PERSIST_NAME +" Persistence definition",
136
					null, 
136
					null,
137 137
					null);
138
			
138

  
139 139
			definition.extend(manager.getDefinition(
140 140
					AbstractPlacementConstraints.PLACEMENT_CONSTRAINTS_PERSISTENCE_NAME));
141 141
			definition.addDynFieldObject("pointPositioner").setClassOfValue(
142 142
					PointLabelPositioner.class).setMandatory(false);
143
		}		
143
		}
144 144
	}
145
	
145

  
146 146
	public Object clone() throws CloneNotSupportedException {
147
		
147

  
148 148
		PointPlacementConstraints resp = (PointPlacementConstraints) super.clone();
149
		PointLabelPositioner aux = (PointLabelPositioner) positioner.clone();
150
		resp.setPositioner(aux);
149
		if(positioner!=null){
150
		    PointLabelPositioner aux = (PointLabelPositioner) positioner.clone();
151
		    resp.setPositioner(aux);
152
		}
151 153
		return resp;
152 154
	}
153 155

  
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
389 389
			SymbolManager manager = MapContextLocator.getSymbolManager();
390 390

  
391 391
			shapeTypes = new int[] { Geometry.TYPES.SURFACE,
392
					Geometry.TYPES.CIRCLE, Geometry.TYPES.ELLIPSE,
393 392
					Geometry.TYPES.MULTISURFACE };
394 393
			manager.registerMultiLayerSymbol(IFillSymbol.SYMBOL_NAME,
395 394
					shapeTypes, MultiLayerFillSymbol.class);
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
398 398
			int[] shapeTypes;
399 399
			SymbolManager manager = MapContextLocator.getSymbolManager();
400 400

  
401
		       shapeTypes = new int[] { Geometry.TYPES.CURVE, Geometry.TYPES.ARC,
402
		                Geometry.TYPES.ELLIPTICARC, Geometry.TYPES.MULTICURVE };
401
		       shapeTypes = new int[] {
402
		           Geometry.TYPES.CURVE,
403
		           Geometry.TYPES.MULTICURVE };
403 404
		        manager.registerMultiLayerSymbol(ILineSymbol.SYMBOL_NAME,
404 405
		            shapeTypes,
405 406
		            MultiLayerLineSymbol.class);
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.swing/org.gvsig.symbology.swing.impl/src/main/java/org/gvsig/symbology/swing/impl/DefaultSymbologySwingManager.java
29 29
import java.util.Iterator;
30 30
import java.util.List;
31 31
import java.util.Map;
32
import java.util.function.Consumer;
32

  
33 33
import javax.swing.Action;
34

  
35
import org.slf4j.Logger;
36
import org.slf4j.LoggerFactory;
37

  
34 38
import org.gvsig.app.gui.labeling.LabelClassEditor;
35 39
import org.gvsig.app.gui.labeling.LabelClassEditorFactory;
36

  
37 40
import org.gvsig.app.gui.styling.TypeSymbolEditor;
38 41
import org.gvsig.app.project.documents.view.legend.gui.ILabelingStrategyPanel;
39 42
import org.gvsig.app.project.documents.view.legend.gui.ILegendPanel;
......
41 44
import org.gvsig.fmap.geom.type.GeometryType;
42 45
import org.gvsig.fmap.mapcontext.layers.FLayer;
43 46
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClass;
44
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClassFactory;
45 47
import org.gvsig.gui.ColorTablePainter;
46 48
import org.gvsig.gui.ColorTablesFactory;
47 49
import org.gvsig.gui.DefaultColorTablesFactory;
......
51 53
import org.gvsig.symbology.swing.SymbologyWindowManager;
52 54
import org.gvsig.tools.ToolsLocator;
53 55
import org.gvsig.tools.i18n.I18nManager;
54
import org.slf4j.Logger;
55
import org.slf4j.LoggerFactory;
56 56

  
57 57
/**
58 58
 * Default implementation of the {@link SymbologySwingManager}.
......
192 192
                        editors.add(editor);
193 193
                    }
194 194
                } catch(Throwable th) {
195
                    
195

  
196 196
                }
197 197
            }
198 198
        }
......
271 271
        }
272 272
        this.optionalActionsOfLegendsPanel.add(action);
273 273
    }
274
    
274

  
275 275
}

Also available in: Unified diff