| 1 |
/* |
| 2 |
* DiTAA - Diagrams Through Ascii Art |
| 3 |
* |
| 4 |
* Copyright (C) 2004 Efstathios Sideris |
| 5 |
* |
| 6 |
* This program is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU General Public License |
| 8 |
* as published by the Free Software Foundation; either version 2 |
| 9 |
* of the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* This program is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with this program; if not, write to the Free Software |
| 18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 |
* |
| 20 |
*/ |
| 21 |
package org.stathissideris.ascii2image.core; |
| 22 |
|
| 23 |
import java.util.HashMap; |
| 24 |
|
| 25 |
import org.stathissideris.ascii2image.graphics.CustomShapeDefinition; |
| 26 |
|
| 27 |
/** |
| 28 |
* @author Efstathios Sideris |
| 29 |
* |
| 30 |
*/ |
| 31 |
public class ProcessingOptions { |
| 32 |
|
| 33 |
private HashMap<String, CustomShapeDefinition> customShapes = new HashMap<String, CustomShapeDefinition>(); |
| 34 |
|
| 35 |
private boolean beVerbose = false; |
| 36 |
private boolean printDebugOutput = false; |
| 37 |
private boolean overwriteFiles = false; |
| 38 |
private boolean performSeparationOfCommonEdges = true; |
| 39 |
private boolean allCornersAreRound = false; |
| 40 |
|
| 41 |
public static final int USE_TAGS = 0; |
| 42 |
public static final int RENDER_TAGS = 1; |
| 43 |
public static final int IGNORE_TAGS = 2; |
| 44 |
private int tagProcessingMode = USE_TAGS; |
| 45 |
|
| 46 |
public static final int USE_COLOR_CODES = 0; |
| 47 |
public static final int RENDER_COLOR_CODES = 1; |
| 48 |
public static final int IGNORE_COLOR_CODES = 2; |
| 49 |
private int colorCodesProcessingMode = USE_COLOR_CODES; |
| 50 |
|
| 51 |
public static final int FORMAT_JPEG = 0; |
| 52 |
public static final int FORMAT_PNG = 1; |
| 53 |
public static final int FORMAT_GIF = 2; |
| 54 |
private int exportFormat = FORMAT_PNG; |
| 55 |
|
| 56 |
public static final int DEFAULT_TAB_SIZE = 8; |
| 57 |
private int tabSize = DEFAULT_TAB_SIZE; |
| 58 |
|
| 59 |
private String inputFilename; |
| 60 |
private String outputFilename; |
| 61 |
|
| 62 |
private String characterEncoding = null; |
| 63 |
|
| 64 |
/** |
| 65 |
* @return |
| 66 |
*/ |
| 67 |
public boolean areAllCornersRound() { |
| 68 |
return allCornersAreRound; |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* @return |
| 73 |
*/ |
| 74 |
public int getColorCodesProcessingMode() { |
| 75 |
return colorCodesProcessingMode; |
| 76 |
} |
| 77 |
|
| 78 |
/** |
| 79 |
* @return |
| 80 |
*/ |
| 81 |
public int getExportFormat() { |
| 82 |
return exportFormat; |
| 83 |
} |
| 84 |
|
| 85 |
/** |
| 86 |
* @return |
| 87 |
*/ |
| 88 |
public boolean performSeparationOfCommonEdges() { |
| 89 |
return performSeparationOfCommonEdges; |
| 90 |
} |
| 91 |
|
| 92 |
/** |
| 93 |
* @return |
| 94 |
*/ |
| 95 |
public int getTagProcessingMode() { |
| 96 |
return tagProcessingMode; |
| 97 |
} |
| 98 |
|
| 99 |
/** |
| 100 |
* @param b |
| 101 |
*/ |
| 102 |
public void setAllCornersAreRound(boolean b) { |
| 103 |
allCornersAreRound = b; |
| 104 |
} |
| 105 |
|
| 106 |
/** |
| 107 |
* @param i |
| 108 |
*/ |
| 109 |
public void setColorCodesProcessingMode(int i) { |
| 110 |
colorCodesProcessingMode = i; |
| 111 |
} |
| 112 |
|
| 113 |
/** |
| 114 |
* @param i |
| 115 |
*/ |
| 116 |
public void setExportFormat(int i) { |
| 117 |
exportFormat = i; |
| 118 |
} |
| 119 |
|
| 120 |
/** |
| 121 |
* @param b |
| 122 |
*/ |
| 123 |
public void setPerformSeparationOfCommonEdges(boolean b) { |
| 124 |
performSeparationOfCommonEdges = b; |
| 125 |
} |
| 126 |
|
| 127 |
/** |
| 128 |
* @param i |
| 129 |
*/ |
| 130 |
public void setTagProcessingMode(int i) { |
| 131 |
tagProcessingMode = i; |
| 132 |
} |
| 133 |
|
| 134 |
/** |
| 135 |
* @return |
| 136 |
*/ |
| 137 |
public String getInputFilename() { |
| 138 |
return inputFilename; |
| 139 |
} |
| 140 |
|
| 141 |
/** |
| 142 |
* @return |
| 143 |
*/ |
| 144 |
public String getOutputFilename() { |
| 145 |
return outputFilename; |
| 146 |
} |
| 147 |
|
| 148 |
/** |
| 149 |
* @param string |
| 150 |
*/ |
| 151 |
public void setInputFilename(String string) { |
| 152 |
inputFilename = string; |
| 153 |
} |
| 154 |
|
| 155 |
/** |
| 156 |
* @param string |
| 157 |
*/ |
| 158 |
public void setOutputFilename(String string) { |
| 159 |
outputFilename = string; |
| 160 |
} |
| 161 |
|
| 162 |
/** |
| 163 |
* @return |
| 164 |
*/ |
| 165 |
public boolean verbose() { |
| 166 |
return beVerbose; |
| 167 |
} |
| 168 |
|
| 169 |
/** |
| 170 |
* @return |
| 171 |
*/ |
| 172 |
public boolean printDebugOutput() { |
| 173 |
return printDebugOutput; |
| 174 |
} |
| 175 |
|
| 176 |
/** |
| 177 |
* @param b |
| 178 |
*/ |
| 179 |
public void setVerbose(boolean b) { |
| 180 |
beVerbose = b; |
| 181 |
} |
| 182 |
|
| 183 |
/** |
| 184 |
* @param b |
| 185 |
*/ |
| 186 |
public void setPrintDebugOutput(boolean b) { |
| 187 |
printDebugOutput = b; |
| 188 |
} |
| 189 |
|
| 190 |
/** |
| 191 |
* @return |
| 192 |
*/ |
| 193 |
public boolean overwriteFiles() { |
| 194 |
return overwriteFiles; |
| 195 |
} |
| 196 |
|
| 197 |
/** |
| 198 |
* @param b |
| 199 |
*/ |
| 200 |
public void setOverwriteFiles(boolean b) { |
| 201 |
overwriteFiles = b; |
| 202 |
} |
| 203 |
|
| 204 |
/** |
| 205 |
* @return |
| 206 |
*/ |
| 207 |
public int getTabSize() { |
| 208 |
return tabSize; |
| 209 |
} |
| 210 |
|
| 211 |
/** |
| 212 |
* @param i |
| 213 |
*/ |
| 214 |
public void setTabSize(int i) { |
| 215 |
tabSize = i; |
| 216 |
} |
| 217 |
|
| 218 |
public String getCharacterEncoding() { |
| 219 |
return characterEncoding; |
| 220 |
} |
| 221 |
|
| 222 |
public void setCharacterEncoding(String characterEncoding) { |
| 223 |
this.characterEncoding = characterEncoding; |
| 224 |
} |
| 225 |
|
| 226 |
public HashMap<String, CustomShapeDefinition> getCustomShapes() { |
| 227 |
return customShapes; |
| 228 |
} |
| 229 |
|
| 230 |
public void setCustomShapes(HashMap<String, CustomShapeDefinition> customShapes) { |
| 231 |
this.customShapes = customShapes; |
| 232 |
} |
| 233 |
|
| 234 |
public void putAllInCustomShapes(HashMap<String, CustomShapeDefinition> customShapes) { |
| 235 |
this.customShapes.putAll(customShapes); |
| 236 |
} |
| 237 |
|
| 238 |
public CustomShapeDefinition getFromCustomShapes(String tagName){ |
| 239 |
return customShapes.get(tagName); |
| 240 |
} |
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
} |