001/*
002 *   View  -- This class represents an IGES view and its transformation.
003 *
004 *   Copyright (C) 2010-2016, Joseph A. Huwaldt.
005 *   All rights reserved.
006 *   
007 *   This library is free software; you can redistribute it and/or
008 *   modify it under the terms of the GNU Lesser General Public
009 *   License as published by the Free Software Foundation; either
010 *   version 2.1 of the License, or (at your option) any later version.
011 *   
012 *   This library is distributed in the hope that it will be useful,
013 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
014 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015 *   Lesser General Public License for more details.
016 *
017 *   You should have received a copy of the GNU Lesser General Public License
018 *   along with this program; if not, write to the Free Software
019 *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
020 *   Or visit:  http://www.gnu.org/licenses/lgpl.html
021 *
022 *   Based on, but heavily modified from, IGESView ( http://ts.nist.gov/Standards/IGES/igesTools.cfm )
023 */
024package geomss.geom.reader.iges;
025
026import geomss.geom.Point;
027
028/**
029 * The View class represents an IGES view and its transformation. This is mainly to keep
030 * each view's information organized in one List instead of three or four Lists.
031 * 
032 * <p> Modified by: Joseph A. Huwaldt </p>
033 * 
034 * @author JDN, Version 1.0
035 * @version September 13, 2016
036 */
037public class View {
038
039    /**
040     * View DE number
041     */
042    public int viewde;
043
044    /**
045     * Origin 2D point
046     */
047    public Point origin;
048
049    /**
050     * Rotation angle
051     */
052    public double angle;
053
054    /**
055     * Default constructor.
056     */
057    public View() {
058        origin = Point.newInstance(2);
059    }
060
061    /**
062     * Copy constructor.
063     *
064     * @param v The view to copy.
065     */
066    public View(View v) {
067        viewde = v.viewde;
068        origin = Point.valueOf(v.origin);
069        angle = v.angle;
070    }
071
072    /**
073     * Initialization constructor
074     *
075     * @param de view DE number
076     * @param or origin point
077     * @param an angle
078     */
079    public View(int de, Point or, double an) {
080        viewde = de;
081        origin = or;
082        angle = an;
083    }
084
085    /**
086     * Set the values for the view.
087     *
088     * @param de view DE number
089     * @param or origin point
090     * @param an angle
091     */
092    public void set(int de, Point or, double an) {
093        viewde = de;
094        origin = or;
095        angle = an;
096    }
097
098    /**
099     * Dump to string.
100     *
101     * @return string value
102     */
103    @Override
104    public String toString() {
105        StringBuilder buffer = new StringBuilder();
106                buffer.append("  viewde = ");   buffer.append(viewde);              buffer.append("\n");
107                buffer.append("  origin = ");   buffer.append(origin.toString());   buffer.append("\n");
108                buffer.append("   angle = ");   buffer.append(angle);
109
110        return buffer.toString();
111    }
112}