private ShapesLine(Point p1, Point p2,ShapesLineDefiner.ShapeDefiner[] shapeSketches,int count) {
super( 0,false, p1, p2);
ShapesLineDefiner.ShapeDefiner shapeDefiner;
PhysicalShape shape;
ShapesController controller=new ShapesController();
for(int i=0;i<count;i++){
shapeDefiner=shapeSketches[i];
if(shapeDefiner instanceof ShapesLineDefiner.CircleDefiner){
shape=new Circle(controller,shapeDefiner.getPosition(),((ShapesLineDefiner.CircleDefiner)shapeDefiner).getRadius(),shapeDefiner.getColor());
}else if(shapeDefiner instanceof ShapesLineDefiner.RectangleDefiner){
shape=new Rectangle(controller,shapeDefiner.getPosition(),shapeDefiner.getAngle(),((ShapesLineDefiner.RectangleDefiner)shapeDefiner).getWidth(),((ShapesLineDefiner.RectangleDefiner)shapeDefiner).getHeight(),shapeDefiner.getColor());
}else{
shape=new Polygon(controller,shapeDefiner.getPosition(),shapeDefiner.getAngle(),((ShapesLineDefiner.PolygonDefiner)shapeDefiner).getVertices(),shapeDefiner.getColor());
}
if(!shape.isVerified()){
if(i==0)
controller.destroy();
break;
}
}
shapeSketches=null;
this.destroy();