f@0: /* f@0: CCmI Editor - A Collaborative Cross-Modal Diagram Editing Tool f@0: f@0: Copyright (C) 2011 Queen Mary University of London (http://ccmi.eecs.qmul.ac.uk/) f@0: f@0: This program is free software: you can redistribute it and/or modify f@0: it under the terms of the GNU General Public License as published by f@0: the Free Software Foundation, either version 3 of the License, or f@0: (at your option) any later version. f@0: f@0: This program is distributed in the hope that it will be useful, f@0: but WITHOUT ANY WARRANTY; without even the implied warranty of f@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the f@0: GNU General Public License for more details. f@0: f@0: You should have received a copy of the GNU General Public License f@0: along with this program. If not, see . f@0: */ f@0: package uk.ac.qmul.eecs.ccmi.gui; f@0: f@0: import java.awt.BasicStroke; f@0: import java.awt.Stroke; f@0: f@0: /** f@0: * Defines the possible values for the stroke of lines painted on the graph when drawing an {@link Edge}. f@0: * It can be Solid, Dotted or Dashed. f@0: * f@0: */ f@0: public enum LineStyle { f@0: Solid(new BasicStroke(),0xFFFF), f@0: Dotted(new BasicStroke(1.0f, f@0: BasicStroke.CAP_ROUND, f@0: BasicStroke.JOIN_ROUND, f@0: 0.0f, f@0: new float[]{1.0f,3.0f}, f@0: 0.0f),0xAAAA), f@0: Dashed(new BasicStroke(1.0f, f@0: BasicStroke.CAP_ROUND, f@0: BasicStroke.JOIN_ROUND, f@0: 0.0f, f@0: new float[]{5.0f,5.0f}, f@0: 0.0f),0xF0F0); f@0: f@0: private LineStyle(BasicStroke stroke, int stipplePattern){ f@0: this.stroke = stroke; f@0: this.stipplePattern = stipplePattern; f@0: } f@0: f@0: /** f@0: * returns the stroke of this line style. The stroke is used to paint f@0: * the edge that has this line style on a graphics. f@0: * f@0: * @return the stroke for this line style f@0: */ f@0: public Stroke getStroke(){ f@0: return stroke; f@0: } f@0: f@0: /** f@0: * Returns an a bit representation of the stippling of this edge. f@0: * This value can be used by openGL like libraries to draw the edge and it's used by f@0: * the OmniHaptic device native code to paint the edge visually and haptically. f@0: * f@0: * @see glLineStipple f@0: * f@0: * @return an int with the bit representation of the stipple pattern f@0: */ f@0: public int getStipplePattern(){ f@0: return stipplePattern; f@0: } f@0: f@0: private Stroke stroke; f@0: private int stipplePattern; f@0: }