Revision 5945 trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/PolylineCADTool.java

View differences:

PolylineCADTool.java
123 123
        	Geometry jtsG = gAux.toJTSGeometry();
124 124
        	logger.debug("A punto de escribir " + jtsG.toText());
125 125
        	try {
126
        		int shapeType = getVLE().getVEA().getShapeType(); 
126
        		int shapeType = getVLE().getVEA().getShapeType();
127 127
				if ((shapeType ==FShape.POLYGON) || (shapeType == FShape.MULTI)) {
128 128
//					GeneralPathX gpx=new GeneralPathX();
129 129
//					gpx.moveTo(antPoint.getX(),antPoint.getY());
......
137 137
				e.printStackTrace();
138 138
				return;
139 139
			}
140
        	
140

  
141 141
        }
142 142

  
143 143
        addGeometry(newGeom);
......
152 152
        elShape.lineTo(firstPoint.getX(), firstPoint.getY());
153 153

  
154 154
        list.add(ShapeFactory.createPolyline2D(elShape));
155
        
156 155

  
156

  
157 157
        // list.add(ShapeFactory.createPolyline2D(elShape));
158 158

  
159 159
    }
......
192 192
        PolylineCADToolState actualState = (PolylineCADToolState) _fsm.getPreviousState();
193 193
        String status = actualState.getName();
194 194

  
195
        if (status.equals("Polyline.FirstPoint")) {
196
            antPoint = new Point2D.Double(x, y);
195
//        if (status.equals("Polyline.FirstPoint")) {
196
//            antPoint = new Point2D.Double(x, y);
197
//
198
//            if (firstPoint == null) {
199
//                firstPoint = (Point2D) antPoint.clone();
200
//            }
201
//        } else
202
        if (status.equals("Polyline.NextPointOrArcOrClose") || status.equals("Polyline.FirstPoint")) {
203
           if (antPoint==null)
204
        	   antPoint = new Point2D.Double(x, y);
205
           if (firstPoint == null) {
206
               firstPoint = (Point2D) antPoint.clone();
207
           }
208
        	Point2D point = new Point2D.Double(x, y);
197 209

  
198
            if (firstPoint == null) {
199
                firstPoint = (Point2D) antPoint.clone();
200
            }
201
        } else if (status.equals("Polyline.NextPointOrArcOrClose")) {
202
            Point2D point = new Point2D.Double(x, y);
203

  
204 210
            if (antPoint != null) {
205 211
                GeneralPathX elShape = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD,
206 212
                        2);
......
336 342
        PolylineCADToolState actualState = ((PolylineCADToolContext)_fsm).getState();
337 343
        String status = actualState.getName();
338 344

  
339
        if (status.equals("Polyline.NextPointOrArcOrClose")) {
345
        if (status.equals("Polyline.NextPointOrArcOrClose") || status.equals("Polyline.FirstPoint")) {
340 346
            for (int i = 0; i < list.size(); i++) {
341 347
                ((IGeometry) list.get(i)).cloneGeometry().draw((Graphics2D) g,
342 348
                    getCadToolAdapter().getMapControl().getViewPort(),
343 349
                    CADTool.drawingSymbol);
344 350
            }
351
            if (antPoint!=null)
352
            	drawLine((Graphics2D) g, antPoint, new Point2D.Double(x, y));
345 353

  
346
            drawLine((Graphics2D) g, antPoint, new Point2D.Double(x, y));
347 354
        } else if ((status.equals("Polyline.NextPointOrLineOrClose"))) {
348 355
            for (int i = 0; i < list.size(); i++) {
349 356
                ((IGeometry) list.get(i)).cloneGeometry().draw((Graphics2D) g,

Also available in: Unified diff