Revision 31676 branches/v2_0_0_prep/extensions/org.gvsig.annotation/src/main/java/org/gvsig/annotation/impl/DefaultAnnotationManager.java

View differences:

DefaultAnnotationManager.java
47 47
	private int posColor;
48 48
	private int posHeight;
49 49
	private int posRotate;
50
	private boolean rightType;
50 51
		
51 52
	/**
52 53
	 * Initialize set preference values
......
315 316
	public ILabelingStrategy activate(FeatureStore annotationStore,int cartographicSupport) throws DataException {
316 317
		boolean resul = checkIsAnnotation(annotationStore);
317 318
		if (resul==true){
319
			if (rightType==false){
320
				//TODO EXPORTAR A FORMATO CORRECTO ANNOTATION gvSIG 2.0
321
				//CREATE SHAPE NEW PARAMETERS AND DATA SERVER EXPLORER
322
				//Create new Shape file with the right fields
323
	     	}	
318 324
			//Open AnnotationLayer
319 325
			return open(annotationStore,cartographicSupport);
320 326
		}
......
323 329

  
324 330
	public boolean checkIsAnnotation(FeatureStore annotationStore) throws DataException {
325 331
		int fieldsIncluded=0;
326
		boolean rightType=false;
332
		rightType=true;
333
		
327 334
		//Checking that the store has the right fields
328 335
		FeatureSet annotationFeatures = annotationStore.getFeatureSet();
329 336
		FeatureType type = annotationFeatures.getDefaultFeatureType();
330 337
		fieldsNames = type.getAttributeDescriptors();
331 338
		for(int i=0;i<fieldsNames.length;i++){
332 339
			if(fieldsNames[i].getName().compareToIgnoreCase("TEXT")==0){
333
					if(fieldsNames[i].getDataType()==DataTypes.STRING)
334
						rightType=true;
335
					else
336
						rightType=false;
337
					fieldsIncluded++;
340
				getPreferences().setMappedNumColumnText(i);
341
				if(fieldsNames[i].getDataType()==DataTypes.STRING)
342
					rightType=true;
343
				else
344
					rightType=false;
345
				fieldsIncluded++;
338 346
			}else if(fieldsNames[i].getName().compareToIgnoreCase("TYPEFONT")==0){
339
					if(fieldsNames[i].getDataType()==DataTypes.STRING)
340
						rightType=true;
341
					else 
342
						rightType=false;
343
					fieldsIncluded++;
347
				getPreferences().setMappedColumnNumTypeFont(i);
348
				if(fieldsNames[i].getDataType()==DataTypes.STRING)
349
					rightType=true;
350
				else 
351
					rightType=false;
352
				fieldsIncluded++;
344 353
			}else if(fieldsNames[i].getName().compareToIgnoreCase("STYLEFONT")==0){
345
					if(fieldsNames[i].getDataType()==DataTypes.INT)
346
						rightType=true;
347
					else
348
						rightType=false;
349
					fieldsIncluded++;
354
				getPreferences().setMappedColumnNumStyleFont(i);
355
				if(fieldsNames[i].getDataType()==DataTypes.INT)
356
					rightType=true;
357
				else
358
					rightType=false;
359
				fieldsIncluded++;
350 360
			}else if(fieldsNames[i].getName().compareToIgnoreCase("COLOR")==0){
351
					if(fieldsNames[i].getDataType()==DataTypes.INT)
352
						rightType=true;
353
					else
354
						rightType=false;
355
					fieldsIncluded++;
361
				getPreferences().setMappedNumColumnColor(i);
362
				if(fieldsNames[i].getDataType()==DataTypes.INT)
363
					rightType=true;
364
				else
365
					rightType=false;
366
				fieldsIncluded++;
356 367
			}else if(fieldsNames[i].getName().compareToIgnoreCase("ROTATE")==0){
357
					if(fieldsNames[i].getDataType()==DataTypes.DOUBLE)
358
						rightType=true;
359
					else
360
						rightType=false;
361
					fieldsIncluded++;
368
				getPreferences().setMappedColumnNumRotate(i);
369
				if(fieldsNames[i].getDataType()==DataTypes.DOUBLE)
370
					rightType=true;
371
				else
372
					rightType=false;
373
				fieldsIncluded++;
362 374
			}else if(fieldsNames[i].getName().compareToIgnoreCase("HEIGHT")==0){
363
					if((fieldsNames[i].getDataType()==DataTypes.DOUBLE)||(fieldsNames[i].getDataType()==DataTypes.INT))	
364
						rightType=true;
365
					else
366
						rightType=false;
367
					fieldsIncluded++;
375
				getPreferences().setMappedNumColumnText(i);
376
				if((fieldsNames[i].getDataType()==DataTypes.DOUBLE)||(fieldsNames[i].getDataType()==DataTypes.INT))	
377
					rightType=true;
378
				else
379
					rightType=false;
380
				fieldsIncluded++;
368 381
			}
369 382
		}
370
		if ((fieldsIncluded==6)&&(rightType==true)){
371
			//Open AnnotationLayer
383
		if (fieldsIncluded==6){
372 384
			return true;
373 385
		}
374 386
		return false;

Also available in: Unified diff