Revision 11192 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/styling/AbstractPlacementConstraints.java

View differences:

AbstractPlacementConstraints.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.4  2007-04-12 16:01:11  jaume
46
* Revision 1.5  2007-04-13 11:59:30  jaume
47 47
* *** empty log message ***
48 48
*
49
* Revision 1.4  2007/04/12 16:01:11  jaume
50
* *** empty log message ***
51
*
49 52
* Revision 1.3  2007/04/11 16:01:08  jaume
50 53
* maybe a label placer refactor
51 54
*
......
76 79

  
77 80
package com.iver.cit.gvsig.fmap.rendering.styling;
78 81
import com.iver.cit.gvsig.fmap.core.FShape;
82
import com.iver.utiles.XMLEntity;
79 83

  
80 84
/**
81 85
 * @author  jaume dominguez faus - jaume.dominguez@iver.es
......
85 89

  
86 90
	private int duplicateLabelsMode = ONE_LABEL_PER_FEATURE_PART; // default duplicate treatment
87 91
	private int placementMode;
88

  
89
	private boolean atTheBeginingOfLine;
90

  
91
	private boolean atTheEndOfLine;
92

  
93 92
	private boolean bellowTheLine;
94

  
95 93
	private boolean aboveTheLine;
96

  
97 94
	private boolean pageOriented;
95
	private int locationAlongLine;
98 96

  
99 97
	public void setDuplicateLabelsMode(int mode) {
100 98
		if (mode != REMOVE_DUPLICATE_LABELS &&
......
108 106
	}
109 107

  
110 108
	public void setPlacementMode(int mode) {
111
		switch (shapeType) {
112
		case FShape.POINT:
109
		if (this instanceof PointPlacementConstraints) {
113 110
			if (mode != OFFSET_HORIZONTALY_AROUND_THE_POINT &&
114 111
				mode != ON_TOP_OF_THE_POINT &&
115 112
				mode != AT_SPECIFIED_ANGLE &&
......
119 116
						"ON_TOP_OF_THE_POINT, " +
120 117
						"AT_SPECIFIED_ANGLE " +
121 118
						"or AT_ANGLE_SPECIFIED_BY_A_FIELD allowed for points");
122
			break;
123
		case FShape.POLYGON:
119
		}
120

  
121
		if (this instanceof PolygonPlacementConstraints) {
124 122
			if (mode != HORIZONTAL &&
125 123
				mode != PARALLEL )
126 124
					throw new IllegalArgumentException(
127 125
							"Only HORIZONTAL, " +
128 126
							"or PARALEL allowed for polygons");
129
			break;
130
		case FShape.LINE:
131
			if (mode != HORIZONTAL &&
127
		}
128

  
129
		if (this instanceof LinePlacementConstraints) {
130
					if (mode != HORIZONTAL &&
132 131
				mode != PARALLEL &&
133 132
				mode != FOLLOWING_LINE &&
134 133
				mode != PERPENDICULAR)
135 134
				throw new IllegalArgumentException(
136 135
						"Only HORIZONTAL, " +
137 136
						"or PARALEL allowed for lines");
138
			break;
139 137
		}
140 138
		this.placementMode = mode;
141 139
	}
......
168 166
		return placementMode == ON_TOP_OF_THE_POINT;
169 167
	}
170 168

  
171
	public boolean isAtTheBeginingOfLine() {
172
		return atTheBeginingOfLine;
173
	}
174

  
175
	public boolean isAtTheEndOfLine() {
176
		return atTheEndOfLine;
177
	}
178

  
179 169
	public boolean isBellowTheLine() {
180 170
		return bellowTheLine;
181 171
	}
......
187 177
	public boolean isPageOriented() {
188 178
		return pageOriented;
189 179
	}
180

  
190 181
	public void setPageOriented(boolean b) {
191
		this.pageOriented = pageOriented;
182
		this.pageOriented = b;
192 183
	}
193 184

  
185
	public void setBellowTheLine(boolean b) {
186
		this.bellowTheLine = b;
187
	}
194 188

  
195
	public void setAtTheBeginingOfLine(boolean b) {
196
		this.atTheBeginingOfLine = b;
189
	public void setAboveTheLine(boolean b) {
190
		this.aboveTheLine = b;
197 191
	}
198 192

  
199
	public void setAtTheEndOfLine(boolean b) {
200
		this.atTheEndOfLine = b;
193
	public boolean isAtTheEndOfLine() {
194
		return locationAlongLine == AT_THE_END_OF_THE_LINE;
201 195
	}
202 196

  
203
	public void setBellowTheLine(boolean b) {
204
		this.bellowTheLine = b;
197

  
198
	public boolean isAtTheBeginingOfLine() {
199
		return locationAlongLine == AT_THE_BEGINING_OF_THE_LINE;
205 200
	}
206 201

  
207
	public void setAboveTheLine(boolean b) {
208
		this.aboveTheLine = b;
202
	public void setLocationAlongTheLine(int location) {
203
		if (location != IPlacementConstraints.AT_THE_MIDDLE_OF_THE_LINE
204
			&& location != IPlacementConstraints.AT_THE_BEGINING_OF_THE_LINE
205
			&& location != IPlacementConstraints.AT_THE_END_OF_THE_LINE) {
206
			throw new IllegalArgumentException("Only IPlacementConstraints.AT_THE_MIDDLE_OF_THE_LINE, " +
207
					"IPlacementConstraints.AT_THE_BEGINING_OF_THE_LINE, or " +
208
					"IPlacementConstraints.AT_THE_END_OF_THE_LINE values are allowed");
209
		}
210
		this.locationAlongLine = location;
209 211
	}
212

  
213
	public XMLEntity getXMLEntity() {
214
		XMLEntity xml = new XMLEntity();
215
		return xml;
216
	}
217

  
218
	public void setXMLEntity(XMLEntity xml) {
219

  
220
	}
210 221
}

Also available in: Unified diff