001    /*
002     * This file is part of McIDAS-V
003     *
004     * Copyright 2007-2013
005     * Space Science and Engineering Center (SSEC)
006     * University of Wisconsin - Madison
007     * 1225 W. Dayton Street, Madison, WI 53706, USA
008     * https://www.ssec.wisc.edu/mcidas
009     * 
010     * All Rights Reserved
011     * 
012     * McIDAS-V is built on Unidata's IDV and SSEC's VisAD libraries, and
013     * some McIDAS-V source code is based on IDV and VisAD source code.  
014     * 
015     * McIDAS-V is free software; you can redistribute it and/or modify
016     * it under the terms of the GNU Lesser Public License as published by
017     * the Free Software Foundation; either version 3 of the License, or
018     * (at your option) any later version.
019     * 
020     * McIDAS-V is distributed in the hope that it will be useful,
021     * but WITHOUT ANY WARRANTY; without even the implied warranty of
022     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
023     * GNU Lesser Public License for more details.
024     * 
025     * You should have received a copy of the GNU Lesser Public License
026     * along with this program.  If not, see http://www.gnu.org/licenses.
027     */
028    
029    package edu.wisc.ssec.mcidasv.data;
030    
031    
032    /**
033     * Class FrameDirtyInfo Holds the state of
034     * the frame components from McIdas-X
035     */
036    public class FrameDirtyInfo {
037            
038            /** Which frame number is this for */
039            public int frameNumber = 0;
040    
041        /** Dirty status of each component */
042        public boolean dirtyImage = false;
043        public boolean dirtyGraphics = false;
044        public boolean dirtyColorTable = false;
045    
046        /**
047         * Constructor
048         */
049        public FrameDirtyInfo() {}
050    
051        /**
052         * Copy constructor
053         *
054         * @param that The FrameDirtyInfo to copy
055         *
056         */
057        public FrameDirtyInfo(FrameDirtyInfo that) {
058            this.frameNumber     = that.frameNumber;
059            this.dirtyImage      = that.dirtyImage;
060            this.dirtyGraphics   = that.dirtyGraphics;
061            this.dirtyColorTable = that.dirtyColorTable;
062        }
063    
064        /**
065         * Constructor
066         */
067        public FrameDirtyInfo( int frameNumber, boolean isDirtyImage, boolean isDirtyGraphics, boolean isDirtyColorTable) {
068            this.frameNumber     = frameNumber;
069            this.dirtyImage      = isDirtyImage;
070            this.dirtyGraphics   = isDirtyGraphics;
071            this.dirtyColorTable = isDirtyColorTable;
072        }
073    
074        /**
075         * Get the frameNumber property.
076         *
077         * @return The frameNumber property.
078         */
079        public int getFrameNumber() {
080            return this.frameNumber;
081        }
082        
083        /**
084         * Get the dirtyImage property.
085         *
086         * @return The dirtyImage property.
087         */
088        public boolean getDirtyImage() {
089            return this.dirtyImage;
090        }
091    
092        /**
093         * Get the dirtyGraphics property.
094         *
095         * @return The dirtyGraphics property.
096         */
097        public boolean getDirtyGraphics() {
098            return this.dirtyGraphics;
099        }
100    
101    
102        /**
103         * Get the dirtyColorTable property.
104         *
105         * @return The dirtyColorTable property.
106         */
107        public boolean getDirtyColorTable() {
108            return this.dirtyColorTable;
109        }
110    
111        /**
112         * Set the frameNumber property.
113         *
114         * @param newValue The new vaue for the frameNumber property.
115         */
116        public void setFrameNumber(int newValue) {
117            this.frameNumber = newValue;
118        }
119        
120        /**
121         * Set the dirtyImage property.
122         *
123         * @param newValue The new vaue for the dirtyImage property.
124         */
125        public void setDirtyImage(boolean newValue) {
126            this.dirtyImage = newValue;
127        }
128    
129        /**
130         * Set the dirtyGraphics property.
131         *
132         * @param newValue The new vaue for the dirtyGraphics property.
133         */
134        public void setDirtyGraphics(boolean newValue) {
135            this.dirtyGraphics = newValue;
136        }
137    
138        /**
139         * Set the dirtyColorTable property.
140         *
141         * @param newValue The new vaue for the dirtyColorTable property.
142         */
143        public void setDirtyColorTable(boolean newValue) {
144            this.dirtyColorTable = newValue;
145        }
146    
147        /**
148         * Get a String representation of this object
149         * @return a string representation
150         */
151        public String toString() {
152            boolean clean = true;
153            StringBuffer buf = new StringBuffer();
154            buf.append("frame ");
155            buf.append(this.frameNumber);
156            buf.append(": ");
157            if (this.dirtyImage) {
158                    if (clean) buf.append("dirty ");
159                    else buf.append (", ");
160                    clean = false;
161                    buf.append("image");
162            }
163            if (this.dirtyGraphics) {
164                    if (clean) buf.append("dirty ");
165                    else buf.append (", ");
166                    clean = false;
167                    buf.append("graphics");
168            }
169            if (this.dirtyColorTable) {
170                    if (clean) buf.append("dirty ");
171                    else buf.append (", ");
172                    clean = false;
173                    buf.append("colortable");
174            }
175            if (clean) buf.append("clean");
176            return buf.toString();
177        }
178    
179    }