Revision 82

View differences:

trunk/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfEntityMaker.java
208 208
		for (int i=0; i<grp.size(); i++) {
209 209
			g = (DxfGroup) grp.get(i);
210 210
			if (g.getCode() == 10)
211
				x = ((Float) g.getData()).doubleValue();
211
				x = ((Double) g.getData()).doubleValue();
212 212
			else if (g.getCode() == 20) {
213
				y = ((Float) g.getData()).doubleValue();
213
				y = ((Double) g.getData()).doubleValue();
214 214
				//if (y <= 1.0) throw new Exception("Y == "+y);
215 215
				entity.add( proj.createPoint( x, y ) );
216 216
				x = 0.0; y = 0.0;
......
586 586
			System.out.println("createLine(): A?adimos una linea al bloque " + iterator);
587 587
			blk.add(entity);
588 588
		}
589
		
590 589
	}
591 590
	public void createBlock(DxfGroupVector grp) throws Exception {
592 591
		DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8));
trunk/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfFeatureMaker.java
99 99
			feature.setGeometry(lineString);
100 100
		} else if ((flags & 0x01) == 0x01) {
101 101
			feature.setGeometry(polygon);
102
			//feature.setGeometry(lineString);
102 103
		} else {
103 104
			System.out.println("Detectada una Polyline Flag que no corresponde");
104 105
			System.out.println("a una Polyline corriente, ni a una Closed Polyline");
......
379 380
		for (int i=0; i<grp.size(); i++) {
380 381
			g = (DxfGroup) grp.get(i);
381 382
			if (g.getCode() == 10)
382
				x = ((Float) g.getData()).doubleValue();
383
				x = ((Double) g.getData()).doubleValue();
383 384
			else if (g.getCode() == 20) {
384
				y = ((Float) g.getData()).doubleValue();
385
				y = ((Double) g.getData()).doubleValue();
385 386
				//if (y <= 1.0) throw new Exception("Y == "+y);
386 387
				lineString.add( proj.createPoint( x, y ) );
387 388
				polygon.add( proj.createPoint( x, y ) );
......
851 852
	/* (non-Javadoc)
852 853
	 * @see org.cresques.io.DxfFile.EntityFactory#createSolid(org.cresques.io.DxfGroupVector)
853 854
	 */
854
	public void createSolid(DxfGroupVector v) throws Exception {
855
		// TODO Auto-generated method stub
855
	public void createSolid(DxfGroupVector grp) throws Exception {
856
		double x = 0.0, y = 0.0, z1 = 0.0, z2 = 0.0, z3 = 0.0, z4 = 0.0;
857
		DxfGroup g = null;
858
		//Point2D pt1 = null, pt2 = null, pt3 = null, pt4 = null;
859
		Point2D[] pts = new Point2D[4];
860
		//DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8));
856 861
		
862
		//LineString lineString = new LineString();
863
		Polygon polygon = new Polygon();
864
		Feature feature = new Feature();
865

  
866
		x = grp.getDataAsDouble(10);
867
		y = grp.getDataAsDouble(20);
868
		if (grp.hasCode(30)) z1 = grp.getDataAsDouble(30);
869
		pts[0] = proj.createPoint(x, y);
870
		x = grp.getDataAsDouble(11);
871
		y = grp.getDataAsDouble(21);
872
		if (grp.hasCode(31)) z2 = grp.getDataAsDouble(31);
873
		pts[1] = proj.createPoint(x, y);
874
		x = grp.getDataAsDouble(12);
875
		y = grp.getDataAsDouble(22);
876
		if (grp.hasCode(32)) z3 = grp.getDataAsDouble(32);
877
		pts[2] = proj.createPoint(x, y);
878
		x = grp.getDataAsDouble(13);
879
		y = grp.getDataAsDouble(23);
880
		if (grp.hasCode(33)) z2 = grp.getDataAsDouble(33);
881
		pts[3] = proj.createPoint(x, y);
882
		if (grp.hasCode(62)) {
883
			Integer integer = new Integer(grp.getDataAsInt(62));
884
			String string = integer.toString();
885
			feature.setProp("color", string);
886
		} else {
887
			feature.setProp("color", "0");
888
		}
889
		if (grp.hasCode(210))
890
			xtruX = grp.getDataAsDouble(210);
891
		if (grp.hasCode(220))
892
			xtruY = grp.getDataAsInt(220);
893
		if (grp.hasCode(230))
894
			xtruZ = grp.getDataAsInt(230);
895
		Point3D point_in1 = new Point3D(pts[0].getX(), pts[0].getY(), z1);
896
		Point3D point_in2 = new Point3D(pts[1].getX(), pts[1].getY(), z2);
897
		Point3D point_in3 = new Point3D(pts[2].getX(), pts[2].getY(), z3);
898
		Point3D point_in4 = new Point3D(pts[3].getX(), pts[3].getY(), z4);
899
		Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
900
		Point2D point_out1 = DxfCalXtru.CalculateXtru(point_in1, xtru);
901
		Point2D point_out2 = DxfCalXtru.CalculateXtru(point_in2, xtru);
902
		Point2D point_out3 = DxfCalXtru.CalculateXtru(point_in3, xtru);
903
		Point2D point_out4 = DxfCalXtru.CalculateXtru(point_in4, xtru);
904
		pts[0].setLocation(point_out1);
905
		pts[1].setLocation(point_out2);
906
		pts[2].setLocation(point_out3);
907
		pts[3].setLocation(point_out4);
908
		
909
		for (int i=0; i<pts.length; i++) {
910
			//lineString.add(pts[i]);
911
			polygon.add(pts[i]);
912
		}
913
		
914
		//feature.setGeometry(lineString);
915
		feature.setGeometry(polygon);
916
		//features.add(feature);
917
		if (addingToBlock == false) {
918
			System.out.println("createSolid(): A?ade un solid a la lista de entidades");
919
			features.add(feature);
920
		} else {
921
			System.out.println("createSolid(): A?adimos un circulo al bloque " + iterator);
922
			blk.add(feature);
923
		}
857 924
	}
858 925
	
859 926
	public void createBlock(DxfGroupVector grp) throws Exception {

Also available in: Unified diff