Revision 47437

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/gui/layerproperties/PlacementProperties.java
196 196
	private JLabelHTML lblPointPosDesc = new JLabelHTML(""); //pointStyle.getDescription());
197 197
	IPlacementConstraints oldConstraints;
198 198
	private JCheckBox chkFitInsidePolygon;
199
        
200
        private boolean initialized;
199 201

  
200 202

  
201 203
	/**
......
209 211
	 * @throws ReadDriverException
210 212
	 */
211 213
	public PlacementProperties(IPlacementConstraints constraints, int shapeType) {
214
            this.initialized = false;
212 215
		initialize(constraints, shapeType, getPnlDuplicateLabels());
213 216
	}
214 217

  
215 218
	PlacementProperties(IPlacementConstraints costraints,
216 219
			int shapeType, DuplicateLayersMode duplicatesMode) {
217 220

  
221
            this.initialized = false;
218 222
		initialize( costraints, shapeType, duplicatesMode);
219 223
		refreshComponents();
224
            this.initialized = true;
225
                
220 226
	}
221 227

  
222 228
	private void refreshComponents() {
......
265 271
		// duplicates mode
266 272
		int dupMode = constraints.getDuplicateLabelsMode();
267 273
		duplicateLabelsMode.setMode(dupMode);
268
		applyToPreview();
274
                
275
                getPreview().setConstraints(constraints);
276
                
277
//		applyToPreview();
269 278
	}
270 279

  
271 280
	private void initialize(
272 281
			IPlacementConstraints constraints,
273 282
			int shapeType, DuplicateLayersMode duplicatesMode) {
274
	    
283
            
275 284
        this.duplicateLabelsMode = duplicatesMode;
276 285

  
277 286
		this.shapeType = shapeType;
278
		this.oldConstraints = constraints;
287
		this.oldConstraints = this.constraints;
279 288
//		this.constraints = constraints != null ?
280 289
//				PlacementManager.createPlacementConstraints(constraints.getXMLEntity())	:
281 290
//				PlacementManager.createPlacementConstraints(shapeType);
......
572 581
		return positionPanel;
573 582
	}
574 583

  
575
	private Component getPreview() {
584
	private MiniMapContext getPreview() {
576 585
		 if (preview == null) {
577 586
			 preview = new MiniMapContext(shapeType);
578 587
		 }
......
824 833
	private void applyToPreview() {
825 834
		if (preview != null) {
826 835
			try {
836
                            if(this.initialized) {
827 837
				applyConstraints();
838
                            }
828 839
			} catch (GeometryException e) {
829 840
				logger.error("While applying constraints.", e);
830 841
			}
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/PlacementManager.java
151 151
		GeometryType geom_gt = GeometryLocator.getGeometryManager().getGeometryType(
152 152
				geotype, Geometry.SUBTYPES.GEOM2D);
153 153

  
154
		if (geom_gt.getType() == TYPES.POINT ||
155
				geom_gt.getType() == TYPES.MULTIPOINT) {
154
		if (geom_gt.isTypeOf(TYPES.POINT) ||
155
				geom_gt.isTypeOf(TYPES.MULTIPOINT)) {
156 156
			return new PointPlacementConstraints();
157 157
		} else {
158 158
			if (geom_gt.isTypeOf(TYPES.CURVE) ||
159
					geom_gt.getType() == TYPES.MULTICURVE) {
159
					geom_gt.isTypeOf(TYPES.MULTICURVE)) {
160 160
				return new LinePlacementConstraints();
161 161
			} else {
162 162
				if (geom_gt.isTypeOf(TYPES.SURFACE) ||
163
						geom_gt.getType() == TYPES.MULTISURFACE) {
163
						geom_gt.isTypeOf(TYPES.MULTISURFACE)) {
164 164
					return new PolygonPlacementConstraints();
165 165
				} else {
166 166
					if (geom_gt.getType() == TYPES.GEOMETRY ||
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/label/GeneralLabelingStrategy.java
445 445

  
446 446
				geom_gt = gm.getGeometryType(geom.getType(), SUBTYPES.GEOM2D);
447 447

  
448
				if (geom_gt.getType() == TYPES.POINT
449
						|| geom_gt.getType() == TYPES.MULTIPOINT) {
448
				if (geom_gt.isTypeOf(TYPES.POINT)
449
						|| geom_gt.isTypeOf(TYPES.MULTIPOINT)) {
450 450
					pc = mpc.getPointConstraints();
451 451
				} else {
452 452
					if (geom_gt.isTypeOf(TYPES.CURVE)
453
							|| geom_gt.getType() == TYPES.MULTICURVE) {
453
							|| geom_gt.isTypeOf(TYPES.MULTICURVE)) {
454 454
						pc = mpc.getLineConstraints();
455 455
					} else {
456 456
						if (geom_gt.isTypeOf(TYPES.SURFACE)
457
								|| geom_gt.getType() == TYPES.MULTISURFACE) {
457
								|| geom_gt.isTypeOf(TYPES.MULTISURFACE)) {
458 458
							pc = mpc.getPolygonConstraints();
459 459
						}
460 460
					}

Also available in: Unified diff