001/*
002 *   EntityXXX_Unsupported  -- This class encapsulates an unknown IGES entity.
003 *
004 *   Copyright (C) 2010-2016, Joseph A. Huwaldt. All rights reserved.
005 *   
006 *   This library is free software; you can redistribute it and/or
007 *   modify it under the terms of the GNU Lesser General Public
008 *   License as published by the Free Software Foundation; either
009 *   version 2.1 of the License, or (at your option) any later version.
010 *   
011 *   This library is distributed in the hope that it will be useful,
012 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
013 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 *   Lesser General Public License for more details.
015 *
016 *   You should have received a copy of the GNU Lesser General Public License
017 *   along with this program; if not, write to the Free Software
018 *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
019 *   Or visit:  http://www.gnu.org/licenses/lgpl.html
020 *
021 *   Based on, but heavily modified from, IGESView ( http://ts.nist.gov/Standards/IGES/igesTools.cfm )
022 */
023package geomss.geom.reader.iges;
024
025import java.io.IOException;
026import java.io.RandomAccessFile;
027import java.text.MessageFormat;
028
029/**
030 * <b><i>UNSUPPORTED ENTITY</i></b> - This entity is both a generic starting point for
031 * entity class creation and a placeholder for unsupported entities in the IGES file. To
032 * extend this class, add whatever member variables are required for the entity type. Make
033 * them private.
034 *
035 * <p> Modified by: Joseph A. Huwaldt </p>
036 *
037 * @author JDN, Version 1.0
038 * @version April 10, 2016
039 */
040public class EntityXXX_Unsupported extends Entity {
041
042    /**
043     * The default constructor should be good as is, unless you declare members that need
044     * initializing, such as Lists.
045     *
046     * @param p  part to which this entity is contained
047     * @param de Directory Entry for this entity
048     */
049    public EntityXXX_Unsupported(Part p, DirEntry de) {
050        super(p, de);
051
052        if (Constants.DEBUG) {
053            System.out.println("EntityXXX constructor called");
054        }
055    }
056
057    /**
058     * The method check() should go through the given restrictions for the entity and put
059     * together an error string to be displayed in the error window. If the error should
060     * prevent the entity from being drawn, set toBeDrawn to false (it is true by
061     * default).
062     */
063    @Override
064    public void check() {
065        DirEntry DE = getDirectoryEntry();
066
067        // Set message to unsupported
068        StringBuilder msg = new StringBuilder(RESOURCES.getString("error"));
069        msg.append(":  DE ");
070        msg.append(DE.getDENum());
071        msg.append(":  ");
072        msg.append(MessageFormat.format(RESOURCES.getString("unsupportedEntity"), DE.getType()));
073        addErrorMessage(msg.toString());
074
075    }
076
077    /**
078     * The read() method basically parses the String read in by Entity.read(). There are
079     * several methods to use to grab specific data types: getInt(), getReal(),
080     * getString(), and getChar(). See other entity classes for examples of usage. The
081     * GlobalSection class also has some examples.
082     *
083     * @param in input file
084     * @throws IOException if there is any problem reading the entity from the IGES file.
085     */
086    @Override
087    public void read(RandomAccessFile in) throws IOException {
088        if (Constants.DEBUG) {
089            System.out.println("EntityXXX.read() called");
090        }
091
092        super.read(in);
093
094        if (Constants.DEBUG) {
095            System.out.println("PD String = \"" + getPDString() + "\"");
096        }
097    }
098
099    /**
100     * Returns a short String describing this Entity object's type.
101     *
102     * @return A short String describing this Entity object's type.
103     */
104    @Override
105    public String getTypeString() {
106        return "EntityXXX - Unsupported";
107    }
108
109}