/* Copyright 2006 Rene Grothmann, modified by Eric Hakenholz This file is part of C.a.R. software. C.a.R. is a free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. C.a.R. is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package rene.zirkel.objects; // file: PrimitiveCircleObject.java import java.awt.Color; import java.awt.Rectangle; import java.util.Enumeration; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import rene.gui.Global; import rene.util.xml.XmlWriter; import rene.zirkel.ZirkelCanvas; import rene.zirkel.construction.Construction; import rene.zirkel.construction.Count; import rene.zirkel.expression.Expression; import rene.zirkel.expression.ExpressionColor; import rene.zirkel.graphics.MyGraphics; import rene.zirkel.graphics.MainGraphics; import rene.zirkel.structures.Coordinates; public class PrimitiveCircleObject extends ConstructionObject implements PointonObject, InsideObject { protected double X, Y, R; static Count N=new Count(); boolean Partial=false; PointObject Dep[]; // array for points, depending on the circle for partial // display int NDep; // number of points in Dep PointObject M; // The midpoint boolean Filled=false; String StartPtName=null, EndPtName=null; // Border points name for Arcs PointObject StartPt=null, EndPt=null; // Border points for Arcs // PointObject RealCorrespondingStartPt=null; // for 3 pts Arcs only boolean isArc3pts=false; double A1, A2, A; boolean Arc=true; // Seulement pour les droites hyperboliques : private double oldStartX=Double.NaN; private double oldStartY=Double.NaN; public PrimitiveCircleObject(final Construction c, final PointObject p) { super(c); setColor(ColorIndex, SpecialColor); M=p; Unit=Global.getParameter("unit.length", ""); } public void validate() { super.validate(); // Gestion de la continuité des droites sur le cercle horizon : if (isDPLineObject()) { // Premier passage, mémorisation de l'extrémité Start de l'arc if (Double.isNaN(oldStartX)) { oldStartX=getStart().getX(); oldStartY=getStart().getY(); } else { final double d1=(oldStartX-getStart().getX())*(oldStartX-getStart().getX()) +(oldStartY-getStart().getY())*(oldStartY-getStart().getY()); final double d2=(oldStartX-getEnd().getX())*(oldStartX-getEnd().getX()) +(oldStartY-getEnd().getY())*(oldStartY-getEnd().getY()); // Si Start et End se sont échangés, on remet dans l'ordre (cela fonctionne // car ce sont des arcs 180°) : if (d20&&Partial &&!hasRange()) // partial display { // System.out.println("partial display"); for (int i=0; i