00001 /******************************************************************************* 00002 * Copyright (c) 2013 Stefan Profanter. All rights reserved. This program and the accompanying 00003 * materials are made available under the terms of the GNU Public License v3.0 which accompanies 00004 * this distribution, and is available at http://www.gnu.org/licenses/gpl.html 00005 * 00006 * Contributors: Stefan Profanter - initial API and implementation, Year: 2013 00007 ******************************************************************************/ 00008 package edu.tum.cs.vis.model.util; 00009 00010 import java.awt.Color; 00011 00019 public class DrawSettings { 00024 public DrawSettings() { 00025 this.drawType = DrawType.FILL; 00026 overrideColor = null; 00027 } 00028 00032 private Color overrideColor; 00036 public DrawType drawType; 00040 private int lineWidth = 1; 00044 public boolean forceDraw = false; 00045 00049 public void incLineWidth() { 00050 lineWidth++; 00051 } 00052 00056 public void decLineWidth() { 00057 if (lineWidth == 1) 00058 return; 00059 lineWidth--; 00060 } 00061 00067 public int getLineWidth() { 00068 return lineWidth; 00069 } 00070 00075 public void setOverrideColor(Color overrideColor) { 00076 this.overrideColor = overrideColor; 00077 } 00078 00083 public void setLineWidth(int lineWidth) { 00084 this.lineWidth = lineWidth; 00085 } 00086 00087 @Override 00088 public Object clone() { 00089 DrawSettings ds = new DrawSettings(); 00090 ds.overrideColor = overrideColor == null ? null : new Color(overrideColor.getRed(), 00091 overrideColor.getGreen(), overrideColor.getBlue(), overrideColor.getAlpha()); 00092 ds.drawType = drawType; 00093 ds.lineWidth = lineWidth; 00094 ds.forceDraw = forceDraw; 00095 return ds; 00096 00097 } 00098 00107 public DrawSettings getTemporaryOverride(Color overrideColor) { 00108 DrawSettings ds = (DrawSettings) this.clone(); 00109 ds.overrideColor = overrideColor; 00110 return ds; 00111 } 00112 00116 public Color getOverrideColor() { 00117 return overrideColor; 00118 } 00119 00120 }