Revision 9843 trunk/libraries/libDwg/src/com/iver/cit/jdwglib/dwg/objects/DwgSolid.java
DwgSolid.java | ||
---|---|---|
36 | 36 |
|
37 | 37 |
import java.awt.geom.Point2D; |
38 | 38 |
import java.util.ArrayList; |
39 |
import java.util.List; |
|
39 | 40 |
|
40 | 41 |
import com.iver.cit.gvsig.fmap.core.FPolyline2D; |
41 | 42 |
import com.iver.cit.gvsig.fmap.core.FShape; |
43 |
import com.iver.cit.jdwglib.dwg.DwgFile; |
|
42 | 44 |
import com.iver.cit.jdwglib.dwg.DwgObject; |
43 | 45 |
import com.iver.cit.jdwglib.dwg.DwgUtil; |
44 | 46 |
import com.iver.cit.jdwglib.dwg.IDwg2FMap; |
45 | 47 |
import com.iver.cit.jdwglib.dwg.IDwg3DTestable; |
48 |
import com.iver.cit.jdwglib.dwg.IDwgBlockMember; |
|
46 | 49 |
import com.iver.cit.jdwglib.dwg.IDwgExtrusionable; |
47 | 50 |
import com.iver.cit.jdwglib.util.AcadExtrusionCalculator; |
48 | 51 |
import com.iver.cit.jdwglib.util.FMapUtil; |
... | ... | |
53 | 56 |
* @author jmorell, azabala |
54 | 57 |
*/ |
55 | 58 |
public class DwgSolid extends DwgObject |
56 |
implements IDwgExtrusionable, IDwg3DTestable, IDwg2FMap{ |
|
59 |
implements IDwgExtrusionable, IDwg3DTestable, IDwg2FMap, IDwgBlockMember{
|
|
57 | 60 |
public DwgSolid(int index) { |
58 | 61 |
super(index); |
59 | 62 |
// TODO Auto-generated constructor stub |
... | ... | |
324 | 327 |
public String toString(){ |
325 | 328 |
return "Solid"; |
326 | 329 |
} |
330 |
public void transform2Block(double[] bPoint, Point2D insPoint, double[] scale, double rot, List dwgObjectsWithoutBlocks, DwgFile callBack) { |
|
331 |
double[] corner1 = getCorner1(); |
|
332 |
double[] corner2 = getCorner2(); |
|
333 |
double[] corner3 = getCorner3(); |
|
334 |
double[] corner4 = getCorner4(); |
|
335 |
Point2D pointAux = new Point2D.Double(corner1[0] - bPoint[0], |
|
336 |
corner1[1] - bPoint[1]); |
|
337 |
double laX = insPoint.getX() + |
|
338 |
((pointAux.getX()*scale[0])*Math.cos(rot) + |
|
339 |
(pointAux.getY()*scale[1])*(-1)*Math.sin(rot)); |
|
340 |
double laY = insPoint.getY() + |
|
341 |
((pointAux.getX()*scale[0])*Math.sin(rot) + |
|
342 |
(pointAux.getY()*scale[1])*Math.cos(rot)); |
|
343 |
double[] transformedP1 = new double[]{laX, laY}; |
|
344 |
pointAux = new Point2D.Double(corner2[0] - bPoint[0], |
|
345 |
corner2[1] - bPoint[1]); |
|
346 |
laX = insPoint.getX() + |
|
347 |
((pointAux.getX()*scale[0])*Math.cos(rot) + |
|
348 |
(pointAux.getY()*scale[1])*(-1)*Math.sin(rot)); |
|
349 |
laY = insPoint.getY() + |
|
350 |
((pointAux.getX()*scale[0])*Math.sin(rot) + |
|
351 |
(pointAux.getY()*scale[1])*Math.cos(rot)); |
|
352 |
double[] transformedP2 = new double[]{laX, laY}; |
|
353 |
pointAux = new Point2D.Double(corner3[0] - bPoint[0], |
|
354 |
corner3[1] - bPoint[1]); |
|
355 |
laX = insPoint.getX() + |
|
356 |
((pointAux.getX()*scale[0])*Math.cos(rot) + |
|
357 |
(pointAux.getY()*scale[1])*(-1)*Math.sin(rot)); |
|
358 |
laY = insPoint.getY() + |
|
359 |
((pointAux.getX()*scale[0])*Math.sin(rot) + |
|
360 |
(pointAux.getY()*scale[1])*Math.cos(rot)); |
|
361 |
double[] transformedP3 = new double[]{laX, laY}; |
|
362 |
pointAux = new Point2D.Double(corner4[0] - bPoint[0], |
|
363 |
corner4[1] - bPoint[1]); |
|
364 |
laX = insPoint.getX() + |
|
365 |
((pointAux.getX()*scale[0])*Math.cos(rot) + |
|
366 |
(pointAux.getY()*scale[1])*(-1)*Math.sin(rot)); |
|
367 |
laY = insPoint.getY() + |
|
368 |
((pointAux.getX()*scale[0])*Math.sin(rot) + |
|
369 |
(pointAux.getY()*scale[1])*Math.cos(rot)); |
|
370 |
double[] transformedP4 = new double[]{laX, laY}; |
|
371 |
setCorner1(transformedP1); |
|
372 |
setCorner2(transformedP2); |
|
373 |
setCorner3(transformedP3); |
|
374 |
setCorner4(transformedP4); |
|
375 |
setElevation(getElevation() * scale[2]); |
|
376 |
dwgObjectsWithoutBlocks.add(this); |
|
377 |
} |
|
327 | 378 |
} |
Also available in: Unified diff