001 /*
002 * BuildHistory.java
003 *
004 *
005 * The Salamander Project - 2D and 3D graphics libraries in Java
006 * Copyright (C) 2004 Mark McKay
007 *
008 * This library is free software; you can redistribute it and/or
009 * modify it under the terms of the GNU Lesser General Public
010 * License as published by the Free Software Foundation; either
011 * version 2.1 of the License, or (at your option) any later version.
012 *
013 * This library is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016 * Lesser General Public License for more details.
017 *
018 * You should have received a copy of the GNU Lesser General Public
019 * License along with this library; if not, write to the Free Software
020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
021 *
022 * Mark McKay can be contacted at mark@kitfox.com. Salamander and other
023 * projects can be found at http://www.kitfox.com
024 *
025 * Created on January 26, 2004, 9:18 PM
026 */
027
028 package com.kitfox.svg.pathcmd;
029
030 import java.awt.geom.Point2D;
031
032 /**
033 * When building a path from command segments, most need to cache information
034 * (such as the point finished at) for future commands. This structure allows
035 * that
036 *
037 * @author Mark McKay
038 * @author <a href="mailto:mark@kitfox.com">Mark McKay</a>
039 */
040 public class BuildHistory {
041
042 // Point2D.Float[] history = new Point2D.Float[2];
043 Point2D.Float[] history = {new Point2D.Float(), new Point2D.Float()};
044 Point2D.Float start = new Point2D.Float();
045 int length = 0;
046
047 /** Creates a new instance of BuildHistory */
048 public BuildHistory() {
049 }
050
051 public void setPoint(float x, float y)
052 {
053 history[0].setLocation(x, y);
054 length = 1;
055 }
056
057 public void setStart(float x, float y)
058 {
059 start.setLocation(x, y);
060 }
061
062 public void setPointAndKnot(float x, float y, float kx, float ky)
063 {
064 history[0].setLocation(x, y);
065 history[1].setLocation(kx, ky);
066 length = 2;
067 }
068 }