Revision 2326 branches/CqCMSDvp/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfEntityMaker.java

View differences:

DxfEntityMaker.java
155 155
			DxfPolyline polyline = (DxfPolyline)lastEntity;
156 156
			if (polyline.closed) {
157 157
				((DxfPolyline) lastEntity).add(firstPt);
158
				if (!(bulge==0)) {
158
				if (bulge>0) {
159 159
					int cnt = ((DxfPolyline) lastEntity).pts.size();
160
					Vector arc = DxfPolyline.createArc((Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-2)), (Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-1)), bulge);
161
					((DxfPolyline) lastEntity).pts.remove(cnt-1);
162
					for (int i=0; i<arc.size(); i++) {
163
						Point2D pt = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
164
						((DxfPolyline) lastEntity).add(pt);
165
						if (((DxfPolyline)lastEntity).pts.size() == 1) firstPt = pt;
160
					if (((Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-2))).getX()==((Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-1))).getX() && ((Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-2))).getY()==((Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-1))).getY()) {
161
					    // no se construye el arco
162
					} else {
163
						Vector arc = DxfPolyline.createArc((Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-2)), (Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-1)), bulge);
164
						((DxfPolyline) lastEntity).pts.remove(cnt-1);
165
						for (int i=0; i<arc.size(); i++) {
166
							Point2D pt = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
167
							((DxfPolyline) lastEntity).add(pt);
168
							if (((DxfPolyline)lastEntity).pts.size() == 1) firstPt = pt;
169
						}
166 170
					}
167 171
					bulge = 0.0;
172
				} else if (bulge<0) {
173
					int cnt = ((DxfPolyline) lastEntity).pts.size();
174
					if (((Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-2))).getX()==((Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-1))).getX() && ((Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-2))).getY()==((Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-1))).getY()) {
175
					    // no se construye el arco
176
					} else {
177
						Vector arc = DxfPolyline.createArc((Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-2)), (Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-1)), bulge);
178
						((DxfPolyline) lastEntity).pts.remove(cnt-1);
179
						for (int i=arc.size()-1; i>=0; i--) {
180
							Point2D pt = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY());
181
							((DxfPolyline) lastEntity).add(pt);
182
							if (((DxfPolyline)lastEntity).pts.size() == 1) firstPt = pt;
183
						}
184
					}
185
					bulge = 0.0;
168 186
				}
169 187
			}
170 188
			// 050315, jmorell: Para leer Polylines estas tb deben tener vector de bulges.

Also available in: Unified diff